23 #define UNCHECKED_BITSTREAM_READER 1
47 #define SPRITE_TRAJ_VLC_BITS 6
49 #define MB_TYPE_B_VLC_BITS 4
50 #define STUDIO_INTRA_BITS 9
74 int16_t *ac_val, *ac_val1;
75 int8_t *
const qscale_table =
s->current_picture.qscale_table;
78 ac_val = &
s->ac_val[0][0][0] +
s->block_index[n] * 16;
82 const int xy =
s->mb_x - 1 +
s->mb_y *
s->mb_stride;
86 if (
s->mb_x == 0 ||
s->qscale == qscale_table[xy] ||
89 for (
i = 1;
i < 8;
i++)
90 block[
s->idsp.idct_permutation[
i << 3]] += ac_val[
i];
93 for (
i = 1;
i < 8;
i++)
97 const int xy =
s->mb_x +
s->mb_y *
s->mb_stride -
s->mb_stride;
99 ac_val -= 16 *
s->block_wrap[n];
101 if (
s->mb_y == 0 ||
s->qscale == qscale_table[xy] ||
104 for (
i = 1;
i < 8;
i++)
105 block[
s->idsp.idct_permutation[
i]] += ac_val[
i + 8];
108 for (
i = 1;
i < 8;
i++)
114 for (
i = 1;
i < 8;
i++)
115 ac_val1[
i] =
block[
s->idsp.idct_permutation[
i << 3]];
119 ac_val1[8 +
i] =
block[
s->idsp.idct_permutation[
i]];
137 (v >> (8 -
s->pict_type) != 1) ||
s->partitioned_frame)
140 bits_count += 8 +
s->pict_type;
144 if (bits_count + 8 >=
s->gb.size_in_bits) {
146 v |= 0x7F >> (7 - (bits_count & 7));
153 int mb_num_bits =
av_log2(
s->mb_num - 1) + 1;
164 if (!mb_num || mb_num >
s->mb_num ||
get_bits_count(&
s->gb)+6 >
s->gb.size_in_bits)
179 int a = 2 <<
s->sprite_warping_accuracy;
180 int rho = 3 -
s->sprite_warping_accuracy;
186 int min_ab,
i, w2, h2, w3, h3;
187 int sprite_ref[4][2];
188 int virtual_ref[2][2];
193 const int vop_ref[4][2] = { { 0, 0 }, {
s->width, 0 },
194 { 0,
s->height }, {
s->width,
s->height } };
195 int d[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
197 if (
w <= 0 ||
h <= 0)
200 for (
i = 0;
i <
ctx->num_sprite_warping_points;
i++) {
208 if (!(
ctx->divx_version == 500 &&
ctx->divx_build == 413))
216 ctx->sprite_traj[
i][0] = d[
i][0] = x;
217 ctx->sprite_traj[
i][1] = d[
i][1] = y;
220 ctx->sprite_traj[
i][0] =
ctx->sprite_traj[
i][1] = 0;
224 while ((1 << beta) <
h)
230 if (
ctx->divx_version == 500 &&
ctx->divx_build == 413) {
231 sprite_ref[0][0] =
a * vop_ref[0][0] + d[0][0];
232 sprite_ref[0][1] =
a * vop_ref[0][1] + d[0][1];
233 sprite_ref[1][0] =
a * vop_ref[1][0] + d[0][0] + d[1][0];
234 sprite_ref[1][1] =
a * vop_ref[1][1] + d[0][1] + d[1][1];
235 sprite_ref[2][0] =
a * vop_ref[2][0] + d[0][0] + d[2][0];
236 sprite_ref[2][1] =
a * vop_ref[2][1] + d[0][1] + d[2][1];
238 sprite_ref[0][0] = (
a >> 1) * (2 * vop_ref[0][0] + d[0][0]);
239 sprite_ref[0][1] = (
a >> 1) * (2 * vop_ref[0][1] + d[0][1]);
240 sprite_ref[1][0] = (
a >> 1) * (2 * vop_ref[1][0] + d[0][0] + d[1][0]);
241 sprite_ref[1][1] = (
a >> 1) * (2 * vop_ref[1][1] + d[0][1] + d[1][1]);
242 sprite_ref[2][0] = (
a >> 1) * (2 * vop_ref[2][0] + d[0][0] + d[2][0]);
243 sprite_ref[2][1] = (
a >> 1) * (2 * vop_ref[2][1] + d[0][1] + d[2][1]);
253 virtual_ref[0][0] = 16 * (vop_ref[0][0] + w2) +
255 (
r * sprite_ref[0][0] - 16LL * vop_ref[0][0]) +
256 w2 * (
r * sprite_ref[1][0] - 16LL * vop_ref[1][0])),
w);
257 virtual_ref[0][1] = 16 * vop_ref[0][1] +
259 (
r * sprite_ref[0][1] - 16LL * vop_ref[0][1]) +
260 w2 * (
r * sprite_ref[1][1] - 16LL * vop_ref[1][1])),
w);
261 virtual_ref[1][0] = 16 * vop_ref[0][0] +
262 ROUNDED_DIV(((
h - h2) * (
r * sprite_ref[0][0] - 16LL * vop_ref[0][0]) +
263 h2 * (
r * sprite_ref[2][0] - 16LL * vop_ref[2][0])),
h);
264 virtual_ref[1][1] = 16 * (vop_ref[0][1] + h2) +
265 ROUNDED_DIV(((
h - h2) * (
r * sprite_ref[0][1] - 16LL * vop_ref[0][1]) +
266 h2 * (
r * sprite_ref[2][1] - 16LL * vop_ref[2][1])),
h);
268 switch (
ctx->num_sprite_warping_points) {
270 sprite_offset[0][0] =
271 sprite_offset[0][1] =
272 sprite_offset[1][0] =
273 sprite_offset[1][1] = 0;
274 sprite_delta[0][0] =
a;
276 sprite_delta[1][0] = 0;
277 sprite_delta[1][1] =
a;
278 ctx->sprite_shift[0] =
279 ctx->sprite_shift[1] = 0;
282 sprite_offset[0][0] = sprite_ref[0][0] -
a * vop_ref[0][0];
283 sprite_offset[0][1] = sprite_ref[0][1] -
a * vop_ref[0][1];
284 sprite_offset[1][0] = ((sprite_ref[0][0] >> 1) | (sprite_ref[0][0] & 1)) -
285 a * (vop_ref[0][0] / 2);
286 sprite_offset[1][1] = ((sprite_ref[0][1] >> 1) | (sprite_ref[0][1] & 1)) -
287 a * (vop_ref[0][1] / 2);
288 sprite_delta[0][0] =
a;
290 sprite_delta[1][0] = 0;
291 sprite_delta[1][1] =
a;
292 ctx->sprite_shift[0] =
293 ctx->sprite_shift[1] = 0;
296 sprite_offset[0][0] = ((
int64_t) sprite_ref[0][0] * (1 <<
alpha + rho)) +
297 ((
int64_t) -
r * sprite_ref[0][0] + virtual_ref[0][0]) *
299 ((
int64_t)
r * sprite_ref[0][1] - virtual_ref[0][1]) *
301 sprite_offset[0][1] = ((
int64_t) sprite_ref[0][1] * (1 <<
alpha + rho)) +
302 ((
int64_t) -
r * sprite_ref[0][1] + virtual_ref[0][1]) *
304 ((
int64_t) -
r * sprite_ref[0][0] + virtual_ref[0][0]) *
306 sprite_offset[1][0] = (((
int64_t)-
r * sprite_ref[0][0] + virtual_ref[0][0]) *
307 ((
int64_t)-2 * vop_ref[0][0] + 1) +
308 ((
int64_t)
r * sprite_ref[0][1] - virtual_ref[0][1]) *
309 ((
int64_t)-2 * vop_ref[0][1] + 1) + 2 * w2 *
r *
310 (
int64_t) sprite_ref[0][0] - 16 * w2 + (1 << (
alpha + rho + 1)));
311 sprite_offset[1][1] = (((
int64_t)-
r * sprite_ref[0][1] + virtual_ref[0][1]) *
312 ((
int64_t)-2 * vop_ref[0][0] + 1) +
313 ((
int64_t)-
r * sprite_ref[0][0] + virtual_ref[0][0]) *
314 ((
int64_t)-2 * vop_ref[0][1] + 1) + 2 * w2 *
r *
315 (
int64_t) sprite_ref[0][1] - 16 * w2 + (1 << (
alpha + rho + 1)));
316 sprite_delta[0][0] = (-
r * sprite_ref[0][0] + virtual_ref[0][0]);
317 sprite_delta[0][1] = (+
r * sprite_ref[0][1] - virtual_ref[0][1]);
318 sprite_delta[1][0] = (-
r * sprite_ref[0][1] + virtual_ref[0][1]);
319 sprite_delta[1][1] = (-
r * sprite_ref[0][0] + virtual_ref[0][0]);
322 ctx->sprite_shift[1] =
alpha + rho + 2;
328 sprite_offset[0][0] = ((
int64_t)sprite_ref[0][0] * (1 << (
alpha + beta + rho - min_ab))) +
329 ((
int64_t)-
r * sprite_ref[0][0] + virtual_ref[0][0]) * h3 * (-vop_ref[0][0]) +
330 ((
int64_t)-
r * sprite_ref[0][0] + virtual_ref[1][0]) * w3 * (-vop_ref[0][1]) +
332 sprite_offset[0][1] = ((
int64_t)sprite_ref[0][1] * (1 << (
alpha + beta + rho - min_ab))) +
333 ((
int64_t)-
r * sprite_ref[0][1] + virtual_ref[0][1]) * h3 * (-vop_ref[0][0]) +
334 ((
int64_t)-
r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-vop_ref[0][1]) +
336 sprite_offset[1][0] = ((
int64_t)-
r * sprite_ref[0][0] + virtual_ref[0][0]) * h3 * (-2 * vop_ref[0][0] + 1) +
337 ((
int64_t)-
r * sprite_ref[0][0] + virtual_ref[1][0]) * w3 * (-2 * vop_ref[0][1] + 1) +
338 (
int64_t)2 * w2 * h3 *
r * sprite_ref[0][0] - 16 * w2 * h3 +
340 sprite_offset[1][1] = ((
int64_t)-
r * sprite_ref[0][1] + virtual_ref[0][1]) * h3 * (-2 * vop_ref[0][0] + 1) +
341 ((
int64_t)-
r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-2 * vop_ref[0][1] + 1) +
342 (
int64_t)2 * w2 * h3 *
r * sprite_ref[0][1] - 16 * w2 * h3 +
344 sprite_delta[0][0] = (-
r * (
int64_t)sprite_ref[0][0] + virtual_ref[0][0]) * h3;
345 sprite_delta[0][1] = (-
r * (
int64_t)sprite_ref[0][0] + virtual_ref[1][0]) * w3;
346 sprite_delta[1][0] = (-
r * (
int64_t)sprite_ref[0][1] + virtual_ref[0][1]) * h3;
347 sprite_delta[1][1] = (-
r * (
int64_t)sprite_ref[0][1] + virtual_ref[1][1]) * w3;
349 ctx->sprite_shift[0] =
alpha + beta + rho - min_ab;
350 ctx->sprite_shift[1] =
alpha + beta + rho - min_ab + 2;
356 if (sprite_delta[0][0] ==
a <<
ctx->sprite_shift[0] &&
357 sprite_delta[0][1] == 0 &&
358 sprite_delta[1][0] == 0 &&
359 sprite_delta[1][1] ==
a <<
ctx->sprite_shift[0]) {
360 sprite_offset[0][0] >>=
ctx->sprite_shift[0];
361 sprite_offset[0][1] >>=
ctx->sprite_shift[0];
362 sprite_offset[1][0] >>=
ctx->sprite_shift[1];
363 sprite_offset[1][1] >>=
ctx->sprite_shift[1];
364 sprite_delta[0][0] =
a;
365 sprite_delta[0][1] = 0;
366 sprite_delta[1][0] = 0;
367 sprite_delta[1][1] =
a;
368 ctx->sprite_shift[0] = 0;
369 ctx->sprite_shift[1] = 0;
370 s->real_sprite_warping_points = 1;
372 int shift_y = 16 -
ctx->sprite_shift[0];
373 int shift_c = 16 -
ctx->sprite_shift[1];
375 for (
i = 0;
i < 2;
i++) {
376 if (shift_c < 0 || shift_y < 0 ||
377 FFABS( sprite_offset[0][
i]) >= INT_MAX >> shift_y ||
378 FFABS( sprite_offset[1][
i]) >= INT_MAX >> shift_c ||
379 FFABS( sprite_delta[0][
i]) >= INT_MAX >> shift_y ||
380 FFABS( sprite_delta[1][
i]) >= INT_MAX >> shift_y
387 for (
i = 0;
i < 2;
i++) {
388 sprite_offset[0][
i] *= 1 << shift_y;
389 sprite_offset[1][
i] *= 1 << shift_c;
390 sprite_delta[0][
i] *= 1 << shift_y;
391 sprite_delta[1][
i] *= 1 << shift_y;
392 ctx->sprite_shift[
i] = 16;
395 for (
i = 0;
i < 2;
i++) {
397 sprite_delta[
i][0] -
a * (1LL<<16),
398 sprite_delta[
i][1] -
a * (1LL<<16)
401 if (llabs(sprite_offset[0][
i] + sprite_delta[
i][0] * (
w+16LL)) >= INT_MAX ||
402 llabs(sprite_offset[0][
i] + sprite_delta[
i][1] * (
h+16LL)) >= INT_MAX ||
403 llabs(sprite_offset[0][
i] + sprite_delta[
i][0] * (
w+16LL) + sprite_delta[
i][1] * (
h+16LL)) >= INT_MAX ||
404 llabs(sprite_delta[
i][0] * (
w+16LL)) >= INT_MAX ||
405 llabs(sprite_delta[
i][1] * (
h+16LL)) >= INT_MAX ||
406 llabs(sd[0]) >= INT_MAX ||
407 llabs(sd[1]) >= INT_MAX ||
408 llabs(sprite_offset[0][
i] + sd[0] * (
w+16LL)) >= INT_MAX ||
409 llabs(sprite_offset[0][
i] + sd[1] * (
h+16LL)) >= INT_MAX ||
410 llabs(sprite_offset[0][
i] + sd[0] * (
w+16LL) + sd[1] * (
h+16LL)) >= INT_MAX
416 s->real_sprite_warping_points =
ctx->num_sprite_warping_points;
419 for (
i = 0;
i < 4;
i++) {
420 s->sprite_offset[
i&1][
i>>1] = sprite_offset[
i&1][
i>>1];
421 s->sprite_delta [
i&1][
i>>1] = sprite_delta [
i&1][
i>>1];
426 memset(
s->sprite_offset, 0,
sizeof(
s->sprite_offset));
427 memset(
s->sprite_delta, 0,
sizeof(
s->sprite_delta));
451 int mb_num_bits =
av_log2(
s->mb_num - 1) + 1;
452 int header_extension = 0, mb_num,
len;
473 if (mb_num >=
s->mb_num || !mb_num) {
475 "illegal mb_num in video packet (%d %d) \n", mb_num,
s->mb_num);
479 s->mb_x = mb_num %
s->mb_width;
480 s->mb_y = mb_num /
s->mb_width;
483 int qscale =
get_bits(&
s->gb,
s->quant_precision);
485 s->chroma_qscale =
s->qscale = qscale;
491 if (header_extension) {
497 check_marker(
s->avctx, &
s->gb,
"before time_increment in video packed header");
499 check_marker(
s->avctx, &
s->gb,
"before vop_coding_type in video packed header");
520 "Error, video packet header damaged (f_code=0)\n");
526 "Error, video packet header damaged (b_code=0)\n");
541 s->last_dc[2] = 1 << (
s->avctx->bits_per_raw_sample +
s->dct_precision +
s->intra_dc_precision - 1);
556 vlc_len =
av_log2(
s->mb_width *
s->mb_height) + 1;
559 if (mb_num >=
s->mb_num)
562 s->mb_x = mb_num %
s->mb_width;
563 s->mb_y = mb_num /
s->mb_width;
593 int x, y, mb_v, sum, dx, dy,
shift;
594 int len = 1 << (
s->f_code + 4);
595 const int a =
s->sprite_warping_accuracy;
598 len >>=
s->quarter_sample;
600 if (
s->real_sprite_warping_points == 1) {
601 if (
ctx->divx_version == 500 &&
ctx->divx_build == 413 &&
a >=
s->quarter_sample)
602 sum =
s->sprite_offset[0][n] / (1 << (
a -
s->quarter_sample));
604 sum =
RSHIFT(
s->sprite_offset[0][n] * (1 <<
s->quarter_sample),
a);
606 dx =
s->sprite_delta[n][0];
607 dy =
s->sprite_delta[n][1];
610 dy -= 1 << (
shift +
a + 1);
612 dx -= 1 << (
shift +
a + 1);
613 mb_v =
s->sprite_offset[0][n] + dx *
s->mb_x * 16U + dy *
s->mb_y * 16U;
616 for (y = 0; y < 16; y++) {
619 v = mb_v + (unsigned)dy * y;
621 for (x = 0; x < 16; x++) {
626 sum =
RSHIFT(sum,
a + 8 -
s->quarter_sample);
652 if (code < 0 || code > 9 ) {
694 static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
697 s->first_slice_line = 1;
698 for (;
s->mb_y <
s->mb_height;
s->mb_y++) {
700 for (;
s->mb_x <
s->mb_width;
s->mb_x++) {
701 const int xy =
s->mb_x +
s->mb_y *
s->mb_stride;
707 if (
s->mb_x ==
s->resync_mb_x &&
s->mb_y ==
s->resync_mb_y + 1)
708 s->first_slice_line = 0;
720 "mcbpc corrupted at %d %d\n",
s->mb_x,
s->mb_y);
725 s->cbp_table[xy] = cbpc & 3;
732 s->current_picture.qscale_table[xy] =
s->qscale;
734 s->mbintra_table[xy] = 1;
735 for (
i = 0;
i < 6;
i++) {
740 "DC corrupted at %d %d\n",
s->mb_x,
s->mb_y);
747 s->pred_dir_table[xy] = dir;
749 int mx, my, pred_x, pred_y,
bits;
750 int16_t *
const mot_val =
s->current_picture.motion_val[0][
s->block_index[0]];
751 const int stride =
s->b8_stride * 2;
759 if (
bits & 0x10000) {
784 if (
s->mbintra_table[xy])
792 "mcbpc corrupted at %d %d\n",
s->mb_x,
s->mb_y);
798 s->cbp_table[xy] = cbpc & (8 + 3);
800 s->mb_intra = ((cbpc & 4) != 0);
804 s->mbintra_table[xy] = 1;
814 if (
s->mbintra_table[xy])
824 if ((cbpc & 16) == 0) {
858 for (
i = 0;
i < 4;
i++) {
887 static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
889 s->mb_x =
s->resync_mb_x;
890 s->first_slice_line = 1;
891 for (
s->mb_y =
s->resync_mb_y; mb_num < mb_count; s->mb_y++) {
893 for (; mb_num < mb_count &&
s->mb_x <
s->mb_width;
s->mb_x++) {
894 const int xy =
s->mb_x +
s->mb_y *
s->mb_stride;
898 if (
s->mb_x ==
s->resync_mb_x &&
s->mb_y ==
s->resync_mb_y + 1)
899 s->first_slice_line = 0;
906 "cbpy corrupted at %d %d\n",
s->mb_x,
s->mb_y);
910 s->cbp_table[xy] |= cbpy << 2;
913 if (
IS_INTRA(
s->current_picture.mb_type[xy])) {
921 "I cbpy corrupted at %d %d\n",
s->mb_x,
s->mb_y);
925 if (
s->cbp_table[xy] & 8)
927 s->current_picture.qscale_table[xy] =
s->qscale;
929 for (
i = 0;
i < 6;
i++) {
934 "DC corrupted at %d %d\n",
s->mb_x,
s->mb_y);
941 s->cbp_table[xy] &= 3;
942 s->cbp_table[xy] |= cbpy << 2;
944 s->pred_dir_table[xy] = dir;
945 }
else if (
IS_SKIP(
s->current_picture.mb_type[xy])) {
946 s->current_picture.qscale_table[xy] =
s->qscale;
947 s->cbp_table[xy] = 0;
953 "P cbpy corrupted at %d %d\n",
s->mb_x,
s->mb_y);
957 if (
s->cbp_table[xy] & 8)
959 s->current_picture.qscale_table[xy] =
s->qscale;
961 s->cbp_table[xy] &= 3;
962 s->cbp_table[xy] |= (cbpy ^ 0xf) << 2;
966 if (mb_num >= mb_count)
988 s->mb_x,
s->mb_y, part_a_error);
992 if (
s->resync_mb_x +
s->resync_mb_y *
s->mb_width + mb_num >
s->mb_num) {
995 s->mb_x,
s->mb_y, part_a_error);
999 s->mb_num_left = mb_num;
1006 "marker missing after first I partition at %d %d\n",
1015 "marker missing after first P partition at %d %d\n",
1021 s->mb_x - 1,
s->mb_y, part_a_end);
1043 int n,
int coded,
int intra,
int rvlc)
1055 if (
ctx->use_intra_dc_vlc) {
1057 if (
s->partitioned_frame) {
1058 level =
s->dc_val[0][
s->block_index[n]];
1063 dc_pred_dir = (
s->pred_dir_table[
s->mb_x +
s->mb_y *
s->mb_stride] << n) & 32;
1086 if (dc_pred_dir == 0)
1087 scan_table =
s->intra_v_scantable.permutated;
1089 scan_table =
s->intra_h_scantable.permutated;
1091 scan_table =
s->intra_scantable.permutated;
1098 s->block_last_index[n] =
i;
1106 scan_table =
s->intra_scantable.permutated;
1108 if (
s->mpeg_quant) {
1116 qmul =
s->qscale << 1;
1117 qadd = (
s->qscale - 1) | 1;
1134 "1. marker bit missing in rvlc esc\n");
1147 "2. marker bit missing in rvlc esc\n");
1173 cache ^= 0xC0000000;
1175 if (cache & 0x80000000) {
1176 if (cache & 0x40000000) {
1191 "1. marker bit missing in 3. esc\n");
1202 "2. marker bit missing in 3. esc\n");
1211 if (
s->error_recognition >= FF_ER_COMPLIANT) {
1214 const int run1=
run - rl->
max_run[last][abs_level] - 1;
1215 if (abs_level <= rl->max_level[last][
run]) {
1219 if (
s->error_recognition > FF_ER_COMPLIANT) {
1220 if (abs_level <= rl->max_level[last][
run]*2) {
1224 if (run1 >= 0 && abs_level <= rl->max_level[last][run1]) {
1237 if ((
unsigned)(
level + 2048) > 4095) {
1241 "|level| overflow in 3. esc, qp=%d\n",
1275 ff_tlog(
s->avctx,
"dct[%d][%d] = %- 4d end?:%d\n", scan_table[
i&63]&7, scan_table[
i&63] >> 3,
level,
i>62);
1280 "ac-tex damaged at %d %d\n",
s->mb_x,
s->mb_y);
1295 if (!
ctx->use_intra_dc_vlc) {
1305 s->block_last_index[n] =
i;
1317 const int xy =
s->mb_x +
s->mb_y *
s->mb_stride;
1321 mb_type =
s->current_picture.mb_type[xy];
1322 cbp =
s->cbp_table[xy];
1324 ctx->use_intra_dc_vlc =
s->qscale <
ctx->intra_dc_threshold;
1326 if (
s->current_picture.qscale_table[xy] !=
s->qscale)
1332 for (
i = 0;
i < 4;
i++) {
1333 s->mv[0][
i][0] =
s->current_picture.motion_val[0][
s->block_index[
i]][0];
1334 s->mv[0][
i][1] =
s->current_picture.motion_val[0][
s->block_index[
i]][1];
1340 for (
i = 0;
i < 6;
i++)
1341 s->block_last_index[
i] = -1;
1352 }
else if (
s->mb_intra) {
1353 s->ac_pred =
IS_ACPRED(
s->current_picture.mb_type[xy]);
1354 }
else if (!
s->mb_intra) {
1366 s->ac_pred =
IS_ACPRED(
s->current_picture.mb_type[xy]);
1371 s->bdsp.clear_blocks(
s->block[0]);
1373 for (
i = 0;
i < 6;
i++) {
1376 "texture corrupted at %d %d %d\n",
1377 s->mb_x,
s->mb_y,
s->mb_intra);
1385 if (--
s->mb_num_left <= 0) {
1392 const int delta =
s->mb_x + 1 ==
s->mb_width ? 2 : 1;
1393 if (
s->cbp_table[xy +
delta])
1403 int cbpc, cbpy,
i, cbp, pred_x, pred_y, mx, my, dquant;
1405 static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
1406 const int xy =
s->mb_x +
s->mb_y *
s->mb_stride;
1417 for (
i = 0;
i < 6;
i++)
1418 s->block_last_index[
i] = -1;
1445 "mcbpc damaged at %d %d\n",
s->mb_x,
s->mb_y);
1448 }
while (cbpc == 20);
1450 s->bdsp.clear_blocks(
s->block[0]);
1452 s->mb_intra = ((cbpc & 4) != 0);
1464 "P cbpy damaged at %d %d\n",
s->mb_x,
s->mb_y);
1468 cbp = (cbpc & 3) | (cbpy << 2);
1471 if ((!
s->progressive_sequence) &&
1476 if ((cbpc & 16) == 0) {
1485 s->mv[0][0][0] = mx;
1486 s->mv[0][0][1] = my;
1487 }
else if ((!
s->progressive_sequence) &&
get_bits1(&
s->gb)) {
1499 for (
i = 0;
i < 2;
i++) {
1508 s->mv[0][
i][0] = mx;
1509 s->mv[0][
i][1] = my;
1525 s->mv[0][0][0] = mx;
1526 s->mv[0][0][1] = my;
1531 for (
i = 0;
i < 4;
i++) {
1540 s->mv[0][
i][0] = mx;
1541 s->mv[0][
i][1] = my;
1555 for (
i = 0;
i < 2;
i++) {
1556 s->last_mv[
i][0][0] =
1557 s->last_mv[
i][0][1] =
1558 s->last_mv[
i][1][0] =
1559 s->last_mv[
i][1][1] = 0;
1566 s->mb_skipped =
s->next_picture.mbskip_table[
s->mb_y *
s->mb_stride +
s->mb_x];
1568 if (
s->mb_skipped) {
1570 for (
i = 0;
i < 6;
i++)
1571 s->block_last_index[
i] = -1;
1601 s->bdsp.clear_blocks(
s->block[0]);
1610 if (!
s->progressive_sequence) {
1638 s->last_mv[0][1][0] =
1639 s->last_mv[0][0][0] =
1640 s->mv[0][0][0] = mx;
1641 s->last_mv[0][1][1] =
1642 s->last_mv[0][0][1] =
1643 s->mv[0][0][1] = my;
1651 s->last_mv[1][1][0] =
1652 s->last_mv[1][0][0] =
1653 s->mv[1][0][0] = mx;
1654 s->last_mv[1][1][1] =
1655 s->last_mv[1][0][1] =
1656 s->mv[1][0][1] = my;
1664 for (
i = 0;
i < 2;
i++) {
1667 s->last_mv[0][
i][0] =
1668 s->mv[0][
i][0] = mx;
1669 s->last_mv[0][
i][1] = (
s->mv[0][
i][1] = my) * 2;
1676 for (
i = 0;
i < 2;
i++) {
1679 s->last_mv[1][
i][0] =
1680 s->mv[1][
i][0] = mx;
1681 s->last_mv[1][
i][1] = (
s->mv[1][
i][1] = my) * 2;
1699 s->current_picture.mb_type[xy] = mb_type;
1705 "I cbpc damaged at %d %d\n",
s->mb_x,
s->mb_y);
1708 }
while (cbpc == 8);
1723 "I cbpy damaged at %d %d\n",
s->mb_x,
s->mb_y);
1726 cbp = (cbpc & 3) | (cbpy << 2);
1728 ctx->use_intra_dc_vlc =
s->qscale <
ctx->intra_dc_threshold;
1733 if (!
s->progressive_sequence)
1736 s->bdsp.clear_blocks(
s->block[0]);
1738 for (
i = 0;
i < 6;
i++) {
1747 for (
i = 0;
i < 6;
i++) {
1758 if (
s->mb_x +
s->mb_y*
s->mb_width + 1 > next && (
s->avctx->err_recognition &
AV_EF_AGGRESSIVE)) {
1760 }
else if (
s->mb_x +
s->mb_y*
s->mb_width + 1 >= next)
1764 const int delta=
s->mb_x + 1 ==
s->mb_width ? 2 : 1;
1766 (
s->mb_x +
delta >=
s->mb_width)
1767 ?
FFMIN(
s->mb_y + 1,
s->mb_height - 1)
1769 if (
s->next_picture.mbskip_table[xy +
delta])
1821 int cc, dct_dc_size, dct_diff,
code, j, idx = 1, group = 0,
run = 0,
1822 additional_code_len, sign, mismatch;
1824 uint8_t *
const scantable =
s->intra_scantable.permutated;
1825 const uint16_t *quant_matrix;
1827 const int min = -1 * (1 << (
s->avctx->bits_per_raw_sample + 6));
1828 const int max = ((1 << (
s->avctx->bits_per_raw_sample + 6)) - 1);
1829 int shift = 3 -
s->dct_precision;
1838 quant_matrix =
s->intra_matrix;
1845 quant_matrix =
s->chroma_intra_matrix;
1848 if (dct_dc_size == 0) {
1853 if (dct_dc_size > 8) {
1860 s->last_dc[cc] += dct_diff;
1863 block[0] =
s->last_dc[cc] * (8 >>
s->intra_dc_precision);
1865 block[0] =
s->last_dc[cc] * (8 >>
s->intra_dc_precision) * (8 >>
s->dct_precision);
1869 mismatch ^=
block[0];
1886 }
else if (group >= 1 && group <= 6) {
1888 run = 1 << additional_code_len;
1889 if (additional_code_len)
1893 }
else if (group >= 7 && group <= 12) {
1898 run = (1 << (additional_code_len - 1)) +
code;
1902 j = scantable[idx++];
1903 block[j] = sign ? 1 : -1;
1904 }
else if (group >= 13 && group <= 20) {
1908 j = scantable[idx++];
1910 }
else if (group == 21) {
1914 j = scantable[idx++];
1915 additional_code_len =
s->avctx->bits_per_raw_sample +
s->dct_precision + 4;
1916 flc =
get_bits(&
s->gb, additional_code_len);
1917 if (flc >> (additional_code_len-1))
1918 block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1);
1924 mismatch ^=
block[j];
1927 block[63] ^= mismatch & 1;
1934 int i, j,
w,
h, idx = 0;
1935 int block_mean, rice_parameter, rice_prefix_code, rice_suffix_code,
1936 dpcm_residual, left, top, topleft, min_left_top, max_left_top, p, p2, output;
1937 h = 16 >> (n ?
s->chroma_y_shift : 0);
1938 w = 16 >> (n ?
s->chroma_x_shift : 0);
1940 block_mean =
get_bits(&
s->gb,
s->avctx->bits_per_raw_sample);
1941 if (block_mean == 0){
1945 s->last_dc[n] = block_mean * (1 << (
s->dct_precision +
s->intra_dc_precision));
1948 if (rice_parameter == 0) {
1953 if (rice_parameter == 15)
1956 if (rice_parameter > 11) {
1961 for (
i = 0;
i <
h;
i++) {
1962 output = 1 << (
s->avctx->bits_per_raw_sample - 1);
1963 top = 1 << (
s->avctx->bits_per_raw_sample - 1);
1965 for (j = 0; j <
w; j++) {
1972 if (rice_prefix_code == 11)
1973 dpcm_residual =
get_bits(&
s->gb,
s->avctx->bits_per_raw_sample);
1975 if (rice_prefix_code == 12) {
1979 rice_suffix_code =
get_bitsz(&
s->gb, rice_parameter);
1980 dpcm_residual = (rice_prefix_code << rice_parameter) + rice_suffix_code;
1984 if (dpcm_residual & 1)
1985 dpcm_residual = (-1 * dpcm_residual) >> 1;
1987 dpcm_residual = (dpcm_residual >> 1);
1990 top = macroblock[idx-
w];
1992 p = left + top - topleft;
1993 min_left_top =
FFMIN(left, top);
1994 if (p < min_left_top)
1997 max_left_top =
FFMAX(left, top);
1998 if (p > max_left_top)
2001 p2 = (
FFMIN(min_left_top, topleft) +
FFMAX(max_left_top, topleft)) >> 1;
2006 dpcm_residual *= -1;
2008 macroblock[idx++] = output = (dpcm_residual + p) & ((1 <<
s->avctx->bits_per_raw_sample) - 1);
2019 s->dpcm_direction = 0;
2040 for (
i = 0;
i < 3;
i++) {
2064 int hours, minutes, seconds;
2076 s->time_base = seconds + 60*(minutes + 60*hours);
2100 int visual_object_type;
2101 int is_visual_object_identifier =
get_bits1(gb);
2103 if (is_visual_object_identifier) {
2106 visual_object_type =
get_bits(gb, 4);
2111 if (video_signal_type) {
2112 int video_range, color_description;
2119 if (color_description) {
2120 s->avctx->color_primaries =
get_bits(gb, 8);
2135 for (
i = 0;
i < 64;
i++) {
2136 int j =
s->idsp.idct_permutation[
i];
2138 s->intra_matrix[j] = v;
2139 s->chroma_intra_matrix[j] = v;
2142 s->inter_matrix[j] = v;
2143 s->chroma_inter_matrix[j] = v;
2155 for (
i = 0;
i < 64;
i++) {
2158 s->intra_matrix[j] = v;
2159 s->chroma_intra_matrix[j] = v;
2167 for (
i = 0;
i < 64;
i++) {
2176 for (
i = 0;
i < 64;
i++) {
2179 s->chroma_intra_matrix[j] = v;
2187 for (
i = 0;
i < 64;
i++) {
2217 int bits_per_raw_sample;
2218 int rgb, chroma_format;
2238 bits_per_raw_sample =
get_bits(gb, 4);
2239 if (bits_per_raw_sample == 10) {
2249 if (
rgb !=
ctx->rgb ||
s->chroma_format != chroma_format)
2250 s->context_reinit = 1;
2251 s->avctx->bits_per_raw_sample = bits_per_raw_sample;
2253 s->chroma_format = chroma_format;
2256 check_marker(
s->avctx, gb,
"before video_object_layer_width");
2258 check_marker(
s->avctx, gb,
"before video_object_layer_height");
2260 check_marker(
s->avctx, gb,
"after video_object_layer_height");
2264 if (
s->width &&
s->height &&
2266 s->context_reinit = 1;
2273 s->avctx->sample_aspect_ratio.num =
get_bits(gb, 8);
2274 s->avctx->sample_aspect_ratio.den =
get_bits(gb, 8);
2284 check_marker(
s->avctx, gb,
"after first_half_vbv_buffer_size");
2287 check_marker(
s->avctx, gb,
"after first_half_vbv_buffer_size");
2289 check_marker(
s->avctx, gb,
"after latter_half_vbv_occupancy");
2317 s->studio_profile = 1;
2320 }
else if (
s->studio_profile) {
2332 s->avctx->sample_aspect_ratio.num =
get_bits(gb, 8);
2333 s->avctx->sample_aspect_ratio.den =
get_bits(gb, 8);
2339 int chroma_format =
get_bits(gb, 2);
2350 check_marker(
s->avctx, gb,
"after first_half_vbv_buffer_size");
2353 check_marker(
s->avctx, gb,
"after first_half_vbv_occupancy");
2355 check_marker(
s->avctx, gb,
"after latter_half_vbv_occupancy");
2360 if (
s->picture_number == 0) {
2361 switch(
s->vo_type) {
2380 check_marker(
s->avctx, gb,
"before time_increment_resolution");
2382 s->avctx->framerate.num =
get_bits(gb, 16);
2383 if (!
s->avctx->framerate.num) {
2388 ctx->time_increment_bits =
av_log2(
s->avctx->framerate.num - 1) + 1;
2389 if (
ctx->time_increment_bits < 1)
2390 ctx->time_increment_bits = 1;
2395 s->avctx->framerate.den =
get_bits(gb,
ctx->time_increment_bits);
2397 s->avctx->framerate.den = 1;
2411 !(
s->width &&
s->codec_tag ==
AV_RL32(
"MP4S"))) {
2412 if (
s->width &&
s->height &&
2414 s->context_reinit = 1;
2420 s->progressive_sequence =
2422 s->interlaced_dct = 0;
2425 "MPEG-4 OBMC not supported (very likely buggy encoder)\n");
2446 if (
ctx->num_sprite_warping_points > 3) {
2448 "%d sprite_warping_points\n",
2449 ctx->num_sprite_warping_points);
2450 ctx->num_sprite_warping_points = 0;
2453 s->sprite_warping_accuracy =
get_bits(gb, 2);
2464 if (
s->quant_precision != 5)
2466 "quant precision %d\n",
s->quant_precision);
2467 if (
s->quant_precision<3 ||
s->quant_precision>9) {
2468 s->quant_precision = 5;
2471 s->quant_precision = 5;
2484 for (
i = 0;
i < 64;
i++) {
2496 s->intra_matrix[j] = last;
2497 s->chroma_intra_matrix[j] = last;
2501 for (;
i < 64;
i++) {
2503 s->intra_matrix[j] = last;
2504 s->chroma_intra_matrix[j] = last;
2511 for (
i = 0;
i < 64;
i++) {
2523 s->inter_matrix[j] = v;
2524 s->chroma_inter_matrix[j] = v;
2528 for (;
i < 64;
i++) {
2530 s->inter_matrix[j] = last;
2531 s->chroma_inter_matrix[j] = last;
2541 s->quarter_sample = 0;
2550 int estimation_method =
get_bits(gb, 2);
2551 if (estimation_method < 2) {
2566 if (!
check_marker(
s->avctx, gb,
"in complexity estimation part 1")) {
2584 if (!
check_marker(
s->avctx, gb,
"in complexity estimation part 2")) {
2588 if (estimation_method == 1) {
2594 "Invalid Complexity estimation method %d\n",
2599 ctx->cplx_estimation_trash_i =
2600 ctx->cplx_estimation_trash_p =
2601 ctx->cplx_estimation_trash_b = 0;
2607 if (
s->data_partitioning)
2610 if (vo_ver_id != 1) {
2612 if (
ctx->new_pred) {
2619 "reduced resolution VOP not supported\n");
2626 if (
ctx->scalability) {
2628 int h_sampling_factor_n;
2629 int h_sampling_factor_m;
2630 int v_sampling_factor_n;
2631 int v_sampling_factor_m;
2636 h_sampling_factor_n =
get_bits(gb, 5);
2637 h_sampling_factor_m =
get_bits(gb, 5);
2638 v_sampling_factor_n =
get_bits(gb, 5);
2639 v_sampling_factor_m =
get_bits(gb, 5);
2642 if (h_sampling_factor_n == 0 || h_sampling_factor_m == 0 ||
2643 v_sampling_factor_n == 0 || v_sampling_factor_m == 0) {
2646 ctx->scalability = 0;
2656 av_log(
s->avctx,
AV_LOG_DEBUG,
"tb %d/%d, tincrbits:%d, qp_prec:%d, ps:%d, low_delay:%d %s%s%s%s\n",
2657 s->avctx->framerate.den,
s->avctx->framerate.num,
2658 ctx->time_increment_bits,
2660 s->progressive_sequence,
2662 ctx->scalability ?
"scalability " :
"" ,
s->quarter_sample ?
"qpel " :
"",
2663 s->data_partitioning ?
"partition " :
"",
ctx->rvlc ?
"rvlc " :
""
2680 int ver = 0, build = 0, ver2 = 0, ver3 = 0;
2691 e = sscanf(buf,
"DivX%dBuild%d%c", &ver, &build, &last);
2693 e = sscanf(buf,
"DivX%db%d%c", &ver, &build, &last);
2695 ctx->divx_version = ver;
2696 ctx->divx_build = build;
2697 s->divx_packed = e == 3 && last ==
'p';
2701 e = sscanf(buf,
"FFmpe%*[^b]b%d", &build) + 3;
2703 e = sscanf(buf,
"FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build);
2705 e = sscanf(buf,
"Lavc%d.%d.%d", &ver, &ver2, &ver3) + 1;
2707 if (ver > 0xFFU || ver2 > 0xFFU || ver3 > 0xFFU) {
2709 "Unknown Lavc version string encountered, %d.%d.%d; "
2710 "clamping sub-version values to 8-bits.\n",
2713 build = ((ver & 0xFF) << 16) + ((ver2 & 0xFF) << 8) + (ver3 & 0xFF);
2717 if (strcmp(buf,
"ffmpeg") == 0)
2718 ctx->lavc_build = 4600;
2721 ctx->lavc_build = build;
2724 e = sscanf(buf,
"XviD%d", &build);
2726 ctx->xvid_build = build;
2736 if (
ctx->xvid_build == -1 &&
ctx->divx_version == -1 &&
ctx->lavc_build == -1) {
2737 if (
s->codec_tag ==
AV_RL32(
"XVID") ||
2742 ctx->xvid_build = 0;
2745 if (
ctx->xvid_build == -1 &&
ctx->divx_version == -1 &&
ctx->lavc_build == -1)
2746 if (
s->codec_tag ==
AV_RL32(
"DIVX") &&
s->vo_type == 0 &&
2747 ctx->vol_control_parameters == 0)
2748 ctx->divx_version = 400;
2750 if (
ctx->xvid_build >= 0 &&
ctx->divx_version >= 0) {
2752 ctx->divx_build = -1;
2756 if (
s->codec_tag ==
AV_RL32(
"XVIX"))
2759 if (
s->codec_tag ==
AV_RL32(
"UMP4"))
2762 if (
ctx->divx_version >= 500 &&
ctx->divx_build < 1814)
2765 if (
ctx->divx_version > 502 &&
ctx->divx_build < 1814)
2768 if (
ctx->xvid_build <= 3U)
2769 s->padding_bug_score = 256 * 256 * 256 * 64;
2771 if (
ctx->xvid_build <= 1U)
2774 if (
ctx->xvid_build <= 12U)
2777 if (
ctx->xvid_build <= 32U)
2780 #define SET_QPEL_FUNC(postfix1, postfix2) \
2781 s->qdsp.put_ ## postfix1 = ff_put_ ## postfix2; \
2782 s->qdsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2; \
2783 s->qdsp.avg_ ## postfix1 = ff_avg_ ## postfix2;
2785 if (
ctx->lavc_build < 4653U)
2788 if (
ctx->lavc_build < 4655U)
2791 if (
ctx->lavc_build < 4670U)
2794 if (
ctx->lavc_build <= 4712U)
2797 if ((
ctx->lavc_build&0xFF) >= 100) {
2798 if (
ctx->lavc_build > 3621476 &&
ctx->lavc_build < 3752552 &&
2799 (
ctx->lavc_build < 3752037 ||
ctx->lavc_build > 3752191)
2804 if (
ctx->divx_version >= 0)
2806 if (
ctx->divx_version == 501 &&
ctx->divx_build == 20020416)
2807 s->padding_bug_score = 256 * 256 * 256 * 64;
2809 if (
ctx->divx_version < 500U)
2812 if (
ctx->divx_version >= 0)
2834 "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
2835 s->workaround_bugs,
ctx->lavc_build,
ctx->xvid_build,
2836 ctx->divx_version,
ctx->divx_build,
s->divx_packed ?
"p" :
"");
2852 int time_incr, time_increment;
2864 if (
s->partitioned_frame)
2875 if (
ctx->time_increment_bits == 0 ||
2878 "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);
2880 for (
ctx->time_increment_bits = 1;
2881 ctx->time_increment_bits < 16;
2882 ctx->time_increment_bits++) {
2886 if ((
show_bits(gb,
ctx->time_increment_bits + 6) & 0x37) == 0x30)
2888 }
else if ((
show_bits(gb,
ctx->time_increment_bits + 5) & 0x1F) == 0x18)
2893 "time_increment_bits set to %d bits, based on bitstream analysis\n",
ctx->time_increment_bits);
2894 if (
s->avctx->framerate.num && 4*
s->avctx->framerate.num < 1<<
ctx->time_increment_bits) {
2895 s->avctx->framerate.num = 1<<
ctx->time_increment_bits;
2903 time_increment =
get_bits(gb,
ctx->time_increment_bits);
2906 s->last_time_base =
s->time_base;
2907 s->time_base += time_incr;
2908 s->time =
s->time_base * (
int64_t)
s->avctx->framerate.num + time_increment;
2910 if (
s->time <
s->last_non_b_time) {
2914 s->time +=
s->avctx->framerate.num;
2917 s->pp_time =
s->time -
s->last_non_b_time;
2918 s->last_non_b_time =
s->time;
2920 s->time = (
s->last_time_base + time_incr) * (
int64_t)
s->avctx->framerate.num + time_increment;
2921 s->pb_time =
s->pp_time - (
s->last_non_b_time -
s->time);
2922 if (
s->pp_time <=
s->pb_time ||
2923 s->pp_time <=
s->pp_time -
s->pb_time ||
2930 if (
ctx->t_frame == 0)
2931 ctx->t_frame =
s->pb_time;
2932 if (
ctx->t_frame == 0)
2938 if (
s->pp_field_time <=
s->pb_field_time ||
s->pb_field_time <= 1) {
2939 s->pb_field_time = 2;
2940 s->pp_field_time = 4;
2941 if (!
s->progressive_sequence)
2946 if (
s->avctx->framerate.den)
3004 if (!
s->progressive_sequence) {
3008 s->alternate_scan = 0;
3011 if (
s->alternate_scan) {
3028 if (
ctx->sprite_brightness_change)
3030 "sprite_brightness_change not supported\n");
3034 memset(
s->sprite_offset, 0,
sizeof(
s->sprite_offset));
3035 memset(
s->sprite_delta, 0,
sizeof(
s->sprite_delta));
3040 s->chroma_qscale =
s->qscale =
get_bits(gb,
s->quant_precision);
3041 if (
s->qscale == 0) {
3043 "Error, header damaged or not MPEG-4 header (qscale=0)\n");
3049 if (
s->f_code == 0) {
3051 "Error, header damaged or not MPEG-4 header (f_code=0)\n");
3060 if (
s->b_code == 0) {
3062 "Error, header damaged or not MPEG4 header (b_code=0)\n");
3071 "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",
3072 s->qscale,
s->f_code,
s->b_code,
3075 s->top_field_first,
s->quarter_sample ?
"q" :
"h",
3076 s->data_partitioning,
ctx->resync_marker,
3077 ctx->num_sprite_warping_points,
s->sprite_warping_accuracy,
3078 1 -
s->no_rounding,
s->vo_type,
3079 ctx->vol_control_parameters ?
" VOLC" :
" ",
ctx->intra_dc_threshold,
3080 ctx->cplx_estimation_trash_i,
ctx->cplx_estimation_trash_p,
3081 ctx->cplx_estimation_trash_b,
3087 if (!
ctx->scalability) {
3091 if (
ctx->enhancement_type) {
3092 int load_backward_shape =
get_bits1(gb);
3093 if (load_backward_shape)
3095 "load backward shape isn't supported\n");
3103 if (
s->vo_type == 0 &&
ctx->vol_control_parameters == 0 &&
3104 ctx->divx_version == -1 &&
s->picture_number == 0) {
3106 "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
3110 s->picture_number++;
3117 s->h_edge_pos =
s->width;
3118 s->v_edge_pos =
s->height;
3149 s->partitioned_frame = 0;
3150 s->interlaced_dct = 0;
3173 s->intra_dc_precision =
get_bits(gb, 2);
3177 if (
s->alternate_scan) {
3200 int visual_object_type;
3203 visual_object_type =
get_bits(gb, 4);
3226 unsigned startcode, v;
3236 if (!
s->studio_profile &&
s->avctx->bits_per_raw_sample != 8)
3237 s->avctx->bits_per_raw_sample = 0;
3249 (
ctx->divx_version >= 0 ||
ctx->xvid_build >= 0) ||
s->codec_tag ==
AV_RL32(
"QMP4")) {
3260 startcode = ((startcode << 8) | v) & 0xffffffff;
3262 if ((startcode & 0xFFFFFF00) != 0x100)
3267 if (startcode <= 0x11F)
3269 else if (startcode <= 0x12F)
3271 else if (startcode <= 0x13F)
3273 else if (startcode <= 0x15F)
3275 else if (startcode <= 0x1AF)
3277 else if (startcode == 0x1B0)
3279 else if (startcode == 0x1B1)
3281 else if (startcode == 0x1B2)
3283 else if (startcode == 0x1B3)
3285 else if (startcode == 0x1B4)
3287 else if (startcode == 0x1B5)
3289 else if (startcode == 0x1B6)
3291 else if (startcode == 0x1B7)
3293 else if (startcode == 0x1B8)
3295 else if (startcode == 0x1B9)
3297 else if (startcode == 0x1BA)
3299 else if (startcode == 0x1BB)
3301 else if (startcode == 0x1BC)
3303 else if (startcode == 0x1BD)
3305 else if (startcode == 0x1BE)
3307 else if (startcode == 0x1BF)
3309 else if (startcode == 0x1C0)
3311 else if (startcode == 0x1C1)
3313 else if (startcode == 0x1C2)
3315 else if (startcode == 0x1C3)
3317 else if (startcode <= 0x1C5)
3319 else if (startcode <= 0x1FF)
3324 if (startcode >= 0x120 && startcode <= 0x12F) {
3341 s->studio_profile = 1;
3344 }
else if (
s->studio_profile) {
3351 if (
s->studio_profile) {
3367 s->avctx->has_b_frames = !
s->low_delay;
3369 if (
s->studio_profile) {
3370 if (!
s->avctx->bits_per_raw_sample) {
3380 static int done = 0;
3397 NULL, 0, 0, 0, 0, 128);
3413 if (
s->divx_packed) {
3414 int current_pos =
s->gb.buffer ==
s->bitstream_buffer ? 0 : (
get_bits_count(&
s->gb) >> 3);
3415 int startcode_found = 0;
3417 if (buf_size - current_pos > 7) {
3420 for (
i = current_pos;
i < buf_size - 4;
i++)
3425 buf[
i + 3] == 0xB6) {
3426 startcode_found = !(buf[
i + 4] & 0x40);
3431 if (startcode_found) {
3432 if (!
ctx->showed_packed_warning) {
3434 "wasteful way to store B-frames ('packed B-frames'). "
3435 "Consider using the mpeg4_unpack_bframes bitstream filter without encoding but stream copy to fix it.\n");
3436 ctx->showed_packed_warning = 1;
3439 &
s->allocated_bitstream_buffer_size,
3440 buf_size - current_pos);
3441 if (!
s->bitstream_buffer) {
3442 s->bitstream_buffer_size = 0;
3445 memcpy(
s->bitstream_buffer, buf + current_pos,
3446 buf_size - current_pos);
3447 s->bitstream_buffer_size = buf_size - current_pos;
3460 int init =
s->m.context_initialized;
3468 s->time_increment_bits =
s1->time_increment_bits;
3469 s->shape =
s1->shape;
3470 s->vol_sprite_usage =
s1->vol_sprite_usage;
3471 s->sprite_brightness_change =
s1->sprite_brightness_change;
3472 s->num_sprite_warping_points =
s1->num_sprite_warping_points;
3474 s->resync_marker =
s1->resync_marker;
3475 s->t_frame =
s1->t_frame;
3476 s->new_pred =
s1->new_pred;
3477 s->enhancement_type =
s1->enhancement_type;
3478 s->scalability =
s1->scalability;
3479 s->use_intra_dc_vlc =
s1->use_intra_dc_vlc;
3480 s->intra_dc_threshold =
s1->intra_dc_threshold;
3481 s->divx_version =
s1->divx_version;
3482 s->divx_build =
s1->divx_build;
3483 s->xvid_build =
s1->xvid_build;
3484 s->lavc_build =
s1->lavc_build;
3485 s->showed_packed_warning =
s1->showed_packed_warning;
3486 s->vol_control_parameters =
s1->vol_control_parameters;
3487 s->cplx_estimation_trash_i =
s1->cplx_estimation_trash_i;
3488 s->cplx_estimation_trash_p =
s1->cplx_estimation_trash_p;
3489 s->cplx_estimation_trash_b =
s1->cplx_estimation_trash_b;
3492 memcpy(
s->sprite_shift,
s1->sprite_shift,
sizeof(
s1->sprite_shift));
3493 memcpy(
s->sprite_traj,
s1->sprite_traj,
sizeof(
s1->sprite_traj));
3514 for (
unsigned i = 0,
offset = 0;
i < 12;
i++) {
3539 ctx->lavc_build = -1;
3547 ctx->time_increment_bits = 4;
3556 #define OFFSET(x) offsetof(MpegEncContext, x)
3557 #define FLAGS AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY
3592 #if CONFIG_MPEG4_NVDEC_HWACCEL
3595 #if CONFIG_MPEG4_VAAPI_HWACCEL
3598 #if CONFIG_MPEG4_VDPAU_HWACCEL
3601 #if CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL
static void flush(AVCodecContext *avctx)
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)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> dc
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define FF_DEBUG_STARTCODE
#define AV_EF_BITSTREAM
detect bitstream specification deviations
#define FF_BUG_XVID_ILACE
#define FF_PROFILE_UNKNOWN
#define FF_BUG_HPEL_CHROMA
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
#define FF_BUG_QPEL_CHROMA2
#define AV_EF_IGNORE_ERR
ignore errors and continue
#define FF_BUG_DIRECT_BLOCKSIZE
#define FF_DEBUG_PICT_INFO
#define FF_PROFILE_MPEG4_SIMPLE_STUDIO
#define AV_EF_AGGRESSIVE
consider things that a sane encoder should not do as an error
#define FF_BUG_AUTODETECT
autodetection
#define FF_BUG_NO_PADDING
#define FF_BUG_QPEL_CHROMA
static av_cold int init(AVCodecContext *avctx)
int ff_init_vlc_from_lengths(VLC *vlc_arg, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx)
Build VLC decoding tables suitable for use with get_vlc2()
static VLC_TYPE vlc_buf[16716][2]
#define ROUNDED_DIV(a, b)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#define CONFIG_MPEG4_DECODER
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
#define GET_CACHE(name, gb)
#define SKIP_CACHE(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.
#define CLOSE_READER(name, gb)
static int get_bits_left(GetBitContext *gb)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
#define SHOW_UBITS(name, gb, num)
static unsigned int get_bits1(GetBitContext *s)
#define SHOW_SBITS(name, gb, num)
#define OPEN_READER(name, gb)
static void skip_bits(GetBitContext *s, int n)
#define SKIP_BITS(name, gb, num)
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
#define UPDATE_CACHE(name, gb)
#define LAST_SKIP_BITS(name, gb, num)
static int get_bits_count(const GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define SKIP_COUNTER(name, gb, num)
static int check_marker(void *logctx, GetBitContext *s, const char *msg)
static const uint8_t * align_get_bits(GetBitContext *s)
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
static int get_xbits(GetBitContext *s, int n)
Read MPEG-1 dc-style VLC (sign bit + mantissa with no MSB).
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
#define AV_CODEC_CAP_TRUNCATED
#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 AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_FLAG_LOW_DELAY
Force low delay.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
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...
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_P
Predicted.
@ AV_PICTURE_TYPE_S
S(GMC)-VOP MPEG-4.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define LIBAVUTIL_VERSION_INT
int16_t * ff_h263_pred_motion(MpegEncContext *s, int block, int dir, int *px, int *py)
#define FF_ASPECT_EXTENDED
VLC ff_h263_intra_MCBPC_vlc
enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[]
int ff_h263_decode_motion(MpegEncContext *s, int pred, int f_code)
VLC ff_h263_inter_MCBPC_vlc
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define INTRA_MCBPC_VLC_BITS
int ff_h263_decode_end(AVCodecContext *avctx)
int ff_h263_decode_init(AVCodecContext *avctx)
#define INTER_MCBPC_VLC_BITS
const AVRational ff_h263_pixel_aspect[16]
#define HWACCEL_VDPAU(codec)
#define HWACCEL_NVDEC(codec)
#define HWACCEL_VAAPI(codec)
av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
static const int16_t alpha[]
#define FF_CODEC_CAP_ALLOCATE_PROGRESS
#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...
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
static int ff_thread_once(char *control, void(*routine)(void))
static const AVProfile profiles[]
static enum AVPixelFormat pix_fmts[]
const uint8_t ff_zigzag_direct[64]
const uint8_t ff_sprite_trajectory_lens[15]
const uint8_t ff_mpeg4_DCtab_lum[13][2]
const uint8_t ff_mpeg4_studio_intra[12][24][2]
RLTable ff_mpeg4_rl_intra
const uint8_t ff_mb_type_b_tab[4][2]
const int16_t ff_mpeg4_default_intra_matrix[64]
const uint8_t ff_mpeg4_c_dc_scale_table[32]
const uint16_t ff_mpeg4_resync_prefix[8]
const uint8_t ff_mpeg4_y_dc_scale_table[32]
const uint8_t ff_mpeg4_DCtab_chrom[13][2]
const uint8_t ff_mpeg4_studio_dc_chroma[19][2]
const int16_t ff_mpeg4_default_non_intra_matrix[64]
const uint8_t ff_mpeg4_studio_dc_luma[19][2]
const uint8_t ff_mpeg4_dc_threshold[8]
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s)
void ff_mpeg4_init_direct_mv(MpegEncContext *s)
uint8_t ff_mpeg4_static_rl_table_store[3][2][2 *MAX_RUN+MAX_LEVEL+3]
int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my)
#define QUANT_MATRIX_EXT_ID
#define ADV_SIMPLE_VO_TYPE
#define VOT_STILL_TEXTURE_ID
#define USER_DATA_STARTCODE
#define SIMPLE_STUDIO_VO_TYPE
static const uint8_t mpeg4_block_count[4]
#define CORE_STUDIO_VO_TYPE
static int ff_mpeg4_pred_dc(MpegEncContext *s, int n, int level, int *dir_ptr, int encoding)
Predict the dc.
#define VISUAL_OBJ_STARTCODE
static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *gb)
static void reset_studio_dc_predictors(MpegEncContext *s)
static av_cold void mpeg4_init_static(void)
static int mpeg4_decode_profile_level(MpegEncContext *s, GetBitContext *gb, int *profile, int *level)
static VLC studio_luma_dc
static int mpeg4_decode_dpcm_macroblock(MpegEncContext *s, int16_t macroblock[256], int n)
static int mpeg4_decode_dc(MpegEncContext *s, int n, int *dir_ptr)
Decode the dc value.
#define STUDIO_INTRA_BITS
static int decode_new_pred(Mpeg4DecContext *ctx, GetBitContext *gb)
static int read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)
static void decode_smpte_tc(Mpeg4DecContext *ctx, GetBitContext *gb)
static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx)
Decode first partition.
static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
Decode the next studio vop header.
static const uint8_t ac_state_tab[22][2]
static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n)
#define MB_TYPE_B_VLC_BITS
static av_cold int decode_init(AVCodecContext *avctx)
static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
decode partition C of one MB.
int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx)
Decode the next video packet.
static int mpeg4_decode_studio_mb(MpegEncContext *s, int16_t block_[12][64])
static VLC sprite_trajectory
static int mpeg4_decode_visual_object(MpegEncContext *s, GetBitContext *gb)
static int mpeg4_decode_gop_header(MpegEncContext *s, GetBitContext *gb)
static void extension_and_user_data(MpegEncContext *s, GetBitContext *gb, int id)
static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64])
static void next_start_code_studio(GetBitContext *gb)
av_cold void ff_mpeg4videodec_static_init(void)
static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
static const AVClass mpeg4_class
#define SPRITE_TRAJ_VLC_BITS
static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count)
decode second partition.
static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
static VLC studio_chroma_dc
int ff_mpeg4_workaround_bugs(AVCodecContext *avctx)
static const AVOption mpeg4_options[]
static const int mb_type_b_map[4]
static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
Decode the first and second partition.
#define SET_QPEL_FUNC(postfix1, postfix2)
static void mpeg4_load_default_matrices(MpegEncContext *s)
int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb, int header)
Decode MPEG-4 headers.
static VLC studio_intra_tab[12]
void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir)
Predict the ac.
int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx)
Decode the next video packet.
static int decode_studiovisualobject(Mpeg4DecContext *ctx, GetBitContext *gb)
static int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, int n, int coded, int intra, int rvlc)
Decode a block.
static int mpeg4_is_resync(Mpeg4DecContext *ctx)
check if the next stuff is a resync marker or the end.
static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb)
Decode the user data stuff in the header.
static int get_amv(Mpeg4DecContext *ctx, int n)
Get the average motion vector for a GMC MB.
#define USES_LIST(a, list)
#define MB_TYPE_INTERLACED
#define FRAME_SKIPPED
Return value for header parsers if frame is not coded.
void ff_mpeg_flush(AVCodecContext *avctx)
av_cold void ff_mpv_idct_init(MpegEncContext *s)
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
void ff_init_block_index(MpegEncContext *s)
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
void ff_clean_intra_table_entries(MpegEncContext *s)
Clean dc, ac, coded_block for the current non-intra MB.
#define SLICE_END
end marker found
#define SLICE_NOEND
no end marker or error found but mb count exceeded
#define MV_TYPE_FIELD
2 vectors, one per field
#define MV_TYPE_8X8
4 vectors (H.263, MPEG-4 4MV)
static int mpeg_get_qscale(MpegEncContext *s)
#define MV_DIRECT
bidirectional mode where the difference equals the MV of the last P/S/I-Frame (MPEG-4)
#define MV_TYPE_16X16
1 vector for the whole mb
static void ff_update_block_index(MpegEncContext *s)
const uint8_t ff_alternate_horizontal_scan[64]
const uint8_t ff_alternate_vertical_scan[64]
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_JPEG
Full range content.
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P10
const AVProfile ff_mpeg4_video_profiles[]
void ff_thread_await_progress(ThreadFrame *f, int n, int field)
Wait for earlier decoding threads to finish reference pictures.
av_cold void ff_rl_init(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
#define INIT_VLC_RL(rl, static_size)
#define INIT_FIRST_VLC_RL(rl, static_size)
static const uint8_t header[24]
static const SheerTable rgb[2]
#define FF_ARRAY_ELEMS(a)
static int shift(int a, int b)
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
main external API structure.
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
const char * name
Name of the codec implementation.
Rational number (pair of numerator and denominator).
int8_t * max_run[2]
encoding & decoding
RL_VLC_ELEM * rl_vlc[32]
decoding only
int8_t * max_level[2]
encoding & decoding
VLC_TYPE(* table)[2]
code, bits
#define avpriv_request_sample(...)
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
static const uint8_t offset[127][2]
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
#define INIT_VLC_STATIC_OVERLONG
#define INIT_VLC_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap, symbols, symbols_wrap, symbols_size, offset, flags, static_size)
av_cold void ff_xvid_idct_init(IDCTDSPContext *c, AVCodecContext *avctx)