Go to the documentation of this file.
57 #define UNI_MPEG4_ENC_INDEX(last, run, level) ((last) * 128 * 64 + (run) * 128 + (level))
74 int block_last_index,
const uint8_t scantable[64])
80 for (j = 1; j <= block_last_index; j++) {
81 const int index = scantable[j];
85 if ((
level & (~127)) == 0) {
86 if (j < block_last_index)
91 rate +=
s->ac_esc_length;
109 const int dir[6],
const uint8_t *st[6],
110 const int zigzag_last_index[6])
113 memcpy(
s->block_last_index, zigzag_last_index,
sizeof(
int) * 6);
115 for (n = 0; n < 6; n++) {
116 int16_t *ac_val = &
s->ac_val[0][0][0] +
s->block_index[n] * 16;
118 st[n] =
s->intra_scantable.permutated;
121 for (
i = 1;
i < 8;
i++)
122 block[n][
s->idsp.idct_permutation[
i]] = ac_val[
i + 8];
125 for (
i = 1;
i < 8;
i++)
126 block[n][
s->idsp.idct_permutation[
i << 3]] = ac_val[
i];
140 const int dir[6],
const uint8_t *st[6],
141 int zigzag_last_index[6])
145 const int8_t *
const qscale_table =
s->cur_pic.qscale_table;
147 memcpy(zigzag_last_index,
s->block_last_index,
sizeof(
int) * 6);
149 for (n = 0; n < 6; n++) {
150 int16_t *ac_val, *ac_val1;
153 s->intra_scantable.permutated);
155 ac_val = &
s->ac_val[0][0][0] +
s->block_index[n] * 16;
158 const int xy =
s->mb_x +
s->mb_y *
s->mb_stride -
s->mb_stride;
160 ac_val -=
s->block_wrap[n] * 16;
161 if (
s->mb_y == 0 ||
s->qscale == qscale_table[xy] || n == 2 || n == 3) {
163 for (
i = 1;
i < 8;
i++) {
164 const int level =
block[n][
s->idsp.idct_permutation[
i]];
165 block[n][
s->idsp.idct_permutation[
i]] =
level - ac_val[
i + 8];
166 ac_val1[
i] =
block[n][
s->idsp.idct_permutation[
i << 3]];
171 for (
i = 1;
i < 8;
i++) {
172 const int level =
block[n][
s->idsp.idct_permutation[
i]];
174 ac_val1[
i] =
block[n][
s->idsp.idct_permutation[
i << 3]];
178 st[n] =
s->permutated_intra_h_scantable;
180 const int xy =
s->mb_x - 1 +
s->mb_y *
s->mb_stride;
183 if (
s->mb_x == 0 ||
s->qscale == qscale_table[xy] || n == 1 || n == 3) {
185 for (
i = 1;
i < 8;
i++) {
186 const int level =
block[n][
s->idsp.idct_permutation[
i << 3]];
187 block[n][
s->idsp.idct_permutation[
i << 3]] =
level - ac_val[
i];
189 ac_val1[
i + 8] =
block[n][
s->idsp.idct_permutation[
i]];
193 for (
i = 1;
i < 8;
i++) {
194 const int level =
block[n][
s->idsp.idct_permutation[
i << 3]];
197 ac_val1[
i + 8] =
block[n][
s->idsp.idct_permutation[
i]];
200 st[n] =
s->permutated_intra_v_scantable;
203 for (
i = 63;
i > 0;
i--)
206 s->block_last_index[n] =
i;
225 int8_t *
const qscale_table =
s->cur_pic.qscale_table;
234 for (
i = 0;
i <
s->mb_num;
i++) {
235 int mb_xy =
s->mb_index2xy[
i];
236 odd += qscale_table[mb_xy] & 1;
239 if (2 * odd >
s->mb_num)
244 for (
i = 0;
i <
s->mb_num;
i++) {
245 int mb_xy =
s->mb_index2xy[
i];
246 if ((qscale_table[mb_xy] & 1) != odd)
247 qscale_table[mb_xy]++;
248 if (qscale_table[mb_xy] > 31)
249 qscale_table[mb_xy] = 31;
252 for (
i = 1;
i <
s->mb_num;
i++) {
253 int mb_xy =
s->mb_index2xy[
i];
254 if (qscale_table[mb_xy] != qscale_table[
s->mb_index2xy[
i - 1]] &&
292 const int16_t *
block,
int n,
int intra_dc,
296 int i, last_non_zero;
297 const uint32_t *bits_tab;
298 const uint8_t *len_tab;
299 const int last_index =
s->block_last_index[n];
318 last_non_zero =
i - 1;
319 for (;
i < last_index;
i++) {
322 int run =
i - last_non_zero - 1;
324 if ((
level & (~127)) == 0) {
329 7 + 2 + 1 + 6 + 1 + 12 + 1,
330 (3 << 23) + (3 << 21) + (0 << 20) + (
run << 14) +
331 (1 << 13) + (((
level - 64) & 0xfff) << 1) + 1);
338 int run =
i - last_non_zero - 1;
340 if ((
level & (~127)) == 0) {
345 7 + 2 + 1 + 6 + 1 + 12 + 1,
346 (3 << 23) + (3 << 21) + (1 << 20) + (
run << 14) +
347 (1 << 13) + (((
level - 64) & 0xfff) << 1) + 1);
353 const int16_t *
block,
int n,
354 int intra_dc,
const uint8_t *scan_table)
356 int i, last_non_zero;
357 const uint8_t *len_tab;
358 const int last_index =
s->block_last_index[n];
376 last_non_zero =
i - 1;
377 for (;
i < last_index;
i++) {
380 int run =
i - last_non_zero - 1;
382 if ((
level & (~127)) == 0) {
386 len += 7 + 2 + 1 + 6 + 1 + 12 + 1;
393 int run =
i - last_non_zero - 1;
395 if ((
level & (~127)) == 0) {
399 len += 7 + 2 + 1 + 6 + 1 + 12 + 1;
407 const int16_t
block[6][64],
408 const int intra_dc[6],
409 const uint8_t *
const *scan_table,
417 for (
i = 0;
i < 6;
i++)
420 intra_dc[
i], scan_table[
i]));
423 for (
i = 0;
i < 6;
i++)
425 intra_dc[
i], scan_table[
i], dc_pb, ac_pb);
429 for (
i = 0;
i < 6;
i++)
432 s->intra_scantable.permutated));
435 for (
i = 0;
i < 6;
i++)
437 s->intra_scantable.permutated, dc_pb, ac_pb);
443 int motion_x,
int motion_y,
int mb_type)
451 for (
i = 0;
i < 6;
i++) {
452 if (
s->coded_score[
i] < 0) {
453 score +=
s->coded_score[
i];
460 if ((motion_x | motion_y |
s->dquant | mb_type) == 0)
463 zero_score *= lambda;
464 if (zero_score <= score)
468 for (
i = 0;
i < 6;
i++) {
469 if (
s->block_last_index[
i] >= 0 && ((cbp >> (5 -
i)) & 1) == 0) {
470 s->block_last_index[
i] = -1;
471 s->bdsp.clear_block(
s->block[
i]);
475 for (
i = 0;
i < 6;
i++) {
476 if (
s->block_last_index[
i] >= 0)
487 int motion_x,
int motion_y)
489 int cbpc, cbpy, pred_x, pred_y;
493 const int interleaved_stats = (
s->avctx->flags &
AV_CODEC_FLAG_PASS1) && !
s->data_partitioning ? 1 : 0;
500 static const int mb_type_table[8] = { -1, 3, 2, 1, -1, -1, -1, 0 };
501 int mb_type = mb_type_table[
s->mv_dir];
504 for (
i = 0;
i < 2;
i++)
505 s->last_mv[
i][0][0] =
506 s->last_mv[
i][0][1] =
507 s->last_mv[
i][1][0] =
508 s->last_mv[
i][1][1] = 0;
516 if (
s->next_pic.mbskip_table[
s->mb_y *
s->mb_stride +
s->mb_x]) {
522 s->qscale -=
s->dquant;
530 if ((cbp | motion_x | motion_y | mb_type) == 0) {
536 if (interleaved_stats) {
549 if (cbp && mb_type) {
555 s->qscale -=
s->dquant;
557 if (!
s->progressive_sequence) {
564 if (interleaved_stats)
575 s->mv[0][0][0] -
s->last_mv[0][0][0],
576 s->mv[0][0][1] -
s->last_mv[0][0][1],
578 s->last_mv[0][0][0] =
579 s->last_mv[0][1][0] =
s->mv[0][0][0];
580 s->last_mv[0][0][1] =
581 s->last_mv[0][1][1] =
s->mv[0][0][1];
585 s->mv[1][0][0] -
s->last_mv[1][0][0],
586 s->mv[1][0][1] -
s->last_mv[1][0][1],
588 s->last_mv[1][0][0] =
589 s->last_mv[1][1][0] =
s->mv[1][0][0];
590 s->last_mv[1][0][1] =
591 s->last_mv[1][1][1] =
s->mv[1][0][1];
603 for (
i = 0;
i < 2;
i++) {
605 s->mv[0][
i][0] -
s->last_mv[0][
i][0],
606 s->mv[0][
i][1] -
s->last_mv[0][
i][1] / 2,
608 s->last_mv[0][
i][0] =
s->mv[0][
i][0];
609 s->last_mv[0][
i][1] =
s->mv[0][
i][1] * 2;
613 for (
i = 0;
i < 2;
i++) {
615 s->mv[1][
i][0] -
s->last_mv[1][
i][0],
616 s->mv[1][
i][1] -
s->last_mv[1][
i][1] / 2,
618 s->last_mv[1][
i][0] =
s->mv[1][
i][0];
619 s->last_mv[1][
i][1] =
s->mv[1][
i][1] * 2;
625 if (interleaved_stats)
630 if (interleaved_stats)
635 if ((cbp | motion_x | motion_y |
s->dquant) == 0 &&
640 if (
s->max_b_frames > 0) {
643 const uint8_t *p_pic;
649 p_pic =
s->new_pic->data[0] +
offset;
652 for (
i = 0;
i <
s->max_b_frames;
i++) {
653 const uint8_t *b_pic;
655 const MPVPicture *pic =
s->reordered_input_picture[
i + 1];
664 if (x + 16 >
s->width || y + 16 >
s->height) {
666 int xe =
FFMIN(16,
s->width - x);
667 int ye =
FFMIN(16,
s->height - y);
669 for (y1 = 0; y1 < ye; y1++) {
670 for (x1 = 0; x1 < xe; x1++) {
671 diff +=
FFABS(p_pic[x1 + y1 *
s->linesize] - b_pic[x1 + y1 *
s->linesize]);
676 diff =
s->sad_cmp[0](
NULL, p_pic, b_pic,
s->linesize, 16);
678 if (
diff >
s->qscale * 70) {
686 if (
s->mb_skipped == 1) {
690 if (interleaved_stats) {
714 if (!
s->progressive_sequence) {
720 if (interleaved_stats)
746 if (interleaved_stats)
757 s->mv[0][0][0] - pred_x,
758 s->mv[0][0][1] - pred_y,
761 s->mv[0][1][0] - pred_x,
762 s->mv[0][1][1] - pred_y,
771 if (!
s->progressive_sequence && cbp)
774 if (interleaved_stats)
777 for (
i = 0;
i < 4;
i++) {
782 s->cur_pic.motion_val[0][
s->block_index[
i]][0] - pred_x,
783 s->cur_pic.motion_val[0][
s->block_index[
i]][1] - pred_y,
788 if (interleaved_stats)
793 if (interleaved_stats)
800 int zigzag_last_index[6];
801 const uint8_t *scan_table[6];
804 for (
i = 0;
i < 6;
i++)
810 for (
i = 0;
i < 6;
i++)
811 scan_table[
i] =
s->intra_scantable.permutated;
816 for (
i = 0;
i < 6;
i++)
817 if (
s->block_last_index[
i] >= 1)
841 if (!
s->progressive_sequence)
844 if (interleaved_stats)
849 if (interleaved_stats)
867 put_bits(pbc, length, (1 << (length - 1)) - 1);
876 s->last_time_base =
s->time_base;
877 s->time_base =
FFUDIV(
s->time,
s->avctx->time_base.den);
883 int64_t hours, minutes, seconds;
888 time =
s->cur_pic.ptr->f->pts;
889 if (
s->reordered_input_picture[1])
890 time =
FFMIN(time,
s->reordered_input_picture[1]->f->pts);
891 time = time *
s->avctx->time_base.num;
892 s->last_time_base =
FFUDIV(time,
s->avctx->time_base.den);
894 seconds =
FFUDIV(time,
s->avctx->time_base.den);
895 minutes =
FFUDIV(seconds, 60); seconds =
FFUMOD(seconds, 60);
896 hours =
FFUDIV(minutes, 60); minutes =
FFUMOD(minutes, 60);
897 hours =
FFUMOD(hours , 24);
912 int profile_and_level_indication;
916 profile_and_level_indication =
s->avctx->profile << 4;
917 }
else if (
s->max_b_frames ||
s->quarter_sample) {
918 profile_and_level_indication = 0xF0;
920 profile_and_level_indication = 0x00;
924 profile_and_level_indication |=
s->avctx->level;
926 profile_and_level_indication |= 1;
928 if (profile_and_level_indication >> 4 == 0xF)
937 put_bits(&
s->pb, 8, profile_and_level_indication);
956 int vo_ver_id, vo_type, aspect_ratio_info;
958 if (
s->max_b_frames ||
s->quarter_sample) {
983 av_reduce(&
s->avctx->sample_aspect_ratio.num, &
s->avctx->sample_aspect_ratio.den,
984 s->avctx->sample_aspect_ratio.num,
s->avctx->sample_aspect_ratio.den, 255);
985 put_bits(&
s->pb, 8,
s->avctx->sample_aspect_ratio.num);
986 put_bits(&
s->pb, 8,
s->avctx->sample_aspect_ratio.den);
1001 put_bits(&
s->pb, 16,
s->avctx->time_base.den);
1002 if (
s->time_increment_bits < 1)
1003 s->time_increment_bits = 1;
1011 put_bits(&
s->pb, 1,
s->progressive_sequence ? 0 : 1);
1021 if (
s->mpeg_quant) {
1030 put_bits(&
s->pb, 1,
s->data_partitioning ? 1 : 0);
1031 if (
s->data_partitioning)
1034 if (vo_ver_id != 1) {
1071 time_div =
FFUDIV(
s->time,
s->avctx->time_base.den);
1072 time_mod =
FFUMOD(
s->time,
s->avctx->time_base.den);
1073 time_incr = time_div -
s->last_time_base;
1076 if (time_incr > 3600*24) {
1086 put_bits(&
s->pb,
s->time_increment_bits, time_mod);
1093 if (!
s->progressive_sequence) {
1111 int level, uni_code, uni_len;
1167 int slevel,
run, last;
1172 for (slevel = -64; slevel < 64; slevel++) {
1176 for (last = 0; last <= 1; last++) {
1178 int level = slevel < 0 ? -slevel : slevel;
1179 int sign = slevel < 0 ? 1 : 0;
1183 len_tab[
index] = 100;
1245 bits =
bits * 4096 + (slevel & 0xfff);
1275 if (avctx->
width >= (1<<13) || avctx->
height >= (1<<13)) {
1286 s->min_qcoeff = -2048;
1287 s->max_qcoeff = 2047;
1293 s->ac_esc_length = 7 + 2 + 1 + 6 + 1 + 12 + 1;
1299 if (!
s->avctx->extradata)
1317 uint8_t *end =
s->pb.buf_end;
1318 int size = end - start;
1319 int pb_size = (((intptr_t)start +
size / 3) & (~3)) - (intptr_t)start;
1320 int tex_size = (
size - 2 * pb_size) & (~3);
1335 s->misc_bits += 19 + pb2_len +
bits -
s->last_bits;
1336 s->i_tex_bits += tex_pb_len;
1339 s->misc_bits += 17 + pb2_len;
1340 s->mv_bits +=
bits -
s->last_bits;
1341 s->p_tex_bits += tex_pb_len;
1355 int mb_num_bits =
av_log2(
s->mb_num - 1) + 1;
1360 put_bits(&
s->pb, mb_num_bits,
s->mb_x +
s->mb_y *
s->mb_width);
1365 #define OFFSET(x) offsetof(MpegEncContext, x)
1366 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
1368 {
"data_partitioning",
"Use data partitioning.",
OFFSET(data_partitioning),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
VE },
1369 {
"alternate_scan",
"Enable alternate scantable.",
OFFSET(alternate_scan),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
VE },
1370 {
"mpeg_quant",
"Use MPEG quantizers instead of H.263",
static av_cold void mpeg4_encode_init_static(void)
static int mpeg4_get_dc_length(int level, int n)
#define CANDIDATE_MB_TYPE_BIDIR
#define MV_TYPE_16X16
1 vector for the whole mb
AVPixelFormat
Pixel format.
#define FF_ASPECT_EXTENDED
static void mpeg4_encode_vol_header(MpegEncContext *s, int vo_number, int vol_number)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int get_bits_diff(MpegEncContext *s)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static void av_unused put_bits32(PutBitContext *s, uint32_t value)
Write exactly 32 bits into a bitstream.
void ff_clean_mpeg4_qscales(MpegEncContext *s)
modify mb_type & qscale so that encoding is actually possible in MPEG-4
static int put_bytes_output(const PutBitContext *s)
static void mpeg4_encode_block(const MpegEncContext *s, const int16_t *block, int n, int intra_dc, const uint8_t *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb)
Encode an 8x8 block.
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
av_cold void ff_qpeldsp_init(QpelDSPContext *c)
#define MV_DIRECT
bidirectional mode where the difference equals the MV of the last P/S/I-Frame (MPEG-4)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static av_cold void init_uni_dc_tab(void)
static void mpeg4_encode_visual_object_header(MpegEncContext *s)
av_cold void ff_mpeg4_init_rl_intra(void)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
static uint32_t uni_mpeg4_intra_rl_bits[64 *64 *2 *2]
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
#define FF_MPV_COMMON_MOTION_EST_OPTS
int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic_arg, int *got_packet)
#define FF_MPV_COMMON_OPTS
void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
Copy the content of src to the bitstream.
static uint8_t uni_mpeg4_intra_rl_len[64 *64 *2 *2]
const uint8_t ff_mpeg4_DCtab_chrom[13][2]
AVCodec p
The public AVCodec.
int16_t * ff_h263_pred_motion(MpegEncContext *s, int block, int dir, int *px, int *py)
#define FF_BUG_MS
Work around various bugs in Microsoft's broken decoders.
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s)
static uint32_t uni_mpeg4_inter_rl_bits[64 *64 *2 *2]
static uint8_t uni_DCtab_chrom_len[512]
#define FF_MPV_FLAG_CBP_RD
static void ff_h263_encode_motion_vector(MpegEncContext *s, int x, int y, int f_code)
#define AV_CODEC_FLAG2_NO_OUTPUT
Skip bitstream encoding.
#define FF_CODEC_ENCODE_CB(func)
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static const int dquant_code[5]
#define CANDIDATE_MB_TYPE_DIRECT
int n
number of entries of table_vlc minus 1
static int ff_thread_once(char *control, void(*routine)(void))
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_PROFILE_UNKNOWN
static void mpeg4_encode_blocks(MpegEncContext *s, const int16_t block[6][64], const int intra_dc[6], const uint8_t *const *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb)
int8_t * max_level[2]
encoding & decoding
static uint8_t uni_mpeg4_inter_rl_len[64 *64 *2 *2]
void ff_mpeg4_stuffing(PutBitContext *pbc)
add MPEG-4 stuffing bits (01...1)
static int get_rl_index(const RLTable *rl, int last, int run, int level)
static int get_p_cbp(MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y)
static void skip_put_bits(PutBitContext *s, int n)
Skip the given number of bits.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
RLTable ff_mpeg4_rl_intra
static uint16_t uni_DCtab_chrom_bits[512]
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define UNI_MPEG4_ENC_INDEX(last, run, level)
static uint16_t uni_DCtab_lum_bits[512]
void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix)
void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
Put the string string in the bitstream.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static av_cold void init_uni_mpeg4_rl_tab(RLTable *rl, uint32_t *bits_tab, uint8_t *len_tab)
#define CODEC_LONG_NAME(str)
static void mpeg4_encode_gop_header(MpegEncContext *s)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
const uint8_t ff_mpeg4_DCtab_lum[13][2]
#define LIBAVUTIL_VERSION_INT
void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y)
Describe the class of an AVClass context structure.
#define FF_COMPLIANCE_VERY_STRICT
Strictly conform to an older more strict version of the spec or reference software.
const uint16_t(* table_vlc)[2]
#define ROUNDED_DIV(a, b)
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_PICTURE_TYPE_I
Intra.
#define AV_CODEC_FLAG_AC_PRED
H.263 advanced intra coding / MPEG-4 AC prediction.
av_cold int ff_mpv_encode_end(AVCodecContext *avctx)
static int get_block_rate(MpegEncContext *s, int16_t block[64], int block_last_index, const uint8_t scantable[64])
Return the number of bits that encoding the 8x8 block in block would need.
void ff_mpeg4_init_partitions(MpegEncContext *s)
#define VISUAL_OBJ_STARTCODE
int ff_mpeg4_encode_picture_header(MpegEncContext *s)
void ff_clean_h263_qscales(MpegEncContext *s)
modify qscale so that encoding is actually possible in H.263 (limit difference to -2....
#define MV_TYPE_8X8
4 vectors (H.263, MPEG-4 4MV)
static void set_put_bits_buffer_size(PutBitContext *s, int size)
Change the end of the buffer.
void ff_mpeg4_merge_partitions(MpegEncContext *s)
#define ADV_SIMPLE_VO_TYPE
enum AVPictureType pict_type
Picture type of the frame.
int(* init)(AVBSFContext *ctx)
const uint8_t ff_mpeg4_y_dc_scale_table[32]
static int ff_mpeg4_pred_dc(MpegEncContext *s, int n, int level, int *dir_ptr, int encoding)
Predict the dc.
static int get_b_cbp(MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y, int mb_type)
const uint8_t ff_h263_cbpy_tab[16][2]
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
#define MV_TYPE_FIELD
2 vectors, one per field
const uint8_t ff_h263_inter_MCBPC_bits[28]
#define UNI_AC_ENC_INDEX(run, level)
#define FF_MPEG4_PROFILE_OPTS
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define i(width, name, range_min, range_max)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
static int put_bits_count(PutBitContext *s)
int8_t * max_run[2]
encoding & decoding
static uint8_t uni_DCtab_lum_len[512]
static const AVClass mpeg4enc_class
static const AVOption options[]
const FFCodec ff_mpeg4_encoder
const char * name
Name of the codec implementation.
av_const int ff_h263_aspect_to_info(AVRational aspect)
Return the 4 bit value that specifies the given aspect ratio.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
#define AV_CODEC_FLAG_CLOSED_GOP
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static av_cold int encode_init(AVCodecContext *avctx)
void ff_mpeg4_init_direct_mv(MpegEncContext *s)
void ff_set_mpeg4_time(MpegEncContext *s)
const uint8_t ff_h263_intra_MCBPC_bits[9]
main external API structure.
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s)
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
const uint8_t ff_h263_intra_MCBPC_code[9]
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
static void mpeg4_encode_dc(PutBitContext *s, int level, int n)
Encode the dc value.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define FF_MPV_COMMON_BFRAME_OPTS
#define USER_DATA_STARTCODE
static int mpeg4_get_block_length(MpegEncContext *s, const int16_t *block, int n, int intra_dc, const uint8_t *scan_table)
static int decide_ac_pred(MpegEncContext *s, int16_t block[6][64], const int dir[6], const uint8_t *st[6], int zigzag_last_index[6])
Return the optimal value (0 or 1) for the ac_pred element for the given MB in MPEG-4.
const uint8_t ff_h263_inter_MCBPC_code[28]
@ AV_PICTURE_TYPE_P
Predicted.
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
const uint8_t ff_mpeg4_c_dc_scale_table[32]
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
int width
picture width / height.
The exact code depends on how similar the blocks are and how related they are to the block
static void restore_ac_coeffs(MpegEncContext *s, int16_t block[6][64], const int dir[6], const uint8_t *st[6], const int zigzag_last_index[6])
Restore the ac coefficients in block that have been changed by decide_ac_pred().
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.