48 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
49 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
54 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
55 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
56 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
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,
66 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
67 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
68 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
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,
78 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
79 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
80 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
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,
90 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
91 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
92 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
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,
113 int16_t *
block,
int n,
int qscale)
115 int i,
level, nCoeffs;
116 const uint16_t *quant_matrix;
126 for(i=1;i<=nCoeffs;i++) {
132 level = (int)(level * qscale * quant_matrix[j]) >> 3;
133 level = (level - 1) | 1;
136 level = (int)(level * qscale * quant_matrix[j]) >> 3;
137 level = (level - 1) | 1;
145 int16_t *
block,
int n,
int qscale)
147 int i,
level, nCoeffs;
148 const uint16_t *quant_matrix;
153 for(i=0; i<=nCoeffs; i++) {
159 level = (((level << 1) + 1) * qscale *
160 ((int) (quant_matrix[j]))) >> 4;
161 level = (level - 1) | 1;
164 level = (((level << 1) + 1) * qscale *
165 ((int) (quant_matrix[j]))) >> 4;
166 level = (level - 1) | 1;
174 int16_t *
block,
int n,
int qscale)
176 int i,
level, nCoeffs;
177 const uint16_t *quant_matrix;
187 for(i=1;i<=nCoeffs;i++) {
193 level = (int)(level * qscale * quant_matrix[j]) >> 3;
196 level = (int)(level * qscale * quant_matrix[j]) >> 3;
204 int16_t *
block,
int n,
int qscale)
206 int i,
level, nCoeffs;
207 const uint16_t *quant_matrix;
218 for(i=1;i<=nCoeffs;i++) {
224 level = (int)(level * qscale * quant_matrix[j]) >> 3;
227 level = (int)(level * qscale * quant_matrix[j]) >> 3;
237 int16_t *
block,
int n,
int qscale)
239 int i,
level, nCoeffs;
240 const uint16_t *quant_matrix;
247 for(i=0; i<=nCoeffs; i++) {
253 level = (((level << 1) + 1) * qscale *
254 ((int) (quant_matrix[j]))) >> 4;
257 level = (((level << 1) + 1) * qscale *
258 ((int) (quant_matrix[j]))) >> 4;
268 int16_t *
block,
int n,
int qscale)
270 int i,
level, qmul, qadd;
282 qadd = (qscale - 1) | 1;
291 for(i=1; i<=nCoeffs; i++) {
295 level = level * qmul - qadd;
297 level = level * qmul + qadd;
305 int16_t *
block,
int n,
int qscale)
307 int i,
level, qmul, qadd;
312 qadd = (qscale - 1) | 1;
317 for(i=0; i<=nCoeffs; i++) {
321 level = level * qmul - qadd;
323 level = level * qmul + qadd;
332 int mb_x,
int mb_y,
int mb_intra,
int mb_skipped)
342 memcpy(s->
mv,
mv,
sizeof(*
mv));
447 if (r < 0 || !pic->f.buf[0]) {
455 for (i = 0; pic->
f.
data[i]; i++) {
459 pic->
f.
data[i] += offset;
480 "get_buffer() failed (stride changed)\n");
487 "get_buffer() failed (uv stride mismatch)\n");
495 "get_buffer() failed to allocate context scratch buffers.\n");
514 for (i = 0; i < 2; i++) {
544 int mv_size = 2 * (b8_array_size + 4) *
sizeof(int16_t);
545 int ref_index_size = 4 * mb_array_size;
547 for (i = 0; mv_size && i < 2; i++) {
561 #define MAKE_WRITABLE(table) \
564 (ret = av_buffer_make_writable(&pic->table)) < 0)\
575 for (i = 0; i < 2; i++) {
592 assert(pic->
f.
data[0]);
595 assert(!pic->
f.
buf[0]);
622 for (i = 0; i < 2; i++) {
658 memset((
uint8_t*)pic + off, 0,
sizeof(*pic) - off);
665 #define UPDATE_TABLE(table)\
668 (!dst->table || dst->table->buffer != src->table->buffer)) {\
669 av_buffer_unref(&dst->table);\
670 dst->table = av_buffer_ref(src->table);\
672 ff_free_picture_tables(dst);\
673 return AVERROR(ENOMEM);\
684 for (i = 0; i < 2; i++) {
695 for (i = 0; i < 2; i++) {
754 int yc_size = y_size + 2 * c_size;
771 2 * 64 *
sizeof(
int), fail)
777 for (i = 0; i < 12; i++) {
786 yc_size *
sizeof(int16_t) * 16, fail);
819 #define COPY(a) bak->a = src->a
820 COPY(edge_emu_buffer);
825 COPY(obmc_scratchpad);
832 COPY(me.map_generation);
853 for (i = 0; i < 12; i++) {
861 "scratch buffers.\n");
875 if (dst == src || !s1->context_initialized)
894 s->
width = s1->width;
909 if (s1->picture[i].f.buf[0] &&
914 #define UPDATE_PICTURE(pic)\
916 ff_mpeg_unref_picture(s, &s->pic);\
917 if (s1->pic.f.buf[0])\
918 ret = ff_mpeg_ref_picture(s, &s->pic, &s1->pic);\
920 ret = update_picture_tables(&s->pic, &s1->pic);\
939 (
char *) &s1->pb_field_time +
sizeof(s1->pb_field_time) -
940 (
char *) &s1->last_time_base);
950 if (s1->bitstream_buffer) {
951 if (s1->bitstream_buffer_size +
955 s1->allocated_bitstream_buffer_size);
958 s1->bitstream_buffer_size);
968 "scratch buffers.\n");
973 "be allocated due to unknown size.\n");
979 (
char *) &s1->rtp_mode - (
char *) &s1->progressive_sequence);
981 if (!s1->first_field) {
983 if (s1->current_picture_ptr)
984 s->
last_lambda_for[s1->pict_type] = s1->current_picture_ptr->f.quality;
1066 int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
1091 yc_size = y_size + 2 * c_size;
1105 mv_table_size * 2 *
sizeof(int16_t), fail);
1107 mv_table_size * 2 *
sizeof(int16_t), fail);
1109 mv_table_size * 2 *
sizeof(int16_t), fail);
1111 mv_table_size * 2 *
sizeof(int16_t), fail);
1113 mv_table_size * 2 *
sizeof(int16_t), fail);
1115 mv_table_size * 2 *
sizeof(int16_t), fail);
1127 sizeof(uint16_t), fail);
1133 mb_array_size *
sizeof(
float), fail);
1135 mb_array_size *
sizeof(
float), fail);
1142 for (i = 0; i < 2; i++) {
1144 for (j = 0; j < 2; j++) {
1145 for (k = 0; k < 2; k++) {
1148 mv_table_size * 2 *
sizeof(int16_t),
1154 mb_array_size * 2 *
sizeof(
uint8_t), fail);
1156 mv_table_size * 2 *
sizeof(int16_t), fail);
1161 mb_array_size * 2 *
sizeof(
uint8_t), fail);
1171 mb_array_size *
sizeof(
uint8_t), fail);
1173 mb_array_size *
sizeof(
uint8_t), fail);
1180 yc_size *
sizeof(int16_t), fail);
1184 for (i = 0; i < yc_size; i++)
1222 "decoding to AV_PIX_FMT_NONE is not supported.\n");
1233 " reducing to %d\n", nb_slices, max_slices);
1234 nb_slices = max_slices;
1279 if (nb_slices > 1) {
1280 for (i = 1; i < nb_slices; i++) {
1285 for (i = 0; i < nb_slices; i++) {
1289 (s->
mb_height * (i) + nb_slices / 2) / nb_slices;
1291 (s->
mb_height * (i + 1) + nb_slices / 2) / nb_slices;
1330 for (i = 0; i < 2; i++) {
1331 for (j = 0; j < 2; j++) {
1332 for (k = 0; k < 2; k++) {
1406 if (nb_slices > 1) {
1407 for (i = 1; i < nb_slices; i++) {
1412 for (i = 0; i < nb_slices; i++) {
1416 (s->
mb_height * (i) + nb_slices / 2) / nb_slices;
1418 (s->
mb_height * (i + 1) + nb_slices / 2) / nb_slices;
1484 int last,
run,
level, start, end, i;
1491 for (last = 0; last < 2; last++) {
1500 memset(max_level, 0,
MAX_RUN + 1);
1502 memset(index_run, rl->
n,
MAX_RUN + 1);
1503 for (i = start; i < end; i++) {
1506 if (index_run[run] == rl->
n)
1508 if (level > max_level[run])
1510 if (run > max_run[level])
1514 rl->
max_level[last] = static_store[last];
1527 memcpy(rl->
index_run[last], index_run, MAX_RUN + 1);
1535 for (q = 0; q < 32; q++) {
1537 int qadd = (q - 1) | 1;
1551 }
else if (len < 0) {
1555 if (code == rl->
n) {
1561 if (code >= rl->
last) run += 192;
1649 "releasing zombie picture\n");
1710 av_dlog(s->
avctx,
"L%p N%p C%p L%p N%p C%p type:%d drop:%d\n",
1721 int h_chroma_shift, v_chroma_shift;
1723 &h_chroma_shift, &v_chroma_shift);
1726 "warning: first frame is no keyframe\n");
1729 "allocate dummy last picture for field based first keyframe\n");
1750 (avctx->
height >> v_chroma_shift) *
1753 (avctx->
height >> v_chroma_shift) *
1799 "Non-reference picture received and no reference available\n");
1805 for (i = 0; i < 4; i++) {
1896 for (x = 0; x < s->
mb_width; x++) {
1924 else if (
IS_GMC(mb_type))
1966 int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !s->
quarter_sample;
1967 int my,
off, i, mvs;
1986 for (i = 0; i < mvs; i++) {
1987 my = s->
mv[dir][i][1]<<qpel_shift;
1988 my_max =
FFMAX(my_max, my);
1989 my_min =
FFMIN(my_min, my);
1992 off = (
FFMAX(-my_min, my_max) + 63) >> 6;
2001 int16_t *
block,
int i,
uint8_t *dest,
int line_size,
int qscale)
2017 int16_t *
block,
int i,
uint8_t *dest,
int line_size,
int qscale)
2039 memset(s->
ac_val[0][xy ], 0, 32 *
sizeof(int16_t));
2040 memset(s->
ac_val[0][xy + wrap], 0, 32 *
sizeof(int16_t));
2053 memset(s->
ac_val[1][xy], 0, 16 *
sizeof(int16_t));
2054 memset(s->
ac_val[2][xy], 0, 16 *
sizeof(int16_t));
2089 for(j=0; j<64; j++){
2113 uint8_t *dest_y, *dest_cb, *dest_cr;
2114 int dct_linesize, dct_offset;
2120 const int block_size = 8;
2139 dct_offset = s->
interlaced_dct ? linesize : linesize * block_size;
2143 dest_cb= s->
dest[1];
2144 dest_cr= s->
dest[2];
2215 add_dct(s, block[0], 0, dest_y , dct_linesize);
2216 add_dct(s, block[1], 1, dest_y + block_size, dct_linesize);
2217 add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize);
2218 add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
2222 add_dct(s, block[4], 4, dest_cb, uvlinesize);
2223 add_dct(s, block[5], 5, dest_cr, uvlinesize);
2229 add_dct(s, block[4], 4, dest_cb, dct_linesize);
2230 add_dct(s, block[5], 5, dest_cr, dct_linesize);
2231 add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize);
2232 add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize);
2234 add_dct(s, block[8], 8, dest_cb+8, dct_linesize);
2235 add_dct(s, block[9], 9, dest_cr+8, dct_linesize);
2236 add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize);
2237 add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize);
2249 put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->
qscale);
2250 put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->
qscale);
2251 put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->
qscale);
2268 s->
dsp.
idct_put(dest_y + block_size, dct_linesize, block[1]);
2269 s->
dsp.
idct_put(dest_y + dct_offset , dct_linesize, block[2]);
2270 s->
dsp.
idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
2283 s->
dsp.
idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
2284 s->
dsp.
idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
2286 s->
dsp.
idct_put(dest_cb + 8, dct_linesize, block[8]);
2287 s->
dsp.
idct_put(dest_cr + 8, dct_linesize, block[9]);
2288 s->
dsp.
idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]);
2289 s->
dsp.
idct_put(dest_cr + 8 + dct_offset, dct_linesize, block[11]);
2317 Picture *last,
int y,
int h,
int picture_structure,
2322 const int field_pic = picture_structure !=
PICT_FRAME;
2353 offset[2]= (y >> vshift) * src->
linesize[1];
2361 y, picture_structure, h);
2375 const int mb_size= 4;
2392 s->
dest[0] += s->
mb_y * linesize << mb_size;
2396 s->
dest[0] += (s->
mb_y>>1) * linesize << mb_size;
2420 for(i=0; i<=last; i++){
2421 const int j= scantable[i];
2426 for(i=0; i<=last; i++){
2427 const int j= scantable[i];
2428 const int perm_j= permutation[j];
2429 block[perm_j]= temp[j];
2467 else if (qscale > 31)
2483 #if CONFIG_ERROR_RESILIENCE
int bitstream_buffer_size
uint8_t * scratchpad
data area for the ME algo, so that the ME does not need to malloc/free
#define PICT_BOTTOM_FIELD
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 ...
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')...
av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
#define MAX_PICTURE_COUNT
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_NUM_DATA_POINTERS
ScanTable intra_v_scantable
#define SLICE_FLAG_ALLOW_FIELD
allow draw_horiz_band() with field slices (MPEG2 field pics)
av_cold void ff_MPV_common_init_x86(MpegEncContext *s)
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...
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
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.
av_cold int ff_dct_common_init(MpegEncContext *s)
av_cold int ff_MPV_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
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.
void ff_MPV_report_decode_progress(MpegEncContext *s)
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.
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])
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 ff_MPV_common_init_ppc(MpegEncContext *s)
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)
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(* idct_add)(uint8_t *dest, int line_size, int16_t *block)
block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
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 USES_LIST(a, list)
does this mb use listX, note does not work if subMBs
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 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
const uint8_t ff_alternate_vertical_scan[64]
#define CONFIG_WMV2_ENCODER
void(* idct_put)(uint8_t *dest, int line_size, int16_t *block)
block -> idct -> clip to unsigned 8 bit -> dest.
int ff_MPV_common_frame_size_change(MpegEncContext *s)
enum OutputFormat out_format
output format
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...
Picture current_picture
copy of the current picture structure.
static int pic_is_unused(MpegEncContext *s, Picture *pic)
static int alloc_picture_tables(MpegEncContext *s, Picture *pic)
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
uint8_t idct_permutation[64]
idct input permutation.
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).
int mb_height
number of MBs horizontally & vertically
enum AVPixelFormat ff_pixfmt_list_420[]
void ff_MPV_frame_end(MpegEncContext *s)
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
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
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)
const uint8_t ff_alternate_horizontal_scan[64]
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)
struct Picture * next_pic
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.
int low_delay
no reordering needed / has no b-frames
static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], int is_mpeg12)
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_draw_horiz_band(AVCodecContext *avctx, Picture *cur, Picture *last, int y, int h, int picture_structure, int first_field, int low_delay)
int priv_data_size
Size of HW accelerator private data.
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...
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...
void ff_mpeg_er_frame_start(MpegEncContext *s)
enum AVPictureType pict_type
Picture type of the frame.
struct Picture * last_pic
#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)
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...
void(* clear_blocks)(int16_t *blocks)
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
int mb_decision
macroblock decision mode
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_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
generic function called after decoding the header and before a frame is decoded.
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
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
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...
#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
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
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.
void(* qpel_mc_func)(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
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]
av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
#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.
int slice_flags
slice flags
void ff_MPV_decode_mb(MpegEncContext *s, int16_t block[12][64])
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.
ptrdiff_t uvlinesize
line size, for chroma in bytes, may be different from width
DSPContext dsp
pointers for accelerated dsp functions
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.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
const uint8_t ff_zigzag_direct[64]
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
AVBufferRef * mbskip_table_buf
void ff_MPV_common_defaults(MpegEncContext *s)
Set the given MpegEncContext to common defaults (same for encoding and decoding). ...
#define CODEC_FLAG_GRAY
Only decode/encode grayscale.
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)
static void dct_unquantize_h263_inter_c(MpegEncContext *s, int16_t *block, int n, int qscale)
int b4_stride
4*mb_width+1 used for some 4x4 block arrays to allow simple addressing
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.
#define FF_ENABLE_DEPRECATION_WARNINGS
int top_field_first
If the content is interlaced, is top field displayed first.
void ff_xvmc_decode_mb(MpegEncContext *s)
void ff_MPV_common_end(MpegEncContext *s)
av_cold void ff_init_rl(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
int ff_MPV_lowest_referenced_row(MpegEncContext *s, int dir)
find the lowest MB row referenced in the MVs
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
#define SLICE_FLAG_CODED_ORDER
draw_horiz_band() is called in coded order instead of display
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
#define REBASE_PICTURE(pic, new_ctx, old_ctx)
void ff_er_frame_start(ERContext *s)
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
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
static int first_field(int fd)
av_cold void ff_MPV_common_init_arm(MpegEncContext *s)
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
AVPixelFormat
Pixel format.
#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)
void ff_MPV_decode_defaults(MpegEncContext *s)
Set the given MpegEncContext to defaults for decoding.
uint16_t pb_time
time distance between the last b and p,s,i frame
AVBufferRef * ref_index_buf[2]