23 #define UNCHECKED_BITSTREAM_READER 1
40 #define SPRITE_TRAJ_VLC_BITS 6
42 #define MB_TYPE_B_VLC_BITS 4
63 int16_t *ac_val, *ac_val1;
75 if (s->
mb_x == 0 || s->
qscale == qscale_table[xy] ||
78 for (i = 1; i < 8; i++)
82 for (i = 1; i < 8; i++)
90 if (s->
mb_y == 0 || s->
qscale == qscale_table[xy] ||
93 for (i = 1; i < 8; i++)
97 for (i = 1; i < 8; i++)
103 for (i = 1; i < 8; i++)
107 for (i = 1; i < 8; i++)
135 v |= 0x7F >> (7 - (bits_count & 7));
148 for (len = 0; len < 32; len++)
175 int min_ab, i, w2, h2, w3, h3;
176 int sprite_ref[4][2];
177 int virtual_ref[2][2];
180 const int vop_ref[4][2] = { { 0, 0 }, { s->
width, 0 },
182 int d[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
184 if (w <= 0 || h <= 0)
209 while ((1 << alpha) < w)
211 while ((1 << beta) < h)
218 sprite_ref[0][0] = a * vop_ref[0][0] + d[0][0];
219 sprite_ref[0][1] = a * vop_ref[0][1] + d[0][1];
220 sprite_ref[1][0] = a * vop_ref[1][0] + d[0][0] + d[1][0];
221 sprite_ref[1][1] = a * vop_ref[1][1] + d[0][1] + d[1][1];
222 sprite_ref[2][0] = a * vop_ref[2][0] + d[0][0] + d[2][0];
223 sprite_ref[2][1] = a * vop_ref[2][1] + d[0][1] + d[2][1];
225 sprite_ref[0][0] = (a >> 1) * (2 * vop_ref[0][0] + d[0][0]);
226 sprite_ref[0][1] = (a >> 1) * (2 * vop_ref[0][1] + d[0][1]);
227 sprite_ref[1][0] = (a >> 1) * (2 * vop_ref[1][0] + d[0][0] + d[1][0]);
228 sprite_ref[1][1] = (a >> 1) * (2 * vop_ref[1][1] + d[0][1] + d[1][1]);
229 sprite_ref[2][0] = (a >> 1) * (2 * vop_ref[2][0] + d[0][0] + d[2][0]);
230 sprite_ref[2][1] = (a >> 1) * (2 * vop_ref[2][1] + d[0][1] + d[2][1]);
240 virtual_ref[0][0] = 16 * (vop_ref[0][0] + w2) +
242 (r * sprite_ref[0][0] - 16 * vop_ref[0][0]) +
243 w2 * (r * sprite_ref[1][0] - 16 * vop_ref[1][0])), w);
244 virtual_ref[0][1] = 16 * vop_ref[0][1] +
246 (r * sprite_ref[0][1] - 16 * vop_ref[0][1]) +
247 w2 * (r * sprite_ref[1][1] - 16 * vop_ref[1][1])), w);
248 virtual_ref[1][0] = 16 * vop_ref[0][0] +
249 ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][0] - 16 * vop_ref[0][0]) +
250 h2 * (r * sprite_ref[2][0] - 16 * vop_ref[2][0])), h);
251 virtual_ref[1][1] = 16 * (vop_ref[0][1] + h2) +
252 ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][1] - 16 * vop_ref[0][1]) +
253 h2 * (r * sprite_ref[2][1] - 16 * vop_ref[2][1])), h);
269 s->
sprite_offset[0][0] = sprite_ref[0][0] - a * vop_ref[0][0];
270 s->
sprite_offset[0][1] = sprite_ref[0][1] - a * vop_ref[0][1];
271 s->
sprite_offset[1][0] = ((sprite_ref[0][0] >> 1) | (sprite_ref[0][0] & 1)) -
272 a * (vop_ref[0][0] / 2);
273 s->
sprite_offset[1][1] = ((sprite_ref[0][1] >> 1) | (sprite_ref[0][1] & 1)) -
274 a * (vop_ref[0][1] / 2);
283 s->
sprite_offset[0][0] = (sprite_ref[0][0] << (alpha + rho)) +
284 (-r * sprite_ref[0][0] + virtual_ref[0][0]) *
286 (r * sprite_ref[0][1] - virtual_ref[0][1]) *
287 (-vop_ref[0][1]) + (1 << (alpha + rho - 1));
288 s->
sprite_offset[0][1] = (sprite_ref[0][1] << (alpha + rho)) +
289 (-r * sprite_ref[0][1] + virtual_ref[0][1]) *
291 (-r * sprite_ref[0][0] + virtual_ref[0][0]) *
292 (-vop_ref[0][1]) + (1 << (alpha + rho - 1));
293 s->
sprite_offset[1][0] = ((-r * sprite_ref[0][0] + virtual_ref[0][0]) *
294 (-2 * vop_ref[0][0] + 1) +
295 (r * sprite_ref[0][1] - virtual_ref[0][1]) *
296 (-2 * vop_ref[0][1] + 1) + 2 * w2 * r *
297 sprite_ref[0][0] - 16 * w2 + (1 << (alpha + rho + 1)));
298 s->
sprite_offset[1][1] = ((-r * sprite_ref[0][1] + virtual_ref[0][1]) *
299 (-2 * vop_ref[0][0] + 1) +
300 (-r * sprite_ref[0][0] + virtual_ref[0][0]) *
301 (-2 * vop_ref[0][1] + 1) + 2 * w2 * r *
302 sprite_ref[0][1] - 16 * w2 + (1 << (alpha + rho + 1)));
303 s->
sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
304 s->
sprite_delta[0][1] = (+r * sprite_ref[0][1] - virtual_ref[0][1]);
305 s->
sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]);
306 s->
sprite_delta[1][1] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
312 min_ab =
FFMIN(alpha, beta);
315 s->
sprite_offset[0][0] = (sprite_ref[0][0] << (alpha + beta + rho - min_ab)) +
316 (-r * sprite_ref[0][0] + virtual_ref[0][0]) *
317 h3 * (-vop_ref[0][0]) +
318 (-r * sprite_ref[0][0] + virtual_ref[1][0]) *
319 w3 * (-vop_ref[0][1]) +
320 (1 << (alpha + beta + rho - min_ab - 1));
321 s->
sprite_offset[0][1] = (sprite_ref[0][1] << (alpha + beta + rho - min_ab)) +
322 (-r * sprite_ref[0][1] + virtual_ref[0][1]) *
323 h3 * (-vop_ref[0][0]) +
324 (-r * sprite_ref[0][1] + virtual_ref[1][1]) *
325 w3 * (-vop_ref[0][1]) +
326 (1 << (alpha + beta + rho - min_ab - 1));
327 s->
sprite_offset[1][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]) *
328 h3 * (-2 * vop_ref[0][0] + 1) +
329 (-r * sprite_ref[0][0] + virtual_ref[1][0]) *
330 w3 * (-2 * vop_ref[0][1] + 1) + 2 * w2 * h3 *
331 r * sprite_ref[0][0] - 16 * w2 * h3 +
332 (1 << (alpha + beta + rho - min_ab + 1));
333 s->
sprite_offset[1][1] = (-r * sprite_ref[0][1] + virtual_ref[0][1]) *
334 h3 * (-2 * vop_ref[0][0] + 1) +
335 (-r * sprite_ref[0][1] + virtual_ref[1][1]) *
336 w3 * (-2 * vop_ref[0][1] + 1) + 2 * w2 * h3 *
337 r * sprite_ref[0][1] - 16 * w2 * h3 +
338 (1 << (alpha + beta + rho - min_ab + 1));
339 s->
sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3;
340 s->
sprite_delta[0][1] = (-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3;
341 s->
sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3;
342 s->
sprite_delta[1][1] = (-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3;
367 for (i = 0; i < 2; i++) {
400 int header_extension = 0, mb_num,
len;
406 for (len = 0; len < 32; len++)
421 if (mb_num >= s->
mb_num) {
423 "illegal mb_num in video packet (%d %d) \n", mb_num, s->
mb_num);
439 if (header_extension) {
445 check_marker(&s->
gb,
"before time_increment in video packed header");
447 check_marker(&s->
gb,
"before vop_coding_type in video packed header");
468 "Error, video packet header damaged (f_code=0)\n");
474 "Error, video packet header damaged (b_code=0)\n");
492 int x,
y, mb_v, sum, dx, dy,
shift;
509 dy -= 1 << (shift + a + 1);
511 dx -= 1 << (shift + a + 1);
515 for (y = 0; y < 16; y++) {
520 for (x = 0; x < 16; x++) {
551 if (code < 0 || code > 9 ) {
564 level =
get_bits(&s->
gb, code - 1) + (1 << (code - 1));
566 level = -
get_bits(&s->
gb, code - 1) - (1 << (code - 1));
593 static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
619 "mcbpc corrupted at %d %d\n", s->
mb_x, s->
mb_y);
634 for (i = 0; i < 6; i++) {
639 "DC corrupted at %d %d\n", s->
mb_x, s->
mb_y);
648 int mx, my, pred_x, pred_y,
bits;
658 if (bits & 0x10000) {
676 mot_val[0 + stride] =
677 mot_val[2 + stride] = mx;
680 mot_val[1 + stride] =
681 mot_val[3 + stride] = my;
691 "mcbpc corrupted at %d %d\n", s->
mb_x, s->
mb_y);
706 mot_val[0 + stride] =
707 mot_val[2 + stride] = 0;
710 mot_val[1 + stride] =
711 mot_val[3 + stride] = 0;
723 if ((cbpc & 16) == 0) {
747 mot_val[0 + stride] =
748 mot_val[2 + stride] = mx;
751 mot_val[1 + stride] =
752 mot_val[3 + stride] = my;
757 for (i = 0; i < 4; i++) {
786 static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
805 "cbpy corrupted at %d %d\n", s->
mb_x, s->
mb_y);
820 "I cbpy corrupted at %d %d\n", s->
mb_x, s->
mb_y);
828 for (i = 0; i < 6; i++) {
833 "DC corrupted at %d %d\n", s->
mb_x, s->
mb_y);
852 "P cbpy corrupted at %d %d\n", s->
mb_x, s->
mb_y);
865 if (mb_num >= mb_count)
904 "marker missing after first I partition at %d %d\n",
913 "marker missing after first P partition at %d %d\n",
940 int n,
int coded,
int intra,
int rvlc)
943 int level, i, last,
run, qmul, qadd;
983 if (dc_pred_dir == 0)
1014 qadd = (s->
qscale - 1) | 1;
1031 "1. marker bit missing in rvlc esc\n");
1044 "2. marker bit missing in rvlc esc\n");
1058 level = level * qmul + qadd;
1070 cache ^= 0xC0000000;
1072 if (cache & 0x80000000) {
1073 if (cache & 0x40000000) {
1088 "1. marker bit missing in 3. esc\n");
1099 "2. marker bit missing in 3. esc\n");
1108 if (s->error_recognition >= FF_ER_COMPLIANT) {
1109 const int abs_level=
FFABS(level);
1111 const int run1= run - rl->
max_run[last][abs_level] - 1;
1112 if (abs_level <= rl->max_level[last][run]) {
1116 if (s->error_recognition > FF_ER_COMPLIANT) {
1117 if (abs_level <= rl->max_level[last][run]*2) {
1121 if (run1 >= 0 && abs_level <= rl->max_level[last][run1]) {
1130 level = level * qmul + qadd;
1132 level = level * qmul - qadd;
1134 if ((
unsigned)(level + 2048) > 4095) {
1136 if (level > 2560 || level < -2560) {
1138 "|level| overflow in 3. esc, qp=%d\n",
1143 level = level < 0 ? -2048 : 2047;
1153 i += run + rl->
max_run[run >> 7][level / qmul] + 1;
1162 level = level + rl->
max_level[run >> 7][(run - 1) & 63] * qmul;
1172 tprintf(s->
avctx,
"dct[%d][%d] = %- 4d end?:%d\n", scan_table[i&63]&7, scan_table[i&63] >> 3, level, i>62);
1177 "ac-tex damaged at %d %d\n", s->
mb_x, s->
mb_y);
1181 block[scan_table[i]] =
level;
1185 block[scan_table[i]] =
level;
1227 for (i = 0; i < 4; i++) {
1235 for (i = 0; i < 6; i++)
1268 for (i = 0; i < 6; i++) {
1271 "texture corrupted at %d %d %d\n",
1298 int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
1300 static int8_t quant_tab[4] = { -1, -2, 1, 2 };
1311 for (i = 0; i < 6; i++)
1339 "mcbpc damaged at %d %d\n", s->
mb_x, s->
mb_y);
1342 }
while (cbpc == 20);
1357 cbp = (cbpc & 3) | (cbpy << 2);
1365 if ((cbpc & 16) == 0) {
1374 s->
mv[0][0][0] = mx;
1375 s->
mv[0][0][1] = my;
1388 for (i = 0; i < 2; i++) {
1397 s->
mv[0][i][0] = mx;
1398 s->
mv[0][i][1] = my;
1414 s->
mv[0][0][0] = mx;
1415 s->
mv[0][0][1] = my;
1420 for (i = 0; i < 4; i++) {
1429 s->
mv[0][i][0] = mx;
1430 s->
mv[0][i][1] = my;
1444 for (i = 0; i < 2; i++) {
1459 for (i = 0; i < 6; i++)
1529 s->
mv[0][0][0] = mx;
1532 s->
mv[0][0][1] = my;
1542 s->
mv[1][0][0] = mx;
1545 s->
mv[1][0][1] = my;
1553 for (i = 0; i < 2; i++) {
1557 s->
mv[0][i][0] = mx;
1558 s->
last_mv[0][i][1] = (s->
mv[0][i][1] = my) * 2;
1565 for (i = 0; i < 2; i++) {
1569 s->
mv[1][i][0] = mx;
1570 s->
last_mv[1][i][1] = (s->
mv[1][i][1] = my) * 2;
1594 "I cbpc damaged at %d %d\n", s->
mb_x, s->
mb_y);
1597 }
while (cbpc == 8);
1612 "I cbpy damaged at %d %d\n", s->
mb_x, s->
mb_y);
1615 cbp = (cbpc & 3) | (cbpy << 2);
1627 for (i = 0; i < 6; i++) {
1636 for (i = 0; i < 6; i++) {
1671 int hours, minutes, seconds;
1683 s->
time_base = seconds + 60*(minutes + 60*hours);
1728 int chroma_format =
get_bits(gb, 2);
1792 !(
s->width &&
s->codec_tag ==
AV_RL32(
"MP4S"))) {
1793 if (
s->width &&
s->height &&
1795 s->context_reinit = 1;
1801 s->progressive_sequence =
1803 s->interlaced_dct = 0;
1806 "MPEG4 OBMC not supported (very likely buggy encoder)\n");
1810 ctx->vol_sprite_usage =
get_bits(gb, 2);
1826 ctx->num_sprite_warping_points =
get_bits(gb, 6);
1827 if (ctx->num_sprite_warping_points > 3) {
1829 "%d sprite_warping_points\n",
1830 ctx->num_sprite_warping_points);
1831 ctx->num_sprite_warping_points = 0;
1834 s->sprite_warping_accuracy =
get_bits(gb, 2);
1835 ctx->sprite_brightness_change =
get_bits1(gb);
1845 if (
s->quant_precision != 5)
1847 "quant precision %d\n",
s->quant_precision);
1848 if (
s->quant_precision<3 ||
s->quant_precision>9) {
1849 s->quant_precision = 5;
1852 s->quant_precision = 5;
1861 for (i = 0; i < 64; i++) {
1862 int j =
s->idsp.idct_permutation[i];
1864 s->intra_matrix[j] =
v;
1865 s->chroma_intra_matrix[j] =
v;
1868 s->inter_matrix[j] =
v;
1869 s->chroma_inter_matrix[j] =
v;
1875 for (i = 0; i < 64; i++) {
1883 s->intra_matrix[j] = last;
1884 s->chroma_intra_matrix[j] = last;
1888 for (; i < 64; i++) {
1890 s->intra_matrix[j] = last;
1891 s->chroma_intra_matrix[j] = last;
1898 for (i = 0; i < 64; i++) {
1906 s->inter_matrix[j] =
v;
1907 s->chroma_inter_matrix[j] =
v;
1911 for (; i < 64; i++) {
1913 s->inter_matrix[j] = last;
1914 s->chroma_inter_matrix[j] = last;
1924 s->quarter_sample = 0;
1933 int estimation_method =
get_bits(gb, 2);
1934 if (estimation_method < 2) {
1936 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1937 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1938 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1939 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1940 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1941 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1944 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1945 ctx->cplx_estimation_trash_p += 8 *
get_bits1(gb);
1946 ctx->cplx_estimation_trash_p += 8 *
get_bits1(gb);
1947 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1949 if (!
check_marker(gb,
"in complexity estimation part 1")) {
1954 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1955 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1956 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1957 ctx->cplx_estimation_trash_i += 4 *
get_bits1(gb);
1960 ctx->cplx_estimation_trash_p += 8 *
get_bits1(gb);
1961 ctx->cplx_estimation_trash_p += 8 *
get_bits1(gb);
1962 ctx->cplx_estimation_trash_b += 8 *
get_bits1(gb);
1963 ctx->cplx_estimation_trash_p += 8 *
get_bits1(gb);
1964 ctx->cplx_estimation_trash_p += 8 *
get_bits1(gb);
1965 ctx->cplx_estimation_trash_p += 8 *
get_bits1(gb);
1967 if (!
check_marker(gb,
"in complexity estimation part 2")) {
1971 if (estimation_method == 1) {
1972 ctx->cplx_estimation_trash_i += 8 *
get_bits1(gb);
1973 ctx->cplx_estimation_trash_p += 8 *
get_bits1(gb);
1977 "Invalid Complexity estimation method %d\n",
1982 ctx->cplx_estimation_trash_i =
1983 ctx->cplx_estimation_trash_p =
1984 ctx->cplx_estimation_trash_b = 0;
1990 if (
s->data_partitioning)
1993 if (vo_ver_id != 1) {
1995 if (ctx->new_pred) {
2002 "reduced resolution VOP not supported\n");
2009 if (ctx->scalability) {
2011 int h_sampling_factor_n;
2012 int h_sampling_factor_m;
2013 int v_sampling_factor_n;
2014 int v_sampling_factor_m;
2019 h_sampling_factor_n =
get_bits(gb, 5);
2020 h_sampling_factor_m =
get_bits(gb, 5);
2021 v_sampling_factor_n =
get_bits(gb, 5);
2022 v_sampling_factor_m =
get_bits(gb, 5);
2025 if (h_sampling_factor_n == 0 || h_sampling_factor_m == 0 ||
2026 v_sampling_factor_n == 0 || v_sampling_factor_m == 0) {
2029 ctx->scalability = 0;
2040 s->avctx->framerate.den,
s->avctx->framerate.num,
2041 ctx->time_increment_bits,
2043 s->progressive_sequence,
2044 ctx->scalability ?
"scalability " :
"" ,
s->quarter_sample ?
"qpel " :
"",
2045 s->data_partitioning ?
"partition " :
"", ctx->rvlc ?
"rvlc " :
""
2062 int ver = 0, build = 0, ver2 = 0, ver3 = 0;
2073 e = sscanf(buf,
"DivX%dBuild%d%c", &ver, &build, &last);
2075 e = sscanf(buf,
"DivX%db%d%c", &ver, &build, &last);
2082 "wasteful way to store B-frames ('packed B-frames'). "
2083 "Consider using a tool like VirtualDub or avidemux to fix it.\n");
2089 e = sscanf(buf,
"FFmpe%*[^b]b%d", &build) + 3;
2091 e = sscanf(buf,
"FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build);
2093 e = sscanf(buf,
"Lavc%d.%d.%d", &ver, &ver2, &ver3) + 1;
2095 build = (ver << 16) + (ver2 << 8) + ver3;
2098 if (strcmp(buf,
"ffmpeg") == 0)
2105 e = sscanf(buf,
"XviD%d", &build);
2161 #define SET_QPEL_FUNC(postfix1, postfix2) \
2162 s->qdsp.put_ ## postfix1 = ff_put_ ## postfix2; \
2163 s->qdsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2; \
2164 s->qdsp.avg_ ## postfix1 = ff_avg_ ## postfix2;
2208 "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
2212 if (CONFIG_MPEG4_DECODER && ctx->
xvid_build >= 0 &&
2226 int time_incr, time_increment;
2251 "hmm, seems the headers are not complete, trying to guess time_increment_bits\n");
2276 time_increment =
get_bits(gb, ctx->time_increment_bits);
2279 s->last_time_base =
s->time_base;
2280 s->time_base += time_incr;
2281 s->time =
s->time_base *
s->avctx->framerate.num + time_increment;
2283 if (
s->time <
s->last_non_b_time) {
2287 s->time +=
s->avctx->framerate.num;
2290 s->pp_time =
s->time -
s->last_non_b_time;
2291 s->last_non_b_time =
s->time;
2293 s->time = (
s->last_time_base + time_incr) *
s->avctx->framerate.num + time_increment;
2294 s->pb_time =
s->pp_time - (
s->last_non_b_time -
s->time);
2295 if (
s->pp_time <=
s->pb_time ||
2296 s->pp_time <=
s->pp_time -
s->pb_time ||
2303 if (ctx->t_frame == 0)
2304 ctx->t_frame =
s->pb_time;
2305 if (ctx->t_frame == 0)
2307 s->pp_field_time = (
ROUNDED_DIV(
s->last_non_b_time, ctx->t_frame) -
2308 ROUNDED_DIV(
s->last_non_b_time -
s->pp_time, ctx->t_frame)) * 2;
2310 ROUNDED_DIV(
s->last_non_b_time -
s->pp_time, ctx->t_frame)) * 2;
2311 if (
s->pp_field_time <=
s->pb_field_time ||
s->pb_field_time <= 1) {
2312 s->pb_field_time = 2;
2313 s->pp_field_time = 4;
2314 if (!
s->progressive_sequence)
2319 if (
s->avctx->framerate.den)
2379 if (!
s->progressive_sequence) {
2383 s->alternate_scan = 0;
2386 if (
s->alternate_scan) {
2403 if (ctx->sprite_brightness_change)
2405 "sprite_brightness_change not supported\n");
2411 s->chroma_qscale =
s->qscale =
get_bits(gb,
s->quant_precision);
2412 if (
s->qscale == 0) {
2414 "Error, header damaged or not MPEG4 header (qscale=0)\n");
2420 if (
s->f_code == 0) {
2422 "Error, header damaged or not MPEG4 header (f_code=0)\n");
2431 if (
s->b_code == 0) {
2433 "Error, header damaged or not MPEG4 header (b_code=0)\n");
2442 "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",
2443 s->qscale,
s->f_code,
s->b_code,
2445 gb->size_in_bits,
s->progressive_sequence,
s->alternate_scan,
2446 s->top_field_first,
s->quarter_sample ?
"q" :
"h",
2447 s->data_partitioning, ctx->resync_marker,
2448 ctx->num_sprite_warping_points,
s->sprite_warping_accuracy,
2449 1 -
s->no_rounding,
s->vo_type,
2450 ctx->vol_control_parameters ?
" VOLC" :
" ", ctx->intra_dc_threshold,
2451 ctx->cplx_estimation_trash_i, ctx->cplx_estimation_trash_p,
2452 ctx->cplx_estimation_trash_b,
2458 if (!ctx->scalability) {
2462 if (ctx->enhancement_type) {
2463 int load_backward_shape =
get_bits1(gb);
2464 if (load_backward_shape)
2466 "load backward shape isn't supported\n");
2474 if (
s->vo_type == 0 && ctx->vol_control_parameters == 0 &&
2475 ctx->divx_version == -1 &&
s->picture_number == 0) {
2477 "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
2481 s->picture_number++;
2488 s->h_edge_pos =
s->width;
2489 s->v_edge_pos =
s->height;
2503 unsigned startcode,
v;
2528 startcode = ((startcode << 8) | v) & 0xffffffff;
2530 if ((startcode & 0xFFFFFF00) != 0x100)
2535 if (startcode <= 0x11F)
2537 else if (startcode <= 0x12F)
2539 else if (startcode <= 0x13F)
2541 else if (startcode <= 0x15F)
2543 else if (startcode <= 0x1AF)
2545 else if (startcode == 0x1B0)
2547 else if (startcode == 0x1B1)
2549 else if (startcode == 0x1B2)
2551 else if (startcode == 0x1B3)
2553 else if (startcode == 0x1B4)
2555 else if (startcode == 0x1B5)
2557 else if (startcode == 0x1B6)
2559 else if (startcode == 0x1B7)
2561 else if (startcode == 0x1B8)
2563 else if (startcode == 0x1B9)
2565 else if (startcode == 0x1BA)
2567 else if (startcode == 0x1BB)
2569 else if (startcode == 0x1BC)
2571 else if (startcode == 0x1BD)
2573 else if (startcode == 0x1BE)
2575 else if (startcode == 0x1BF)
2577 else if (startcode == 0x1C0)
2579 else if (startcode == 0x1C1)
2581 else if (startcode == 0x1C2)
2583 else if (startcode == 0x1C3)
2585 else if (startcode <= 0x1C5)
2587 else if (startcode <= 0x1FF)
2592 if (startcode >= 0x120 && startcode <= 0x12F) {
2618 static int done = 0;
2653 int startcode_found = 0;
2655 if (buf_size - current_pos > 7) {
2658 for (i = current_pos; i < buf_size - 4; i++)
2663 buf[i + 3] == 0xB6) {
2664 startcode_found = !(buf[i + 4] & 0x40);
2669 if (startcode_found) {
2672 buf_size - current_pos);
2676 buf_size - current_pos);
2698 if (CONFIG_MPEG4_DECODER && !init && s1->
xvid_build >= 0)
2758 "MPEG4 Video Decoder",
2785 #if CONFIG_MPEG4_VDPAU_DECODER
2786 static const AVClass mpeg4_vdpau_class = {
2787 "MPEG4 Video VDPAU Decoder",
2793 AVCodec ff_mpeg4_vdpau_decoder = {
2794 .
name =
"mpeg4_vdpau",
2806 .priv_class = &mpeg4_vdpau_class,