42 const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 };
87 int pic_size_in_ctb = ((width >> log2_min_cb_size) + 1) *
88 ((height >> log2_min_cb_size) + 1);
142 uint8_t luma_weight_l0_flag[16];
143 uint8_t chroma_weight_l0_flag[16];
144 uint8_t luma_weight_l1_flag[16];
145 uint8_t chroma_weight_l1_flag[16];
155 if (!luma_weight_l0_flag[i]) {
162 chroma_weight_l0_flag[i] =
get_bits1(gb);
165 chroma_weight_l0_flag[i] = 0;
168 if (luma_weight_l0_flag[i]) {
173 if (chroma_weight_l0_flag[i]) {
174 for (j = 0; j < 2; j++) {
191 if (!luma_weight_l1_flag[i]) {
198 chroma_weight_l1_flag[i] =
get_bits1(gb);
201 chroma_weight_l1_flag[i] = 0;
204 if (luma_weight_l1_flag[i]) {
209 if (chroma_weight_l1_flag[i]) {
210 for (j = 0; j < 2; j++) {
231 int prev_delta_msb = 0;
232 unsigned int nb_sps = 0, nb_sh;
248 for (i = 0; i < rps->
nb_refs; i++) {
265 if (delta_poc_msb_present) {
268 if (i && i != nb_sps)
269 delta += prev_delta_msb;
272 prev_delta_msb =
delta;
287 for (i = 0; frame->
data[i]; i++) {
300 unsigned int num = 0, den = 0;
353 if (num != 0 && den != 0)
420 int slice_address_length;
430 "Invalid slice segment address: %u.\n",
473 int short_term_ref_pic_set_sps_flag, poc;
479 "Ignoring POC change between slices: %d -> %d\n", s->
poc, poc);
486 short_term_ref_pic_set_sps_flag =
get_bits1(gb);
487 if (!short_term_ref_pic_set_sps_flag) {
494 int numbits, rps_idx;
502 rps_idx = numbits > 0 ?
get_bits(gb, numbits) : 0;
603 "Invalid collocated_ref_idx: %d.\n",
618 "Invalid number of merging MVP candidates: %d.\n",
640 int deblocking_filter_override_flag = 0;
643 deblocking_filter_override_flag =
get_bits1(gb);
645 if (deblocking_filter_override_flag) {
680 int segments = offset_len >> 4;
681 int rest = (offset_len & 15);
695 for (j = 0; j < segments; j++) {
720 for (i = 0; i <
length; i++)
729 "The slice_qp %d is outside the valid range "
761 #define CTB(tab, x, y) ((tab)[(y) * s->sps->ctb_width + (x)])
763 #define SET_SAO(elem, value) \
765 if (!sao_merge_up_flag && !sao_merge_left_flag) \
767 else if (sao_merge_left_flag) \
768 sao->elem = CTB(s->sao, rx-1, ry).elem; \
769 else if (sao_merge_up_flag) \
770 sao->elem = CTB(s->sao, rx, ry-1).elem; \
778 int sao_merge_left_flag = 0;
779 int sao_merge_up_flag = 0;
789 if (ry > 0 && !sao_merge_left_flag) {
795 for (c_idx = 0; c_idx < 3; c_idx++) {
814 for (i = 0; i < 4; i++)
818 for (i = 0; i < 4; i++) {
827 }
else if (c_idx != 2) {
833 for (i = 0; i < 4; i++) {
841 sao->
offset_val[c_idx][i + 1] <<= log2_sao_offset_scale;
853 if (log2_res_scale_abs_plus1 != 0) {
856 (1 - 2 * res_scale_sign_flag);
866 int xBase,
int yBase,
int cb_xBase,
int cb_yBase,
867 int log2_cb_size,
int log2_trafo_size,
868 int trafo_depth,
int blk_idx,
869 int cbf_luma,
int *cbf_cb,
int *cbf_cr)
872 const int log2_trafo_size_c = log2_trafo_size - s->
sps->
hshift[1];
876 int trafo_size = 1 << log2_trafo_size;
882 if (cbf_luma || cbf_cb[0] || cbf_cr[0] ||
886 int cbf_chroma = cbf_cb[0] || cbf_cr[0] ||
888 (cbf_cb[1] || cbf_cr[1]));
900 "The cu_qp_delta %d is outside the valid range "
914 if (cu_chroma_qp_offset_flag) {
915 int cu_chroma_qp_offset_idx = 0;
919 "cu_chroma_qp_offset_idx not yet tested.\n");
953 int trafo_size_h = 1 << (log2_trafo_size_c + s->
sps->
hshift[1]);
954 int trafo_size_v = 1 << (log2_trafo_size_c + s->
sps->
vshift[1]);
965 s->
hpc.
intra_pred[log2_trafo_size_c - 2](
s, x0, y0 + (i << log2_trafo_size_c), 1);
969 log2_trafo_size_c, scan_idx_c, 1);
975 int16_t *coeffs_y = lc->
tu.
coeffs[0];
977 int size = 1 << log2_trafo_size_c;
981 for (i = 0; i < (size *
size); i++) {
994 s->
hpc.
intra_pred[log2_trafo_size_c - 2](
s, x0, y0 + (i << log2_trafo_size_c), 2);
998 log2_trafo_size_c, scan_idx_c, 2);
1004 int16_t *coeffs_y = lc->
tu.
coeffs[0];
1005 int16_t *coeffs = lc->
tu.
coeffs[1];
1006 int size = 1 << log2_trafo_size_c;
1010 for (i = 0; i < (size *
size); i++) {
1016 }
else if (blk_idx == 3) {
1017 int trafo_size_h = 1 << (log2_trafo_size + 1);
1018 int trafo_size_v = 1 << (log2_trafo_size + s->
sps->
vshift[1]);
1022 trafo_size_h, trafo_size_v);
1023 s->
hpc.
intra_pred[log2_trafo_size - 2](
s, xBase, yBase + (i << log2_trafo_size), 1);
1027 log2_trafo_size, scan_idx_c, 1);
1032 trafo_size_h, trafo_size_v);
1033 s->
hpc.
intra_pred[log2_trafo_size - 2](
s, xBase, yBase + (i << log2_trafo_size), 2);
1037 log2_trafo_size, scan_idx_c, 2);
1042 int trafo_size_h = 1 << (log2_trafo_size_c + s->
sps->
hshift[1]);
1043 int trafo_size_v = 1 << (log2_trafo_size_c + s->
sps->
vshift[1]);
1049 trafo_size_h, trafo_size_v);
1050 s->
hpc.
intra_pred[log2_trafo_size_c - 2](
s, x0, y0 + (1 << log2_trafo_size_c), 1);
1051 s->
hpc.
intra_pred[log2_trafo_size_c - 2](
s, x0, y0 + (1 << log2_trafo_size_c), 2);
1053 }
else if (blk_idx == 3) {
1054 int trafo_size_h = 1 << (log2_trafo_size + 1);
1055 int trafo_size_v = 1 << (log2_trafo_size + s->
sps->
vshift[1]);
1057 trafo_size_h, trafo_size_v);
1062 trafo_size_h, trafo_size_v);
1063 s->
hpc.
intra_pred[log2_trafo_size - 2](
s, xBase, yBase + (1 << (log2_trafo_size)), 1);
1064 s->
hpc.
intra_pred[log2_trafo_size - 2](
s, xBase, yBase + (1 << (log2_trafo_size)), 2);
1074 int cb_size = 1 << log2_cb_size;
1082 for (j = (y0 >> log2_min_pu_size); j < (y_end >> log2_min_pu_size); j++)
1083 for (i = (x0 >> log2_min_pu_size); i < (x_end >> log2_min_pu_size); i++)
1084 s->
is_pcm[i + j * min_pu_width] = 2;
1088 int xBase,
int yBase,
int cb_xBase,
int cb_yBase,
1089 int log2_cb_size,
int log2_trafo_size,
1090 int trafo_depth,
int blk_idx,
1091 const int *base_cbf_cb,
const int *base_cbf_cr)
1099 cbf_cb[0] = base_cbf_cb[0];
1100 cbf_cb[1] = base_cbf_cb[1];
1101 cbf_cr[0] = base_cbf_cr[0];
1102 cbf_cr[1] = base_cbf_cr[1];
1105 if (trafo_depth == 1) {
1121 if (log2_trafo_size <= s->sps->log2_max_trafo_size &&
1123 trafo_depth < lc->cu.max_trafo_depth &&
1138 if (trafo_depth == 0 || cbf_cb[0]) {
1145 if (trafo_depth == 0 || cbf_cr[0]) {
1153 if (split_transform_flag) {
1154 const int trafo_size_split = 1 << (log2_trafo_size - 1);
1155 const int x1 = x0 + trafo_size_split;
1156 const int y1 = y0 + trafo_size_split;
1158 #define SUBDIVIDE(x, y, idx) \
1160 ret = hls_transform_tree(s, x, y, x0, y0, cb_xBase, cb_yBase, log2_cb_size, \
1161 log2_trafo_size - 1, trafo_depth + 1, idx, \
1180 cbf_cb[0] || cbf_cr[0] ||
1186 log2_cb_size, log2_trafo_size, trafo_depth,
1187 blk_idx, cbf_luma, cbf_cb, cbf_cr);
1193 for (i = 0; i < (1 << log2_trafo_size); i += min_tu_size)
1194 for (j = 0; j < (1 << log2_trafo_size); j += min_tu_size) {
1195 int x_tu = (x0 + j) >> log2_min_tu_size;
1196 int y_tu = (y0 + i) >> log2_min_tu_size;
1197 s->
cbf_luma[y_tu * min_tu_width + x_tu] = 1;
1214 int cb_size = 1 << log2_cb_size;
1266 int block_w,
int block_h,
int luma_weight,
int luma_offset)
1270 ptrdiff_t srcstride = ref->
linesize[0];
1279 x_off += mv->
x >> 2;
1280 y_off += mv->
y >> 2;
1291 edge_emu_stride, srcstride,
1295 pic_width, pic_height);
1297 srcstride = edge_emu_stride;
1302 block_h, mx, my, block_w);
1306 luma_weight, luma_offset, mx, my, block_w);
1326 AVFrame *ref0,
const Mv *mv0,
int x_off,
int y_off,
1327 int block_w,
int block_h,
AVFrame *ref1,
const Mv *mv1,
struct MvField *current_mv)
1331 ptrdiff_t src0stride = ref0->
linesize[0];
1332 ptrdiff_t src1stride = ref1->
linesize[0];
1335 int mx0 = mv0->
x & 3;
1336 int my0 = mv0->
y & 3;
1337 int mx1 = mv1->
x & 3;
1338 int my1 = mv1->
y & 3;
1341 int x_off0 = x_off + (mv0->
x >> 2);
1342 int y_off0 = y_off + (mv0->
y >> 2);
1343 int x_off1 = x_off + (mv1->
x >> 2);
1344 int y_off1 = y_off + (mv1->
y >> 2);
1358 edge_emu_stride, src0stride,
1362 pic_width, pic_height);
1364 src0stride = edge_emu_stride;
1375 edge_emu_stride, src1stride,
1379 pic_width, pic_height);
1381 src1stride = edge_emu_stride;
1385 block_h, mx0, my0, block_w);
1388 block_h, mx1, my1, block_w);
1418 ptrdiff_t dststride,
uint8_t *src0, ptrdiff_t srcstride,
int reflist,
1419 int x_off,
int y_off,
int block_w,
int block_h,
struct MvField *current_mv,
int chroma_weight,
int chroma_offset)
1424 const Mv *
mv = ¤t_mv->
mv[reflist];
1430 intptr_t mx = mv->
x & ((1 << (2 + hshift)) - 1);
1431 intptr_t my = mv->
y & ((1 << (2 + vshift)) - 1);
1432 intptr_t _mx = mx << (1 - hshift);
1433 intptr_t _my = my << (1 - vshift);
1435 x_off += mv->
x >> (2 + hshift);
1436 y_off += mv->
y >> (2 + vshift);
1447 edge_emu_stride, srcstride,
1451 pic_width, pic_height);
1454 srcstride = edge_emu_stride;
1458 block_h, _mx, _my, block_w);
1462 chroma_weight, chroma_offset, _mx, _my, block_w);
1483 int x_off,
int y_off,
int block_w,
int block_h,
struct MvField *current_mv,
int cidx)
1489 ptrdiff_t src1stride = ref0->
linesize[cidx+1];
1490 ptrdiff_t src2stride = ref1->
linesize[cidx+1];
1495 Mv *mv0 = ¤t_mv->
mv[0];
1496 Mv *mv1 = ¤t_mv->
mv[1];
1500 intptr_t mx0 = mv0->
x & ((1 << (2 + hshift)) - 1);
1501 intptr_t my0 = mv0->
y & ((1 << (2 + vshift)) - 1);
1502 intptr_t mx1 = mv1->
x & ((1 << (2 + hshift)) - 1);
1503 intptr_t my1 = mv1->
y & ((1 << (2 + vshift)) - 1);
1504 intptr_t _mx0 = mx0 << (1 - hshift);
1505 intptr_t _my0 = my0 << (1 - vshift);
1506 intptr_t _mx1 = mx1 << (1 - hshift);
1507 intptr_t _my1 = my1 << (1 - vshift);
1509 int x_off0 = x_off + (mv0->
x >> (2 + hshift));
1510 int y_off0 = y_off + (mv0->
y >> (2 + vshift));
1511 int x_off1 = x_off + (mv1->
x >> (2 + hshift));
1512 int y_off1 = y_off + (mv1->
y >> (2 + vshift));
1514 src1 += y_off0 * src1stride + (int)((
unsigned)x_off0 << s->
sps->
pixel_shift);
1515 src2 += y_off1 * src2stride + (int)((
unsigned)x_off1 << s->
sps->
pixel_shift);
1526 edge_emu_stride, src1stride,
1530 pic_width, pic_height);
1533 src1stride = edge_emu_stride;
1545 edge_emu_stride, src2stride,
1549 pic_width, pic_height);
1552 src2stride = edge_emu_stride;
1556 block_h, _mx0, _my0, block_w);
1559 src2, src2stride, tmp,
1560 block_h, _mx1, _my1, block_w);
1563 src2, src2stride, tmp,
1570 _mx1, _my1, block_w);
1576 int y = (mv->
y >> 2) + y0 + height + 9;
1584 int log2_cb_size,
int partIdx,
int idx)
1586 #define POS(c_idx, x, y) \
1587 &s->frame->data[c_idx][((y) >> s->sps->vshift[c_idx]) * s->frame->linesize[c_idx] + \
1588 (((x) >> s->sps->hshift[c_idx]) << s->sps->pixel_shift)]
1591 struct MvField current_mv = {{{ 0 }}};
1603 int x_cb = x0 >> log2_min_cb_size;
1604 int y_cb = y0 >> log2_min_cb_size;
1619 log2_cb_size, partIdx,
1620 merge_idx, ¤t_mv);
1626 tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv;
1636 partIdx, merge_idx, ¤t_mv);
1642 tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv;
1650 if (inter_pred_idc !=
PRED_L1) {
1653 current_mv.
ref_idx[0] = ref_idx[0];
1659 partIdx, merge_idx, ¤t_mv,
1665 if (inter_pred_idc !=
PRED_L0) {
1668 current_mv.
ref_idx[1] = ref_idx[1];
1680 partIdx, merge_idx, ¤t_mv,
1691 tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv;
1696 ref0 = refPicList[0].
ref[current_mv.
ref_idx[0]];
1702 ref1 = refPicList[1].
ref[current_mv.
ref_idx[1]];
1715 ¤t_mv.
mv[0], x0, y0, nPbW, nPbH,
1720 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1723 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1732 ¤t_mv.
mv[1], x0, y0, nPbW, nPbH,
1737 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1741 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1750 ¤t_mv.
mv[0], x0, y0, nPbW, nPbH,
1751 ref1->
frame, ¤t_mv.
mv[1], ¤t_mv);
1754 x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0);
1757 x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 1);
1765 int prev_intra_luma_pred_flag)
1783 int intra_pred_mode;
1788 if ((y0 - 1) < y_ctb)
1791 if (cand_left == cand_up) {
1792 if (cand_left < 2) {
1797 candidate[0] = cand_left;
1798 candidate[1] = 2 + ((cand_left - 2 - 1 + 32) & 31);
1799 candidate[2] = 2 + ((cand_left - 2 + 1) & 31);
1802 candidate[0] = cand_left;
1803 candidate[1] = cand_up;
1813 if (prev_intra_luma_pred_flag) {
1814 intra_pred_mode = candidate[lc->
pu.
mpm_idx];
1816 if (candidate[0] > candidate[1])
1818 if (candidate[0] > candidate[2])
1820 if (candidate[1] > candidate[2])
1824 for (i = 0; i < 3; i++)
1825 if (intra_pred_mode >= candidate[i])
1832 for (i = 0; i < size_in_pus; i++) {
1833 memset(&s->
tab_ipm[(y_pu + i) * min_pu_width + x_pu],
1834 intra_pred_mode, size_in_pus);
1836 for (j = 0; j < size_in_pus; j++) {
1841 return intra_pred_mode;
1845 int log2_cb_size,
int ct_depth)
1858 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20,
1859 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31};
1865 static const uint8_t intra_chroma_table[4] = { 0, 26, 10, 1 };
1866 uint8_t prev_intra_luma_pred_flag[4];
1868 int pb_size = (1 << log2_cb_size) >> split;
1869 int side = split + 1;
1873 for (i = 0; i < side; i++)
1874 for (j = 0; j < side; j++)
1877 for (i = 0; i < side; i++) {
1878 for (j = 0; j < side; j++) {
1879 if (prev_intra_luma_pred_flag[2 * i + j])
1886 prev_intra_luma_pred_flag[2 * i + j]);
1891 for (i = 0; i < side; i++) {
1892 for (j = 0; j < side; j++) {
1894 if (chroma_mode != 4) {
1907 if (chroma_mode != 4) {
1911 mode_idx = intra_chroma_table[chroma_mode];
1918 if (chroma_mode != 4) {
1934 int pb_size = 1 << log2_cb_size;
1942 if (size_in_pus == 0)
1944 for (j = 0; j < size_in_pus; j++)
1945 memset(&s->
tab_ipm[(y_pu + j) * min_pu_width + x_pu],
INTRA_DC, size_in_pus);
1947 for (j = 0; j < size_in_pus; j++)
1948 for (k = 0; k < size_in_pus; k++)
1954 int cb_size = 1 << log2_cb_size;
1957 int length = cb_size >> log2_min_cb_size;
1959 int x_cb = x0 >> log2_min_cb_size;
1960 int y_cb = y0 >> log2_min_cb_size;
1961 int idx = log2_cb_size - 2;
1974 for (x = 0; x < 4; x++)
1986 x = y_cb * min_cb_width + x_cb;
1987 for (y = 0; y <
length; y++) {
1988 memset(&s->
skip_flag[x], skip_flag, length);
1993 x = y_cb * min_cb_width + x_cb;
1994 for (y = 0; y <
length; y++) {
2019 log2_cb_size <= s->sps->pcm.log2_max_pcm_cb_size) {
2045 hls_prediction_unit(s, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1, idx - 1);
2049 hls_prediction_unit(s, x0, y0 + cb_size / 4, cb_size, cb_size * 3 / 4, log2_cb_size, 1, idx);
2053 hls_prediction_unit(s, x0, y0 + cb_size * 3 / 4, cb_size, cb_size / 4, log2_cb_size, 1, idx);
2057 hls_prediction_unit(s, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1, idx - 2);
2061 hls_prediction_unit(s, x0 + cb_size * 3 / 4, y0, cb_size / 4, cb_size, log2_cb_size, 1, idx - 2);
2065 hls_prediction_unit(s, x0 + cb_size / 2, y0, cb_size / 2, cb_size / 2, log2_cb_size, 1, idx - 1);
2066 hls_prediction_unit(s, x0, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2, idx - 1);
2067 hls_prediction_unit(s, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3, idx - 1);
2078 const static int cbf[2] = { 0 };
2084 log2_cb_size, 0, 0, cbf, cbf);
2097 x = y_cb * min_cb_width + x_cb;
2098 for (y = 0; y <
length; y++) {
2103 if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
2104 ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0) {
2114 int log2_cb_size,
int cb_depth)
2117 const int cb_size = 1 << log2_cb_size;
2123 if (x0 + cb_size <= s->sps->width &&
2124 y0 + cb_size <= s->sps->height &&
2142 const int cb_size_split = cb_size >> 1;
2143 const int x1 = x0 + cb_size_split;
2144 const int y1 = y0 + cb_size_split;
2152 if (more_data && x1 < s->sps->width) {
2157 if (more_data && y1 < s->sps->height) {
2162 if (more_data && x1 < s->sps->width &&
2163 y1 < s->sps->height) {
2169 if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
2170 ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0)
2174 return ((x1 + cb_size_split) < s->
sps->
width ||
2182 if ((!((x0 + cb_size) %
2184 (x0 + cb_size >= s->
sps->
width)) &&
2189 return !end_of_slice_flag;
2204 int ctb_addr_in_slice = ctb_addr_rs - s->
sh.
slice_addr;
2209 if (x_ctb == 0 && (y_ctb & (ctb_size - 1)) == 0)
2235 if (!ctb_addr_in_slice > 0)
2237 if (ctb_addr_in_slice < s->sps->ctb_width)
2269 while (more_data && ctb_addr_ts < s->sps->ctb_size) {
2285 if (more_data < 0) {
2296 if (x_ctb + ctb_size >= s->
sps->
width &&
2320 int *ctb_row_p = input_ctb_row;
2321 int ctb_row = ctb_row_p[job];
2331 ret =
init_get_bits8(&lc->
gb,
s->data +
s->sh.offset[ctb_row - 1],
s->sh.size[ctb_row - 1]);
2338 while(more_data && ctb_addr_ts < s->sps->ctb_size) {
2339 int x_ctb = (ctb_addr_rs %
s->sps->ctb_width) <<
s->sps->log2_ctb_size;
2340 int y_ctb = (ctb_addr_rs /
s->sps->ctb_width) <<
s->sps->log2_ctb_size;
2352 hls_sao_param(
s, x_ctb >>
s->sps->log2_ctb_size, y_ctb >>
s->sps->log2_ctb_size);
2355 if (more_data < 0) {
2356 s->tab_slice_address[ctb_addr_rs] = -1;
2366 if (!more_data && (x_ctb+ctb_size) <
s->sps->width && ctb_row !=
s->sh.num_entry_point_offsets) {
2372 if ((x_ctb+ctb_size) >=
s->sps->width && (y_ctb+ctb_size) >=
s->sps->height ) {
2377 ctb_addr_rs =
s->pps->ctb_addr_ts_to_rs[ctb_addr_ts];
2380 if(x_ctb >=
s->sps->width) {
2395 int startheader, cmpt = 0;
2413 for (j = 0, cmpt = 0, startheader = offset + s->
sh.
entry_point_offset[0]; j < s->skipped_bytes; j++) {
2422 for (j = 0, cmpt = 0, startheader = offset
2486 "nal_unit_type: %d, nuh_layer_id: %d, temporal_id: %d\n",
2489 return nuh_layer_id == 0;
2601 int ctb_addr_ts,
ret;
2657 if (s->
max_ra == INT_MAX) {
2679 }
else if (!s->
ref) {
2686 "Non-matching NAL types of the VCL NALUs: %d %d\n",
2696 "Error constructing the reference lists for the current slice.\n");
2709 if (ctb_addr_ts < 0) {
2743 #define STARTCODE_TEST \
2744 if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
2745 if (src[i + 2] != 3) { \
2751 #if HAVE_FAST_UNALIGNED
2752 #define FIND_FIRST_ZERO \
2753 if (i > 0 && !src[i]) \
2758 for (i = 0; i + 1 <
length; i += 9) {
2760 (
AV_RN64A(src + i) - 0x0100010001000101ULL)) &
2761 0x8000800080008080ULL))
2768 for (i = 0; i + 1 <
length; i += 5) {
2770 (
AV_RN32A(src + i) - 0x01000101U)) &
2779 for (i = 0; i + 1 <
length; i += 2) {
2782 if (i > 0 && src[i - 1] == 0)
2788 if (i >= length - 1) {
2801 memcpy(dst, src, i);
2803 while (si + 2 < length) {
2805 if (src[si + 2] > 3) {
2806 dst[di++] = src[si++];
2807 dst[di++] = src[si++];
2808 }
else if (src[si] == 0 && src[si + 1] == 0) {
2809 if (src[si + 2] == 3) {
2830 dst[di++] = src[si++];
2833 dst[di++] = src[si++];
2845 int i, consumed,
ret = 0;
2854 while (length >= 4) {
2856 int extract_length = 0;
2861 extract_length = (extract_length << 8) | buf[i];
2865 if (extract_length > length) {
2872 while (buf[0] != 0 || buf[1] != 0 || buf[2] != 1) {
2936 for (i = 0; i < s->
nb_nals; i++) {
2944 "Error parsing NAL unit #%d.\n", i);
2959 for (i = 0; i < 16; i++)
2960 av_log(log_ctx, level,
"%02"PRIx8, md5[i]);
2989 for (i = 0; frame->
data[i]; i++) {
2997 for (j = 0; j < h; j++) {
3002 (
const uint16_t *) src, w);
3010 if (!memcmp(md5, s->
md5[i], 16)) {
3315 int i, j, num_arrays, nal_len_size;
3320 nal_len_size = (bytestream2_get_byte(&gb) & 3) + 1;
3321 num_arrays = bytestream2_get_byte(&gb);
3328 for (i = 0; i < num_arrays; i++) {
3329 int type = bytestream2_get_byte(&gb) & 0x3f;
3330 int cnt = bytestream2_get_be16(&gb);
3332 for (j = 0; j < cnt; j++) {
3334 int nalsize = bytestream2_peek_be16(&gb) + 2;
3337 "Invalid NAL unit size in extradata.\n");
3344 "Decoding nal unit %d %d from hvcC failed\n",
3406 memset(s, 0,
sizeof(*s));
3422 #define OFFSET(x) offsetof(HEVCContext, x)
3423 #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
3434 {
"apply_defdispwin",
"Apply default display window from VUI",
OFFSET(apply_defdispwin),
3436 {
"strict-displaywin",
"stricly apply default display window size",
OFFSET(apply_defdispwin),
3454 .priv_class = &hevc_decoder_class,