23 #define UNCHECKED_BITSTREAM_READER 1 44 #define SPRITE_TRAJ_VLC_BITS 6 46 #define MB_TYPE_B_VLC_BITS 4 47 #define STUDIO_INTRA_BITS 9 68 int16_t *ac_val, *ac_val1;
80 if (s->
mb_x == 0 || s->
qscale == qscale_table[xy] ||
83 for (i = 1; i < 8; i++)
87 for (i = 1; i < 8; i++)
95 if (s->
mb_y == 0 || s->
qscale == qscale_table[xy] ||
98 for (i = 1; i < 8; i++)
102 for (i = 1; i < 8; i++)
108 for (i = 1; i < 8; i++)
112 for (i = 1; i < 8; i++)
140 v |= 0x7F >> (7 - (bits_count & 7));
153 for (len = 0; len < 32; len++)
180 int min_ab, i, w2, h2, w3, h3;
181 int sprite_ref[4][2];
182 int virtual_ref[2][2];
183 int64_t sprite_offset[2][2];
184 int64_t sprite_delta[2][2];
187 const int vop_ref[4][2] = { { 0, 0 }, { s->
width, 0 },
189 int d[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
191 if (w <= 0 || h <= 0)
220 while ((1 << alpha) < w)
222 while ((1 << beta) < h)
229 sprite_ref[0][0] = a * vop_ref[0][0] + d[0][0];
230 sprite_ref[0][1] = a * vop_ref[0][1] + d[0][1];
231 sprite_ref[1][0] = a * vop_ref[1][0] + d[0][0] + d[1][0];
232 sprite_ref[1][1] = a * vop_ref[1][1] + d[0][1] + d[1][1];
233 sprite_ref[2][0] = a * vop_ref[2][0] + d[0][0] + d[2][0];
234 sprite_ref[2][1] = a * vop_ref[2][1] + d[0][1] + d[2][1];
236 sprite_ref[0][0] = (a >> 1) * (2 * vop_ref[0][0] + d[0][0]);
237 sprite_ref[0][1] = (a >> 1) * (2 * vop_ref[0][1] + d[0][1]);
238 sprite_ref[1][0] = (a >> 1) * (2 * vop_ref[1][0] + d[0][0] + d[1][0]);
239 sprite_ref[1][1] = (a >> 1) * (2 * vop_ref[1][1] + d[0][1] + d[1][1]);
240 sprite_ref[2][0] = (a >> 1) * (2 * vop_ref[2][0] + d[0][0] + d[2][0]);
241 sprite_ref[2][1] = (a >> 1) * (2 * vop_ref[2][1] + d[0][1] + d[2][1]);
251 virtual_ref[0][0] = 16 * (vop_ref[0][0] + w2) +
253 (r * sprite_ref[0][0] - 16LL * vop_ref[0][0]) +
254 w2 * (r * sprite_ref[1][0] - 16LL * vop_ref[1][0])), w);
255 virtual_ref[0][1] = 16 * vop_ref[0][1] +
257 (r * sprite_ref[0][1] - 16LL * vop_ref[0][1]) +
258 w2 * (r * sprite_ref[1][1] - 16LL * vop_ref[1][1])), w);
259 virtual_ref[1][0] = 16 * vop_ref[0][0] +
260 ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][0] - 16LL * vop_ref[0][0]) +
261 h2 * (r * sprite_ref[2][0] - 16LL * vop_ref[2][0])), h);
262 virtual_ref[1][1] = 16 * (vop_ref[0][1] + h2) +
263 ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][1] - 16LL * vop_ref[0][1]) +
264 h2 * (r * sprite_ref[2][1] - 16LL * vop_ref[2][1])),
h);
268 sprite_offset[0][0] =
269 sprite_offset[0][1] =
270 sprite_offset[1][0] =
271 sprite_offset[1][1] = 0;
272 sprite_delta[0][0] =
a;
274 sprite_delta[1][0] = 0;
275 sprite_delta[1][1] =
a;
280 sprite_offset[0][0] = sprite_ref[0][0] - a * vop_ref[0][0];
281 sprite_offset[0][1] = sprite_ref[0][1] - a * vop_ref[0][1];
282 sprite_offset[1][0] = ((sprite_ref[0][0] >> 1) | (sprite_ref[0][0] & 1)) -
283 a * (vop_ref[0][0] / 2);
284 sprite_offset[1][1] = ((sprite_ref[0][1] >> 1) | (sprite_ref[0][1] & 1)) -
285 a * (vop_ref[0][1] / 2);
286 sprite_delta[0][0] =
a;
288 sprite_delta[1][0] = 0;
289 sprite_delta[1][1] =
a;
294 sprite_offset[0][0] = ((int64_t) sprite_ref[0][0] * (1 << alpha + rho)) +
295 ((int64_t) -r * sprite_ref[0][0] + virtual_ref[0][0]) *
296 ((int64_t) -vop_ref[0][0]) +
297 ((int64_t) r * sprite_ref[0][1] - virtual_ref[0][1]) *
298 ((int64_t) -vop_ref[0][1]) + (1 << (alpha + rho - 1));
299 sprite_offset[0][1] = ((int64_t) sprite_ref[0][1] * (1 << alpha + rho)) +
300 ((int64_t) -r * sprite_ref[0][1] + virtual_ref[0][1]) *
301 ((int64_t) -vop_ref[0][0]) +
302 ((int64_t) -r * sprite_ref[0][0] + virtual_ref[0][0]) *
303 ((int64_t) -vop_ref[0][1]) + (1 << (alpha + rho - 1));
304 sprite_offset[1][0] = (((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) *
305 ((int64_t)-2 * vop_ref[0][0] + 1) +
306 ((int64_t) r * sprite_ref[0][1] - virtual_ref[0][1]) *
307 ((int64_t)-2 * vop_ref[0][1] + 1) + 2 * w2 * r *
308 (int64_t) sprite_ref[0][0] - 16 * w2 + (1 << (alpha + rho + 1)));
309 sprite_offset[1][1] = (((int64_t)-r * sprite_ref[0][1] + virtual_ref[0][1]) *
310 ((int64_t)-2 * vop_ref[0][0] + 1) +
311 ((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) *
312 ((int64_t)-2 * vop_ref[0][1] + 1) + 2 * w2 * r *
313 (int64_t) sprite_ref[0][1] - 16 * w2 + (1 << (alpha + rho + 1)));
314 sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
315 sprite_delta[0][1] = (+r * sprite_ref[0][1] - virtual_ref[0][1]);
316 sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]);
317 sprite_delta[1][1] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
323 min_ab =
FFMIN(alpha, beta);
326 sprite_offset[0][0] = ((int64_t)sprite_ref[0][0] * (1 << (alpha + beta + rho - min_ab))) +
327 ((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3 * (-vop_ref[0][0]) +
328 ((int64_t)-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3 * (-vop_ref[0][1]) +
329 ((int64_t)1 << (alpha + beta + rho - min_ab - 1));
330 sprite_offset[0][1] = ((int64_t)sprite_ref[0][1] * (1 << (alpha + beta + rho - min_ab))) +
331 ((int64_t)-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3 * (-vop_ref[0][0]) +
332 ((int64_t)-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-vop_ref[0][1]) +
333 ((int64_t)1 << (alpha + beta + rho - min_ab - 1));
334 sprite_offset[1][0] = ((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3 * (-2 * vop_ref[0][0] + 1) +
335 ((int64_t)-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3 * (-2 * vop_ref[0][1] + 1) +
336 (int64_t)2 * w2 * h3 * r * sprite_ref[0][0] - 16 * w2 * h3 +
337 ((int64_t)1 << (alpha + beta + rho - min_ab + 1));
338 sprite_offset[1][1] = ((int64_t)-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3 * (-2 * vop_ref[0][0] + 1) +
339 ((int64_t)-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-2 * vop_ref[0][1] + 1) +
340 (int64_t)2 * w2 * h3 * r * sprite_ref[0][1] - 16 * w2 * h3 +
341 ((int64_t)1 << (alpha + beta + rho - min_ab + 1));
342 sprite_delta[0][0] = (-r * (int64_t)sprite_ref[0][0] + virtual_ref[0][0]) * h3;
343 sprite_delta[0][1] = (-r * (int64_t)sprite_ref[0][0] + virtual_ref[1][0]) * w3;
344 sprite_delta[1][0] = (-r * (int64_t)sprite_ref[0][1] + virtual_ref[0][1]) * h3;
345 sprite_delta[1][1] = (-r * (int64_t)sprite_ref[0][1] + virtual_ref[1][1]) * w3;
353 sprite_delta[0][1] == 0 &&
354 sprite_delta[1][0] == 0 &&
360 sprite_delta[0][0] =
a;
361 sprite_delta[0][1] = 0;
362 sprite_delta[1][0] = 0;
363 sprite_delta[1][1] =
a;
371 for (i = 0; i < 2; i++) {
372 if (shift_c < 0 || shift_y < 0 ||
373 FFABS( sprite_offset[0][i]) >= INT_MAX >> shift_y ||
374 FFABS( sprite_offset[1][i]) >= INT_MAX >> shift_c ||
375 FFABS( sprite_delta[0][i]) >= INT_MAX >> shift_y ||
376 FFABS( sprite_delta[1][i]) >= INT_MAX >> shift_y
383 for (i = 0; i < 2; i++) {
384 sprite_offset[0][i] *= 1 << shift_y;
385 sprite_offset[1][i] *= 1 << shift_c;
386 sprite_delta[0][i] *= 1 << shift_y;
387 sprite_delta[1][i] *= 1 << shift_y;
391 for (i = 0; i < 2; i++) {
393 sprite_delta[i][0] - a * (1LL<<16),
394 sprite_delta[i][1] - a * (1LL<<16)
397 if (llabs(sprite_offset[0][i] + sprite_delta[i][0] * (w+16LL)) >= INT_MAX ||
398 llabs(sprite_offset[0][i] + sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
399 llabs(sprite_offset[0][i] + sprite_delta[i][0] * (w+16LL) + sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
400 llabs(sprite_delta[i][0] * (w+16LL)) >= INT_MAX ||
401 llabs(sprite_delta[i][1] * (w+16LL)) >= INT_MAX ||
402 llabs(sd[0]) >= INT_MAX ||
403 llabs(sd[1]) >= INT_MAX ||
404 llabs(sprite_offset[0][i] + sd[0] * (w+16LL)) >= INT_MAX ||
405 llabs(sprite_offset[0][i] + sd[1] * (h+16LL)) >= INT_MAX ||
406 llabs(sprite_offset[0][i] + sd[0] * (w+16LL) + sd[1] * (h+16LL)) >= INT_MAX
415 for (i = 0; i < 4; i++) {
448 int header_extension = 0, mb_num,
len;
454 for (len = 0; len < 32; len++)
469 if (mb_num >= s->
mb_num || !mb_num) {
471 "illegal mb_num in video packet (%d %d) \n", mb_num, s->
mb_num);
487 if (header_extension) {
516 "Error, video packet header damaged (f_code=0)\n");
522 "Error, video packet header damaged (b_code=0)\n");
589 int x, y, mb_v, sum, dx, dy,
shift;
606 dy -= 1 << (shift + a + 1);
608 dx -= 1 << (shift + a + 1);
612 for (y = 0; y < 16; y++) {
617 for (x = 0; x < 16; x++) {
648 if (code < 0 || code > 9 ) {
661 level =
get_bits(&s->
gb, code - 1) + (1 << (code - 1));
663 level = -
get_bits(&s->
gb, code - 1) - (1 << (code - 1));
690 static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
716 "mcbpc corrupted at %d %d\n", s->
mb_x, s->
mb_y);
731 for (i = 0; i < 6; i++) {
736 "DC corrupted at %d %d\n", s->
mb_x, s->
mb_y);
745 int mx, my, pred_x, pred_y, bits;
755 if (bits & 0x10000) {
788 "mcbpc corrupted at %d %d\n", s->
mb_x, s->
mb_y);
820 if ((cbpc & 16) == 0) {
854 for (i = 0; i < 4; i++) {
883 static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
902 "cbpy corrupted at %d %d\n", s->
mb_x, s->
mb_y);
917 "I cbpy corrupted at %d %d\n", s->
mb_x, s->
mb_y);
925 for (i = 0; i < 6; i++) {
930 "DC corrupted at %d %d\n", s->
mb_x, s->
mb_y);
949 "P cbpy corrupted at %d %d\n", s->
mb_x, s->
mb_y);
962 if (mb_num >= mb_count)
1002 "marker missing after first I partition at %d %d\n",
1011 "marker missing after first P partition at %d %d\n",
1039 int n,
int coded,
int intra,
int rvlc)
1042 int level, i, last,
run, qmul, qadd;
1082 if (dc_pred_dir == 0)
1113 qadd = (s->
qscale - 1) | 1;
1130 "1. marker bit missing in rvlc esc\n");
1143 "2. marker bit missing in rvlc esc\n");
1157 level = level * qmul + qadd;
1169 cache ^= 0xC0000000;
1171 if (cache & 0x80000000) {
1172 if (cache & 0x40000000) {
1187 "1. marker bit missing in 3. esc\n");
1198 "2. marker bit missing in 3. esc\n");
1207 if (s->error_recognition >= FF_ER_COMPLIANT) {
1208 const int abs_level=
FFABS(level);
1210 const int run1= run - rl->
max_run[last][abs_level] - 1;
1211 if (abs_level <= rl->max_level[last][run]) {
1215 if (s->error_recognition > FF_ER_COMPLIANT) {
1216 if (abs_level <= rl->max_level[last][run]*2) {
1220 if (run1 >= 0 && abs_level <= rl->max_level[last][run1]) {
1229 level = level * qmul + qadd;
1231 level = level * qmul - qadd;
1233 if ((
unsigned)(level + 2048) > 4095) {
1235 if (level > 2560 || level < -2560) {
1237 "|level| overflow in 3. esc, qp=%d\n",
1242 level = level < 0 ? -2048 : 2047;
1252 i += run + rl->
max_run[run >> 7][level / qmul] + 1;
1261 level = level + rl->
max_level[run >> 7][(run - 1) & 63] * qmul;
1271 ff_tlog(s->
avctx,
"dct[%d][%d] = %- 4d end?:%d\n", scan_table[i&63]&7, scan_table[i&63] >> 3, level, i>62);
1276 "ac-tex damaged at %d %d\n", s->
mb_x, s->
mb_y);
1280 block[scan_table[i]] =
level;
1284 block[scan_table[i]] =
level;
1320 ctx->use_intra_dc_vlc = s->
qscale < ctx->intra_dc_threshold;
1328 for (i = 0; i < 4; i++) {
1336 for (i = 0; i < 6; i++)
1369 for (i = 0; i < 6; i++) {
1372 "texture corrupted at %d %d %d\n",
1399 int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
1401 static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
1413 for (i = 0; i < 6; i++)
1441 "mcbpc damaged at %d %d\n", s->
mb_x, s->
mb_y);
1444 }
while (cbpc == 20);
1453 ctx->vol_sprite_usage ==
GMC_SPRITE && (cbpc & 16) == 0)
1460 "P cbpy damaged at %d %d\n", s->
mb_x, s->
mb_y);
1464 cbp = (cbpc & 3) | (cbpy << 2);
1472 if ((cbpc & 16) == 0) {
1481 s->
mv[0][0][0] = mx;
1482 s->
mv[0][0][1] = my;
1495 for (i = 0; i < 2; i++) {
1504 s->
mv[0][i][0] = mx;
1505 s->
mv[0][i][1] = my;
1521 s->
mv[0][0][0] = mx;
1522 s->
mv[0][0][1] = my;
1527 for (i = 0; i < 4; i++) {
1536 s->
mv[0][i][0] = mx;
1537 s->
mv[0][i][1] = my;
1551 for (i = 0; i < 2; i++) {
1566 for (i = 0; i < 6; i++)
1636 s->
mv[0][0][0] = mx;
1639 s->
mv[0][0][1] = my;
1649 s->
mv[1][0][0] = mx;
1652 s->
mv[1][0][1] = my;
1660 for (i = 0; i < 2; i++) {
1664 s->
mv[0][i][0] = mx;
1665 s->
last_mv[0][i][1] = (s->
mv[0][i][1] = my) * 2;
1672 for (i = 0; i < 2; i++) {
1676 s->
mv[1][i][0] = mx;
1677 s->
last_mv[1][i][1] = (s->
mv[1][i][1] = my) * 2;
1701 "I cbpc damaged at %d %d\n", s->
mb_x, s->
mb_y);
1704 }
while (cbpc == 8);
1719 "I cbpy damaged at %d %d\n", s->
mb_x, s->
mb_y);
1722 cbp = (cbpc & 3) | (cbpy << 2);
1724 ctx->use_intra_dc_vlc = s->
qscale < ctx->intra_dc_threshold;
1734 for (i = 0; i < 6; i++) {
1743 for (i = 0; i < 6; i++) {
1817 int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0,
run = 0,
1818 additional_code_len, sign, mismatch;
1821 const uint16_t *quant_matrix;
1828 memset(block, 0, 64 *
sizeof(
int32_t));
1843 if (dct_dc_size < 0) {
1846 }
else if (dct_dc_size == 0) {
1851 if (dct_dc_size > 8) {
1866 block[0] = av_clip(block[0], min, max);
1867 mismatch ^= block[0];
1884 }
else if (group >= 1 && group <= 6) {
1886 run = 1 << additional_code_len;
1887 if (additional_code_len)
1891 }
else if (group >= 7 && group <= 12) {
1893 code =
get_bits(&s->
gb, additional_code_len);
1896 run = (1 << (additional_code_len - 1)) + code;
1898 j = scantable[idx++];
1899 block[j] = sign ? 1 : -1;
1900 }
else if (group >= 13 && group <= 20) {
1902 j = scantable[idx++];
1903 block[j] =
get_xbits(&s->
gb, additional_code_len);
1904 }
else if (group == 21) {
1906 j = scantable[idx++];
1909 if (flc >> (additional_code_len-1))
1910 block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1);
1915 block[j] = av_clip(block[j], min, max);
1916 mismatch ^= block[j];
1919 block[63] ^= mismatch & 1;
1961 int hours, minutes, seconds;
1973 s->
time_base = seconds + 60*(minutes + 60*hours);
1997 int visual_object_type;
1998 int is_visual_object_identifier =
get_bits1(gb);
2000 if (is_visual_object_identifier) {
2003 visual_object_type =
get_bits(gb, 4);
2008 if (video_signal_type) {
2009 int video_range, color_description;
2016 if (color_description) {
2032 for (i = 0; i < 64; i++) {
2067 int chroma_format =
get_bits(gb, 2);
2138 if (width && height &&
2153 "MPEG-4 OBMC not supported (very likely buggy encoder)\n");
2176 "%d sprite_warping_points\n",
2212 for (i = 0; i < 64; i++) {
2229 for (; i < 64; i++) {
2239 for (i = 0; i < 64; i++) {
2256 for (; i < 64; i++) {
2278 int estimation_method =
get_bits(gb, 2);
2279 if (estimation_method < 2) {
2316 if (estimation_method == 1) {
2322 "Invalid Complexity estimation method %d\n",
2338 if (vo_ver_id != 1) {
2347 "reduced resolution VOP not supported\n");
2356 int h_sampling_factor_n;
2357 int h_sampling_factor_m;
2358 int v_sampling_factor_n;
2359 int v_sampling_factor_m;
2364 h_sampling_factor_n =
get_bits(gb, 5);
2365 h_sampling_factor_m =
get_bits(gb, 5);
2366 v_sampling_factor_n =
get_bits(gb, 5);
2367 v_sampling_factor_m =
get_bits(gb, 5);
2370 if (h_sampling_factor_n == 0 || h_sampling_factor_m == 0 ||
2371 v_sampling_factor_n == 0 || v_sampling_factor_m == 0) {
2408 int ver = 0, build = 0, ver2 = 0, ver3 = 0;
2419 e = sscanf(buf,
"DivX%dBuild%d%c", &ver, &build, &last);
2421 e = sscanf(buf,
"DivX%db%d%c", &ver, &build, &last);
2429 e = sscanf(buf,
"FFmpe%*[^b]b%d", &build) + 3;
2431 e = sscanf(buf,
"FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build);
2433 e = sscanf(buf,
"Lavc%d.%d.%d", &ver, &ver2, &ver3) + 1;
2435 if (ver > 0xFFU || ver2 > 0xFFU || ver3 > 0xFFU) {
2437 "Unknown Lavc version string encountered, %d.%d.%d; " 2438 "clamping sub-version values to 8-bits.\n",
2441 build = ((ver & 0xFF) << 16) + ((ver2 & 0xFF) << 8) + (ver3 & 0xFF);
2445 if (strcmp(buf,
"ffmpeg") == 0)
2452 e = sscanf(buf,
"XviD%d", &build);
2508 #define SET_QPEL_FUNC(postfix1, postfix2) \ 2509 s->qdsp.put_ ## postfix1 = ff_put_ ## postfix2; \ 2510 s->qdsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2; \ 2511 s->qdsp.avg_ ## postfix1 = ff_avg_ ## postfix2; 2562 "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
2580 int time_incr, time_increment;
2606 "time_increment_bits %d is invalid in relation to the current bitstream, this is likely caused by a missing VOL header\n", ctx->
time_increment_bits);
2621 "time_increment_bits set to %d bits, based on bitstream analysis\n", ctx->
time_increment_bits);
2758 "sprite_brightness_change not supported\n");
2771 "Error, header damaged or not MPEG-4 header (qscale=0)\n");
2779 "Error, header damaged or not MPEG-4 header (f_code=0)\n");
2790 "Error, header damaged or not MPEG4 header (b_code=0)\n");
2799 "qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel part:%d resync:%d w:%d a:%d rnd:%d vot:%d%s dc:%d ce:%d/%d/%d time:%"PRId64
" tincr:%d\n",
2820 int load_backward_shape =
get_bits1(gb);
2821 if (load_backward_shape)
2823 "load backward shape isn't supported\n");
2834 "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
2857 for (i = 0; i < 64; i++) {
2867 for (i = 0; i < 64; i++) {
2874 for (i = 0; i < 64; i++) {
2883 for (i = 0; i < 64; i++) {
2994 visual_object_type =
get_bits(gb, 4);
3039 if (width && height) {
3086 unsigned startcode, v;
3112 startcode = ((startcode << 8) | v) & 0xffffffff;
3114 if ((startcode & 0xFFFFFF00) != 0x100)
3119 if (startcode <= 0x11F)
3121 else if (startcode <= 0x12F)
3123 else if (startcode <= 0x13F)
3125 else if (startcode <= 0x15F)
3127 else if (startcode <= 0x1AF)
3129 else if (startcode == 0x1B0)
3131 else if (startcode == 0x1B1)
3133 else if (startcode == 0x1B2)
3135 else if (startcode == 0x1B3)
3137 else if (startcode == 0x1B4)
3139 else if (startcode == 0x1B5)
3141 else if (startcode == 0x1B6)
3143 else if (startcode == 0x1B7)
3145 else if (startcode == 0x1B8)
3147 else if (startcode == 0x1B9)
3149 else if (startcode == 0x1BA)
3151 else if (startcode == 0x1BB)
3153 else if (startcode == 0x1BC)
3155 else if (startcode == 0x1BD)
3157 else if (startcode == 0x1BE)
3159 else if (startcode == 0x1BF)
3161 else if (startcode == 0x1C0)
3163 else if (startcode == 0x1C1)
3165 else if (startcode == 0x1C2)
3167 else if (startcode == 0x1C3)
3169 else if (startcode <= 0x1C5)
3171 else if (startcode <= 0x1FF)
3176 if (startcode >= 0x120 && startcode <= 0x12F) {
3222 static int done = 0;
3257 int startcode_found = 0;
3259 if (buf_size - current_pos > 7) {
3262 for (i = current_pos; i < buf_size - 4; i++)
3267 buf[i + 3] == 0xB6) {
3268 startcode_found = !(buf[i + 4] & 0x40);
3273 if (startcode_found) {
3276 "wasteful way to store B-frames ('packed B-frames'). " 3277 "Consider using the mpeg4_unpack_bframes bitstream filter without encoding but stream copy to fix it.\n");
3282 buf_size - current_pos);
3288 buf_size - current_pos);
3322 for (i = 0; i < 12; i++) {
3384 for (i = 0; i < 12; i++)
3427 #if CONFIG_MPEG4_NVDEC_HWACCEL 3430 #if CONFIG_MPEG4_VAAPI_HWACCEL 3433 #if CONFIG_MPEG4_VDPAU_HWACCEL 3436 #if CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL
int bitstream_buffer_size
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
uint16_t sprite_traj[4][2]
sprite trajectory points
#define AV_EF_AGGRESSIVE
consider things that a sane encoder should not do as an error
void ff_init_block_index(MpegEncContext *s)
static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
static int mpeg4_decode_visual_object(MpegEncContext *s, GetBitContext *gb)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define FF_BUG_XVID_ILACE
ScanTable intra_v_scantable
static int shift(int a, int b)
RLTable ff_mpeg4_rl_intra
static float alpha(float a)
const uint8_t ff_mpeg4_c_dc_scale_table[32]
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
static const uint8_t ac_state_tab[22][2]
static void decode_smpte_tc(Mpeg4DecContext *ctx, GetBitContext *gb)
const uint16_t ff_mpeg4_studio_dc_chroma[19][2]
int sprite_brightness_change
#define MV_TYPE_FIELD
2 vectors, one per field
static void flush(AVCodecContext *avctx)
const uint8_t * y_dc_scale_table
qscale -> y_dc_scale table
#define HWACCEL_NVDEC(codec)
int sprite_warping_accuracy
int last_mv[2][2][2]
last MV, used for MV prediction in MPEG-1 & B-frame MPEG-4
av_cold void ff_mpeg4videodec_static_init(void)
int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
#define SLICE_NOEND
no end marker or error found but mb count exceeded
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx)
Decode the next video packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
#define MB_TYPE_B_VLC_BITS
static av_cold int init(AVCodecContext *avctx)
VLC ff_h263_intra_MCBPC_vlc
int resync_marker
could this stream contain resync markers
static int decode_studiovisualobject(Mpeg4DecContext *ctx, GetBitContext *gb)
uint16_t chroma_intra_matrix[64]
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
static int mpeg4_decode_gop_header(MpegEncContext *s, GetBitContext *gb)
int16_t(*[3] ac_val)[16]
used for MPEG-4 AC prediction, all 3 arrays must be continuous
int v_edge_pos
horizontal / vertical position of the right/bottom edge (pixel replication)
#define SKIP_COUNTER(name, gb, num)
uint16_t chroma_inter_matrix[64]
enum AVColorRange color_range
MPEG vs JPEG YUV range.
static int check_marker(void *logctx, GetBitContext *s, const char *msg)
uint8_t * bitstream_buffer
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
#define AV_PIX_FMT_GBRP10
const char * av_default_item_name(void *ptr)
Return the context name.
#define FF_BUG_HPEL_CHROMA
void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir)
Predict the ac.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
static av_cold int decode_init(AVCodecContext *avctx)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define FF_PROFILE_MPEG4_SIMPLE_STUDIO
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
int real_sprite_warping_points
#define AV_EF_BITSTREAM
detect bitstream specification deviations
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int padding_bug_score
used to detect the VERY common padding bug in MPEG-4
#define init_vlc(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
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
static void extension_and_user_data(MpegEncContext *s, GetBitContext *gb, int id)
static int mpeg4_decode_studio_mb(MpegEncContext *s, int16_t block_[12][64])
int time_base
time in seconds of last I,P,S Frame
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
const AVProfile ff_mpeg4_video_profiles[]
int16_t * ff_h263_pred_motion(MpegEncContext *s, int block, int dir, int *px, int *py)
int cplx_estimation_trash_b
#define STUDIO_INTRA_BITS
void ff_clean_intra_table_entries(MpegEncContext *s)
Clean dc, ac, coded_block for the current non-intra MB.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int ff_mpeg4_workaround_bugs(AVCodecContext *avctx)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#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 USES_LIST(a, list)
#define USER_DATA_STARTCODE
int mb_num_left
number of MBs left in this video packet (for partitioned Slices only)
int64_t time
time of current frame
int8_t * max_run[2]
encoding & decoding
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define MV_DIRECT
bidirectional mode where the difference equals the MV of the last P/S/I-Frame (MPEG-4) ...
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64])
const uint16_t ff_mpeg4_resync_prefix[8]
#define FF_DEBUG_PICT_INFO
const uint16_t ff_sprite_trajectory_tab[15][2]
static av_cold int end(AVCodecContext *avctx)
uint8_t * pred_dir_table
used to store pred_dir for partitioned decoding
Multithreading support functions.
#define AV_CODEC_FLAG_LOW_DELAY
Force low delay.
int no_rounding
apply no rounding to motion compensation (MPEG-4, msmpeg4, ...) for B-frames rounding mode is always ...
static void mpeg4_load_default_matrices(MpegEncContext *s)
Picture current_picture
copy of the current picture structure.
const uint8_t ff_mpeg4_DCtab_chrom[13][2]
int cplx_estimation_trash_p
static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb)
Decode the user data stuff in the header.
const uint16_t ff_mpeg4_studio_intra[12][22][2]
#define FF_BUG_QPEL_CHROMA2
static int get_bits_count(const GetBitContext *s)
int8_t * max_level[2]
encoding & decoding
uint16_t pp_time
time distance between the last 2 p,s,i frames
#define AV_LOG_VERBOSE
Detailed information.
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
int intra_dc_threshold
QP above which the ac VLC should be used for intra dc.
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
static int ff_mpeg4_pred_dc(MpegEncContext *s, int n, int level, int *dir_ptr, int encoding)
Predict the dc.
static void ff_update_block_index(MpegEncContext *s)
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
int sprite_offset[2][2]
sprite offset[isChroma][isMVY]
#define ROUNDED_DIV(a, b)
#define FF_BUG_DIRECT_BLOCKSIZE
av_cold void ff_xvid_idct_init(IDCTDSPContext *c, AVCodecContext *avctx)
static int get_bits_left(GetBitContext *gb)
int16_t * dc_val[3]
used for MPEG-4 DC prediction, all 3 arrays must be continuous
#define UPDATE_CACHE(name, gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int has_b_frames
Size of the frame reordering buffer in the decoder.
#define QUANT_MATRIX_EXT_ID
int last_dc[3]
last DC values for MPEG-1
void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
int mb_skipped
MUST BE SET only during DECODING.
int partitioned_frame
is current frame partitioned
int is_copy
Whether the parent AVCodecContext is a copy of the context which had init() called on it...
int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
Decode the first and second partition.
void(* clear_blocks)(int16_t *blocks)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int get_amv(Mpeg4DecContext *ctx, int n)
Get the average motion vector for a GMC MB.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int flags
AV_CODEC_FLAG_*.
#define INTER_MCBPC_VLC_BITS
#define FF_BUG_NO_PADDING
void ff_mpeg4_init_direct_mv(MpegEncContext *s)
int(* decode_mb)(struct MpegEncContext *s, int16_t block[12][64])
const char * name
Name of the codec implementation.
#define AV_PIX_FMT_YUV444P10
int quarter_sample
1->qpel, 0->half pel ME/MC
int low_delay
no reordering needed / has no B-frames
#define SET_QPEL_FUNC(postfix1, postfix2)
#define CLOSE_READER(name, gb)
#define INIT_VLC_RL(rl, static_size)
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
void ff_mpeg_flush(AVCodecContext *avctx)
#define SKIP_BITS(name, gb, num)
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
int resync_mb_x
x position of last resync marker
const uint8_t ff_alternate_horizontal_scan[64]
int dct_precision
number of bits to represent the fractional part of time (encoder only)
int ff_h263_decode_init(AVCodecContext *avctx)
common internal API header
int sprite_delta[2][2]
sprite_delta [isY][isMVY]
static av_cold int decode_end(AVCodecContext *avctx)
#define ADV_SIMPLE_VO_TYPE
const uint8_t ff_mpeg4_DCtab_lum[13][2]
uint8_t ff_mpeg4_static_rl_table_store[3][2][2 *MAX_RUN+MAX_LEVEL+3]
VLC ff_h263_inter_MCBPC_vlc
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *gb)
#define CONFIG_MPEG4_DECODER
static const int mb_type_b_map[4]
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
static void read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)
const uint8_t ff_mpeg4_y_dc_scale_table[32]
static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx)
Decode first partition.
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
static int mpeg4_decode_dc(MpegEncContext *s, int n, int *dir_ptr)
Decode the dc value.
int16_t(*[2] motion_val)[2]
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[]
unsigned int allocated_bitstream_buffer_size
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx)
Decode the next video packet.
#define LAST_SKIP_BITS(name, gb, num)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
int block_last_index[12]
last non zero coefficient in block
uint8_t idct_permutation[64]
IDCT input permutation.
int vol_control_parameters
does the stream contain the low_delay flag, used to work around buggy encoders.
const int16_t ff_mpeg4_default_non_intra_matrix[64]
#define FRAME_SKIPPED
Return value for header parsers if frame is not coded.
uint8_t * mbintra_table
used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding
#define MB_TYPE_INTERLACED
#define FF_BUG_QPEL_CHROMA
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
RL_VLC_ELEM * rl_vlc[32]
decoding only
#define SHOW_UBITS(name, gb, num)
#define SPRITE_TRAJ_VLC_BITS
int block_index[6]
index to current MB in block based arrays with edges
the normal 2^n-1 "JPEG" YUV ranges
static av_cold int init_studio_vlcs(Mpeg4DecContext *ctx)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n)
#define MV_TYPE_16X16
1 vector for the whole mb
int first_slice_line
used in MPEG-4 too to handle resync markers
static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
decode partition C of one MB.
#define AV_LOG_INFO
Standard information.
uint16_t inter_matrix[64]
#define FF_ASPECT_EXTENDED
main external API structure.
int cplx_estimation_trash_i
static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
ScanTable intra_scantable
int height
picture size. must be a multiple of 16
static int get_xbits(GetBitContext *s, int n)
Read MPEG-1 dc-style VLC (sign bit + mantissa with no MSB).
#define OPEN_READER(name, gb)
av_cold int ff_rl_init(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
#define SLICE_END
end marker found
int data_partitioning
data partitioning flag from header
int showed_packed_warning
flag for having shown the warning about invalid Divx B-frames
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
Describe the class of an AVClass context structure.
ScanTable intra_h_scantable
static void skip_bits(GetBitContext *s, int n)
static const AVProfile profiles[]
uint8_t * cbp_table
used to store cbp, ac_pred for partitioned decoding
enum AVColorSpace colorspace
YUV colorspace type.
Rational number (pair of numerator and denominator).
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
static void reset_studio_dc_predictors(MpegEncContext *s)
#define VOT_STILL_TEXTURE_ID
int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
Decode MPEG-4 headers.
#define GET_CACHE(name, gb)
#define AV_EF_IGNORE_ERR
ignore errors and continue
const uint8_t ff_zigzag_direct[64]
#define SKIP_CACHE(name, gb, num)
const int16_t ff_mpeg4_default_intra_matrix[64]
int allocate_progress
Whether to allocate progress for frame threading.
int f_code
forward MV resolution
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my)
int sprite_shift[2]
sprite shift [isChroma]
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
static enum AVPixelFormat pix_fmts[]
#define AV_CODEC_CAP_TRUNCATED
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> dc
const uint8_t ff_mpeg4_dc_threshold[8]
#define FF_BUG_AUTODETECT
autodetection
int h263_pred
use MPEG-4/H.263 ac/dc predictions
#define HWACCEL_VAAPI(codec)
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s)
#define AV_PIX_FMT_YUV422P10
uint16_t pb_field_time
like above, just for interlaced
const AVRational ff_h263_pixel_aspect[16]
const uint8_t * c_dc_scale_table
qscale -> c_dc_scale table
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
the normal 219*2^(n-8) "MPEG" YUV ranges
Picture * next_picture_ptr
pointer to the next picture (for bidir pred)
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
struct AVCodecContext * avctx
static int mpeg4_is_resync(Mpeg4DecContext *ctx)
check if the next stuff is a resync marker or the end.
#define SHOW_SBITS(name, gb, num)
#define VISUAL_OBJ_STARTCODE
static VLC sprite_trajectory
int t_frame
time distance of first I -> B, used for interlaced B-frames
static const AVOption mpeg4_options[]
common internal api header.
int32_t(* block32)[12][64]
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count)
decode second partition.
const uint8_t ff_alternate_vertical_scan[64]
static const AVClass mpeg4_class
int ff_h263_decode_end(AVCodecContext *avctx)
av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
#define FF_DEBUG_STARTCODE
static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
Decode the next studio vop header.
const uint16_t ff_mpeg4_studio_dc_luma[19][2]
struct AVCodecInternal * internal
Private context used for internal data.
int resync_mb_y
y position of last resync marker
int16_t(* block)[64]
points to one of the following blocks
VLC_TYPE(* table)[2]
code, bits
Picture next_picture
copy of the next picture structure.
static int decode_new_pred(Mpeg4DecContext *ctx, GetBitContext *gb)
static const uint8_t * align_get_bits(GetBitContext *s)
static int mpeg4_decode_profile_level(MpegEncContext *s, GetBitContext *gb)
int chroma_qscale
chroma QP
static const uint8_t mpeg4_block_count[4]
int ff_h263_decode_motion(MpegEncContext *s, int pred, int f_code)
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
uint32_t * mb_type
types and macros are defined in mpegutils.h
#define HWACCEL_VDPAU(codec)
int time_increment_bits
number of bits to represent the fractional part of time
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 the cache usage
static void next_start_code_studio(GetBitContext *gb)
static int mpeg_get_qscale(MpegEncContext *s)
int num_sprite_warping_points
#define MV_TYPE_8X8
4 vectors (H.263, MPEG-4 4MV)
int b_code
backward MV resolution for B-frames (MPEG-4)
const uint8_t ff_mb_type_b_tab[4][2]
static int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, int n, int coded, int intra, int rvlc)
Decode a block.
void ff_free_vlc(VLC *vlc)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define INTRA_MCBPC_VLC_BITS
uint16_t pb_time
time distance between the last b and p,s,i frame