52 #define VP3_MV_VLC_BITS 6 53 #define VP4_MV_VLC_BITS 6 54 #define SUPERBLOCK_VLC_BITS 6 56 #define FRAGMENT_PIXELS 8 65 #define SB_NOT_CODED 0 66 #define SB_PARTIALLY_CODED 1 67 #define SB_FULLY_CODED 2 72 #define MAXIMUM_LONG_BIT_RUN 4129 74 #define MODE_INTER_NO_MV 0 76 #define MODE_INTER_PLUS_MV 2 77 #define MODE_INTER_LAST_MV 3 78 #define MODE_INTER_PRIOR_LAST 4 79 #define MODE_USING_GOLDEN 5 80 #define MODE_GOLDEN_MV 6 81 #define MODE_INTER_FOURMV 7 82 #define CODING_MODE_COUNT 8 131 { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 },
132 { 0, 2 }, { 0, 3 }, { 1, 3 }, { 1, 2 },
133 { 2, 2 }, { 2, 3 }, { 3, 3 }, { 3, 2 },
134 { 3, 1 }, { 2, 1 }, { 2, 0 }, { 3, 0 }
161 #define MIN_DEQUANT_VAL 2 216 int fragment_width[2];
217 int fragment_height[2];
220 int fragment_start[3];
226 int8_t (*motion_val[2])[2];
229 uint16_t coded_dc_scale_factor[2][64];
230 uint32_t coded_ac_scale_factor[64];
234 uint16_t qr_base[2][3][64];
253 int16_t *dct_tokens[3][64];
255 #define TOKEN_EOB(eob_run) ((eob_run) << 2) 256 #define TOKEN_ZERO_RUN(coeff, zero_run) (((coeff) * 512) + ((zero_run) << 2) + 1) 257 #define TOKEN_COEFF(coeff) (((coeff) * 4) + 2) 263 int num_coded_frags[3][64];
268 int *coded_fragment_list[3];
272 int num_kf_coded_fragment[3];
366 for (j = 0; j < 2; j++)
367 for (i = 0; i < 7; i++)
370 for (i = 0; i < 2; i++)
384 int sb_x, sb_y, plane;
387 for (plane = 0; plane < 3; plane++) {
395 for (sb_y = 0; sb_y < sb_height; sb_y++)
396 for (sb_x = 0; sb_x < sb_width; sb_x++)
397 for (i = 0; i < 16; i++) {
399 y = 4 * sb_y + hilbert_offset[
i][1];
401 if (x < frag_width && y < frag_height)
419 int i, plane, inter, qri, bmi, bmj, qistart;
421 for (inter = 0; inter < 2; inter++) {
422 for (plane = 0; plane < 3; plane++) {
425 for (qri = 0; qri < s->
qr_count[inter][plane]; qri++) {
426 sum += s->
qr_size[inter][plane][qri];
427 if (s->
qps[qpi] <= sum)
430 qistart = sum - s->
qr_size[inter][plane][qri];
431 bmi = s->
qr_base[inter][plane][qri];
432 bmj = s->
qr_base[inter][plane][qri + 1];
433 for (i = 0; i < 64; i++) {
436 s->
qr_size[inter][plane][qri]) /
437 (2 * s->
qr_size[inter][plane][qri]);
439 int qmin = 8 << (inter + !
i);
440 int qscale = i ? ac_scale_factor : dc_scale_factor;
441 int qbias = (1 + inter) * 3;
443 (i == 0 || s->
version < 2) ?
av_clip((qscale * coeff) / 100 * 4, qmin, 4096)
444 : (qscale * (coeff - qbias) / 100 + qbias) * 4;
448 s->
qmat[
qpi][inter][plane][0] = s->
qmat[0][inter][plane][0];
470 int superblock_starts[3] = {
474 int current_superblock = 0;
476 int num_partial_superblocks = 0;
479 int current_fragment;
481 int plane0_num_coded_frags = 0;
490 while (current_superblock < s->superblock_count &&
get_bits_left(gb) > 0) {
498 if (current_run == 34)
503 "Invalid partially coded superblock run length\n");
509 current_superblock += current_run;
511 num_partial_superblocks += current_run;
516 if (num_partial_superblocks < s->superblock_count) {
517 int superblocks_decoded = 0;
519 current_superblock = 0;
523 while (superblocks_decoded < s->superblock_count - num_partial_superblocks &&
532 if (current_run == 34)
535 for (j = 0; j < current_run; current_superblock++) {
538 "Invalid fully coded superblock run length\n");
548 superblocks_decoded += current_run;
554 if (num_partial_superblocks) {
571 for (plane = 0; plane < 3; plane++) {
572 int sb_start = superblock_starts[plane];
575 int num_coded_frags = 0;
579 for (i = sb_start; i < sb_end; i++) {
581 for (j = 0; j < 16; j++) {
584 if (current_fragment != -1) {
594 for (i = sb_start; i < sb_end && get_bits_left(gb) > 0; i++) {
599 for (j = 0; j < 16; j++) {
602 if (current_fragment != -1) {
608 if (current_run-- == 0) {
632 plane0_num_coded_frags = num_coded_frags;
634 for (i = 0; i < 64; i++)
643 #define BLOCK_X (2 * mb_x + (k & 1)) 644 #define BLOCK_Y (2 * mb_y + (k >> 1)) 646 #if CONFIG_VP4_DECODER 655 while ((bits =
show_bits(gb, 9)) == 0x1ff) {
664 skip_bits(gb, 2 + n); \ 665 v += (1 << n) + get_bits(gb, n); } 666 #define thresh(n) (0x200 - (0x80 >> n)) 667 #define else_if(n) else if (bits < thresh(n)) body(n) 670 }
else if (bits < thresh(0)) {
697 int next_block_pattern_table;
698 int bit, current_run, has_partial;
710 current_run = vp4_get_mb_count(s, gb);
722 current_run = vp4_get_mb_count(s, gb);
727 current_run = vp4_get_mb_count(s, gb);
737 next_block_pattern_table = 0;
739 for (plane = 0; plane < 3; plane++) {
748 for (sb_y = 0; sb_y < sb_height; sb_y++) {
749 for (sb_x = 0; sb_x < sb_width; sb_x++) {
750 for (j = 0; j < 4; j++) {
751 int mb_x = 2 * sb_x + (j >> 1);
752 int mb_y = 2 * sb_y + (j >> 1) ^ (j & 1);
753 int mb_coded, pattern, coded;
755 if (mb_x >= mb_width || mb_y >= mb_height)
763 pattern = vp4_get_block_pattern(s, gb, &next_block_pattern_table);
767 for (k = 0; k < 4; k++) {
771 coded = pattern & (8 >> k);
790 int i, j, k, sb_x, sb_y;
792 int current_macroblock;
793 int current_fragment;
808 for (i = 0; i < 8; i++)
810 for (i = 0; i < 8; i++)
811 custom_mode_alphabet[
get_bits(gb, 3)] =
i;
812 alphabet = custom_mode_alphabet;
823 for (j = 0; j < 4; j++) {
824 int mb_x = 2 * sb_x + (j >> 1);
825 int mb_y = 2 * sb_y + (((j >> 1) + j) & 1);
835 for (k = 0; k < 4; k++) {
853 for (k = 0; k < 4; k++) {
859 #define SET_CHROMA_MODES \ 860 if (frag[s->fragment_start[1]].coding_method != MODE_COPY) \ 861 frag[s->fragment_start[1]].coding_method = coding_mode; \ 862 if (frag[s->fragment_start[2]].coding_method != MODE_COPY) \ 863 frag[s->fragment_start[2]].coding_method = coding_mode; 872 for (k = 0; k < 2; k++) {
877 for (k = 0; k < 4; k++) {
895 return last_motion < 0 ? -v : v;
904 int j, k, sb_x, sb_y;
908 int last_motion_x = 0;
909 int last_motion_y = 0;
910 int prior_last_motion_x = 0;
911 int prior_last_motion_y = 0;
912 int last_gold_motion_x = 0;
913 int last_gold_motion_y = 0;
914 int current_macroblock;
915 int current_fragment;
931 for (j = 0; j < 4; j++) {
932 int mb_x = 2 * sb_x + (j >> 1);
933 int mb_y = 2 * sb_y + (((j >> 1) + j) & 1);
943 if (coding_mode == 2) {
944 last_gold_motion_x = motion_x[0] =
vp4_get_mv(s, gb, 0, last_gold_motion_x);
945 last_gold_motion_y = motion_y[0] =
vp4_get_mv(s, gb, 1, last_gold_motion_y);
950 if (coding_mode == 0) {
955 }
else if (coding_mode == 1) {
959 motion_x[0] =
vp4_get_mv(s, gb, 0, last_motion_x);
960 motion_y[0] =
vp4_get_mv(s, gb, 1, last_motion_y);
965 prior_last_motion_x = last_motion_x;
966 prior_last_motion_y = last_motion_y;
967 last_motion_x = motion_x[0];
968 last_motion_y = motion_y[0];
974 prior_last_motion_x = last_motion_x;
975 prior_last_motion_y = last_motion_y;
979 for (k = 0; k < 4; k++) {
982 if (coding_mode == 0) {
987 }
else if (coding_mode == 1) {
991 motion_x[k] =
vp4_get_mv(s, gb, 0, prior_last_motion_x);
992 motion_y[k] =
vp4_get_mv(s, gb, 1, prior_last_motion_y);
994 last_motion_x = motion_x[k];
995 last_motion_y = motion_y[k];
1005 motion_x[0] = last_motion_x;
1006 motion_y[0] = last_motion_y;
1015 motion_x[0] = prior_last_motion_x;
1016 motion_y[0] = prior_last_motion_y;
1019 prior_last_motion_x = last_motion_x;
1020 prior_last_motion_y = last_motion_y;
1021 last_motion_x = motion_x[0];
1022 last_motion_y = motion_y[0];
1035 for (k = 0; k < 4; k++) {
1039 s->
motion_val[0][current_fragment][0] = motion_x[k];
1040 s->
motion_val[0][current_fragment][1] = motion_y[k];
1042 s->
motion_val[0][current_fragment][0] = motion_x[0];
1043 s->
motion_val[0][current_fragment][1] = motion_y[0];
1049 motion_x[0] =
RSHIFT(motion_x[0] + motion_x[1] +
1050 motion_x[2] + motion_x[3], 2);
1051 motion_y[0] =
RSHIFT(motion_y[0] + motion_y[1] +
1052 motion_y[2] + motion_y[3], 2);
1055 motion_x[0] = (motion_x[0] >> 1) | (motion_x[0] & 1);
1056 motion_y[0] = (motion_y[0] >> 1) | (motion_y[0] & 1);
1063 motion_x[0] =
RSHIFT(motion_x[0] + motion_x[1], 1);
1064 motion_y[0] =
RSHIFT(motion_y[0] + motion_y[1], 1);
1065 motion_x[1] =
RSHIFT(motion_x[2] + motion_x[3], 1);
1066 motion_y[1] =
RSHIFT(motion_y[2] + motion_y[3], 1);
1068 motion_x[1] = motion_x[0];
1069 motion_y[1] = motion_y[0];
1072 motion_x[0] = (motion_x[0] >> 1) | (motion_x[0] & 1);
1073 motion_x[1] = (motion_x[1] >> 1) | (motion_x[1] & 1);
1076 for (k = 0; k < 2; k++) {
1082 for (k = 0; k < 4; k++) {
1102 int qpi,
i, j,
bit, run_length, blocks_decoded, num_blocks_at_qpi;
1105 for (qpi = 0; qpi < s->
nqps - 1 && num_blocks > 0; qpi++) {
1106 i = blocks_decoded = num_blocks_at_qpi = 0;
1119 if (run_length == 34)
1121 blocks_decoded += run_length;
1124 num_blocks_at_qpi += run_length;
1126 for (j = 0; j < run_length; i++) {
1135 }
while (blocks_decoded < num_blocks &&
get_bits_left(gb) > 0);
1137 num_blocks -= num_blocks_at_qpi;
1153 int bits_to_get, zero_run;
1157 bits_to_get =
get_bits(gb, bits_to_get);
1191 int16_t *dct_tokens = s->
dct_tokens[plane][coeff_index];
1198 if (num_coeffs < 0) {
1200 "Invalid number of coefficients at level %d\n", coeff_index);
1204 if (eob_run > num_coeffs) {
1206 blocks_ended = num_coeffs;
1207 eob_run -= num_coeffs;
1210 blocks_ended = eob_run;
1216 dct_tokens[j++] = blocks_ended << 2;
1220 token =
get_vlc2(gb, vlc_table, 11, 3);
1222 if ((
unsigned) token <= 6
U) {
1229 if (eob_run > num_coeffs - coeff_i) {
1230 dct_tokens[j++] =
TOKEN_EOB(num_coeffs - coeff_i);
1231 blocks_ended += num_coeffs - coeff_i;
1232 eob_run -= num_coeffs - coeff_i;
1233 coeff_i = num_coeffs;
1236 blocks_ended += eob_run;
1240 }
else if (token >= 0) {
1241 zero_run =
get_coeff(gb, token, &coeff);
1251 all_fragments[coded_fragment_list[coeff_i]].
dc =
coeff;
1256 if (coeff_index + zero_run > 64) {
1258 "Invalid zero run of %d with %d coeffs left\n",
1259 zero_run, 64 - coeff_index);
1260 zero_run = 64 - coeff_index;
1265 for (i = coeff_index + 1; i <= coeff_index + zero_run; i++)
1280 for (i = coeff_index + 1; i < 64; i++)
1285 s->
dct_tokens[plane + 1][coeff_index] = dct_tokens + j;
1286 else if (coeff_index < 63)
1287 s->
dct_tokens[0][coeff_index + 1] = dct_tokens + j;
1295 int fragment_height);
1307 int residual_eob_run = 0;
1322 0, residual_eob_run);
1323 if (residual_eob_run < 0)
1324 return residual_eob_run;
1333 1, residual_eob_run);
1334 if (residual_eob_run < 0)
1335 return residual_eob_run;
1337 2, residual_eob_run);
1338 if (residual_eob_run < 0)
1339 return residual_eob_run;
1356 for (i = 1; i <= 5; i++) {
1358 y_tables[
i] = &s->
coeff_vlc[ac_y_table + 16];
1359 c_tables[
i] = &s->
coeff_vlc[ac_c_table + 16];
1361 for (i = 6; i <= 14; i++) {
1363 y_tables[
i] = &s->
coeff_vlc[ac_y_table + 32];
1364 c_tables[
i] = &s->
coeff_vlc[ac_c_table + 32];
1366 for (i = 15; i <= 27; i++) {
1368 y_tables[
i] = &s->
coeff_vlc[ac_y_table + 48];
1369 c_tables[
i] = &s->
coeff_vlc[ac_c_table + 48];
1371 for (i = 28; i <= 63; i++) {
1373 y_tables[
i] = &s->
coeff_vlc[ac_y_table + 64];
1374 c_tables[
i] = &s->
coeff_vlc[ac_c_table + 64];
1378 for (i = 1; i <= 63; i++) {
1379 residual_eob_run =
unpack_vlcs(s, gb, y_tables[i], i,
1380 0, residual_eob_run);
1381 if (residual_eob_run < 0)
1382 return residual_eob_run;
1384 residual_eob_run =
unpack_vlcs(s, gb, c_tables[i], i,
1385 1, residual_eob_run);
1386 if (residual_eob_run < 0)
1387 return residual_eob_run;
1388 residual_eob_run =
unpack_vlcs(s, gb, c_tables[i], i,
1389 2, residual_eob_run);
1390 if (residual_eob_run < 0)
1391 return residual_eob_run;
1397 #if CONFIG_VP4_DECODER 1406 int plane,
int eob_tracker[64],
int fragment)
1414 while (!eob_tracker[coeff_i]) {
1421 if ((
unsigned) token <= 6
U) {
1424 eob_tracker[coeff_i] = eob_run - 1;
1426 }
else if (token >= 0) {
1427 zero_run =
get_coeff(gb, token, &coeff);
1430 if (coeff_i + zero_run > 64) {
1432 "Invalid zero run of %d with %d coeffs left\n",
1433 zero_run, 64 - coeff_i);
1434 zero_run = 64 - coeff_i;
1437 coeff_i += zero_run;
1453 eob_tracker[coeff_i]--;
1467 for (i = 0; i < 4; i++)
1470 for (j = 1; j < 5; j++)
1471 for (i = 0; i < 4; i++)
1472 vp4_dc_predictor_reset(&dc_pred[j][i + 1]);
1479 for (i = 0; i < 4; i++)
1482 for (i = 1; i < 5; i++)
1483 dc_pred[i][0] = dc_pred[i][4];
1493 dc += dc_pred[-6].
dc;
1498 dc += dc_pred[6].
dc;
1502 if (count != 2 && dc_pred[-1].
type ==
type) {
1503 dc += dc_pred[-1].
dc;
1507 if (count != 2 && dc_pred[1].
type ==
type) {
1508 dc += dc_pred[1].
dc;
1513 return count == 2 ? dc / 2 : last_dc[
type];
1520 for (plane = 0; plane < 3; plane++) {
1521 for (i = 0; i < 64; i++) {
1536 int plane, sb_y, sb_x;
1537 int eob_tracker[64];
1554 tables[0][0] = &s->
coeff_vlc[dc_y_table];
1555 tables[1][0] = &s->
coeff_vlc[dc_c_table];
1556 for (i = 1; i <= 5; i++) {
1558 tables[0][
i] = &s->
coeff_vlc[ac_y_table + 16];
1559 tables[1][
i] = &s->
coeff_vlc[ac_c_table + 16];
1561 for (i = 6; i <= 14; i++) {
1563 tables[0][
i] = &s->
coeff_vlc[ac_y_table + 32];
1564 tables[1][
i] = &s->
coeff_vlc[ac_c_table + 32];
1566 for (i = 15; i <= 27; i++) {
1568 tables[0][
i] = &s->
coeff_vlc[ac_y_table + 48];
1569 tables[1][
i] = &s->
coeff_vlc[ac_c_table + 48];
1571 for (i = 28; i <= 63; i++) {
1573 tables[0][
i] = &s->
coeff_vlc[ac_y_table + 64];
1574 tables[1][
i] = &s->
coeff_vlc[ac_c_table + 64];
1577 vp4_set_tokens_base(s);
1579 memset(last_dc, 0,
sizeof(last_dc));
1582 memset(eob_tracker, 0,
sizeof(eob_tracker));
1588 for (j = 0; j < 6; j++)
1589 for (i = 0; i < 6; i++)
1590 vp4_dc_predictor_reset(&dc_pred[j][i]);
1594 vp4_dc_pred_before(s, dc_pred, sb_x);
1595 for (j = 0; j < 16; j++) {
1598 int x = 4 * sb_x + hx;
1599 int y = 4 * sb_y + hy;
1611 if (vp4_unpack_vlcs(s, gb, tables[!!plane], plane, eob_tracker, fragment) < 0)
1617 vp4_dc_pred(s, this_dc_pred, last_dc, dc_block_type, plane);
1619 this_dc_pred->
type = dc_block_type,
1622 vp4_dc_pred_after(s, dc_pred, sb_x);
1627 vp4_set_tokens_base(s);
1638 #define COMPATIBLE_FRAME(x) \ 1639 (compatible_frame[s->all_fragments[x].coding_method] == current_frame_type) 1640 #define DC_COEFF(u) s->all_fragments[u].dc 1645 int fragment_height)
1653 int i = first_fragment;
1658 int vl, vul, vu, vur;
1670 static const int predictor_transform[16][4] = {
1684 { -104, 116, 0, 116 },
1686 { -104, 116, 0, 116 }
1695 static const unsigned char compatible_frame[9] = {
1706 int current_frame_type;
1722 for (y = 0; y < fragment_height; y++) {
1724 for (x = 0; x < fragment_width; x++, i++) {
1728 current_frame_type =
1739 u = i - fragment_width;
1744 ul = i - fragment_width - 1;
1749 if (x + 1 < fragment_width) {
1750 ur = i - fragment_width + 1;
1757 if (transform == 0) {
1760 predicted_dc = last_dc[current_frame_type];
1764 (predictor_transform[
transform][0] * vul) +
1765 (predictor_transform[transform][1] * vu) +
1766 (predictor_transform[
transform][2] * vur) +
1767 (predictor_transform[transform][3] * vl);
1769 predicted_dc /= 128;
1773 if ((transform == 15) || (transform == 13)) {
1774 if (
FFABS(predicted_dc - vu) > 128)
1776 else if (
FFABS(predicted_dc - vl) > 128)
1778 else if (
FFABS(predicted_dc - vul) > 128)
1786 last_dc[current_frame_type] =
DC_COEFF(i);
1793 int ystart,
int yend)
1807 for (y = ystart; y < yend; y++) {
1808 for (x = 0; x <
width; x++) {
1818 stride, bounding_values);
1825 stride, bounding_values);
1831 if ((x < width - 1) &&
1834 plane_data + 8 * x + 8,
1835 stride, bounding_values);
1841 if ((y < height - 1) &&
1844 plane_data + 8 * x + 8 * stride,
1845 stride, bounding_values);
1851 plane_data += 8 *
stride;
1860 int plane,
int inter, int16_t
block[64])
1862 int16_t *dequantizer = s->
qmat[frag->
qpi][inter][plane];
1868 switch (token & 3) {
1877 i += (token >> 2) & 0x7f;
1882 block[perm[
i]] = (token >> 9) * dequantizer[perm[i]];
1886 block[perm[
i]] = (token >> 2) * dequantizer[perm[i]];
1897 block[0] = frag->
dc * s->
qmat[0][inter][plane][0];
1916 y_flipped == s->
height ? INT_MAX
1947 int motion_y,
int y)
1951 int border = motion_y & 1;
1959 ref_row = y + (motion_y >> 1);
1960 ref_row =
FFMAX(
FFABS(ref_row), ref_row + 8 + border);
1965 #if CONFIG_VP4_DECODER 1969 static int vp4_mc_loop_filter(
Vp3DecodeContext *s,
int plane,
int motion_x,
int motion_y,
int bx,
int by,
1972 int motion_shift = plane ? 4 : 2;
1973 int subpel_mask = plane ? 3 : 1;
1979 int x_subpel, y_subpel;
1980 int x_offset, y_offset;
1982 int block_width = plane ? 8 : 16;
1986 #define loop_stride 12 1990 x = 8 * bx + motion_x / motion_shift;
1991 y = 8 * by + motion_y / motion_shift;
1993 x_subpel = motion_x & subpel_mask;
1994 y_subpel = motion_y & subpel_mask;
1996 if (x_subpel || y_subpel) {
2006 x2 = x + block_width;
2007 y2 = y + block_width;
2009 if (x2 < 0 || x2 >= plane_width || y2 < 0 || y2 >= plane_height)
2012 x_offset = (-(x + 2) & 7) + 2;
2013 y_offset = (-(y + 2) & 7) + 2;
2015 if (x_offset > 8 + x_subpel && y_offset > 8 + y_subpel)
2020 12, 12, src_x - 1, src_y - 1,
2024 if (x_offset <= 8 + x_subpel)
2027 if (y_offset <= 8 + y_subpel)
2035 if (!x_offset && !y_offset)
2040 12, 12, src_x - 1, src_y - 1,
2044 #define safe_loop_filter(name, ptr, stride, bounding_values) \ 2045 if ((uintptr_t)(ptr) & 7) \ 2046 s->vp3dsp.name##_unaligned(ptr, stride, bounding_values); \ 2048 s->vp3dsp.name(ptr, stride, bounding_values); 2051 safe_loop_filter(h_loop_filter, loop + loop_stride + x_offset + 1, loop_stride, bounding_values);
2054 safe_loop_filter(v_loop_filter, loop + (y_offset + 1)*loop_stride + 1, loop_stride, bounding_values);
2057 for (i = 0; i < 9; i++)
2058 memcpy(temp + i*
stride, loop + (i + 1) * loop_stride + 1, 9);
2072 int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef;
2073 int motion_halfpel_index;
2075 int plane, first_pixel;
2080 for (plane = 0; plane < 3; plane++) {
2090 int8_t(*motion_val)[2] = s->
motion_val[!!plane];
2101 int do_await = !plane && HAVE_THREADS &&
2110 for (; sb_y < slice_height; sb_y++) {
2112 for (sb_x = 0; sb_x < slice_width; sb_x++) {
2114 for (j = 0; j < 16; j++) {
2116 y = 4 * sb_y + hilbert_offset[j][1];
2117 fragment = y * fragment_width + x;
2119 i = fragment_start + fragment;
2122 if (x >= fragment_width || y >= fragment_height)
2125 first_pixel = 8 * y * stride + 8 * x;
2130 motion_val[fragment][1],
2137 motion_source = golden_plane;
2139 motion_source = last_plane;
2141 motion_source += first_pixel;
2142 motion_halfpel_index = 0;
2149 int standard_mc = 1;
2150 motion_x = motion_val[fragment][0];
2151 motion_y = motion_val[fragment][1];
2152 #if CONFIG_VP4_DECODER 2153 if (plane && s->
version >= 2) {
2154 motion_x = (motion_x >> 1) | (motion_x & 1);
2155 motion_y = (motion_y >> 1) | (motion_y & 1);
2159 src_x = (motion_x >> 1) + 8 * x;
2160 src_y = (motion_y >> 1) + 8 * y;
2162 motion_halfpel_index = motion_x & 0x01;
2163 motion_source += (motion_x >> 1);
2165 motion_halfpel_index |= (motion_y & 0x01) << 1;
2166 motion_source += ((motion_y >> 1) * stride);
2168 #if CONFIG_VP4_DECODER 2173 if (vp4_mc_loop_filter(s, plane, motion_val[fragment][0], motion_val[fragment][1], x, y, motion_source, stride, src_x, src_y, temp)) {
2174 motion_source =
temp;
2180 if (standard_mc && (
2181 src_x < 0 || src_y < 0 ||
2182 src_x + 9 >= plane_width ||
2183 src_y + 9 >= plane_height)) {
2193 motion_source =
temp;
2204 if (motion_halfpel_index != 3) {
2206 output_plane + first_pixel,
2207 motion_source,
stride, 8);
2211 int d = (motion_x ^ motion_y) >> 31;
2214 motion_source + stride + 1 + d,
2241 output_plane + first_pixel,
2242 last_plane + first_pixel,
2251 FFMIN(4 * sb_y + 3, fragment_height - 1));
2271 int y_fragment_count, c_fragment_count;
2284 memset(s-> num_kf_coded_fragment, -1,
sizeof(s-> num_kf_coded_fragment));
2326 int i, inter, plane,
ret;
2329 int y_fragment_count, c_fragment_count;
2330 #if CONFIG_VP4_DECODER 2355 for (i = 0; i < 64; i++) {
2356 #define TRANSPOSE(x) (((x) >> 3) | (((x) & 7) << 3)) 2364 for (i = 0; i < 3; i++)
2407 for (i = 0; i < 64; i++) {
2417 for (inter = 0; inter < 2; inter++) {
2418 for (plane = 0; plane < 3; plane++) {
2420 s->
qr_size[inter][plane][0] = 63;
2422 s->
qr_base[inter][plane][1] = 2 * inter + (!!plane) * !inter;
2436 #if CONFIG_VP4_DECODER 2463 NULL, 0, 0, 1, 0, avctx);
2469 NULL, 0, 0, 0, 0, avctx);
2475 NULL, 0, 0, 0, 0, avctx);
2486 #if CONFIG_VP4_DECODER 2487 for (j = 0; j < 2; j++)
2488 for (i = 0; i < 7; i++) {
2498 for (i = 0; i < 2; i++)
2534 if (src->
f->
data[0])
2552 int qps_changed = 0,
i, err;
2554 if (!
s1->current_frame.f->data[0] ||
2563 if ((err = ref_frames(s,
s1)) < 0)
2569 for (
i = 0;
i < 3;
i++) {
2570 if (s->
qps[
i] !=
s1->qps[1]) {
2576 if (s->
qps[0] !=
s1->qps[0])
2581 memcpy(s->
qps,
s1->qps,
sizeof(s->
qps));
2592 void *
data,
int *got_frame,
2597 int buf_size = avpkt->
size;
2605 #if CONFIG_THEORA_DECODER 2611 av_log(avctx,
AV_LOG_ERROR,
"midstream reconfiguration with multithreading is unsupported, try -threads 1\n");
2625 }
else if (type == 2) {
2638 "Header packet passed to frame decoder, skipping\n");
2650 for (i = 0; i < 3; i++)
2662 s->
keyframe ?
"key" :
"", avctx->frame_number + 1, s->
qps[0]);
2695 if (avctx->frame_number == 0)
2697 "VP version: %d\n", s->
version);
2703 "Warning, unsupported keyframe coding type?!\n");
2706 #if CONFIG_VP4_DECODER 2708 int mb_height, mb_width;
2709 int mb_width_mul, mb_width_div, mb_height_mul, mb_height_div;
2721 if (mb_width_mul != 1 || mb_width_div != 1 || mb_height_mul != 1 || mb_height_div != 1)
2732 "vp3: first frame not a keyframe\n");
2754 #if CONFIG_VP4_DECODER 2756 if ((
ret = vp4_unpack_macroblocks(s, &gb)) < 0) {
2780 #if CONFIG_VP4_DECODER 2782 if ((
ret = vp4_unpack_dct_coeffs(s, &gb)) < 0) {
2789 for (
i = 0;
i < 3;
i++) {
2803 for (
i = 0;
i < 3;
i++) {
2814 frame->crop_right = avctx->coded_width - avctx->width - s->
offset_x;
2816 frame->crop_bottom = avctx->coded_height - avctx->height - s->
offset_y;
2847 ff_dlog(avctx,
"code length %d, curr entry %d, token %d\n",
2865 #if CONFIG_THEORA_DECODER 2873 int visible_width, visible_height, colorspace;
2874 uint8_t offset_x = 0, offset_y = 0;
2891 if (s->
theora < 0x030200) {
2894 "Old (<alpha3) Theora bitstream, flipped image\n");
2902 if (s->
theora >= 0x030200) {
2912 visible_width + offset_x > s->
width ||
2913 visible_height + offset_y > s->
height) {
2915 "Invalid frame dimensions - w:%d h:%d x:%d y:%d (%dx%d).\n",
2916 visible_width, visible_height, offset_x, offset_y,
2923 if (fps.
num && fps.
den) {
2924 if (fps.
num < 0 || fps.
den < 0) {
2929 fps.
den, fps.
num, 1 << 30);
2934 if (aspect.
num && aspect.
den) {
2937 aspect.
num, aspect.
den, 1 << 30);
2941 if (s->
theora < 0x030200)
2948 if (s->
theora >= 0x030200) {
2963 avctx->
width = visible_width;
2964 avctx->
height = visible_height;
2971 if (colorspace == 1)
2973 else if (colorspace == 2)
2976 if (colorspace == 1 || colorspace == 2) {
2988 int i, n, matrices, inter, plane,
ret;
2993 if (s->
theora >= 0x030200) {
2997 for (i = 0; i < 64; i++)
3001 if (s->
theora >= 0x030200)
3006 for (i = 0; i < 64; i++)
3009 if (s->
theora >= 0x030200)
3014 for (i = 0; i < 64; i++)
3018 if (s->
theora >= 0x030200)
3023 if (matrices > 384) {
3028 for (n = 0; n < matrices; n++)
3029 for (i = 0; i < 64; i++)
3032 for (inter = 0; inter <= 1; inter++) {
3033 for (plane = 0; plane <= 2; plane++) {
3035 if (inter || plane > 0)
3043 qtj = (3 * inter + plane - 1) / 3;
3044 plj = (plane + 2) % 3;
3057 if (i >= matrices) {
3059 "invalid base matrix index\n");
3066 s->
qr_size[inter][plane][qri++] =
i;
3096 const uint8_t *header_start[3];
3111 42, header_start, header_len) < 0) {
3116 for (i = 0; i < 3; i++) {
3117 if (header_len[i] <= 0)
3125 if (!(ptype & 0x80)) {
3148 "Unknown Theora config packet: %d\n", ptype & ~0x80);
3153 "%d bits left in packet %X\n",
3155 if (s->
theora < 0x030200)
3168 .
init = theora_decode_init,
3196 #if CONFIG_VP4_DECODER #define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
uint8_t idct_scantable[64]
discard all frames except keyframes
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_NUM_DATA_POINTERS
int16_t qmat[3][2][3][64]
qmat[qpi][is_inter][plane]
static int init_block_mapping(Vp3DecodeContext *s)
This function sets up all of the various blocks mappings: superblocks <-> fragments, macroblocks <-> fragments, superblocks <-> macroblocks.
This structure describes decoded (raw) audio or video data.
#define TOKEN_EOB(eob_run)
HuffTable huffman_table[5 *16]
static void render_slice(Vp3DecodeContext *s, int slice)
static const uint8_t mode_code_vlc_len[8]
ptrdiff_t const GLvoid * data
static void flush(AVCodecContext *avctx)
int bounding_values_array[256+2]
int coded_width
Bitstream width / height, may be different from width/height e.g.
void(* put_no_rnd_pixels_l2)(uint8_t *dst, const uint8_t *a, const uint8_t *b, ptrdiff_t stride, int h)
Copy 8xH pixels from source to destination buffer using a bilinear filter with no rounding (i...
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
static int get_coeff(GetBitContext *gb, int token, int16_t *coeff)
uint16_t qr_base[2][3][64]
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static av_cold int init(AVCodecContext *avctx)
static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb)
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
#define avpriv_request_sample(...)
#define MODE_INTER_PLUS_MV
static av_cold int init_frames(Vp3DecodeContext *s)
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 int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)
static const uint8_t zero_run_base[32]
void(* v_loop_filter)(uint8_t *src, ptrdiff_t stride, int *bounding_values)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_cold int vp3_decode_init(AVCodecContext *avctx)
static const uint8_t coeff_get_bits[32]
int num_kf_coded_fragment[3]
static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
#define FF_ARRAY_ELEMS(a)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static const uint16_t vp4_ac_scale_factor[64]
static void reverse_dc_prediction(Vp3DecodeContext *s, int first_fragment, int fragment_width, int fragment_height)
static av_cold int vp3_decode_end(AVCodecContext *avctx)
static void error(const char *err)
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before ff_thread_await_progress() has been called on them.reget_buffer() and buffer age optimizations no longer work.*The contents of buffers must not be written to after ff_thread_report_progress() has been called on them.This includes draw_edges().Porting codecs to frame threading
int * superblock_fragments
VLC superblock_run_length_vlc
#define MAXIMUM_LONG_BIT_RUN
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
void(* draw_horiz_band)(struct AVCodecContext *s, const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], int y, int type, int height)
If non NULL, 'draw_horiz_band' is called by the libavcodec decoder to draw a horizontal band...
Vp3Fragment * all_fragments
static void init_loop_filter(Vp3DecodeContext *s)
#define COMPATIBLE_FRAME(x)
void(* emulated_edge_mc)(uint8_t *dst, const uint8_t *src, ptrdiff_t dst_linesize, ptrdiff_t src_linesize, int block_w, int block_h, int src_x, int src_y, int w, int h)
Copy a rectangular area of samples to a temporary buffer and replicate the border samples...
The exact code depends on how similar the blocks are and how related they are to the block
static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define TOKEN_ZERO_RUN(coeff, zero_run)
#define FF_DEBUG_PICT_INFO
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
static int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag, int plane, int inter, int16_t block[64])
Pull DCT tokens from the 64 levels to decode and dequant the coefficients for the next block in codin...
static int FUNC() huffman_table(CodedBitstreamContext *ctx, RWContext *rw, JPEGRawHuffmanTable *current)
Multithreading support functions.
uint8_t idct_permutation[64]
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static void init_dequantizer(Vp3DecodeContext *s, int qpi)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static void output_plane(const Plane *plane, int buf_sel, uint8_t *dst, ptrdiff_t dst_pitch, int dst_height)
Convert and output the current plane.
#define u(width, name, range_min, range_max)
static void vp3_decode_flush(AVCodecContext *avctx)
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
uint8_t filter_limit_values[64]
static int get_bits_count(const GetBitContext *s)
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
bitstream reader API header.
static const uint8_t vp4_bias[5 *16][32][2]
static const uint8_t vp31_intra_c_dequant[64]
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
static int unpack_dct_coeffs(Vp3DecodeContext *s, GetBitContext *gb)
static const uint16_t table[]
#define FF_CODEC_CAP_ALLOCATE_PROGRESS
static void body(uint32_t ABCD[4], const uint8_t *src, int nblocks)
static const uint8_t vp4_pred_block_type_map[8]
static int get_bits_left(GetBitContext *gb)
static int vp3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static const uint8_t motion_vector_vlc_table[63][2]
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint8_t vp4_mv_vlc[2][7][63][2]
#define AV_CODEC_FLAG2_IGNORE_CROP
Discard cropping information from SPS.
void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
#define init_vlc(vlc, nb_bits, nb_codes,bits, bits_wrap, bits_size,codes, codes_wrap, codes_size,flags)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define CODING_MODE_COUNT
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
void(* idct_add)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int active_thread_type
Which multithreading methods are in use by the codec.
static const int8_t fixed_motion_vector_table[64]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int flags
AV_CODEC_FLAG_*.
void(* h_loop_filter)(uint8_t *src, ptrdiff_t stride, int *bounding_values)
AVCodec ff_theora_decoder
static av_cold void free_tables(AVCodecContext *avctx)
const char * name
Name of the codec implementation.
static int read_huffman_tree(HuffTable *huff, GetBitContext *gb, int length, AVCodecContext *avctx)
uint16_t coded_dc_scale_factor[2][64]
static const int ModeAlphabet[6][CODING_MODE_COUNT]
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define FF_CODEC_CAP_EXPORTS_CROPPING
The decoder sets the cropping fields in the output frames manually.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags)
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have so the codec calls ff_thread_report set FF_CODEC_CAP_ALLOCATE_PROGRESS in AVCodec caps_internal and use ff_thread_get_buffer() to allocate frames.The frames must then be freed with ff_thread_release_buffer().Otherwise decode directly into the user-supplied frames.Call ff_thread_report_progress() after some part of the current picture has decoded.A good place to put this is where draw_horiz_band() is called-add this if it isn't called anywhere
static const int16_t *const coeff_tables[32]
unsigned char * macroblock_coding
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
enum AVPictureType pict_type
Picture type of the frame.
static const uint8_t vp31_intra_y_dequant[64]
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define FF_THREAD_FRAME
Decode more than one frame at once.
VLC fragment_run_length_vlc
static const uint8_t fragment_run_length_vlc_len[30]
int width
picture width / height.
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call ff_thread_finish_setup() afterwards.If some code can't be moved
static VLC coeff_vlc[2][8][4]
#define SB_PARTIALLY_CODED
static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, VLC *table, int coeff_index, int plane, int eob_run)
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
uint8_t * edge_emu_buffer
static const uint8_t vp4_mv_table_selector[32]
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
static const uint16_t vp31_ac_scale_factor[64]
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int avpriv_split_xiph_headers(const uint8_t *extradata, int extradata_size, int first_header_size, const uint8_t *header_start[3], int header_len[3])
Split a single extradata buffer into the three headers that most Xiph codecs use. ...
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static const uint8_t hilbert_offset[16][2]
static const uint8_t vp4_y_dc_scale_factor[64]
void ff_vp3dsp_h_loop_filter_12(uint8_t *first_pixel, ptrdiff_t stride, int *bounding_values)
int total_num_coded_frags
int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
void(* idct_dc_add)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int yend)
static const int8_t transform[32][32]
static const uint8_t vp4_filter_limit_values[64]
#define AV_LOG_INFO
Standard information.
Used to store optimal huffman encoding results.
static const uint8_t vp4_block_pattern_table_selector[14]
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int16_t * dct_tokens[3][64]
This is a list of all tokens in bitstream order.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
ThreadFrame current_frame
main external API structure.
static const uint8_t vp4_generic_dequant[64]
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
uint8_t qr_size[2][3][64]
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
static const uint8_t superblock_run_length_vlc_lens[34]
static av_cold int allocate_tables(AVCodecContext *avctx)
Allocate tables for per-frame data in Vp3DecodeContext.
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have update_thread_context() run it in the next thread.Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities.There will be very little speed gain at this point but it should work.If there are inter-frame dependencies
static unsigned int get_bits1(GetBitContext *s)
op_pixels_func put_no_rnd_pixels_tab[4][4]
Halfpel motion compensation with no rounding (a+b)>>1.
static void skip_bits(GetBitContext *s, int n)
enum AVColorSpace colorspace
YUV colorspace type.
Rational number (pair of numerator and denominator).
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
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()
int * nkf_coded_fragment_list
const uint8_t ff_zigzag_direct[64]
int num_coded_frags[3][64]
number of blocks that contain DCT coefficients at the given level or higher
#define TOKEN_COEFF(coeff)
static int vp4_get_mv(Vp3DecodeContext *s, GetBitContext *gb, int axis, int last_motion)
static VLC_TYPE vlc_tables[VLC_TABLES_SIZE][2]
static const uint8_t vp31_dc_scale_factor[64]
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int update_frames(AVCodecContext *avctx)
Release and shuffle frames after decode finishes.
Writing a table generator This documentation is preliminary Parts of the API are not good and should be changed Basic concepts A table generator consists of two *_tablegen c and *_tablegen h The h file will provide the variable declarations and initialization code for the tables
#define MODE_USING_GOLDEN
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
#define MODE_INTER_FOURMV
static const uint8_t vp4_uv_dc_scale_factor[64]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static const struct @167 eob_run_table[7]
static const uint8_t vp4_block_pattern_vlc[2][14][2]
static int theora_header(AVFormatContext *s, int idx)
void ff_vp3dsp_v_loop_filter_12(uint8_t *first_pixel, ptrdiff_t stride, int *bounding_values)
int * coded_fragment_list[3]
GLint GLenum GLboolean GLsizei stride
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static const uint8_t vp31_inter_dequant[64]
unsigned char * superblock_coding
common internal api header.
int16_t * dct_tokens_base
#define bit(string, value)
static int get_eob_run(GetBitContext *gb, int token)
Core video DSP helper functions.
static const uint8_t vp3_bias[5 *16][32][2]
uint8_t base_matrix[384][64]
void ff_vp3dsp_set_bounding_values(int *bounding_values_array, int filter_limit)
static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)
int * kf_coded_fragment_list
#define SUPERBLOCK_VLC_BITS
static void await_reference_row(Vp3DecodeContext *s, Vp3Fragment *fragment, int motion_y, int y)
Wait for the reference frame of the current fragment.
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
static const double coeff[2][5]
int flags2
AV_CODEC_FLAG2_*.
static const struct twinvq_data tab
#define MODE_INTER_PRIOR_LAST
VP4Predictor * dc_pred_row
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
#define MODE_INTER_LAST_MV
#define av_malloc_array(a, b)
void(* idct_put)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
av_cold void ff_vp3dsp_init(VP3DSPContext *c, int flags)
static const uint8_t vp31_filter_limit_values[64]
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
#define MKTAG(a, b, c, d)
AVPixelFormat
Pixel format.
This structure stores compressed data.
static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y)
called when all pixels up to row y are complete
void ff_free_vlc(VLC *vlc)
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
uint32_t coded_ac_scale_factor[64]
static const uint8_t zero_run_get_bits[32]
void * av_mallocz_array(size_t nmemb, size_t size)
int8_t(*[2] motion_val)[2]