51 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
52 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
57 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
58 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
59 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
60 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
61 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
62 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
63 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
64 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
69 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
70 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
71 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
72 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
73 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
74 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
75 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
76 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
81 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
82 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
83 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
84 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
85 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
86 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
87 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
88 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
93 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
94 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
95 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
96 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
97 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
98 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
99 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
100 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
111 0, 1, 2, 3, 8, 9, 16, 17,
112 10, 11, 4, 5, 6, 7, 15, 14,
113 13, 12, 19, 18, 24, 25, 32, 33,
114 26, 27, 20, 21, 22, 23, 28, 29,
115 30, 31, 34, 35, 40, 41, 48, 49,
116 42, 43, 36, 37, 38, 39, 44, 45,
117 46, 47, 50, 51, 56, 57, 58, 59,
118 52, 53, 54, 55, 60, 61, 62, 63,
122 0, 8, 16, 24, 1, 9, 2, 10,
123 17, 25, 32, 40, 48, 56, 57, 49,
124 41, 33, 26, 18, 3, 11, 4, 12,
125 19, 27, 34, 42, 50, 58, 35, 43,
126 51, 59, 20, 28, 5, 13, 6, 14,
127 21, 29, 36, 44, 52, 60, 37, 45,
128 53, 61, 22, 30, 7, 15, 23, 31,
129 38, 46, 54, 62, 39, 47, 55, 63,
133 int16_t *
block,
int n,
int qscale)
135 int i,
level, nCoeffs;
136 const uint16_t *quant_matrix;
146 for(i=1;i<=nCoeffs;i++) {
152 level = (int)(level * qscale * quant_matrix[j]) >> 3;
153 level = (level - 1) | 1;
156 level = (int)(level * qscale * quant_matrix[j]) >> 3;
157 level = (level - 1) | 1;
165 int16_t *
block,
int n,
int qscale)
167 int i,
level, nCoeffs;
168 const uint16_t *quant_matrix;
173 for(i=0; i<=nCoeffs; i++) {
179 level = (((level << 1) + 1) * qscale *
180 ((int) (quant_matrix[j]))) >> 4;
181 level = (level - 1) | 1;
184 level = (((level << 1) + 1) * qscale *
185 ((int) (quant_matrix[j]))) >> 4;
186 level = (level - 1) | 1;
194 int16_t *
block,
int n,
int qscale)
196 int i,
level, nCoeffs;
197 const uint16_t *quant_matrix;
207 for(i=1;i<=nCoeffs;i++) {
213 level = (int)(level * qscale * quant_matrix[j]) >> 3;
216 level = (int)(level * qscale * quant_matrix[j]) >> 3;
224 int16_t *
block,
int n,
int qscale)
226 int i,
level, nCoeffs;
227 const uint16_t *quant_matrix;
238 for(i=1;i<=nCoeffs;i++) {
244 level = (int)(level * qscale * quant_matrix[j]) >> 3;
247 level = (int)(level * qscale * quant_matrix[j]) >> 3;
257 int16_t *
block,
int n,
int qscale)
259 int i,
level, nCoeffs;
260 const uint16_t *quant_matrix;
267 for(i=0; i<=nCoeffs; i++) {
273 level = (((level << 1) + 1) * qscale *
274 ((int) (quant_matrix[j]))) >> 4;
277 level = (((level << 1) + 1) * qscale *
278 ((int) (quant_matrix[j]))) >> 4;
288 int16_t *
block,
int n,
int qscale)
290 int i,
level, qmul, qadd;
302 qadd = (qscale - 1) | 1;
311 for(i=1; i<=nCoeffs; i++) {
315 level = level * qmul - qadd;
317 level = level * qmul + qadd;
325 int16_t *
block,
int n,
int qscale)
327 int i,
level, qmul, qadd;
332 qadd = (qscale - 1) | 1;
337 for(i=0; i<=nCoeffs; i++) {
341 level = level * qmul - qadd;
343 level = level * qmul + qadd;
352 int mb_x,
int mb_y,
int mb_intra,
int mb_skipped)
362 memcpy(s->
mv,
mv,
sizeof(*
mv));
477 if (r < 0 || !pic->f->buf[0]) {
485 for (i = 0; pic->
f->
data[i]; i++) {
489 pic->
f->
data[i] += offset;
510 "get_buffer() failed (stride changed)\n");
517 "get_buffer() failed (uv stride mismatch)\n");
525 "get_buffer() failed to allocate context scratch buffers.\n");
544 for (i = 0; i < 2; i++) {
574 int mv_size = 2 * (b8_array_size + 4) *
sizeof(int16_t);
575 int ref_index_size = 4 * mb_array_size;
577 for (i = 0; mv_size && i < 2; i++) {
591 #define MAKE_WRITABLE(table) \
594 (ret = av_buffer_make_writable(&pic->table)) < 0)\
605 for (i = 0; i < 2; i++) {
622 assert(pic->
f->
data[0]);
625 assert(!pic->
f->
buf[0]);
652 for (i = 0; i < 2; i++) {
688 memset((
uint8_t*)pic + off, 0,
sizeof(*pic) - off);
695 #define UPDATE_TABLE(table)\
698 (!dst->table || dst->table->buffer != src->table->buffer)) {\
699 av_buffer_unref(&dst->table);\
700 dst->table = av_buffer_ref(src->table);\
702 ff_free_picture_tables(dst);\
703 return AVERROR(ENOMEM);\
714 for (i = 0; i < 2; i++) {
725 for (i = 0; i < 2; i++) {
784 int yc_size = y_size + 2 * c_size;
801 2 * 64 *
sizeof(
int), fail)
807 for (i = 0; i < 12; i++) {
816 yc_size *
sizeof(int16_t) * 16, fail);
849 #define COPY(a) bak->a = src->a
850 COPY(edge_emu_buffer);
855 COPY(obmc_scratchpad);
862 COPY(me.map_generation);
883 for (i = 0; i < 12; i++) {
891 "scratch buffers.\n");
905 if (dst == src || !s1->context_initialized)
925 s->
width = s1->width;
940 if (s1->picture[i].f->buf[0] &&
945 #define UPDATE_PICTURE(pic)\
947 ff_mpeg_unref_picture(s, &s->pic);\
948 if (s1->pic.f->buf[0])\
949 ret = ff_mpeg_ref_picture(s, &s->pic, &s1->pic);\
951 ret = update_picture_tables(&s->pic, &s1->pic);\
970 (
char *) &s1->pb_field_time +
sizeof(s1->pb_field_time) -
971 (
char *) &s1->last_time_base);
981 if (s1->bitstream_buffer) {
982 if (s1->bitstream_buffer_size +
986 s1->allocated_bitstream_buffer_size);
989 s1->bitstream_buffer_size);
999 "scratch buffers.\n");
1004 "be allocated due to unknown size.\n");
1010 (
char *) &s1->rtp_mode - (
char *) &s1->progressive_sequence);
1012 if (!s1->first_field) {
1014 if (s1->current_picture_ptr)
1015 s->
last_lambda_for[s1->pict_type] = s1->current_picture_ptr->f->quality;
1097 int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
1121 yc_size = y_size + 2 * c_size;
1135 mv_table_size * 2 *
sizeof(int16_t), fail);
1137 mv_table_size * 2 *
sizeof(int16_t), fail);
1139 mv_table_size * 2 *
sizeof(int16_t), fail);
1141 mv_table_size * 2 *
sizeof(int16_t), fail);
1143 mv_table_size * 2 *
sizeof(int16_t), fail);
1145 mv_table_size * 2 *
sizeof(int16_t), fail);
1157 sizeof(uint16_t), fail);
1163 mb_array_size *
sizeof(
float), fail);
1165 mb_array_size *
sizeof(
float), fail);
1172 for (i = 0; i < 2; i++) {
1174 for (j = 0; j < 2; j++) {
1175 for (k = 0; k < 2; k++) {
1178 mv_table_size * 2 *
sizeof(int16_t),
1184 mb_array_size * 2 *
sizeof(
uint8_t), fail);
1186 mv_table_size * 2 *
sizeof(int16_t), fail);
1191 mb_array_size * 2 *
sizeof(
uint8_t), fail);
1201 mb_array_size *
sizeof(
uint8_t), fail);
1203 mb_array_size *
sizeof(
uint8_t), fail);
1210 yc_size *
sizeof(int16_t), fail);
1214 for (i = 0; i < yc_size; i++)
1252 "decoding to AV_PIX_FMT_NONE is not supported.\n");
1263 " reducing to %d\n", nb_slices, max_slices);
1264 nb_slices = max_slices;
1321 if (nb_slices > 1) {
1322 for (i = 1; i < nb_slices; i++) {
1327 for (i = 0; i < nb_slices; i++) {
1331 (s->
mb_height * (i) + nb_slices / 2) / nb_slices;
1333 (s->
mb_height * (i + 1) + nb_slices / 2) / nb_slices;
1372 for (i = 0; i < 2; i++) {
1373 for (j = 0; j < 2; j++) {
1374 for (k = 0; k < 2; k++) {
1448 if (nb_slices > 1) {
1449 for (i = 1; i < nb_slices; i++) {
1454 for (i = 0; i < nb_slices; i++) {
1458 (s->
mb_height * (i) + nb_slices / 2) / nb_slices;
1460 (s->
mb_height * (i + 1) + nb_slices / 2) / nb_slices;
1533 int last,
run,
level, start, end, i;
1540 for (last = 0; last < 2; last++) {
1549 memset(max_level, 0,
MAX_RUN + 1);
1551 memset(index_run, rl->
n,
MAX_RUN + 1);
1552 for (i = start; i < end; i++) {
1555 if (index_run[run] == rl->
n)
1557 if (level > max_level[run])
1559 if (run > max_run[level])
1563 rl->
max_level[last] = static_store[last];
1576 memcpy(rl->
index_run[last], index_run, MAX_RUN + 1);
1584 for (q = 0; q < 32; q++) {
1586 int qadd = (q - 1) | 1;
1600 }
else if (len < 0) {
1604 if (code == rl->
n) {
1610 if (code >= rl->
last) run += 192;
1633 if (!pic->
f->
buf[0])
1698 "releasing zombie picture\n");
1758 av_dlog(s->
avctx,
"L%p N%p C%p L%p N%p C%p type:%d drop:%d\n",
1768 int h_chroma_shift, v_chroma_shift;
1770 &h_chroma_shift, &v_chroma_shift);
1773 "warning: first frame is no keyframe\n");
1776 "allocate dummy last picture for field based first keyframe\n");
1797 (avctx->
height >> v_chroma_shift) *
1800 (avctx->
height >> v_chroma_shift) *
1845 "Non-reference picture received and no reference available\n");
1851 for (i = 0; i < 4; i++) {
1942 for (x = 0; x < s->
mb_width; x++) {
1970 else if (
IS_GMC(mb_type))
2012 int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !s->
quarter_sample;
2013 int my, off, i, mvs;
2032 for (i = 0; i < mvs; i++) {
2033 my = s->
mv[dir][i][1]<<qpel_shift;
2034 my_max =
FFMAX(my_max, my);
2035 my_min =
FFMIN(my_min, my);
2038 off = (
FFMAX(-my_min, my_max) + 63) >> 6;
2047 int16_t *
block,
int i,
uint8_t *dest,
int line_size,
int qscale)
2063 int16_t *
block,
int i,
uint8_t *dest,
int line_size,
int qscale)
2085 memset(s->
ac_val[0][xy ], 0, 32 *
sizeof(int16_t));
2086 memset(s->
ac_val[0][xy + wrap], 0, 32 *
sizeof(int16_t));
2099 memset(s->
ac_val[1][xy], 0, 16 *
sizeof(int16_t));
2100 memset(s->
ac_val[2][xy], 0, 16 *
sizeof(int16_t));
2135 for(j=0; j<64; j++){
2160 uint8_t *dest_y, *dest_cb, *dest_cr;
2161 int dct_linesize, dct_offset;
2167 const int block_size = 8;
2186 dct_offset = s->
interlaced_dct ? linesize : linesize * block_size;
2190 dest_cb= s->
dest[1];
2191 dest_cr= s->
dest[2];
2262 add_dct(s, block[0], 0, dest_y , dct_linesize);
2263 add_dct(s, block[1], 1, dest_y + block_size, dct_linesize);
2264 add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize);
2265 add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
2269 add_dct(s, block[4], 4, dest_cb, uvlinesize);
2270 add_dct(s, block[5], 5, dest_cr, uvlinesize);
2276 add_dct(s, block[4], 4, dest_cb, dct_linesize);
2277 add_dct(s, block[5], 5, dest_cr, dct_linesize);
2278 add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize);
2279 add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize);
2281 add_dct(s, block[8], 8, dest_cb+8, dct_linesize);
2282 add_dct(s, block[9], 9, dest_cr+8, dct_linesize);
2283 add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize);
2284 add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize);
2296 put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->
qscale);
2297 put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->
qscale);
2298 put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->
qscale);
2315 s->
idsp.
idct_put(dest_y + block_size, dct_linesize, block[1]);
2316 s->
idsp.
idct_put(dest_y + dct_offset, dct_linesize, block[2]);
2317 s->
idsp.
idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
2330 s->
idsp.
idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
2331 s->
idsp.
idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
2335 s->
idsp.
idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]);
2336 s->
idsp.
idct_put(dest_cr + 8 + dct_offset, dct_linesize, block[11]);
2371 const int mb_size= 4;
2388 s->
dest[0] += s->
mb_y * linesize << mb_size;
2392 s->
dest[0] += (s->
mb_y>>1) * linesize << mb_size;
2416 for(i=0; i<=last; i++){
2417 const int j= scantable[i];
2422 for(i=0; i<=last; i++){
2423 const int j= scantable[i];
2424 const int perm_j= permutation[j];
2425 block[perm_j]= temp[j];
2463 else if (qscale > 31)
int bitstream_buffer_size
uint8_t * scratchpad
data area for the ME algo, so that the ME does not need to malloc/free
av_cold void ff_me_cmp_init(MECmpContext *c, AVCodecContext *avctx)
int last
number of values for last = 0
int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx)
int ff_mpeg_ref_picture(MpegEncContext *s, Picture *dst, Picture *src)
static int init_duplicate_context(MpegEncContext *s)
const struct AVCodec * codec
int16_t(* b_bidir_back_mv_table_base)[2]
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
av_cold void ff_mpv_common_init_arm(MpegEncContext *s)
discard all frames except keyframes
void ff_init_block_index(MpegEncContext *s)
unsigned int stream_codec_tag
fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A')...
#define MAX_PICTURE_COUNT
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
av_cold void ff_mpv_common_init_neon(MpegEncContext *s)
ScanTable intra_v_scantable
av_cold void ff_mpegvideodsp_init(MpegVideoDSPContext *c)
void(* dct_unquantize_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
This structure describes decoded (raw) audio or video data.
int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared)
Allocate a Picture.
int16_t(* p_mv_table)[2]
MV table (1MV per MB) p-frame encoding.
uint8_t * rd_scratchpad
scratchpad for rate distortion mb decision
int start_mb_y
start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) ...
#define MAKE_WRITABLE(table)
const uint8_t * y_dc_scale_table
qscale -> y_dc_scale table
uint8_t * mb_mean
Table for MB luminance.
int coded_width
Bitstream width / height, may be different from width/height e.g.
op_pixels_func avg_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
#define AV_LOG_WARNING
Something somehow does not look correct.
const uint8_t ff_alternate_horizontal_scan[64]
uint8_t * coded_block_base
static int update_picture_tables(Picture *dst, Picture *src)
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
int end_mb_y
end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) ...
uint16_t * mb_var
Table for MB variances.
void ff_block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last)
Permute an 8x8 block.
int16_t(*[3] ac_val)[16]
used for for mpeg4 AC prediction, all 3 arrays must be continuous
int v_edge_pos
horizontal / vertical position of the right/bottom edge (pixel replication)
int msmpeg4_version
0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8
static const uint8_t mpeg2_dc_scale_table3[128]
int needs_realloc
Picture needs to be reallocated (eg due to a frame size change)
uint8_t * bitstream_buffer
void(* clear_blocks)(int16_t *blocks)
int field_picture
whether or not the picture was encoded in separate fields
void ff_print_debug_info(MpegEncContext *s, Picture *p)
Print debugging info for the given picture.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int16_t(*[2][2] p_field_mv_table)[2]
MV table (2MV per MB) interlaced p-frame encoding.
int16_t(* p_mv_table_base)[2]
static int make_tables_writable(Picture *pic)
void(* qpel_mc_func)(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
uint32_t * score_map
map to store the scores
#define FF_ARRAY_ELEMS(a)
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
const int8_t * table_level
static void free_duplicate_context(MpegEncContext *s)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
void ff_thread_await_progress(ThreadFrame *f, int n, int field)
Wait for earlier decoding threads to finish reference pictures.
int mb_num
number of MBs of a picture
void ff_draw_horiz_band(AVCodecContext *avctx, AVFrame *cur, AVFrame *last, int y, int h, int picture_structure, int first_field, int low_delay)
Draw a horizontal band if supported.
int h263_aic
Advanded INTRA Coding (AIC)
int16_t(* b_back_mv_table)[2]
MV table (1MV per MB) backward mode b-frame encoding.
int encoding
true if we are encoding (vs decoding)
void(* dct_unquantize_h263_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
void(* dct_unquantize_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s, int16_t *block, int n, int qscale)
Macro definitions for various function/variable attributes.
int16_t(* b_back_mv_table_base)[2]
static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src)
#define REBASE_PICTURE(pic, new_ctx, old_ctx)
void ff_clean_intra_table_entries(MpegEncContext *s)
Clean dc, ac, coded_block for the current non-intra MB.
void(* dct_unquantize_h263_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
int av_codec_is_encoder(const AVCodec *codec)
#define CODEC_FLAG_PSNR
error[?] variables will be set during encoding.
struct AVHWAccel * hwaccel
Hardware accelerator in use.
#define CONFIG_WMV2_DECODER
#define USES_LIST(a, list)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
int8_t * max_run[2]
encoding & decoding
#define CONFIG_WMV2_ENCODER
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
enum OutputFormat out_format
output format
int ff_mpv_common_frame_size_change(MpegEncContext *s)
void ff_mpv_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, op_pixels_func(*pix_op)[4], qpel_mc_func(*qpix_op)[16])
uint8_t * pred_dir_table
used to store pred_dir for partitioned decoding
Multithreading support functions.
qpel_mc_func(* qpel_put)[16]
static void release_unused_pictures(MpegEncContext *s)
int no_rounding
apply no rounding to motion compensation (MPEG4, msmpeg4, ...) for b-frames rounding mode is always 0...
void ff_mpv_decode_mb(MpegEncContext *s, int16_t block[12][64])
Picture current_picture
copy of the current picture structure.
static int pic_is_unused(MpegEncContext *s, Picture *pic)
void ff_mpv_common_init_ppc(MpegEncContext *s)
static int alloc_picture_tables(MpegEncContext *s, Picture *pic)
#define PICT_BOTTOM_FIELD
int16_t(* b_bidir_forw_mv_table)[2]
MV table (1MV per MB) bidir mode b-frame encoding.
int8_t * max_level[2]
encoding & decoding
int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src)
uint16_t pp_time
time distance between the last 2 p,s,i frames
AVBufferRef * mb_type_buf
uint8_t * b_scratchpad
scratchpad used for writing into write only buffers
static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, int(*mv)[2][4][2], int mb_x, int mb_y, int mb_intra, int mb_skipped)
int flags2
AVCodecContext.flags2.
int interlaced_frame
The content of the picture is interlaced.
#define CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
av_cold void ff_mpv_idct_init(MpegEncContext *s)
int mb_height
number of MBs horizontally & vertically
int codec_tag
internal codec_tag upper case converted from avctx codec_tag
high precision timer, useful to profile code
int16_t(*[2][2] p_field_mv_table_base)[2]
static int free_context_frame(MpegEncContext *s)
Frees and resets MpegEncContext fields depending on the resolution.
static void ff_update_block_index(MpegEncContext *s)
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
AVBufferRef * mb_mean_buf
int intra_only
if true, only intra pictures are generated
int16_t * dc_val[3]
used for mpeg4 DC prediction, all 3 arrays must be continuous
int h263_plus
h263 plus headers
int slice_context_count
number of used thread_contexts
int width
width and height of the video frame
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int stream_codec_tag
internal stream_codec_tag upper case converted from avctx stream_codec_tag
int last_dc[3]
last DC values for MPEG1
void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
static void add_dct(MpegEncContext *s, int16_t *block, int i, uint8_t *dest, int line_size)
#define CODEC_FLAG_INTERLACED_ME
interlaced motion estimation
int mb_skipped
MUST BE SET only during DECODING.
static int find_unused_picture(MpegEncContext *s, int shared)
int partitioned_frame
is current frame partitioned
av_cold void ff_init_vlc_rl(RLTable *rl)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int active_thread_type
Which multithreading methods are in use by the codec.
int last_lambda_for[5]
last lambda for a specific pict type
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
uint8_t * edge_emu_buffer
temporary buffer for if MVs point to out-of-frame data
static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s, int16_t *block, int n, int qscale)
void(* dct_unquantize_mpeg2_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
void(* decode_mb)(void *opaque, int ref, int mv_dir, int mv_type, int(*mv)[2][4][2], int mb_x, int mb_y, int mb_intra, int mb_skipped)
void(* dct_unquantize_mpeg1_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
static enum AVDiscard skip_idct
static void put_dct(MpegEncContext *s, int16_t *block, int i, uint8_t *dest, int line_size, int qscale)
simple assert() macros that are a bit more flexible than ISO C assert().
int overread_index
the index into ParseContext.buffer of the overread bytes
void av_log(void *avcl, int level, const char *fmt,...)
static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s, int16_t *block, int n, int qscale)
int quarter_sample
1->qpel, 0->half pel ME/MC
uint16_t * mb_type
Table for candidate MB types for encoding (defines in mpegutils.h)
int low_delay
no reordering needed / has no b-frames
void ff_mpeg_unref_picture(MpegEncContext *s, Picture *pic)
Deallocate a picture.
VLC vlc
decoding only deprecated FIXME remove
uint8_t *[2][2] b_field_select_table
void ff_mpv_common_end(MpegEncContext *s)
av_cold void ff_mpv_common_init_x86(MpegEncContext *s)
static const uint8_t ff_default_chroma_qscale_table[32]
void ff_mpeg_flush(AVCodecContext *avctx)
av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags)
int coded_picture_number
used to set pic->coded_picture_number, should not be used for/by anything else
uint8_t * error_status_table
AVBufferRef * hwaccel_priv_buf
common internal API header
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
const uint8_t ff_alternate_vertical_scan[64]
int n
number of entries of table_vlc minus 1
av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
AVBufferRef * motion_val_buf[2]
void(* op_pixels_func)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
void(* draw_horiz_band)(struct AVCodecContext *s, const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], int y, int type, int height)
If non NULL, 'draw_horiz_band' is called by the libavcodec decoder to draw a horizontal band...
enum AVPictureType pict_type
Picture type of the frame.
#define UPDATE_PICTURE(pic)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
#define FF_THREAD_FRAME
Decode more than one frame at once.
int overread
the number of bytes which where irreversibly read from the next frame
int next_p_frame_damaged
set if the next p frame is damaged, to avoid showing trashed b frames
static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s, int16_t *block, int n, int qscale)
Picture new_picture
copy of the source picture structure for encoding.
int width
picture width / height.
uint8_t * mbskip_table
used to avoid copy if macroblock skipped (for black regions for example) and used for b-frame encodin...
int16_t(*[2] motion_val)[2]
Picture * current_picture_ptr
pointer to the current picture
unsigned int allocated_bitstream_buffer_size
void * hwaccel_picture_private
hardware accelerator private data
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
int16_t(* ac_val_base)[16]
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
int16_t(*[2][2][2] b_field_mv_table_base)[2]
int16_t(* b_forw_mv_table_base)[2]
int16_t(*[12] pblocks)[64]
int block_last_index[12]
last non zero coefficient in block
uint8_t idct_permutation[64]
IDCT input permutation.
int mb_decision
macroblock decision mode
void(* idct_add)(uint8_t *dest, int line_size, int16_t *block)
block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
uint8_t * mbintra_table
used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding
#define DELAYED_PIC_REF
Value of Picture.reference when Picture is not a reference picture, but is held for delayed output...
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
RL_VLC_ELEM * rl_vlc[32]
decoding only
preferred ID for MPEG-1/2 video decoding
void ff_mpv_decode_defaults(MpegEncContext *s)
Set the given MpegEncContext to defaults for decoding.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
int block_index[6]
index to current MB in block based arrays with edges
if(ac->has_optimized_func)
int * mb_index2xy
mb_index -> mb_x + mb_y*mb_stride
int first_field
is 1 for the first field of a field picture 0 otherwise
int ff_mpv_lowest_referenced_row(MpegEncContext *s, int dir)
find the lowest MB row referenced in the MVs
static const int8_t mv[256][2]
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
void(* idct_put)(uint8_t *dest, int line_size, int16_t *block)
block -> idct -> clip to unsigned 8 bit -> dest.
#define MV_TYPE_16X16
1 vector for the whole mb
void ff_wmv2_add_mb(MpegEncContext *s, int16_t block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
uint16_t * mc_mb_var
Table for motion compensated MB variances.
AVBufferRef * qscale_table_buf
int16_t(* b_bidir_forw_mv_table_base)[2]
const uint8_t *const ff_mpeg2_dc_scale_table[4]
int coded_picture_number
picture number in bitstream order
#define AV_LOG_INFO
Standard information.
uint16_t inter_matrix[64]
struct MpegEncContext * thread_context[MAX_THREADS]
int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags)
The default callback for AVCodecContext.get_buffer2().
Libavcodec external API header.
void ff_free_picture_tables(Picture *pic)
ptrdiff_t linesize
line size, in bytes, may be different from width
av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
main external API structure.
ScanTable intra_scantable
uint8_t * data
The data buffer.
uint8_t * coded_block
used for coded block pattern prediction (msmpeg4v3, wmv1)
int height
picture size. must be a multiple of 16
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s, int16_t *block, int n, int qscale)
const uint8_t ff_mpeg1_dc_scale_table[128]
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
static av_always_inline void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], int is_mpeg12)
#define MV_TYPE_16X8
2 vectors, one per 16x8 block
uint32_t state
contains the last few bytes in MSB order
Picture * picture
main picture buffer
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
#define AVERROR_BUG
Bug detected, please report the issue.
ScanTable intra_h_scantable
int16_t(*[2][2][2] b_field_mv_table)[2]
MV table (4MV per MB) interlaced b-frame encoding.
uint8_t * cbp_table
used to store cbp, ac_pred for partitioned decoding
#define UPDATE_TABLE(table)
unsigned int avpriv_toupper4(unsigned int x)
#define FF_DEBUG_DCT_COEFF
#define FF_MB_DECISION_RD
rate distortion
uint8_t * index_run[2]
encoding only
op_pixels_func put_no_rnd_pixels_tab[2][4]
Halfpel motion compensation with no rounding (a+b)>>1.
const uint8_t ff_zigzag_direct[64]
ptrdiff_t uvlinesize
line size, for chroma in bytes, may be different from width
int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
generic function called after decoding the header and before a frame is decoded.
int f_code
forward MV resolution
int max_b_frames
max number of b-frames for encoding
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
int h263_pred
use mpeg4/h263 ac/dc predictions
int16_t(* b_bidir_back_mv_table)[2]
MV table (1MV per MB) bidir mode b-frame encoding.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
static int init_context_frame(MpegEncContext *s)
Initialize and allocates MpegEncContext fields dependent on the resolution.
uint8_t *[2] p_field_select_table
int16_t(* b_direct_mv_table)[2]
MV table (1MV per MB) direct mode b-frame encoding.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const uint8_t * c_dc_scale_table
qscale -> c_dc_scale table
qpel_mc_func(* qpel_avg)[16]
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
int16_t(* b_forw_mv_table)[2]
MV table (1MV per MB) forward mode b-frame encoding.
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
int noise_reduction
noise reduction strength
static void dct_unquantize_h263_intra_c(MpegEncContext *s, int16_t *block, int n, int qscale)
Picture * next_picture_ptr
pointer to the next picture (for bidir pred)
struct AVCodecContext * avctx
discard all non reference
static void exchange_uv(MpegEncContext *s)
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
AVBufferRef * mbskip_table_buf
#define CODEC_FLAG_GRAY
Only decode/encode grayscale.
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)
static av_cold int dct_init(MpegEncContext *s)
static void dct_unquantize_h263_inter_c(MpegEncContext *s, int16_t *block, int n, int qscale)
Picture last_picture
copy of the previous picture structure.
uint8_t * obmc_scratchpad
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
Allocate a frame buffer.
Picture * last_picture_ptr
pointer to the previous picture.
FF_ENABLE_DEPRECATION_WARNINGS int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
const uint8_t * chroma_qscale_table
qscale -> chroma_qscale (h263)
uint32_t * map
map to avoid duplicate evaluations
int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
void(* dct_unquantize_mpeg1_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
int slices
Number of slices.
av_cold int ff_mpv_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
#define HAVE_INTRINSICS_NEON
av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
#define FF_ENABLE_DEPRECATION_WARNINGS
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
int top_field_first
If the content is interlaced, is top field displayed first.
void ff_xvmc_decode_mb(MpegEncContext *s)
void ff_mpv_frame_end(MpegEncContext *s)
int frame_priv_data_size
Size of per-frame hardware accelerator private data.
av_cold void ff_init_rl(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
int16_t(* block)[64]
points to one of the following blocks
ParseContext parse_context
VLC_TYPE(* table)[2]
code, bits
static void add_dequant_dct(MpegEncContext *s, int16_t *block, int i, uint8_t *dest, int line_size, int qscale)
Picture next_picture
copy of the next picture structure.
AVBufferRef * mc_mb_var_buf
int key_frame
1 -> keyframe, 0-> not
static const uint8_t mpeg2_dc_scale_table1[128]
static int init_er(MpegEncContext *s)
static const uint8_t mpeg2_dc_scale_table2[128]
int chroma_qscale
chroma QP
void(* dct_unquantize_mpeg2_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
int mb_var_sum
sum of MB variance for current frame
void ff_mpv_common_defaults(MpegEncContext *s)
Set the given MpegEncContext to common defaults (same for encoding and decoding). ...
int flags
AVCodecContext.flags (HQ, MV4, ...)
int mc_mb_var_sum
motion compensated MB variance for current frame
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
uint32_t * mb_type
types and macros are defined in mpegutils.h
int workaround_bugs
workaround bugs in encoders which cannot be detected automatically
ScanTable inter_scantable
if inter == intra then intra should be used to reduce tha cache usage
int ff_find_unused_picture(MpegEncContext *s, int shared)
#define MV_TYPE_8X8
4 vectors (h263, mpeg4 4MV)
void ff_xvmc_field_end(MpegEncContext *s)
int16_t(* b_direct_mv_table_base)[2]
int b_code
backward MV resolution for B Frames (mpeg4)
#define CONFIG_MPEG_XVMC_DECODER
void ff_mpv_report_decode_progress(MpegEncContext *s)
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int frame_size_alloc(MpegEncContext *s, int linesize)
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)
AVBufferRef * ref_index_buf[2]