51 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2,
52 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
53 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
57 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3,
58 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
59 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
63 #if CONFIG_H264_DXVA2_HWACCEL
66 #if CONFIG_H264_VAAPI_HWACCEL
69 #if CONFIG_H264_VDA_HWACCEL
78 int mb_x,
int mb_y,
int mb_intra,
int mb_skipped)
127 for (i = 0; i < 2; i++) {
177 const int b4_stride = h->
mb_width * 4 + 1;
178 const int b4_array_size = b4_stride * h->
mb_height * 4;
204 (big_mb_num + h->
mb_stride) *
sizeof(uint32_t),
209 for (i = 0; i < 2; i++) {
211 2 * (b4_array_size + 4) *
sizeof(int16_t),
215 4 * mb_array_size *
sizeof(
uint8_t), fail)
227 return (ret < 0) ? ret :
AVERROR(ENOMEM);
266 static const int8_t top[12] = {
269 static const int8_t left[12] = {
275 for (i = 0; i < 4; i++) {
279 "top block unavailable for requested intra4x4 mode %d at %d %d\n",
289 static const int mask[4] = { 0x8000, 0x2000, 0x80, 0x20 };
290 for (i = 0; i < 4; i++)
295 "left block unavailable for requested intra4x4 mode %d at %d %d\n",
318 "out of range intra chroma pred mode at %d %d\n",
327 "top block unavailable for requested intra mode at %d %d\n",
343 "left block unavailable for requested intra mode at %d %d\n",
353 int *dst_length,
int *consumed,
int length)
366 #define STARTCODE_TEST \
367 if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
368 if (src[i + 2] != 3) { \
374 #if HAVE_FAST_UNALIGNED
375 #define FIND_FIRST_ZERO \
376 if (i > 0 && !src[i]) \
381 for (i = 0; i + 1 < length; i += 9) {
383 (
AV_RN64A(src + i) - 0x0100010001000101ULL)) &
384 0x8000800080008080ULL))
391 for (i = 0; i + 1 < length; i += 5) {
393 (
AV_RN32A(src + i) - 0x01000101U)) &
402 for (i = 0; i + 1 < length; i += 2) {
405 if (i > 0 && src[i - 1] == 0)
411 if (i >= length - 1) {
412 *dst_length = length;
413 *consumed = length + 1;
428 while (si + 2 < length) {
430 if (src[si + 2] > 3) {
431 dst[di++] = src[si++];
432 dst[di++] = src[si++];
433 }
else if (src[si] == 0 && src[si + 1] == 0) {
434 if (src[si + 2] == 3) {
443 dst[di++] = src[si++];
446 dst[di++] = src[si++];
469 for (r = 1; r < 9; r++) {
478 int height,
int y_offset,
int list)
481 int filter_height_up = (raw_my & 3) ? 2 : 0;
482 int filter_height_down = (raw_my & 3) ? 3 : 0;
483 int full_my = (raw_my >> 2) + y_offset;
484 int top = full_my - filter_height_up;
485 int bottom = full_my + filter_height_down +
height;
487 return FFMAX(abs(top), bottom);
491 int height,
int y_offset,
int list0,
492 int list1,
int *nrefs)
508 if (refs[0][ref_n] < 0)
510 refs[0][ref_n] =
FFMAX(refs[0][ref_n], my);
521 if (refs[1][ref_n] < 0)
523 refs[1][ref_n] =
FFMAX(refs[1][ref_n], my);
535 const int mb_xy = h->
mb_xy;
538 int nrefs[2] = { 0 };
541 memset(refs, -1,
sizeof(refs));
561 for (i = 0; i < 4; i++) {
564 int y_offset = (i & 2) << 2;
568 IS_DIR(sub_mb_type, 0, 0),
569 IS_DIR(sub_mb_type, 0, 1),
573 IS_DIR(sub_mb_type, 0, 0),
574 IS_DIR(sub_mb_type, 0, 1),
577 IS_DIR(sub_mb_type, 0, 0),
578 IS_DIR(sub_mb_type, 0, 1),
582 IS_DIR(sub_mb_type, 0, 0),
583 IS_DIR(sub_mb_type, 0, 1),
586 IS_DIR(sub_mb_type, 0, 0),
587 IS_DIR(sub_mb_type, 0, 1),
592 for (j = 0; j < 4; j++) {
593 int sub_y_offset = y_offset + 2 * (j & 2);
595 IS_DIR(sub_mb_type, 0, 0),
596 IS_DIR(sub_mb_type, 0, 1),
603 for (list = h->
list_count - 1; list >= 0; list--)
604 for (ref = 0; ref < 48 && nrefs[list]; ref++) {
605 int row = refs[list][ref];
610 int pic_height = 16 * h->
mb_height >> ref_field_picture;
617 FFMIN((row >> 1) - !(row & 1),
621 FFMIN((row >> 1), pic_height - 1),
625 FFMIN(row * 2 + ref_field,
630 FFMIN(row, pic_height - 1),
634 FFMIN(row, pic_height - 1),
646 int src_x_offset,
int src_y_offset,
649 int pixel_shift,
int chroma_idc)
651 const int mx = h->
mv_cache[list][
scan8[n]][0] + src_x_offset * 8;
653 const int luma_xy = (mx & 3) + ((my & 3) << 2);
654 int offset = ((mx >> 2) << pixel_shift) + (my >> 2) * h->
mb_linesize;
660 const int full_mx = mx >> 2;
661 const int full_my = my >> 2;
662 const int pic_width = 16 * h->
mb_width;
671 if (full_mx < 0 - extra_width ||
672 full_my < 0 - extra_height ||
673 full_mx + 16 > pic_width + extra_width ||
674 full_my + 16 > pic_height + extra_height) {
678 16 + 5, 16 + 5 , full_mx - 2,
679 full_my - 2, pic_width, pic_height);
691 if (chroma_idc == 3 ) {
692 src_cb = pic->
f.
data[1] + offset;
698 full_mx - 2, full_my - 2,
699 pic_width, pic_height);
706 src_cr = pic->
f.
data[2] + offset;
712 full_mx - 2, full_my - 2,
713 pic_width, pic_height);
722 ysh = 3 - (chroma_idc == 2 );
726 emu |= (my >> 3) < 0 || (my >> 3) + 8 >= (pic_height >> 1);
729 src_cb = pic->
f.
data[1] + ((mx >> 3) << pixel_shift) +
731 src_cr = pic->
f.
data[2] + ((mx >> 3) << pixel_shift) +
736 9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
737 pic_width >> 1, pic_height >> (chroma_idc == 1 ));
741 height >> (chroma_idc == 1 ),
742 mx & 7, (my << (chroma_idc == 2 )) & 7);
746 9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
747 pic_width >> 1, pic_height >> (chroma_idc == 1 ));
750 chroma_op(dest_cr, src_cr, h->
mb_uvlinesize, height >> (chroma_idc == 1 ),
751 mx & 7, (my << (chroma_idc == 2 )) & 7);
758 int x_offset,
int y_offset,
763 int list0,
int list1,
764 int pixel_shift,
int chroma_idc)
769 dest_y += (2 * x_offset << pixel_shift) + 2 * y_offset * h->
mb_linesize;
770 if (chroma_idc == 3 ) {
771 dest_cb += (2 * x_offset << pixel_shift) + 2 * y_offset * h->
mb_linesize;
772 dest_cr += (2 * x_offset << pixel_shift) + 2 * y_offset * h->
mb_linesize;
773 }
else if (chroma_idc == 2 ) {
774 dest_cb += (x_offset << pixel_shift) + 2 * y_offset * h->
mb_uvlinesize;
775 dest_cr += (x_offset << pixel_shift) + 2 * y_offset * h->
mb_uvlinesize;
777 dest_cb += (x_offset << pixel_shift) + y_offset * h->
mb_uvlinesize;
778 dest_cr += (x_offset << pixel_shift) + y_offset * h->
mb_uvlinesize;
780 x_offset += 8 * h->
mb_x;
786 dest_y, dest_cb, dest_cr, x_offset, y_offset,
787 qpix_op, chroma_op, pixel_shift, chroma_idc);
790 chroma_op = chroma_avg;
796 dest_y, dest_cb, dest_cr, x_offset, y_offset,
797 qpix_op, chroma_op, pixel_shift, chroma_idc);
805 int x_offset,
int y_offset,
812 int list0,
int list1,
813 int pixel_shift,
int chroma_idc)
817 dest_y += (2 * x_offset << pixel_shift) + 2 * y_offset * h->
mb_linesize;
818 if (chroma_idc == 3 ) {
820 chroma_weight_avg = luma_weight_avg;
821 chroma_weight_op = luma_weight_op;
822 dest_cb += (2 * x_offset << pixel_shift) + 2 * y_offset * h->
mb_linesize;
823 dest_cr += (2 * x_offset << pixel_shift) + 2 * y_offset * h->
mb_linesize;
824 }
else if (chroma_idc == 2 ) {
826 dest_cb += (x_offset << pixel_shift) + 2 * y_offset * h->
mb_uvlinesize;
827 dest_cr += (x_offset << pixel_shift) + 2 * y_offset * h->
mb_uvlinesize;
829 chroma_height = height >> 1;
830 dest_cb += (x_offset << pixel_shift) + y_offset * h->
mb_uvlinesize;
831 dest_cr += (x_offset << pixel_shift) + y_offset * h->
mb_uvlinesize;
833 x_offset += 8 * h->
mb_x;
836 if (list0 && list1) {
846 dest_y, dest_cb, dest_cr,
847 x_offset, y_offset, qpix_put, chroma_put,
848 pixel_shift, chroma_idc);
850 tmp_y, tmp_cb, tmp_cr,
851 x_offset, y_offset, qpix_put, chroma_put,
852 pixel_shift, chroma_idc);
856 int weight1 = 64 - weight0;
858 height, 5, weight0, weight1, 0);
860 chroma_height, 5, weight0, weight1, 0);
862 chroma_height, 5, weight0, weight1, 0);
864 luma_weight_avg(dest_y, tmp_y, h->
mb_linesize, height,
870 chroma_weight_avg(dest_cb, tmp_cb, h->
mb_uvlinesize, chroma_height,
876 chroma_weight_avg(dest_cr, tmp_cr, h->
mb_uvlinesize, chroma_height,
884 int list = list1 ? 1 : 0;
887 mc_dir_part(h, ref, n, square, height, delta, list,
888 dest_y, dest_cb, dest_cr, x_offset, y_offset,
889 qpix_put, chroma_put, pixel_shift, chroma_idc);
909 int pixel_shift,
int chroma_idc)
918 int off = (mx << pixel_shift) +
922 if (chroma_idc == 3 ) {
926 off = ((mx >> 1) << pixel_shift) +
997 for (i = 0; i < 6; i++) {
999 for (j = 0; j < i; j++)
1008 for (q = 0; q < max_qp + 1; q++) {
1009 int shift =
div6[q];
1011 for (x = 0; x < 64; x++)
1023 for (i = 0; i < 6; i++) {
1025 for (j = 0; j < i; j++)
1034 for (q = 0; q < max_qp + 1; q++) {
1035 int shift =
div6[q] + 2;
1037 for (x = 0; x < 16; x++)
1052 for (i = 0; i < 6; i++)
1053 for (x = 0; x < 16; x++)
1056 for (i = 0; i < 6; i++)
1057 for (x = 0; x < 64; x++)
1069 row_mb_num * 8 *
sizeof(
uint8_t), fail)
1071 big_mb_num * 48 *
sizeof(
uint8_t), fail)
1075 big_mb_num *
sizeof(uint16_t), fail)
1077 big_mb_num *
sizeof(
uint8_t), fail)
1079 16 * row_mb_num *
sizeof(
uint8_t), fail);
1081 16 * row_mb_num *
sizeof(
uint8_t), fail);
1083 4 * big_mb_num *
sizeof(
uint8_t), fail);
1085 big_mb_num *
sizeof(
uint8_t), fail)
1092 big_mb_num *
sizeof(uint32_t), fail);
1094 big_mb_num *
sizeof(uint32_t), fail);
1096 for (x = 0; x < h->
mb_width; x++) {
1098 const int b_xy = 4 * x + 4 * y * h->
b_stride;
1160 int yc_size = y_size + 2 * c_size;
1198 mb_array_size *
sizeof(
uint8_t), fail);
1212 for (i = 0; i < yc_size; i++)
1222 int parse_extradata);
1251 int i, cnt, nalsize;
1264 cnt = *(p + 5) & 0x1f;
1266 for (i = 0; i < cnt; i++) {
1272 "Decoding sps %d from avcC failed\n", i);
1279 for (i = 0; i < cnt; i++) {
1285 "Decoding pps %d from avcC failed\n", i);
1353 #define IN_RANGE(a, b, size) (((a) >= (b)) && ((a) < ((b) + (size))))
1354 #undef REBASE_PICTURE
1355 #define REBASE_PICTURE(pic, new_ctx, old_ctx) \
1356 ((pic && pic >= old_ctx->DPB && \
1357 pic < old_ctx->DPB + old_ctx->picture_count) ? \
1358 &new_ctx->DPB[pic - old_ctx->DPB] : NULL)
1366 for (i = 0; i < count; i++) {
1367 assert((
IN_RANGE(from[i], old_base,
sizeof(*old_base)) ||
1379 for (i = 0; i < count; i++) {
1380 if (to[i] && !from[i])
1382 else if (from[i] && !to[i])
1386 memcpy(to[i], from[i], size);
1404 #define copy_fields(to, from, start_field, end_field) \
1405 memcpy(&to->start_field, &from->start_field, \
1406 (char *)&to->end_field - (char *)&to->start_field)
1417 int context_reinitialized = 0;
1420 if (dst == src || !h1->context_initialized)
1424 (h->
width != h1->width ||
1425 h->
height != h1->height ||
1434 h->
width = h1->width;
1446 context_reinitialized = 1;
1464 memcpy(h, h1,
sizeof(*h1));
1467 memset(&h->
er, 0,
sizeof(h->
er));
1468 memset(&h->
me, 0,
sizeof(h->
me));
1484 for (i = 0; i < 2; i++) {
1510 memcpy(h->
DPB, h1->DPB, h1->picture_count *
sizeof(*h1->DPB));
1543 copy_fields(h, h1, dequant4_buffer, dequant4_coeff);
1545 for (i = 0; i < 6; i++)
1547 (h1->dequant4_coeff[i] - h1->dequant4_buffer[0]);
1549 for (i = 0; i < 6; i++)
1551 (h1->dequant8_coeff[i] - h1->dequant8_buffer[0]);
1570 if (context_reinitialized)
1628 for (i = 0; i < 16; i++) {
1632 for (i = 0; i < 16; i++) {
1684 int i, pics, out_of_order, out_idx;
1685 int invalid = 0, cnt = 0;
1810 invalid += out->
poc == INT_MIN;
1813 cnt + invalid == MAX_DELAYED_PIC_COUNT && cnt > 0) {
1822 invalid = MAX_DELAYED_PIC_COUNT;
1826 for (i = 1; i < MAX_DELAYED_PIC_COUNT &&
1845 if (invalid + cnt < MAX_DELAYED_PIC_COUNT) {
1866 sizeof(*h->
last_pocs) * (MAX_DELAYED_PIC_COUNT - 1));
1895 int linesize,
int uvlinesize,
1905 src_cb -= uvlinesize;
1906 src_cr -= uvlinesize;
1912 AV_COPY128(top_border, src_y + 15 * linesize);
1914 AV_COPY128(top_border + 16, src_y + 15 * linesize + 16);
1918 AV_COPY128(top_border + 32, src_cb + 15 * uvlinesize);
1919 AV_COPY128(top_border + 48, src_cb + 15 * uvlinesize + 16);
1920 AV_COPY128(top_border + 64, src_cr + 15 * uvlinesize);
1921 AV_COPY128(top_border + 80, src_cr + 15 * uvlinesize + 16);
1923 AV_COPY128(top_border + 16, src_cb + 15 * uvlinesize);
1924 AV_COPY128(top_border + 32, src_cr + 15 * uvlinesize);
1926 }
else if (chroma422) {
1928 AV_COPY128(top_border + 32, src_cb + 15 * uvlinesize);
1929 AV_COPY128(top_border + 48, src_cr + 15 * uvlinesize);
1931 AV_COPY64(top_border + 16, src_cb + 15 * uvlinesize);
1932 AV_COPY64(top_border + 24, src_cr + 15 * uvlinesize);
1936 AV_COPY128(top_border + 32, src_cb + 7 * uvlinesize);
1937 AV_COPY128(top_border + 48, src_cr + 7 * uvlinesize);
1939 AV_COPY64(top_border + 16, src_cb + 7 * uvlinesize);
1940 AV_COPY64(top_border + 24, src_cr + 7 * uvlinesize);
1954 AV_COPY128(top_border, src_y + 16 * linesize);
1956 AV_COPY128(top_border + 16, src_y + 16 * linesize + 16);
1961 AV_COPY128(top_border + 32, src_cb + 16 * linesize);
1962 AV_COPY128(top_border + 48, src_cb + 16 * linesize + 16);
1963 AV_COPY128(top_border + 64, src_cr + 16 * linesize);
1964 AV_COPY128(top_border + 80, src_cr + 16 * linesize + 16);
1966 AV_COPY128(top_border + 16, src_cb + 16 * linesize);
1967 AV_COPY128(top_border + 32, src_cr + 16 * linesize);
1969 }
else if (chroma422) {
1971 AV_COPY128(top_border + 32, src_cb + 16 * uvlinesize);
1972 AV_COPY128(top_border + 48, src_cr + 16 * uvlinesize);
1974 AV_COPY64(top_border + 16, src_cb + 16 * uvlinesize);
1975 AV_COPY64(top_border + 24, src_cr + 16 * uvlinesize);
1979 AV_COPY128(top_border + 32, src_cb + 8 * uvlinesize);
1980 AV_COPY128(top_border + 48, src_cr + 8 * uvlinesize);
1982 AV_COPY64(top_border + 16, src_cb + 8 * uvlinesize);
1983 AV_COPY64(top_border + 24, src_cr + 8 * uvlinesize);
1991 int linesize,
int uvlinesize,
1992 int xchg,
int chroma444,
1993 int simple,
int pixel_shift)
1995 int deblock_topleft;
2014 deblock_topleft = (h->
mb_x > 0);
2018 src_y -= linesize + 1 + pixel_shift;
2019 src_cb -= uvlinesize + 1 + pixel_shift;
2020 src_cr -= uvlinesize + 1 + pixel_shift;
2025 #define XCHG(a, b, xchg) \
2026 if (pixel_shift) { \
2028 AV_SWAP64(b + 0, a + 0); \
2029 AV_SWAP64(b + 8, a + 8); \
2039 if (deblock_topleft) {
2040 XCHG(top_border_m1 + (8 << pixel_shift),
2041 src_y - (7 << pixel_shift), 1);
2043 XCHG(top_border + (0 << pixel_shift), src_y + (1 << pixel_shift), xchg);
2044 XCHG(top_border + (8 << pixel_shift), src_y + (9 << pixel_shift), 1);
2047 src_y + (17 << pixel_shift), 1);
2052 if (deblock_topleft) {
2053 XCHG(top_border_m1 + (24 << pixel_shift), src_cb - (7 << pixel_shift), 1);
2054 XCHG(top_border_m1 + (40 << pixel_shift), src_cr - (7 << pixel_shift), 1);
2056 XCHG(top_border + (16 << pixel_shift), src_cb + (1 << pixel_shift), xchg);
2057 XCHG(top_border + (24 << pixel_shift), src_cb + (9 << pixel_shift), 1);
2058 XCHG(top_border + (32 << pixel_shift), src_cr + (1 << pixel_shift), xchg);
2059 XCHG(top_border + (40 << pixel_shift), src_cr + (9 << pixel_shift), 1);
2061 XCHG(h->
top_borders[top_idx][h->
mb_x + 1] + (16 << pixel_shift), src_cb + (17 << pixel_shift), 1);
2062 XCHG(h->
top_borders[top_idx][h->
mb_x + 1] + (32 << pixel_shift), src_cr + (17 << pixel_shift), 1);
2066 if (deblock_topleft) {
2067 XCHG(top_border_m1 + (16 << pixel_shift), src_cb - (7 << pixel_shift), 1);
2068 XCHG(top_border_m1 + (24 << pixel_shift), src_cr - (7 << pixel_shift), 1);
2070 XCHG(top_border + (16 << pixel_shift), src_cb + 1 + pixel_shift, 1);
2071 XCHG(top_border + (24 << pixel_shift), src_cr + 1 + pixel_shift, 1);
2080 if (high_bit_depth) {
2087 int index,
int value)
2089 if (high_bit_depth) {
2096 int mb_type,
int is_h264,
2098 int transform_bypass,
2108 block_offset += 16 * p;
2111 if (transform_bypass) {
2118 for (i = 0; i < 16; i += 4) {
2119 uint8_t *
const ptr = dest_y + block_offset[i];
2122 h->
hpc.
pred8x8l_add[dir](ptr, h->
mb + (i * 16 + p * 256 << pixel_shift), linesize);
2128 if (nnz == 1 &&
dctcoef_get(h->
mb, pixel_shift, i * 16 + p * 256))
2129 idct_dc_add(ptr, h->
mb + (i * 16 + p * 256 << pixel_shift), linesize);
2131 idct_add(ptr, h->
mb + (i * 16 + p * 256 << pixel_shift), linesize);
2136 if (transform_bypass) {
2143 for (i = 0; i < 16; i++) {
2144 uint8_t *
const ptr = dest_y + block_offset[i];
2148 h->
hpc.
pred4x4_add[dir](ptr, h->
mb + (i * 16 + p * 256 << pixel_shift), linesize);
2155 assert(h->
mb_y || linesize <= block_offset[i]);
2156 if (!topright_avail) {
2158 tr_high = ((uint16_t *)ptr)[3 - linesize / 2] * 0x0001000100010001ULL;
2159 topright = (
uint8_t *)&tr_high;
2161 tr = ptr[3 - linesize] * 0x01010101u;
2165 topright = ptr + (4 << pixel_shift) - linesize;
2169 h->
hpc.
pred4x4[dir](ptr, topright, linesize);
2173 if (nnz == 1 &&
dctcoef_get(h->
mb, pixel_shift, i * 16 + p * 256))
2174 idct_dc_add(ptr, h->
mb + (i * 16 + p * 256 << pixel_shift), linesize);
2176 idct_add(ptr, h->
mb + (i * 16 + p * 256 << pixel_shift), linesize);
2187 if (!transform_bypass)
2192 static const uint8_t dc_mapping[16] = {
2193 0 * 16, 1 * 16, 4 * 16, 5 * 16,
2194 2 * 16, 3 * 16, 6 * 16, 7 * 16,
2195 8 * 16, 9 * 16, 12 * 16, 13 * 16,
2196 10 * 16, 11 * 16, 14 * 16, 15 * 16 };
2197 for (i = 0; i < 16; i++)
2199 pixel_shift, dc_mapping[i],
2211 int is_h264,
int simple,
2212 int transform_bypass,
2220 block_offset += 16 * p;
2224 if (transform_bypass) {
2229 h->
mb + (p * 256 << pixel_shift),
2232 for (i = 0; i < 16; i++)
2236 h->
mb + (i * 16 + p * 256 << pixel_shift),
2241 h->
mb + (p * 256 << pixel_shift),
2245 }
else if (h->
cbp & 15) {
2246 if (transform_bypass) {
2247 const int di =
IS_8x8DCT(mb_type) ? 4 : 1;
2250 for (i = 0; i < 16; i += di)
2253 h->
mb + (i * 16 + p * 256 << pixel_shift),
2258 h->
mb + (p * 256 << pixel_shift),
2263 h->
mb + (p * 256 << pixel_shift),
2269 for (i = 0; i < 16; i++)
2272 uint8_t *
const ptr = dest_y + block_offset[i];
2294 const int mb_xy = h->
mb_xy;
2300 hl_decode_mb_444_complex(h);
2302 hl_decode_mb_444_simple_8(h);
2303 }
else if (is_complex) {
2304 hl_decode_mb_complex(h);
2306 hl_decode_mb_simple_16(h);
2308 hl_decode_mb_simple_8(h);
2314 int luma_def, chroma_def;
2324 for (list = 0; list < 2; list++) {
2327 for (i = 0; i < h->
ref_count[list]; i++) {
2328 int luma_weight_flag, chroma_weight_flag;
2331 if (luma_weight_flag) {
2346 if (chroma_weight_flag) {
2348 for (j = 0; j < 2; j++) {
2359 for (j = 0; j < 2; j++) {
2380 int ref0, ref1, i, cur_poc, ref_start, ref_count0, ref_count1;
2382 for (i = 0; i < 2; i++) {
2414 for (ref0 = ref_start; ref0 < ref_count0; ref0++) {
2416 for (ref1 = ref_start; ref1 < ref_count1; ref1++) {
2420 int td = av_clip(poc1 - poc0, -128, 127);
2422 int tb = av_clip(cur_poc - poc0, -128, 127);
2423 int tx = (16384 + (
FFABS(td) >> 1)) / td;
2424 int dist_scale_factor = (tb * tx + 32) >> 8;
2425 if (dist_scale_factor >= -64 && dist_scale_factor <= 128)
2426 w = 64 - dist_scale_factor;
2524 int abs_frame_num, expected_delta_per_poc_cycle, expectedpoc;
2535 expected_delta_per_poc_cycle = 0;
2540 if (abs_frame_num > 0) {
2544 expectedpoc = poc_cycle_cnt * expected_delta_per_poc_cycle;
2545 for (i = 0; i <= frame_num_in_poc_cycle; i++)
2553 field_poc[0] = expectedpoc + h->
delta_poc[0];
2583 for (i = 0; i < 16; i++) {
2584 #define T(x) (x >> 2) | ((x << 2) & 0xF)
2589 for (i = 0; i < 64; i++) {
2590 #define T(x) (x >> 3) | ((x & 7) << 3)
2642 "hardware accelerator failed to decode picture\n");
2760 "Reenabling low delay requires a codec flush.\n");
2774 "VDPAU decoding does not support video colorspace.\n");
2879 "Could not allocate memory for h264\n");
2890 " reducing to %d\n", nb_slices, max_slices);
2891 nb_slices = max_slices;
2958 unsigned int first_mb_in_slice;
2959 unsigned int pps_id;
2960 int num_ref_idx_active_override_flag, max_refs, ret;
2961 unsigned int slice_type, tmp, i, j;
2962 int default_ref_list_done = 0;
2963 int last_pic_structure, last_pic_droppable;
2964 int needs_reinit = 0;
2978 if (first_mb_in_slice == 0) {
2995 if (slice_type > 9) {
2997 "slice type too large (%d) at %d %d\n",
3001 if (slice_type > 4) {
3010 default_ref_list_done = 1;
3031 "non-existing PPS %u referenced\n",
3039 "non-existing SPS %u referenced\n",
3124 "h264_slice_header_init() failed\n");
3131 "Cannot (re-)initialize context during parallel decoding.\n");
3141 "h264_slice_header_init() failed\n");
3174 "Changing field mode (%d -> %d) between slices is not allowed\n",
3181 "unset cur_pic_ptr on %d. slice\n",
3192 if (unwrap_prev_frame_num > h->
frame_num)
3193 unwrap_prev_frame_num -= max_frame_num;
3197 if (unwrap_prev_frame_num < 0)
3198 unwrap_prev_frame_num += max_frame_num;
3224 if (!last_pic_droppable && last_pic_structure !=
PICT_FRAME) {
3234 if (!last_pic_droppable && last_pic_structure !=
PICT_FRAME) {
3245 "Invalid field mode combination %d/%d\n",
3250 }
else if (last_pic_droppable != h->
droppable) {
3252 "Cannot combine reference and non-reference fields in the same frame\n");
3354 first_mb_in_slice >= h->
mb_num) {
3401 num_ref_idx_active_override_flag =
get_bits1(&h->
gb);
3403 if (num_ref_idx_active_override_flag) {
3432 if (!default_ref_list_done)
3450 for (i = 0; i < 2; i++) {
3513 "deblocking_filter_idc %u out of range\n", tmp);
3528 "deblocking filter parameters %d %d out of range\n",
3553 "Cannot parallelize deblocking type 1, decoding such frames in sequential order\n");
3558 "Deblocking switched inside frame.\n");
3574 "Too many slices, increase MAX_SLICES and recompile\n");
3577 for (j = 0; j < 2; j++) {
3580 for (i = 0; i < 16; i++) {
3600 for (i = 0; i < 16; i++)
3601 ref2frm[i + 2] = 4 * id_list[i] +
3604 ref2frm[18 + 1] = -1;
3605 for (i = 16; i < 48; i++)
3606 ref2frm[i + 4] = 4 * id_list[(i - 16) >> 1] +
3619 "slice:%d %s mb:%d %c%s%s pps:%u frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n",
3660 int mb_type,
int top_xy,
3663 int left_type[LEFT_MBS],
3664 int mb_xy,
int list)
3671 const int b_xy = h->
mb2b_xy[top_xy] + 3 * b_stride;
3672 const int b8_xy = 4 * top_xy + 2;
3675 ref_cache[0 - 1 * 8] =
3677 ref_cache[2 - 1 * 8] =
3687 const int b8_xy = 4 * left_xy[
LTOP] + 1;
3695 ref_cache[-1 + 16] =
3696 ref_cache[-1 + 24] = ref2frm[list][h->
cur_pic.
f.
ref_index[list][b8_xy + 2 * 1]];
3704 ref_cache[-1 + 16] =
3722 uint32_t ref01 = (
pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;
3723 uint32_t ref23 = (
pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101;
3724 AV_WN32A(&ref_cache[0 * 8], ref01);
3725 AV_WN32A(&ref_cache[1 * 8], ref01);
3726 AV_WN32A(&ref_cache[2 * 8], ref23);
3727 AV_WN32A(&ref_cache[3 * 8], ref23);
3732 AV_COPY128(mv_dst + 8 * 0, mv_src + 0 * b_stride);
3733 AV_COPY128(mv_dst + 8 * 1, mv_src + 1 * b_stride);
3734 AV_COPY128(mv_dst + 8 * 2, mv_src + 2 * b_stride);
3735 AV_COPY128(mv_dst + 8 * 3, mv_src + 3 * b_stride);
3745 const int mb_xy = h->
mb_xy;
3756 left_xy[
LBOT] = left_xy[
LTOP] = mb_xy - 1;
3761 if (left_mb_field_flag != curr_mb_field_flag)
3764 if (curr_mb_field_flag)
3767 if (left_mb_field_flag != curr_mb_field_flag)
3781 if (qp <= qp_thresh &&
3782 (left_xy[
LTOP] < 0 ||
3788 if ((left_xy[
LTOP] < 0 ||
3803 left_type[
LTOP] = left_type[
LBOT] = 0;
3808 left_type[
LTOP] = left_type[
LBOT] = 0;
3818 top_type, left_type, mb_xy, 0);
3821 top_type, left_type, mb_xy, 1);
3825 AV_COPY32(&nnz_cache[4 + 8 * 1], &nnz[0]);
3826 AV_COPY32(&nnz_cache[4 + 8 * 2], &nnz[4]);
3827 AV_COPY32(&nnz_cache[4 + 8 * 3], &nnz[8]);
3828 AV_COPY32(&nnz_cache[4 + 8 * 4], &nnz[12]);
3833 AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[3 * 4]);
3836 if (left_type[
LTOP]) {
3838 nnz_cache[3 + 8 * 1] = nnz[3 + 0 * 4];
3839 nnz_cache[3 + 8 * 2] = nnz[3 + 1 * 4];
3840 nnz_cache[3 + 8 * 3] = nnz[3 + 2 * 4];
3841 nnz_cache[3 + 8 * 4] = nnz[3 + 3 * 4];
3848 nnz_cache[4 + 8 * 0] =
3849 nnz_cache[5 + 8 * 0] = (h->
cbp_table[top_xy] & 0x4000) >> 12;
3850 nnz_cache[6 + 8 * 0] =
3851 nnz_cache[7 + 8 * 0] = (h->
cbp_table[top_xy] & 0x8000) >> 12;
3854 nnz_cache[3 + 8 * 1] =
3855 nnz_cache[3 + 8 * 2] = (h->
cbp_table[left_xy[
LTOP]] & 0x2000) >> 12;
3858 nnz_cache[3 + 8 * 3] =
3859 nnz_cache[3 + 8 * 4] = (h->
cbp_table[left_xy[
LBOT]] & 0x8000) >> 12;
3863 nnz_cache[
scan8[0]] =
3864 nnz_cache[scan8[1]] =
3865 nnz_cache[scan8[2]] =
3866 nnz_cache[scan8[3]] = (h->
cbp & 0x1000) >> 12;
3868 nnz_cache[scan8[0 + 4]] =
3869 nnz_cache[scan8[1 + 4]] =
3870 nnz_cache[scan8[2 + 4]] =
3871 nnz_cache[scan8[3 + 4]] = (h->
cbp & 0x2000) >> 12;
3873 nnz_cache[scan8[0 + 8]] =
3874 nnz_cache[scan8[1 + 8]] =
3875 nnz_cache[scan8[2 + 8]] =
3876 nnz_cache[scan8[3 + 8]] = (h->
cbp & 0x4000) >> 12;
3878 nnz_cache[scan8[0 + 12]] =
3879 nnz_cache[scan8[1 + 12]] =
3880 nnz_cache[scan8[2 + 12]] =
3881 nnz_cache[scan8[3 + 12]] = (h->
cbp & 0x8000) >> 12;
3890 uint8_t *dest_y, *dest_cb, *dest_cr;
3891 int linesize, uvlinesize, mb_x, mb_y;
3898 for (mb_x = start_x; mb_x < end_x; mb_x++)
3899 for (mb_y = end_mb_y -
FRAME_MBAFF; mb_y <= end_mb_y; mb_y++) {
3913 ((mb_x << pixel_shift) + mb_y * h->
linesize) * 16;
3915 (mb_x << pixel_shift) * (8 <<
CHROMA444) +
3918 (mb_x << pixel_shift) * (8 <<
CHROMA444) +
3943 linesize, uvlinesize);
3946 dest_cr, linesize, uvlinesize);
3978 if ((top + height) >= pic_height)
3979 height += deblock_border;
3980 top -= deblock_border;
3986 height =
FFMIN(height, pic_height - top);
3987 if (top < h->emu_edge_height) {
4002 int endx,
int endy,
int status)
4013 int lf_x_start = h->
mb_x;
4058 if (h->
mb_x >= lf_x_start)
4064 "error while decoding MB %d %d, bytestream (%td)\n",
4074 h->
mb_x = lf_x_start = 0;
4089 if (h->
mb_x > lf_x_start)
4113 "error while decoding MB %d %d\n", h->
mb_x, h->
mb_y);
4121 h->
mb_x = lf_x_start = 0;
4156 if (h->
mb_x > lf_x_start)
4185 "Input contains more MB rows than the frame height.\n");
4192 if (context_count == 1) {
4195 for (i = 1; i < context_count; i++) {
4201 NULL, context_count,
sizeof(
void *));
4209 for (i = 1; i < context_count; i++)
4217 int parse_extradata)
4225 int nals_needed = 0;
4236 for (; pass <= 1; pass++) {
4239 next_avc = h->
is_avc ? 0 : buf_size;
4249 if (buf_index >= next_avc) {
4254 nalsize = (nalsize << 8) | buf[buf_index++];
4255 if (nalsize <= 0 || nalsize > buf_size - buf_index) {
4257 "AVC: nal size %d\n", nalsize);
4260 next_avc = buf_index + nalsize;
4263 for (; buf_index + 3 < next_avc; buf_index++)
4265 if (buf[buf_index] == 0 &&
4266 buf[buf_index + 1] == 0 &&
4267 buf[buf_index + 2] == 1)
4270 if (buf_index + 3 >= buf_size) {
4271 buf_index = buf_size;
4276 if (buf_index >= next_avc)
4283 &consumed, next_avc - buf_index);
4284 if (ptr ==
NULL || dst_length < 0) {
4288 i = buf_index + consumed;
4290 buf[i] == 0x00 && buf[i + 1] == 0x00 &&
4291 buf[i + 2] == 0x01 && buf[i + 3] == 0xE0)
4295 while (dst_length > 0 && ptr[dst_length - 1] == 0)
4297 bit_length = !dst_length ? 0
4303 "NAL %d at %d/%d length %d\n",
4306 if (h->
is_avc && (nalsize != consumed) && nalsize)
4308 "AVC: Consumed only %d bytes instead of %d\n",
4311 buf_index += consumed;
4322 nals_needed = nal_index;
4329 nals_needed = nal_index;
4355 "Invalid mix of idr and non-idr slices\n");
4395 &buf[buf_index - consumed],
4400 static const uint8_t start_code[] = {
4403 sizeof(start_code));
4413 "Decoding in chunks is not supported for "
4414 "partitioned slices.\n");
4459 h->
is_avc && (nalsize != consumed) && nalsize) {
4461 "SPS decoding failure, trying again with the complete NAL\n");
4498 }
else if (err == 1) {
4531 if (pos + 10 > buf_size)
4541 int buf_size = avpkt->
size;
4553 if (buf_size == 0) {
4615 assert(pict->
data[0] || !*got_frame);
4685 #if CONFIG_H264_VDPAU_DECODER
4686 AVCodec ff_h264_vdpau_decoder = {
4687 .
name =
"h264_vdpau",
4696 .long_name =
NULL_IF_CONFIG_SMALL(
"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"),
uint8_t * scratchpad
data area for the ME algo, so that the ME does not need to malloc/free
Picture default_ref_list[2][32]
base reference list for all slices of a coded picture
#define PICT_BOTTOM_FIELD
#define CONFIG_H264_VDPAU_DECODER
void ff_h264_direct_dist_scale_factor(H264Context *const h)
enum AVPixelFormat ff_hwaccel_pixfmt_list_420[]
int video_signal_type_present_flag
int ff_h264_decode_mb_cabac(H264Context *h)
Decode a CABAC coded macroblock.
static void clone_tables(H264Context *dst, H264Context *src, int i)
Mimic alloc_tables(), but for every context thread.
#define FF_PROFILE_H264_CONSTRAINED
const struct AVCodec * codec
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int ff_h264_decode_seq_parameter_set(H264Context *h)
Decode SPS.
discard all frames except keyframes
uint8_t * edge_emu_buffer
int(* start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Called at the beginning of each frame or field picture.
av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
void(* prefetch)(uint8_t *buf, ptrdiff_t stride, int h)
Prefetch memory into cache (if supported by hardware).
#define MAX_PICTURE_COUNT
unsigned int top_samples_available
static enum PixelFormat get_pixel_format(H264Context *h)
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, int parse_extradata)
unsigned int topleft_samples_available
int single_decode_warning
1 if the single thread fallback warning has already been displayed, 0 otherwise.
5: top field, bottom field, top field repeated, in that order
static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, int mb_type, int is_h264, int simple, int transform_bypass, int pixel_shift, int *block_offset, int linesize, uint8_t *dest_y, int p)
const uint8_t ff_zigzag_direct[64]
GetBitContext * intra_gb_ptr
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
int qstride
QP store stride.
#define FF_PROFILE_H264_INTRA
static void copy_parameter_set(void **to, void **from, int count, int size)
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
#define FF_PROFILE_H264_MAIN
int coded_width
Bitstream width / height, may be different from width/height.
3: top field, bottom field, in that order
const uint8_t * ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length)
Decode a network abstraction layer unit.
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.
int chroma_qp_index_offset[2]
const uint8_t * bytestream_end
av_cold int ff_h264_decode_init(AVCodecContext *avctx)
int luma_weight_flag[2]
7.4.3.2 luma_weight_lX_flag
MMCO mmco[MAX_MMCO_COUNT]
memory management control operations buffer.
static void align_get_bits(GetBitContext *s)
void * hwaccel_picture_private
hardware accelerator private data (Libav-allocated)
void ff_er_frame_end(ERContext *s)
static av_always_inline void mc_part_weighted(H264Context *h, int n, int square, int height, int delta, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int x_offset, int y_offset, qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, h264_weight_func luma_weight_op, h264_weight_func chroma_weight_op, h264_biweight_func luma_weight_avg, h264_biweight_func chroma_weight_avg, int list0, int list1, int pixel_shift, int chroma_idc)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
static const uint8_t field_scan8x8[64]
static void init_dequant_tables(H264Context *h)
void(* draw_edges)(uint8_t *buf, int wrap, int width, int height, int w, int h, int sides)
int bitstream_restriction_flag
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
void(* h264_idct_add16intra)(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[15 *8])
int repeat_pict
When decoding, this signals how much the picture must be delayed.
int needs_realloc
Picture needs to be reallocated (eg due to a frame size change)
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
#define CODEC_CAP_HWACCEL_VDPAU
int16_t(*[2] motion_val_base)[2]
HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the b...
#define CONFIG_SVQ3_DECODER
void * thread_opaque
used by multithreading to store frame-specific info
static av_always_inline int dctcoef_get(DCTELEM *mb, int high_bit_depth, int index)
int field_picture
whether or not the picture was encoded in separate fields
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 void release_unused_pictures(H264Context *h, int remove_current)
#define FF_QSCALE_TYPE_H264
const uint8_t * field_scan8x8_q0
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int is_avc
Used to parse AVC variant of h264.
static av_always_inline void fill_filter_caches_inter(H264Context *h, int mb_type, int top_xy, int left_xy[LEFT_MBS], int top_type, int left_type[LEFT_MBS], int mb_xy, int list)
static int decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
uint8_t zigzag_scan8x8_cavlc[64]
int ff_h264_get_profile(SPS *sps)
Compute profile from profile_idc and constraint_set?_flags.
uint32_t dequant8_buffer[6][QP_MAX_NUM+1][64]
int16_t mv_cache[2][5 *8][2]
Motion vector cache.
static int context_init(H264Context *h)
Init context Allocate buffers which are not shared amongst multiple threads.
int mmco_reset
h264 MMCO_RESET set this 1. Reordering code must not mix pictures before and after MMCO_RESET...
#define FF_PROFILE_H264_HIGH_422
int prev_poc_msb
poc_msb of the last reference pic for POC type 0
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
uint32_t num_units_in_tick
#define FF_PROFILE_H264_HIGH_444_INTRA
struct H264Context H264Context
H264Context.
4: bottom field, top field, in that order
static int get_lowest_part_list_y(H264Context *h, Picture *pic, int n, int height, int y_offset, int list)
#define AV_PIX_FMT_YUV444P10
void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc)
#define FF_PROFILE_H264_HIGH_444
int slice_type_nos
S free slice type (SI/SP are remapped to I/P)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static const uint8_t rem6[QP_MAX_NUM+1]
unsigned current_sps_id
id of the current SPS
static av_always_inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, int height, int delta, int list, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int src_x_offset, int src_y_offset, qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op, int pixel_shift, int chroma_idc)
static av_always_inline uint32_t pack16to32(int a, int b)
static const uint8_t zigzag_scan[16]
#define AV_PIX_FMT_YUV420P9
void ff_h264_init_cabac_states(H264Context *h)
#define FF_PROFILE_H264_CAVLC_444
#define USES_LIST(a, list)
does this mb use listX, note does not work if subMBs
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
uint8_t * chroma_pred_mode_table
#define IS_DIR(a, part, list)
static const uint8_t div6[QP_MAX_NUM+1]
enum AVDiscard skip_frame
int ff_h264_decode_ref_pic_list_reordering(H264Context *h)
static const uint8_t golomb_to_pict_type[5]
struct AVHWAccel * hwaccel
Hardware accelerator in use.
int long_ref
1->long term reference 0->short term reference
static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, int mb_type, int is_h264, int simple, int transform_bypass, int pixel_shift, int *block_offset, int linesize, uint8_t *dest_y, int p)
static int decode_init_thread_copy(AVCodecContext *avctx)
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
uint8_t scaling_matrix4[6][16]
const uint8_t * bytestream
int ref2frm[MAX_SLICES][2][64]
reference to frame number lists, used in the loop filter, the first 2 are for -2,-1 ...
void(* emulated_edge_mc)(uint8_t *buf, const uint8_t *src, ptrdiff_t 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...
int deblocking_filter_parameters_present
deblocking_filter_parameters_present_flag
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE
DCTELEM mb_luma_dc[3][16 *2]
uint32_t(*[6] dequant4_coeff)[16]
int prev_frame_num_offset
for POC type 2
void(* h264_luma_dc_dequant_idct)(DCTELEM *output, DCTELEM *input, int qmul)
int offset_for_non_ref_pic
#define AV_PIX_FMT_GBRP10
void ff_h264_reset_sei(H264Context *h)
Reset SEI values at the beginning of the frame.
int luma_weight[48][2][2]
void(* qpel_mc_func)(uint8_t *dst, uint8_t *src, int stride)
enum AVColorPrimaries color_primaries
av_cold void ff_h264_decode_init_vlc(void)
void(* h264_idct_add)(uint8_t *dst, DCTELEM *block, int stride)
DCTELEM mb[16 *48 *2]
as a dct coeffecient is int32_t in high depth, we need to reserve twice the space.
static int find_unused_picture(H264Context *h)
Picture ref_list[2][48]
0..15: frame refs, 16..47: mbaff field refs.
int cabac
entropy_coding_mode_flag
qpel_mc_func(* qpel_put)[16]
#define LUMA_DC_BLOCK_INDEX
#define DIAG_DOWN_LEFT_PRED
uint8_t motion_subsample_log2
log2 of the size of the block which a single vector in motion_val represents: (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
static const uint8_t dequant8_coeff_init[6][6]
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
unsigned int crop_right
frame_cropping_rect_right_offset
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define AV_PIX_FMT_YUV420P10
void ff_h264_fill_mbaff_ref_list(H264Context *h)
int transform_bypass
qpprime_y_zero_transform_bypass_flag
static int init_poc(H264Context *h)
static int get_bits_count(const GetBitContext *s)
static int decode_rbsp_trailing(H264Context *h, const uint8_t *src)
Identify the exact end of the bitstream.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
int ff_h264_get_slice_type(const H264Context *h)
Reconstruct bitstream slice_type.
int redundant_pic_cnt_present
redundant_pic_cnt_present_flag
#define AV_PIX_FMT_YUV444P9
static const uint8_t dequant8_coeff_init_scan[16]
int interlaced_frame
The content of the picture is interlaced.
#define MAX_DELAYED_PIC_COUNT
void(* pred4x4[9+3+3])(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
Picture * next_output_pic
#define FF_COMPLIANCE_STRICT
static av_cold void common_init(H264Context *h)
void * owner2
pointer to the context that allocated this picture
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
int luma_log2_weight_denom
static int h264_set_parameter_from_sps(H264Context *h)
int chroma_weight[48][2][2][2]
static int init(AVCodecParserContext *s)
int last_pocs[MAX_DELAYED_PIC_COUNT]
static void init_dequant4_coeff_table(H264Context *h)
static int pic_is_unused(H264Context *h, Picture *pic)
void(* pred8x8l_add[2])(uint8_t *pix, const DCTELEM *block, ptrdiff_t stride)
const uint8_t * zigzag_scan8x8_cavlc_q0
H.264 / AVC / MPEG4 part10 codec.
static void free_picture(H264Context *h, Picture *pic)
static int get_bits_left(GetBitContext *gb)
void ff_thread_finish_setup(AVCodecContext *avctx)
If the codec defines update_thread_context(), call this when they are ready for the next thread to st...
int mb_aff
mb_adaptive_frame_field_flag
enum AVColorTransferCharacteristic color_trc
void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
Set the intra prediction function pointers.
int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...
int has_b_frames
Size of the frame reordering buffer in the decoder.
#define FF_PROFILE_H264_HIGH_10
static int get_ue_golomb(GetBitContext *gb)
read unsigned exp golomb code.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static int decode_slice_header(H264Context *h, H264Context *h0)
Decode a slice header.
static int get_consumed_bytes(int pos, int buf_size)
Return the number of bytes consumed for building the current frame.
const uint8_t * zigzag_scan_q0
int poc_type
pic_order_cnt_type
void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
static void free_frame_buffer(H264Context *h, Picture *pic)
Multithreading support functions.
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
void(* h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height, int log2_denom, int weightd, int weights, int offset)
static const uint16_t mask[17]
void ff_h264_hl_decode_mb(H264Context *h)
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
ParseContext parse_context
int is_copy
Whether the parent AVCodecContext is a copy of the context which had init() called on it...
discard all bidirectional frames
void ff_h264_direct_ref_list_init(H264Context *const h)
static av_always_inline int get_chroma_qp(H264Context *h, int t, int qscale)
Get the chroma qp.
GetBitContext * inter_gb_ptr
void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp)
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.
#define ALZHEIMER_DC_L0T_PRED8x8
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Picture * delayed_pic[MAX_DELAYED_PIC_COUNT+2]
int active_thread_type
Which multithreading methods are in use by the codec.
int mb_field_decoding_flag
#define FF_DEBUG_PICT_INFO
static void flush_dpb(AVCodecContext *avctx)
static int h264_slice_header_init(H264Context *, int)
int capabilities
Codec capabilities.
uint8_t * base[AV_NUM_DATA_POINTERS]
pointer to the first allocated byte of the picture.
void(* decode_mb)(void *opaque, int ref, int mv_dir, int mv_type, int(*mv)[2][4][2], int mb_x, int mb_y, int mb_intra, int mb_skipped)
uint8_t(*[2] mvd_table)[2]
int prev_interlaced_frame
Complement sei_pic_struct SEI_PIC_STRUCT_TOP_BOTTOM and SEI_PIC_STRUCT_BOTTOM_TOP indicate interlaced...
struct Picture * next_pic
int direct_spatial_mv_pred
#define CODEC_FLAG_LOW_DELAY
simple assert() macros that are a bit more flexible than ISO C assert().
void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
int weighted_pred
weighted_pred_flag
int overread_index
the index into ParseContext.buffer of the overread bytes
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
void(* h264_chroma_mc_func)(uint8_t *dst, uint8_t *src, int srcStride, int h, int x, int y)
static void predict_field_decoding_flag(H264Context *h)
int ff_h264_decode_mb_cavlc(H264Context *h)
Decode a macroblock.
#define CODEC_FLAG_EMU_EDGE
uint8_t * list_counts
Array of list_count per MB specifying the slice type.
static void er_add_slice(H264Context *h, int startx, int starty, int endx, int endy, int status)
int delta_pic_order_always_zero_flag
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
int new
flag to keep track if the decoder context needs re-init due to changed SPS
int dct_bits
Size of DCT coefficients.
int offset_for_top_to_bottom_field
#define IN_RANGE(a, b, size)
int priv_data_size
Size of HW accelerator private data.
uint8_t zigzag_scan8x8[64]
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static const uint8_t scan8[16 *3+3]
void(* add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size)
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
the normal 2^n-1 "JPEG" YUV ranges
uint8_t * error_status_table
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static av_always_inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg, int chroma444, int simple, int pixel_shift)
uint8_t scaling_matrix8[6][64]
static void copy_picture_range(Picture **to, Picture **from, int count, H264Context *new_base, H264Context *old_base)
int nal_length_size
Number of bytes used for nal length (1, 2 or 4)
useful rectangle filling function
the normal 219*2^(n-8) "MPEG" YUV ranges
int refs
number of reference frames
unsigned int left_samples_available
static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, int(*mv)[2][4][2], int mb_x, int mb_y, int mb_intra, int mb_skipped)
int ref_frame_count
num_ref_frames
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
#define FF_PROFILE_H264_CONSTRAINED_BASELINE
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
void ff_h264_filter_mb(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize)
struct Picture * last_pic
int frame_num_offset
for POC type 2
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
int overread
the number of bytes which where irreversibly read from the next frame
uint16_t * slice_table
slice_table_base + 2*mb_stride + 1
uint8_t field_scan8x8_cavlc[64]
int poc_cycle_length
num_ref_frames_in_pic_order_cnt_cycle
int colour_description_present_flag
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
void ff_vdpau_h264_picture_complete(H264Context *h)
static const uint8_t field_scan8x8_cavlc[64]
int width
picture width / height.
int long_ref_count
number of actual long term references
qpel_mc_func avg_2tap_qpel_pixels_tab[4][16]
#define CODEC_CAP_FRAME_THREADS
void(* pred4x4_add[2])(uint8_t *pix, const DCTELEM *block, ptrdiff_t stride)
static void implicit_weight_table(H264Context *h, int field)
Initialize implicit_weight table.
PPS * pps_buffers[MAX_PPS_COUNT]
static av_always_inline void prefetch_motion(H264Context *h, int list, int pixel_shift, int chroma_idc)
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static void fill_rectangle(SDL_Surface *screen, int x, int y, int w, int h, int color)
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
Decode PPS.
Context Adaptive Binary Arithmetic Coder inline functions.
int init_qp
pic_init_qp_minus26 + 26
int frame_num
h264 frame_num (raw frame_num from slice header)
int8_t intra4x4_pred_mode_cache[5 *8]
uint8_t * bipred_scratchpad
int max_pic_num
max_frame_num or 2 * max_frame_num for field pics.
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
static const uint8_t field_scan[16]
int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)
#define FF_PROFILE_H264_HIGH
static int decode_slice(struct AVCodecContext *avctx, void *arg)
unsigned int topright_samples_available
const uint8_t * zigzag_scan8x8_q0
#define CODEC_FLAG2_CHUNKS
int curr_pic_num
frame_num for frames or 2 * frame_num + 1 for field pics.
static void init_scan_tables(H264Context *h)
initialize scan tables
static int av_unused get_cabac_terminate(CABACContext *c)
#define DELAYED_PIC_REF
Value of Picture.reference when Picture is not a reference picture, but is held for delayed output...
void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, Picture *last, int y, int h, int picture_structure, int first_field, int draw_edges, int low_delay, int v_edge_pos, int h_edge_pos)
#define FF_PROFILE_H264_HIGH_422_INTRA
static void loop_filter(H264Context *h, int start_x, int end_x)
uint32_t dequant4_buffer[6][QP_MAX_NUM+1][16]
void(* h264_idct8_dc_add)(uint8_t *dst, DCTELEM *block, int stride)
void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
#define PART_NOT_AVAILABLE
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
int dequant_coeff_pps
reinit tables when pps changes
int pic_order_present
pic_order_present_flag
static void idct_add(uint8_t *dest, int line_size, DCTELEM *block)
SPS * sps_buffers[MAX_SPS_COUNT]
void(* h264_idct8_add)(uint8_t *dst, DCTELEM *block, int stride)
static const int8_t mv[256][2]
struct H264Context * thread_context[MAX_THREADS]
int chroma_log2_weight_denom
int bit_depth_luma
luma bit depth from sps to detect changes
uint32_t * mb_type
macroblock type table mb_type_base + mb_width + 2
static void flush_change(H264Context *h)
short offset_for_ref_frame[256]
int chroma_format_idc
chroma format from sps to detect changes
int timing_info_present_flag
static void decode_finish_row(H264Context *h)
Draw edges and report progress for the last MB row.
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
Execute the reference picture marking (memory management control operations).
int coded_picture_number
picture number in bitstream order
#define FF_PROFILE_H264_BASELINE
H264 / AVC / MPEG4 part10 codec data table
int ff_h264_frame_start(H264Context *h)
void ff_thread_await_progress(AVFrame *f, int n, int field)
Wait for earlier decoding threads to finish reference pictures.
int8_t * qscale_table_base
int slice_alpha_c0_offset
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
void ff_h264_remove_all_refs(H264Context *h)
int prev_frame_num
frame_num of the last pic for POC type 1/2
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
static void get_lowest_part_y(H264Context *h, int refs[2][48], int n, int height, int y_offset, int list0, int list1, int *nrefs)
void ff_vdpau_add_data_chunk(uint8_t *data, const uint8_t *buf, int buf_size)
int ff_h264_decode_sei(H264Context *h)
Decode SEI.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int implicit_weight[48][48][2]
int max_contexts
Max number of threads / contexts.
main external API structure.
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
static void close(AVCodecParserContext *s)
int ff_h264_check_intra4x4_pred_mode(H264Context *h)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...
static void decode_postinit(H264Context *h, int setup_finished)
Run setup operations that must be run after slice header decoding.
int ff_h264_alloc_tables(H264Context *h)
Allocate tables.
static enum AVPixelFormat hwaccel_pixfmt_list_h264_jpeg_420[]
int16_t(*[2] motion_val)[2]
motion vector table
static void init_dequant8_coeff_table(H264Context *h)
qpel_mc_func put_2tap_qpel_pixels_tab[4][16]
uint32_t state
contains the last few bytes in MSB order
void(* pred16x16[4+3+2])(uint8_t *src, ptrdiff_t stride)
H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstre...
int constraint_set_flags
constraint_set[0-3]_flag
static unsigned int get_bits1(GetBitContext *s)
SEI_PicStructType sei_pic_struct
pic_struct in picture timing SEI message
void ff_vdpau_h264_set_reference_frames(H264Context *h)
void(* h264_idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride)
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
enum AVPixelFormat(* get_format)(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
callback to negotiate the pixelFormat
const uint8_t * field_scan8x8_cavlc_q0
uint32_t(*[6] dequant8_coeff)[64]
static av_cold int h264_decode_end(AVCodecContext *avctx)
int qp_thresh
QP threshold to skip loopfilter.
enum AVColorSpace colorspace
YUV colorspace type.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
int pixel_shift
0 for 8-bit H264, 1 for high-bit-depth H264
#define FF_INPUT_BUFFER_PADDING_SIZE
int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb, int first_slice)
static void await_references(H264Context *h)
Wait until all reference frames are available for MC operations.
AVHWAccel * ff_find_hwaccel(enum AVCodecID codec_id, enum AVPixelFormat pix_fmt)
Return the hardware accelerated codec for codec codec_id and pixel format pix_fmt.
void(* h264_weight_func)(uint8_t *block, int stride, int height, int log2_denom, int weight, int offset)
#define FF_BUG_AUTODETECT
int8_t * ref_index[2]
motion reference frame index the order in which these are stored can depend on the codec...
int log2_max_poc_lsb
log2_max_pic_order_cnt_lsb_minus4
6: bottom field, top field, bottom field repeated, in that order
void(* h264_idct8_add4)(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[15 *8])
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer. ...
#define CODEC_CAP_SLICE_THREADS
void ff_h264_draw_horiz_band(H264Context *h, int y, int height)
int block_offset[2 *(16 *3)]
block_offset[ 0..23] for frame macroblocks block_offset[24..47] for field macroblocks ...
int field_poc[2]
h264 top/bottom POC
int transform_8x8_mode
transform_8x8_mode_flag
static int pred_weight_table(H264Context *h)
int pic_struct_present_flag
av_cold void ff_h264_free_context(H264Context *h)
Free any data that may have been allocated in the H264 context like SPS, PPS etc. ...
qpel_mc_func put_h264_qpel_pixels_tab[4][16]
#define FIELD_OR_MBAFF_PICTURE
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int8_t * qscale_table
QP table.
qpel_mc_func(* qpel_avg)[16]
#define FF_PROFILE_H264_HIGH_10_INTRA
void ff_h264_filter_mb_fast(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize)
void(* clear_blocks)(DCTELEM *blocks)
#define AV_PIX_FMT_YUV422P10
static void idr(H264Context *h)
instantaneous decoder refresh.
static int field_end(H264Context *h, int in_setup)
hardware decoding through VDA
discard all non reference
#define FF_PROFILE_H264_EXTENDED
int mb_height
pic_height_in_map_units_minus1 + 1
qpel_mc_func avg_h264_qpel_pixels_tab[4][16]
static const uint8_t dequant4_coeff_init[6][3]
common internal api header.
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)
static av_cold void flush(AVCodecContext *avctx)
Flush (reset) the frame ID after seeking.
uint16_t * slice_table_base
int log2_max_frame_num
log2_max_frame_num_minus4 + 4
void ff_vdpau_h264_picture_start(H264Context *h)
#define AVERROR_INVALIDDATA
H.264 / AVC / MPEG4 part10 motion vector predicion.
#define AV_PIX_FMT_YUV422P9
static int execute_decode_slices(H264Context *h, int context_count)
Call decode_slice() for each context.
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
int workaround_bugs
Work around bugs in encoders which sometimes cannot be detected automatically.
int cur_chroma_format_idc
enum AVDiscard skip_loop_filter
int sei_ct_type
Bit set of clock types for fields/frames in picture timing SEI message.
#define AVERROR_PATCHWELCOME
int bit_depth_luma
bit_depth_luma_minus8 + 8
int prev_poc_lsb
poc_lsb of the last reference pic for POC type 0
void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size)
static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int simple)
int(* execute)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size)
The codec may call this to execute several independent things.
int top_field_first
If the content is interlaced, is top field displayed first.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
const uint16_t ff_h264_mb_sizes[4]
void(* h264_idct_add16)(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[15 *8])
uint8_t non_zero_count_cache[15 *8]
non zero coeff count cache.
int ff_h264_decode_extradata(H264Context *h)
uint8_t(*[2] top_borders)[(16 *3)*2]
struct AVCodecInternal * internal
Private context used for internal data.
void ff_init_cabac_states(CABACContext *c)
static int fill_filter_caches(H264Context *h, int mb_type)
void(* add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size)
int key_frame
1 -> keyframe, 0-> not
enum AVPictureType pict_type
int current_slice
current slice number, used to initalize slice_num of each thread/context
int mb_width
pic_width_in_mbs_minus1 + 1
const uint8_t * field_scan_q0
static void * av_mallocz_array(size_t nmemb, size_t size)
static void free_tables(H264Context *h, int free_rbsp)
int ff_h264_fill_default_ref_list(H264Context *h)
Fill the default_ref_list.
#define REBASE_PICTURE(pic, new_ctx, old_ctx)
void ff_er_frame_start(ERContext *s)
uint8_t field_scan8x8[64]
#define FF_DEBUG_STARTCODE
#define copy_fields(to, from, start_field, end_field)
int chroma_weight_flag[2]
7.4.3.2 chroma_weight_lX_flag
static av_always_inline void mc_part_std(H264Context *h, int n, int square, int height, int delta, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int x_offset, int y_offset, qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg, int list0, int list1, int pixel_shift, int chroma_idc)
int8_t * intra4x4_pred_mode
static av_always_inline void dctcoef_set(DCTELEM *mb, int high_bit_depth, int index, int value)
void ff_thread_report_progress(AVFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around get_buffer() for frame-multithreaded codecs.
int mb_linesize
may be equal to s->linesize or s->linesize * 2, for mbaff
static int clone_slice(H264Context *dst, H264Context *src)
Replicate H264 "master" context to thread contexts.
int(* decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Callback for each slice.
int deblocking_filter
disable_deblocking_filter_idc with 1 <-> 0
static int alloc_scratch_buffers(H264Context *h, int linesize)
uint8_t ** extended_data
pointers to the data planes/channels.
int(* end_frame)(AVCodecContext *avctx)
Called at the end of each frame or field picture.
static int alloc_picture(H264Context *h, Picture *pic)
uint8_t(* non_zero_count)[48]
unsigned int crop_bottom
frame_cropping_rect_bottom_offset
AVPixelFormat
Pixel format.
This structure stores compressed data.
int sei_recovery_frame_cnt
recovery_frame_cnt from SEI message
static const uint8_t zigzag_scan8x8_cavlc[64]
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int strict_std_compliance
strictly follow the standard (MPEG4, ...).
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
void(* pred8x8l[9+3])(uint8_t *src, int topleft, int topright, ptrdiff_t stride)
void(* pred16x16_add[3])(uint8_t *pix, const int *block_offset, const DCTELEM *block, ptrdiff_t stride)
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)
unsigned int rbsp_buffer_size[2]
Context Adaptive Binary Arithmetic Coder.
#define FF_PROFILE_UNKNOWN
int8_t ref_cache[2][5 *8]
int mb_mbaff
mb_aff_frame && mb_field_decoding_flag
int short_ref_count
number of actual short term references
static const AVProfile profiles[]
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)
enum AVColorSpace colorspace