47 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 };
92 int pic_size_in_ctb = ((width >> log2_min_cb_size) + 1) *
93 ((height >> log2_min_cb_size) + 1);
147 uint8_t luma_weight_l0_flag[16];
148 uint8_t chroma_weight_l0_flag[16];
149 uint8_t luma_weight_l1_flag[16];
150 uint8_t chroma_weight_l1_flag[16];
151 int luma_log2_weight_denom;
154 if (luma_log2_weight_denom < 0 || luma_log2_weight_denom > 7) {
160 int64_t chroma_log2_weight_denom = luma_log2_weight_denom + (int64_t)
get_se_golomb(gb);
161 if (chroma_log2_weight_denom < 0 || chroma_log2_weight_denom > 7) {
170 if (!luma_weight_l0_flag[i]) {
177 chroma_weight_l0_flag[i] =
get_bits1(gb);
180 chroma_weight_l0_flag[i] = 0;
183 if (luma_weight_l0_flag[i]) {
188 if (chroma_weight_l0_flag[i]) {
189 for (j = 0; j < 2; j++) {
193 if ( (int8_t)delta_chroma_weight_l0 != delta_chroma_weight_l0
194 || delta_chroma_offset_l0 < -(1<<17) || delta_chroma_offset_l0 > (1<<17)) {
212 if (!luma_weight_l1_flag[i]) {
219 chroma_weight_l1_flag[i] =
get_bits1(gb);
222 chroma_weight_l1_flag[i] = 0;
225 if (luma_weight_l1_flag[i]) {
230 if (chroma_weight_l1_flag[i]) {
231 for (j = 0; j < 2; j++) {
235 if ( (int8_t)delta_chroma_weight_l1 != delta_chroma_weight_l1
236 || delta_chroma_offset_l1 < -(1<<17) || delta_chroma_offset_l1 > (1<<17)) {
259 int prev_delta_msb = 0;
260 unsigned int nb_sps = 0, nb_sh;
278 for (i = 0; i < rps->
nb_refs; i++) {
295 if (delta_poc_msb_present) {
299 if (i && i != nb_sps)
300 delta += prev_delta_msb;
306 prev_delta_msb =
delta;
318 unsigned int num = 0, den = 0;
323 avctx->
width = sps->
width - ow->left_offset - ow->right_offset;
324 avctx->
height = sps->
height - ow->top_offset - ow->bottom_offset;
355 if (num != 0 && den != 0)
362 #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + \ 363 CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \ 364 CONFIG_HEVC_NVDEC_HWACCEL + \ 365 CONFIG_HEVC_VAAPI_HWACCEL + \ 366 CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + \ 367 CONFIG_HEVC_VDPAU_HWACCEL) 373 #if CONFIG_HEVC_DXVA2_HWACCEL 376 #if CONFIG_HEVC_D3D11VA_HWACCEL 380 #if CONFIG_HEVC_VAAPI_HWACCEL 383 #if CONFIG_HEVC_VDPAU_HWACCEL 386 #if CONFIG_HEVC_NVDEC_HWACCEL 389 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL 394 #if CONFIG_HEVC_DXVA2_HWACCEL 397 #if CONFIG_HEVC_D3D11VA_HWACCEL 401 #if CONFIG_HEVC_VAAPI_HWACCEL 404 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL 407 #if CONFIG_HEVC_NVDEC_HWACCEL 412 #if CONFIG_HEVC_NVDEC_HWACCEL 448 for (i = 0; i < 3; i++) {
457 for(c_idx = 0; c_idx < c_count; c_idx++) {
523 if (sps->
width != last_sps->width || sps->
height != last_sps->height ||
525 last_sps->temporal_layer[last_sps->max_sub_layers - 1].max_dec_pic_buffering)
545 int slice_address_length;
555 "Invalid slice segment address: %u.\n",
604 "Ignoring POC change between slices: %d -> %d\n", s->
poc, poc);
620 int numbits, rps_idx;
628 rps_idx = numbits > 0 ?
get_bits(gb, numbits) : 0;
734 "Invalid collocated_ref_idx: %d.\n",
751 "Invalid number of merging MVP candidates: %d.\n",
773 int deblocking_filter_override_flag = 0;
776 deblocking_filter_override_flag =
get_bits1(gb);
778 if (deblocking_filter_override_flag) {
783 if (beta_offset_div2 < -6 || beta_offset_div2 > 6 ||
784 tc_offset_div2 < -6 || tc_offset_div2 > 6) {
786 "Invalid deblock filter offsets: %d, %d\n",
787 beta_offset_div2, tc_offset_div2);
830 if (offset_len < 1 || offset_len > 32) {
866 for (i = 0; i <
length; i++)
875 "The slice_qp %d is outside the valid range " 907 #define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)]) 909 #define SET_SAO(elem, value) \ 911 if (!sao_merge_up_flag && !sao_merge_left_flag) \ 913 else if (sao_merge_left_flag) \ 914 sao->elem = CTB(s->sao, rx-1, ry).elem; \ 915 else if (sao_merge_up_flag) \ 916 sao->elem = CTB(s->sao, rx, ry-1).elem; \ 924 int sao_merge_left_flag = 0;
925 int sao_merge_up_flag = 0;
935 if (ry > 0 && !sao_merge_left_flag) {
960 for (i = 0; i < 4; i++)
964 for (i = 0; i < 4; i++) {
973 }
else if (c_idx != 2) {
979 for (i = 0; i < 4; i++) {
987 sao->
offset_val[c_idx][i + 1] *= 1 << log2_sao_offset_scale;
999 if (log2_res_scale_abs_plus1 != 0) {
1002 (1 - 2 * res_scale_sign_flag);
1012 int xBase,
int yBase,
int cb_xBase,
int cb_yBase,
1013 int log2_cb_size,
int log2_trafo_size,
1014 int blk_idx,
int cbf_luma,
int *cbf_cb,
int *cbf_cr)
1017 const int log2_trafo_size_c = log2_trafo_size - s->
ps.
sps->
hshift[1];
1021 int trafo_size = 1 << log2_trafo_size;
1027 if (cbf_luma || cbf_cb[0] || cbf_cr[0] ||
1031 int cbf_chroma = cbf_cb[0] || cbf_cr[0] ||
1033 (cbf_cb[1] || cbf_cr[1]));
1045 "The cu_qp_delta %d is outside the valid range " 1059 if (cu_chroma_qp_offset_flag) {
1060 int cu_chroma_qp_offset_idx = 0;
1064 "cu_chroma_qp_offset_idx not yet tested.\n");
1098 int trafo_size_h = 1 << (log2_trafo_size_c + s->
ps.
sps->
hshift[1]);
1099 int trafo_size_v = 1 << (log2_trafo_size_c + s->
ps.
sps->
vshift[1]);
1110 s->
hpc.
intra_pred[log2_trafo_size_c - 2](
s, x0, y0 + (i << log2_trafo_size_c), 1);
1114 log2_trafo_size_c, scan_idx_c, 1);
1122 int size = 1 << log2_trafo_size_c;
1126 for (i = 0; i < (size *
size); i++) {
1139 s->
hpc.
intra_pred[log2_trafo_size_c - 2](
s, x0, y0 + (i << log2_trafo_size_c), 2);
1143 log2_trafo_size_c, scan_idx_c, 2);
1151 int size = 1 << log2_trafo_size_c;
1155 for (i = 0; i < (size *
size); i++) {
1162 int trafo_size_h = 1 << (log2_trafo_size + 1);
1163 int trafo_size_v = 1 << (log2_trafo_size + s->
ps.
sps->
vshift[1]);
1167 trafo_size_h, trafo_size_v);
1168 s->
hpc.
intra_pred[log2_trafo_size - 2](
s, xBase, yBase + (i << log2_trafo_size), 1);
1172 log2_trafo_size, scan_idx_c, 1);
1177 trafo_size_h, trafo_size_v);
1178 s->
hpc.
intra_pred[log2_trafo_size - 2](
s, xBase, yBase + (i << log2_trafo_size), 2);
1182 log2_trafo_size, scan_idx_c, 2);
1187 int trafo_size_h = 1 << (log2_trafo_size_c + s->
ps.
sps->
hshift[1]);
1188 int trafo_size_v = 1 << (log2_trafo_size_c + s->
ps.
sps->
vshift[1]);
1194 trafo_size_h, trafo_size_v);
1195 s->
hpc.
intra_pred[log2_trafo_size_c - 2](
s, x0, y0 + (1 << log2_trafo_size_c), 1);
1196 s->
hpc.
intra_pred[log2_trafo_size_c - 2](
s, x0, y0 + (1 << log2_trafo_size_c), 2);
1198 }
else if (blk_idx == 3) {
1199 int trafo_size_h = 1 << (log2_trafo_size + 1);
1200 int trafo_size_v = 1 << (log2_trafo_size + s->
ps.
sps->
vshift[1]);
1202 trafo_size_h, trafo_size_v);
1207 trafo_size_h, trafo_size_v);
1208 s->
hpc.
intra_pred[log2_trafo_size - 2](
s, xBase, yBase + (1 << (log2_trafo_size)), 1);
1209 s->
hpc.
intra_pred[log2_trafo_size - 2](
s, xBase, yBase + (1 << (log2_trafo_size)), 2);
1219 int cb_size = 1 << log2_cb_size;
1227 for (j = (y0 >> log2_min_pu_size); j < (y_end >> log2_min_pu_size); j++)
1228 for (i = (x0 >> log2_min_pu_size); i < (x_end >> log2_min_pu_size); i++)
1229 s->
is_pcm[i + j * min_pu_width] = 2;
1233 int xBase,
int yBase,
int cb_xBase,
int cb_yBase,
1234 int log2_cb_size,
int log2_trafo_size,
1235 int trafo_depth,
int blk_idx,
1236 const int *base_cbf_cb,
const int *base_cbf_cr)
1244 cbf_cb[0] = base_cbf_cb[0];
1245 cbf_cb[1] = base_cbf_cb[1];
1246 cbf_cr[0] = base_cbf_cr[0];
1247 cbf_cr[1] = base_cbf_cr[1];
1250 if (trafo_depth == 1) {
1266 if (log2_trafo_size <= s->ps.sps->log2_max_trafo_size &&
1268 trafo_depth < lc->cu.max_trafo_depth &&
1283 if (trafo_depth == 0 || cbf_cb[0]) {
1290 if (trafo_depth == 0 || cbf_cr[0]) {
1298 if (split_transform_flag) {
1299 const int trafo_size_split = 1 << (log2_trafo_size - 1);
1300 const int x1 = x0 + trafo_size_split;
1301 const int y1 = y0 + trafo_size_split;
1303 #define SUBDIVIDE(x, y, idx) \ 1305 ret = hls_transform_tree(s, x, y, x0, y0, cb_xBase, cb_yBase, log2_cb_size, \ 1306 log2_trafo_size - 1, trafo_depth + 1, idx, \ 1325 cbf_cb[0] || cbf_cr[0] ||
1331 log2_cb_size, log2_trafo_size,
1332 blk_idx, cbf_luma, cbf_cb, cbf_cr);
1338 for (i = 0; i < (1 << log2_trafo_size); i += min_tu_size)
1339 for (j = 0; j < (1 << log2_trafo_size); j += min_tu_size) {
1340 int x_tu = (x0 + j) >> log2_min_tu_size;
1341 int y_tu = (y0 + i) >> log2_min_tu_size;
1342 s->
cbf_luma[y_tu * min_tu_width + x_tu] = 1;
1359 int cb_size = 1 << log2_cb_size;
1414 int block_w,
int block_h,
int luma_weight,
int luma_offset)
1418 ptrdiff_t srcstride = ref->
linesize[0];
1427 x_off += mv->
x >> 2;
1428 y_off += mv->
y >> 2;
1439 edge_emu_stride, srcstride,
1443 pic_width, pic_height);
1445 srcstride = edge_emu_stride;
1450 block_h, mx, my, block_w);
1454 luma_weight, luma_offset, mx, my, block_w);
1474 AVFrame *ref0,
const Mv *mv0,
int x_off,
int y_off,
1475 int block_w,
int block_h,
AVFrame *ref1,
const Mv *mv1,
struct MvField *current_mv)
1478 ptrdiff_t src0stride = ref0->
linesize[0];
1479 ptrdiff_t src1stride = ref1->
linesize[0];
1482 int mx0 = mv0->
x & 3;
1483 int my0 = mv0->
y & 3;
1484 int mx1 = mv1->
x & 3;
1485 int my1 = mv1->
y & 3;
1488 int x_off0 = x_off + (mv0->
x >> 2);
1489 int y_off0 = y_off + (mv0->
y >> 2);
1490 int x_off1 = x_off + (mv1->
x >> 2);
1491 int y_off1 = y_off + (mv1->
y >> 2);
1505 edge_emu_stride, src0stride,
1509 pic_width, pic_height);
1511 src0stride = edge_emu_stride;
1522 edge_emu_stride, src1stride,
1526 pic_width, pic_height);
1528 src1stride = edge_emu_stride;
1532 block_h, mx0, my0, block_w);
1535 block_h, mx1, my1, block_w);
1565 ptrdiff_t dststride,
uint8_t *
src0, ptrdiff_t srcstride,
int reflist,
1566 int x_off,
int y_off,
int block_w,
int block_h,
struct MvField *current_mv,
int chroma_weight,
int chroma_offset)
1571 const Mv *
mv = ¤t_mv->
mv[reflist];
1577 intptr_t mx = av_mod_uintp2(mv->
x, 2 + hshift);
1578 intptr_t my = av_mod_uintp2(mv->
y, 2 + vshift);
1579 intptr_t _mx = mx << (1 - hshift);
1580 intptr_t _my = my << (1 - vshift);
1582 x_off += mv->
x >> (2 + hshift);
1583 y_off += mv->
y >> (2 + vshift);
1594 edge_emu_stride, srcstride,
1598 pic_width, pic_height);
1601 srcstride = edge_emu_stride;
1605 block_h, _mx, _my, block_w);
1609 chroma_weight, chroma_offset, _mx, _my, block_w);
1630 int x_off,
int y_off,
int block_w,
int block_h,
struct MvField *current_mv,
int cidx)
1635 ptrdiff_t src1stride = ref0->
linesize[cidx+1];
1636 ptrdiff_t src2stride = ref1->
linesize[cidx+1];
1641 Mv *mv0 = ¤t_mv->
mv[0];
1642 Mv *mv1 = ¤t_mv->
mv[1];
1646 intptr_t mx0 = av_mod_uintp2(mv0->
x, 2 + hshift);
1647 intptr_t my0 = av_mod_uintp2(mv0->
y, 2 + vshift);
1648 intptr_t mx1 = av_mod_uintp2(mv1->
x, 2 + hshift);
1649 intptr_t my1 = av_mod_uintp2(mv1->
y, 2 + vshift);
1650 intptr_t _mx0 = mx0 << (1 - hshift);
1651 intptr_t _my0 = my0 << (1 - vshift);
1652 intptr_t _mx1 = mx1 << (1 - hshift);
1653 intptr_t _my1 = my1 << (1 - vshift);
1655 int x_off0 = x_off + (mv0->
x >> (2 + hshift));
1656 int y_off0 = y_off + (mv0->
y >> (2 + vshift));
1657 int x_off1 = x_off + (mv1->
x >> (2 + hshift));
1658 int y_off1 = y_off + (mv1->
y >> (2 + vshift));
1672 edge_emu_stride, src1stride,
1676 pic_width, pic_height);
1679 src1stride = edge_emu_stride;
1691 edge_emu_stride, src2stride,
1695 pic_width, pic_height);
1698 src2stride = edge_emu_stride;
1702 block_h, _mx0, _my0, block_w);
1705 src2, src2stride, lc->
tmp,
1706 block_h, _mx1, _my1, block_w);
1709 src2, src2stride, lc->
tmp,
1716 _mx1, _my1, block_w);
1723 int y =
FFMAX(0, (mv->
y >> 2) + y0 + height + 9);
1730 int nPbH,
int log2_cb_size,
int part_idx,
1742 if (inter_pred_idc !=
PRED_L1) {
1750 part_idx, merge_idx, mv, mvp_flag, 0);
1755 if (inter_pred_idc !=
PRED_L0) {
1768 part_idx, merge_idx, mv, mvp_flag, 1);
1776 int log2_cb_size,
int partIdx,
int idx)
1778 #define POS(c_idx, x, y) \ 1779 &s->frame->data[c_idx][((y) >> s->ps.sps->vshift[c_idx]) * s->frame->linesize[c_idx] + \ 1780 (((x) >> s->ps.sps->hshift[c_idx]) << s->ps.sps->pixel_shift)] 1783 struct MvField current_mv = {{{ 0 }}};
1795 int x_cb = x0 >> log2_min_cb_size;
1796 int y_cb = y0 >> log2_min_cb_size;
1812 partIdx, merge_idx, ¤t_mv);
1815 partIdx, merge_idx, ¤t_mv);
1823 tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv;
1826 ref0 = refPicList[0].
ref[current_mv.
ref_idx[0]];
1832 ref1 = refPicList[1].
ref[current_mv.
ref_idx[1]];
1845 ¤t_mv.
mv[0], x0, y0, nPbW, nPbH,
1851 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1854 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1864 ¤t_mv.
mv[1], x0, y0, nPbW, nPbH,
1870 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1874 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1884 ¤t_mv.
mv[0], x0, y0, nPbW, nPbH,
1885 ref1->frame, ¤t_mv.
mv[1], ¤t_mv);
1889 x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0);
1892 x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 1);
1901 int prev_intra_luma_pred_flag)
1919 int intra_pred_mode;
1924 if ((y0 - 1) < y_ctb)
1927 if (cand_left == cand_up) {
1928 if (cand_left < 2) {
1933 candidate[0] = cand_left;
1934 candidate[1] = 2 + ((cand_left - 2 - 1 + 32) & 31);
1935 candidate[2] = 2 + ((cand_left - 2 + 1) & 31);
1938 candidate[0] = cand_left;
1939 candidate[1] = cand_up;
1949 if (prev_intra_luma_pred_flag) {
1950 intra_pred_mode = candidate[lc->
pu.
mpm_idx];
1952 if (candidate[0] > candidate[1])
1954 if (candidate[0] > candidate[2])
1956 if (candidate[1] > candidate[2])
1960 for (i = 0; i < 3; i++)
1961 if (intra_pred_mode >= candidate[i])
1968 for (i = 0; i < size_in_pus; i++) {
1969 memset(&s->
tab_ipm[(y_pu + i) * min_pu_width + x_pu],
1970 intra_pred_mode, size_in_pus);
1972 for (j = 0; j < size_in_pus; j++) {
1977 return intra_pred_mode;
1981 int log2_cb_size,
int ct_depth)
1994 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20,
1995 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31};
2001 static const uint8_t intra_chroma_table[4] = { 0, 26, 10, 1 };
2002 uint8_t prev_intra_luma_pred_flag[4];
2004 int pb_size = (1 << log2_cb_size) >> split;
2005 int side = split + 1;
2009 for (i = 0; i < side; i++)
2010 for (j = 0; j < side; j++)
2013 for (i = 0; i < side; i++) {
2014 for (j = 0; j < side; j++) {
2015 if (prev_intra_luma_pred_flag[2 * i + j])
2022 prev_intra_luma_pred_flag[2 * i + j]);
2027 for (i = 0; i < side; i++) {
2028 for (j = 0; j < side; j++) {
2030 if (chroma_mode != 4) {
2043 if (chroma_mode != 4) {
2047 mode_idx = intra_chroma_table[chroma_mode];
2054 if (chroma_mode != 4) {
2070 int pb_size = 1 << log2_cb_size;
2078 if (size_in_pus == 0)
2080 for (j = 0; j < size_in_pus; j++)
2081 memset(&s->
tab_ipm[(y_pu + j) * min_pu_width + x_pu],
INTRA_DC, size_in_pus);
2083 for (j = 0; j < size_in_pus; j++)
2084 for (k = 0; k < size_in_pus; k++)
2090 int cb_size = 1 << log2_cb_size;
2093 int length = cb_size >> log2_min_cb_size;
2095 int x_cb = x0 >> log2_min_cb_size;
2096 int y_cb = y0 >> log2_min_cb_size;
2097 int idx = log2_cb_size - 2;
2108 for (x = 0; x < 4; x++)
2120 x = y_cb * min_cb_width + x_cb;
2121 for (y = 0; y <
length; y++) {
2122 memset(&s->
skip_flag[x], skip_flag, length);
2127 x = y_cb * min_cb_width + x_cb;
2128 for (y = 0; y <
length; y++) {
2155 log2_cb_size <= s->ps.sps->pcm.log2_max_pcm_cb_size) {
2181 hls_prediction_unit(s, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1, idx - 1);
2185 hls_prediction_unit(s, x0, y0 + cb_size / 4, cb_size, cb_size * 3 / 4, log2_cb_size, 1, idx);
2189 hls_prediction_unit(s, x0, y0 + cb_size * 3 / 4, cb_size, cb_size / 4, log2_cb_size, 1, idx);
2193 hls_prediction_unit(s, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1, idx - 2);
2197 hls_prediction_unit(s, x0 + cb_size * 3 / 4, y0, cb_size / 4, cb_size, log2_cb_size, 1, idx - 2);
2201 hls_prediction_unit(s, x0 + cb_size / 2, y0, cb_size / 2, cb_size / 2, log2_cb_size, 1, idx - 1);
2202 hls_prediction_unit(s, x0, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2, idx - 1);
2203 hls_prediction_unit(s, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3, idx - 1);
2209 int rqt_root_cbf = 1;
2216 const static int cbf[2] = { 0 };
2222 log2_cb_size, 0, 0, cbf, cbf);
2235 x = y_cb * min_cb_width + x_cb;
2236 for (y = 0; y <
length; y++) {
2241 if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
2242 ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0) {
2252 int log2_cb_size,
int cb_depth)
2255 const int cb_size = 1 << log2_cb_size;
2260 if (x0 + cb_size <= s->ps.sps->width &&
2261 y0 + cb_size <= s->ps.sps->height &&
2280 const int cb_size_split = cb_size >> 1;
2281 const int x1 = x0 + cb_size_split;
2282 const int y1 = y0 + cb_size_split;
2290 if (more_data && x1 < s->ps.sps->width) {
2295 if (more_data && y1 < s->ps.sps->height) {
2300 if (more_data && x1 < s->ps.sps->width &&
2301 y1 < s->ps.sps->height) {
2307 if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
2308 ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0)
2312 return ((x1 + cb_size_split) < s->
ps.
sps->
width ||
2320 if ((!((x0 + cb_size) %
2327 return !end_of_slice_flag;
2342 int ctb_addr_in_slice = ctb_addr_rs - s->
sh.
slice_addr;
2347 if (x_ctb == 0 && (y_ctb & (ctb_size - 1)) == 0)
2373 if (ctb_addr_in_slice <= 0)
2375 if (ctb_addr_in_slice < s->ps.sps->ctb_width)
2408 while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) {
2428 if (more_data < 0) {
2463 int *ctb_row_p = input_ctb_row;
2464 int ctb_row = ctb_row_p[job];
2474 ret =
init_get_bits8(&lc->
gb,
s->data +
s->sh.offset[ctb_row - 1],
s->sh.size[ctb_row - 1]);
2480 while(more_data && ctb_addr_ts < s->ps.sps->ctb_size) {
2481 int x_ctb = (ctb_addr_rs %
s->ps.sps->ctb_width) <<
s->ps.sps->log2_ctb_size;
2482 int y_ctb = (ctb_addr_rs /
s->ps.sps->ctb_width) <<
s->ps.sps->log2_ctb_size;
2496 hls_sao_param(
s, x_ctb >>
s->ps.sps->log2_ctb_size, y_ctb >>
s->ps.sps->log2_ctb_size);
2499 if (more_data < 0) {
2510 if (!more_data && (x_ctb+ctb_size) <
s->ps.sps->width && ctb_row !=
s->sh.num_entry_point_offsets) {
2516 if ((x_ctb+ctb_size) >=
s->ps.sps->width && (y_ctb+ctb_size) >=
s->ps.sps->height ) {
2521 ctb_addr_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];
2524 if(x_ctb >=
s->ps.sps->width) {
2532 s->tab_slice_address[ctb_addr_rs] = -1;
2546 int64_t startheader, cmpt = 0;
2577 for (j = 0, cmpt = 0, startheader = offset + s->
sh.
entry_point_offset[0]; j < nal->skipped_bytes; j++) {
2586 for (j = 0, cmpt = 0, startheader = offset
2599 if (length < offset) {
2699 const int mapping[3] = {2, 0, 1};
2700 const int chroma_den = 50000;
2701 const int luma_den = 10000;
2708 for (i = 0; i < 3; i++) {
2709 const int j = mapping[i];
2729 "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n",
2738 "min_luminance=%f, max_luminance=%f\n",
2843 int ctb_addr_ts, ret;
2937 if (s->
max_ra == INT_MAX) {
2958 }
else if (!s->
ref) {
2965 "Non-matching NAL types of the VCL NALUs: %d %d\n",
2975 "Error constructing the reference lists for the current slice.\n");
2999 if (ctb_addr_ts < 0) {
3028 int eos_at_start = 1;
3040 "Error splitting the input into NAL units.\n");
3069 "Error parsing NAL unit #%d.\n", i);
3084 for (i = 0; i < 16; i++)
3085 av_log(log_ctx, level,
"%02"PRIx8, md5[i]);
3114 for (i = 0; frame->
data[i]; i++) {
3122 for (j = 0; j <
h; j++) {
3127 (
const uint16_t *) src, w);
3180 int new_extradata_size;
3194 &new_extradata_size);
3195 if (new_extradata && new_extradata_size > 0) {
3209 "hardware accelerator failed to decode picture\n");
3290 for (i = 0; i < 3; i++) {
3499 memset(s, 0,
sizeof(*s));
3517 #define OFFSET(x) offsetof(HEVCContext, x) 3518 #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) 3521 {
"apply_defdispwin",
"Apply default display window from VUI",
OFFSET(apply_defdispwin),
3523 {
"strict-displaywin",
"stricly apply default display window size",
OFFSET(apply_defdispwin),
3541 .priv_class = &hevc_decoder_class,
3553 #if CONFIG_HEVC_DXVA2_HWACCEL 3556 #if CONFIG_HEVC_D3D11VA_HWACCEL 3559 #if CONFIG_HEVC_D3D11VA2_HWACCEL 3562 #if CONFIG_HEVC_NVDEC_HWACCEL 3565 #if CONFIG_HEVC_VAAPI_HWACCEL 3568 #if CONFIG_HEVC_VDPAU_HWACCEL 3571 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL static int set_side_data(HEVCContext *s)
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, AVFrame *ref, const Mv *mv, int x_off, int y_off, int block_w, int block_h, int luma_weight, int luma_offset)
8.5.3.2.2.1 Luma sample unidirectional interpolation process
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, void *logctx, int is_nalff, int nal_length_size, enum AVCodecID codec_id, int small_padding)
Split an input packet into NAL units.
static void intra_prediction_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)
av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
unsigned int log2_min_cb_size
const char const char void * val
discard all frames except keyframes
uint8_t log2_sao_offset_scale_luma
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static enum AVPixelFormat pix_fmt
int anticlockwise_rotation
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static int verify_md5(HEVCContext *s, AVFrame *frame)
This structure describes decoded (raw) audio or video data.
void(* bswap16_buf)(uint16_t *dst, const uint16_t *src, int len)
int current_frame_is_frame0_flag
unsigned MaxCLL
Max content light level (cd/m^2).
#define HWACCEL_D3D11VA2(codec)
#define atomic_store(object, desired)
AVBufferRef * vps_list[HEVC_MAX_VPS_COUNT]
static void flush(AVCodecContext *avctx)
enum AVStereo3DView view
Determines which views are packed.
uint8_t diff_cu_chroma_qp_offset_depth
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
#define HWACCEL_NVDEC(codec)
int coded_width
Bitstream width / height, may be different from width/height e.g.
int max_dec_pic_buffering
void(* put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int width, int height, struct GetBitContext *gb, int pcm_bit_depth)
void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth)
int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth, int x0, int y0)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
void(* put_hevc_qpel_bi_w[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
#define LIBAVUTIL_VERSION_INT
int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
int16_t x
horizontal component of motion vector
hardware decoding through Videotoolbox
static av_cold int init(AVCodecContext *avctx)
static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
void * hwaccel_picture_private
uint8_t intra_split_flag
IntraSplitFlag.
int rem_intra_luma_pred_mode
static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx)
8.5.3.2.2.2 Chroma sample bidirectional interpolation process
enum AVColorRange color_range
MPEG vs JPEG YUV range.
static int hls_transform_tree(HEVCContext *s, int x0, int y0, int xBase, int yBase, int cb_xBase, int cb_yBase, int log2_cb_size, int log2_trafo_size, int trafo_depth, int blk_idx, const int *base_cbf_cb, const int *base_cbf_cr)
void ff_hevc_flush_dpb(HEVCContext *s)
Drop all frames currently in DPB.
int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth)
static const AVClass hevc_decoder_class
Views are next to each other, but when upscaling apply a checkerboard pattern.
Frame contains only the right view.
static int decode_lt_rps(HEVCContext *s, LongTermRPS *rps, GetBitContext *gb)
const char * av_default_item_name(void *ptr)
Return the context name.
uint8_t weighted_bipred_flag
static void hevc_decode_flush(AVCodecContext *avctx)
int ff_hevc_sao_offset_sign_decode(HEVCContext *s)
int ff_hevc_frame_rps(HEVCContext *s)
Construct the reference picture sets for the current frame.
int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
uint8_t seq_loop_filter_across_slices_enabled_flag
uint8_t cabac_init_present_flag
#define AV_PIX_FMT_YUV420P12
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
void(* put_hevc_epel_uni[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
int ff_hevc_decode_extradata(const uint8_t *data, int size, HEVCParamSets *ps, HEVCSEI *sei, int *is_nalff, int *nal_length_size, int err_recognition, int apply_defdispwin, void *logctx)
discard all non intra frames
uint8_t used_by_curr_pic_lt_sps_flag[HEVC_MAX_LONG_TERM_REF_PICS]
ShortTermRPS st_rps[HEVC_MAX_SHORT_TERM_REF_PIC_SETS]
Views are next to each other.
int * ctb_addr_ts_to_rs
CtbAddrTSToRS.
int num_ref_idx_l0_default_active
num_ref_idx_l0_default_active_minus1 + 1
#define HWACCEL_D3D11VA(codec)
void ff_thread_await_progress(ThreadFrame *f, int n, int field)
Wait for earlier decoding threads to finish reference pictures.
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
int8_t cr_qp_offset_list[6]
int ff_hevc_merge_flag_decode(HEVCContext *s)
#define SET_SAO(elem, value)
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static void hls_sao_param(HEVCContext *s, int rx, int ry)
uint16_t seq_decode
Sequence counters for decoded and output frames, so that old frames are output first after a POC rese...
static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, int ctb_addr_ts)
void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
Flip the input matrix horizontally and/or vertically.
void av_md5_update(AVMD5 *ctx, const uint8_t *src, int len)
Update hash value.
Macro definitions for various function/variable attributes.
HEVCSEIMasteringDisplay mastering_display
void av_display_rotation_set(int32_t matrix[9], double angle)
Initialize a transformation matrix describing a pure counterclockwise rotation by the specified angle...
Frame contains only the left view.
uint8_t entropy_coding_sync_enabled_flag
int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s)
enum AVDiscard skip_frame
Skip decoding for selected frames.
AVBufferPool * rpl_tab_pool
candidate references for the current frame
uint8_t log2_sao_offset_scale_chroma
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
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...
unsigned int log2_max_trafo_size
void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags)
void(* put_hevc_epel[10][2][2])(int16_t *dst, uint8_t *src, ptrdiff_t srcstride, int height, intptr_t mx, intptr_t my, int width)
AVBufferRef * sps_list[HEVC_MAX_SPS_COUNT]
int ff_hevc_split_transform_flag_decode(HEVCContext *s, int log2_trafo_size)
struct AVMD5 * av_md5_alloc(void)
Allocate an AVMD5 context.
int ff_hevc_sao_merge_flag_decode(HEVCContext *s)
HEVCSEIContentLight content_light
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
int is_nalff
this flag is != 0 if bitstream is encapsulated as a format defined in 14496-15
int ff_hevc_rem_intra_luma_pred_mode_decode(HEVCContext *s)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
enum HEVCNALUnitType nal_unit_type
static av_always_inline void set_ct_depth(HEVCContext *s, int x0, int y0, int log2_cb_size, int ct_depth)
int(* decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size)
Callback for parameter data (SPS/PPS/VPS etc).
static void set_deblocking_bypass(HEVCContext *s, int x0, int y0, int log2_cb_size)
Stereo 3D type: this structure describes how two videos are packed within a single video surface...
uint8_t ctb_up_right_flag
int ff_hevc_inter_pred_idc_decode(HEVCContext *s, int nPbW, int nPbH)
static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
struct HEVCFrame * ref[HEVC_MAX_REFS]
uint8_t vps_timing_info_present_flag
void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int log2_trafo_size)
#define BOUNDARY_LEFT_TILE
int ff_hevc_part_mode_decode(HEVCContext *s, int log2_cb_size)
int num_ref_idx_l1_default_active
num_ref_idx_l1_default_active_minus1 + 1
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
unsigned int log2_min_pcm_cb_size
int ff_hevc_prev_intra_luma_pred_flag_decode(HEVCContext *s)
void ff_h2645_packet_uninit(H2645Packet *pkt)
Free all the allocated memory in the packet.
#define QPEL_EXTRA_BEFORE
Structure to hold side data for an AVFrame.
int ff_hevc_slice_rpl(HEVCContext *s)
Construct the reference picture list(s) for the current slice.
#define HWACCEL_DXVA2(codec)
static double av_q2d(AVRational a)
Convert an AVRational to a double.
void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size)
int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0, int x_cb, int y_cb)
int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src)
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
void(* put_hevc_qpel_uni_w[10][2][2])(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
AVBufferRef * pps_list[HEVC_MAX_PPS_COUNT]
uint8_t loop_filter_disable_flag
int ff_hevc_cbf_cb_cr_decode(HEVCContext *s, int trafo_depth)
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
uint8_t cu_transquant_bypass_flag
int16_t tmp[MAX_PB_SIZE *MAX_PB_SIZE]
void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
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...
void(* put_hevc_qpel[10][2][2])(int16_t *dst, uint8_t *src, ptrdiff_t srcstride, int height, intptr_t mx, intptr_t my, int width)
int8_t cb_qp_offset_list[6]
static av_unused const uint8_t * skip_bytes(CABACContext *c, int n)
Skip n bytes and reset the decoder.
int ff_hevc_log2_res_scale_abs(HEVCContext *s, int idx)
uint8_t transquant_bypass_enable_flag
int temporal_id
temporal_id_plus1 - 1
HEVCLocalContext * HEVClcList[MAX_NB_THREADS]
int ff_hevc_cu_chroma_qp_offset_idx(HEVCContext *s)
const AVProfile ff_hevc_profiles[]
int slice_idx
number of the slice being currently decoded
static int get_bits_left(GetBitContext *gb)
static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int job, int self_id)
uint8_t intra_pred_mode[4]
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
int ff_hevc_cu_transquant_bypass_flag_decode(HEVCContext *s)
#define SAMPLE_CTB(tab, x, y)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int has_b_frames
Size of the frame reordering buffer in the decoder.
int ff_hevc_frame_nb_refs(const HEVCContext *s)
Get the number of candidate references for the current frame.
int flags
Additional information about the frame packing.
uint8_t slice_initialized
1 if the independent slice segment header was successfully parsed
unsigned int log2_max_poc_lsb
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static int hevc_ref_frame(HEVCContext *s, HEVCFrame *dst, HEVCFrame *src)
int ff_hevc_compute_poc(const HEVCSPS *sps, int pocTid0, int poc_lsb, int nal_unit_type)
Compute POC of the current frame and return it.
int content_interpretation_type
#define atomic_load(object)
int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps)
AVBufferRef * rpl_tab_buf
discard all bidirectional frames
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int vui_timing_info_present_flag
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
int active_thread_type
Which multithreading methods are in use by the codec.
static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
ATSC A53 Part 4 Closed Captions.
void(* intra_pred[4])(struct HEVCContext *s, int x0, int y0, int c_idx)
static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type)
static void intra_prediction_unit_default_value(HEVCContext *s, int x0, int y0, int log2_cb_size)
unsigned int log2_ctb_size
static int set_sps(HEVCContext *s, const HEVCSPS *sps, enum AVPixelFormat pix_fmt)
uint8_t * sao_pixel_buffer_h[3]
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
int preferred_transfer_characteristics
static const uint8_t offset[127][2]
#define BOUNDARY_UPPER_TILE
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
uint8_t max_trafo_depth
MaxTrafoDepth.
uint16_t sequence
A sequence counter, so that old frames are output first after a POC reset.
static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output, AVPacket *avpkt)
static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)
#define FF_CODEC_CAP_EXPORTS_CROPPING
The decoder sets the cropping fields in the output frames manually.
int ff_hevc_sao_band_position_decode(HEVCContext *s)
static char * split(char *message, char delim)
uint8_t tiles_enabled_flag
int ff_alloc_entries(AVCodecContext *avctx, int count)
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
int eo_class[3]
sao_eo_class
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
uint32_t vps_num_units_in_tick
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
Views are alternated temporally.
struct HEVCContext * sList[MAX_NB_THREADS]
common internal API header
enum HEVCNALUnitType first_nal_type
int ff_hevc_sao_eo_class_decode(HEVCContext *s)
uint8_t lists_modification_present_flag
AVBufferRef * tab_mvf_buf
int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
Find next frame in output order and put a reference to it in frame.
uint8_t type_idx[3]
sao_type_idx
enum AVPictureType pict_type
Picture type of the frame.
int ff_hevc_res_scale_sign_flag(HEVCContext *s, int idx)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
#define FF_THREAD_FRAME
Decode more than one frame at once.
struct HEVCSPS::@92 temporal_layer[HEVC_MAX_SUB_LAYERS]
int max_transform_hierarchy_depth_inter
uint8_t * sao_pixel_buffer_v[3]
#define EPEL_EXTRA_BEFORE
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
int offset_abs[3][4]
sao_offset_abs
int width
picture width / height.
static int luma_intra_pred_mode(HEVCContext *s, int x0, int y0, int pu_size, int prev_intra_luma_pred_flag)
8.4.1
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
int ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size)
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
uint8_t cu_qp_delta_enabled_flag
static void print_md5(void *log_ctx, int level, uint8_t md5[16])
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
Context Adaptive Binary Arithmetic Coder inline functions.
static void pic_arrays_free(HEVCContext *s)
NOTE: Each function hls_foo correspond to the function foo in the specification (HLS stands for High ...
#define AV_EF_EXPLODE
abort decoding on minor error detection
void(* put_hevc_qpel_bi[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
static av_cold int hevc_decode_init(AVCodecContext *avctx)
uint8_t output_flag_present_flag
static int hevc_decode_extradata(HEVCContext *s, uint8_t *buf, int length, int first)
HW acceleration through CUDA.
static void error(const char *err)
#define FF_ARRAY_ELEMS(a)
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
the normal 2^n-1 "JPEG" YUV ranges
uint8_t pic_slice_level_chroma_qp_offsets_present_flag
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
void ff_reset_entries(AVCodecContext *avctx)
int colour_description_present_flag
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
static const int8_t mv[256][2]
void ff_hevc_ps_uninit(HEVCParamSets *ps)
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
enum AVPixelFormat pix_fmt
int ff_hevc_merge_idx_decode(HEVCContext *s)
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth)
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
const uint8_t ff_hevc_pel_weight[65]
enum AVStereo3DType type
How views are packed within the video.
#define AV_LOG_INFO
Standard information.
void ff_hevc_clear_refs(HEVCContext *s)
Mark all frames in DPB as unused for reference.
static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset)
8.5.3.2.2.2 Chroma sample uniprediction interpolation process
uint16_t num_tile_columns
num_tile_columns_minus1 + 1
void ff_hevc_reset_sei(HEVCSEI *s)
Reset SEI values that are stored on the Context.
static void hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv)
Views are on top of each other.
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
int(* end_frame)(AVCodecContext *avctx)
Called at the end of each frame or field picture.
static int hls_transform_unit(HEVCContext *s, int x0, int y0, int xBase, int yBase, int cb_xBase, int cb_yBase, int log2_cb_size, int log2_trafo_size, int blk_idx, int cbf_luma, int *cbf_cb, int *cbf_cr)
int * ctb_addr_rs_to_ts
CtbAddrRSToTS.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
unsigned int log2_min_pu_size
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
int ff_hevc_end_of_slice_flag_decode(HEVCContext *s)
unsigned int sps_id
seq_parameter_set_id
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
enum PredMode pred_mode
PredMode.
AVBufferRef * hwaccel_priv_buf
int num_extra_slice_header_bits
uint8_t * data
The data buffer.
int16_t y
vertical component of motion vector
#define EDGE_EMU_BUFFER_STRIDE
uint8_t num_long_term_ref_pics_sps
void av_md5_init(AVMD5 *ctx)
Initialize MD5 hashing.
uint8_t cross_component_prediction_enabled_flag
uint32_t vui_num_units_in_tick
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
uint8_t deblocking_filter_control_present_flag
HEVCSEIFramePacking frame_packing
static unsigned int get_bits1(GetBitContext *s)
static int pred_weight_table(HEVCContext *s, GetBitContext *gb)
uint8_t * checksum_buf
used on BE to byteswap the lines for checksumming
#define AV_PIX_FMT_YUV420P10
uint8_t sps_temporal_mvp_enabled_flag
int ff_hevc_cu_qp_delta_sign_flag(HEVCContext *s)
Describe the class of an AVClass context structure.
void ff_hevc_bump_frame(HEVCContext *s)
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS
static void skip_bits(GetBitContext *s, int n)
uint16_t max_pic_average_light_level
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
uint8_t chroma_qp_offset_list_enabled_flag
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
enum AVColorSpace colorspace
YUV colorspace type.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
static av_cold int hevc_init_context(AVCodecContext *avctx)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
int enable_parallel_tiles
uint8_t edge_emu_buffer[(MAX_PB_SIZE+7) *EDGE_EMU_BUFFER_STRIDE *2]
void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts)
void(* add_residual[4])(uint8_t *dst, int16_t *res, ptrdiff_t stride)
int last_eos
last packet contains an EOS/EOB NAL
#define BOUNDARY_UPPER_SLICE
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data...
static int hevc_frame_start(HEVCContext *s)
unsigned int log2_min_tb_size
void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv)
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
enum PartMode part_mode
PartMode.
enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Wrapper around get_format() for frame-multithreaded codecs.
int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps)
uint8_t intra_pred_mode_c[4]
void(* put_hevc_qpel_uni[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int height, intptr_t mx, intptr_t my, int width)
int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps, int apply_defdispwin)
HEVCSEIPictureHash picture_hash
void av_md5_final(AVMD5 *ctx, uint8_t *dst)
Finish hashing and output digest value.
int allocate_progress
Whether to allocate progress for frame threading.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
int tc_offset
tc_offset_div2 * 2
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer. ...
uint8_t transfer_characteristic
static enum AVPixelFormat pix_fmts[]
int ff_hevc_ref_idx_lx_decode(HEVCContext *s, int num_ref_idx_lx)
uint8_t flags
A combination of HEVC_FRAME_FLAG_*.
HEVCLocalContext * HEVClc
static int FUNC() vps(CodedBitstreamContext *ctx, RWContext *rw, H265RawVPS *current)
static void hevc_await_progress(HEVCContext *s, HEVCFrame *ref, const Mv *mv, int y0, int height)
#define HWACCEL_VAAPI(codec)
static void export_stream_params(AVCodecContext *avctx, const HEVCParamSets *ps, const HEVCSPS *sps)
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int(* decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Callback for each slice.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int ff_hevc_cu_chroma_qp_offset_flag(HEVCContext *s)
HEVCSEIPictureTiming picture_timing
Hardware surfaces for Direct3D11.
the normal 219*2^(n-8) "MPEG" YUV ranges
int(* start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Called at the beginning of each frame or field picture.
int eos
current packet contains an EOS/EOB NAL
static int hls_slice_header(HEVCContext *s)
#define BOUNDARY_LEFT_SLICE
static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps)
void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv, int mvp_lx_flag, int LX)
static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
int max_transform_hierarchy_depth_intra
discard all non reference
static int hls_slice_data(HEVCContext *s)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
int ff_hevc_intra_chroma_pred_mode_decode(HEVCContext *s)
common internal and external API header
AVBufferPool * av_buffer_pool_init(int size, AVBufferRef *(*alloc)(int size))
Allocate and initialize a buffer pool.
static int ref[MAX_W *MAX_W]
uint16_t lt_ref_pic_poc_lsb_sps[HEVC_MAX_LONG_TERM_REF_PICS]
uint8_t weighted_pred_flag
static void hls_prediction_unit(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int partIdx, int idx)
int32_t * tab_slice_address
uint16_t num_tile_rows
num_tile_rows_minus1 + 1
int16_t offset_val[3][5]
SaoOffsetVal.
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
unsigned int * column_width
ColumnWidth.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread)
HEVCSEIAlternativeTransfer alternative_transfer
uint8_t * filter_slice_edges
uint8_t slice_header_extension_present_flag
uint16_t max_content_light_level
HEVCSEIDisplayOrientation display_orientation
unsigned properties
Properties of the stream that gets decoded.
int nal_length_size
Number of bytes used for nal length (1, 2 or 4)
AVBufferPool * tab_mvf_pool
int ff_hevc_sao_type_idx_decode(HEVCContext *s)
int video_full_range_flag
uint8_t edge_emu_buffer2[(MAX_PB_SIZE+7) *EDGE_EMU_BUFFER_STRIDE *2]
static const uint8_t tab_mode_idx[]
uint8_t chroma_qp_offset_list_len_minus1
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0, int nPbW, int nPbH)
int ff_hevc_pred_mode_decode(HEVCContext *s)
struct AVCodecInternal * internal
Private context used for internal data.
int ff_hevc_mpm_idx_decode(HEVCContext *s)
void(* put_hevc_epel_bi[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
int ff_hevc_pcm_flag_decode(HEVCContext *s)
void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, int log2_trafo_size, enum ScanType scan_idx, int c_idx)
int key_frame
1 -> keyframe, 0-> not
HEVCSEIA53Caption a53_caption
uint8_t long_term_ref_pics_present_flag
int temporal_id
HEVC only, nuh_temporal_id_plus_1 - 1.
void(* put_hevc_epel_uni_w[10][2][2])(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
static void luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, AVFrame *ref0, const Mv *mv0, int x_off, int y_off, int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv)
8.5.3.2.2.1 Luma sample bidirectional interpolation process
int diff_cu_qp_delta_depth
static int hls_cross_component_pred(HEVCContext *s, int idx)
Public header for MD5 hash function implementation.
#define atomic_init(obj, value)
static const AVOption options[]
#define HWACCEL_VDPAU(codec)
enum AVColorTransferCharacteristic color_trc
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
void ff_hevc_set_qPy(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
#define av_malloc_array(a, b)
uint8_t context_initialized
int video_signal_type_present_flag
#define FFSWAP(type, a, b)
uint8_t deblocking_filter_override_enabled_flag
int beta_offset
beta_offset_div2 * 2
#define SUBDIVIDE(x, y, idx)
int ff_hevc_sao_offset_abs_decode(HEVCContext *s)
int ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts)
static int hls_coding_quadtree(HEVCContext *s, int x0, int y0, int log2_cb_size, int cb_depth)
int depth
Number of bits in the component.
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.
AVPixelFormat
Pixel format.
This structure stores compressed data.
unsigned MaxFALL
Max average light level per frame (cd/m^2).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, int type)
uint8_t separate_colour_plane_flag
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
int ff_hevc_cu_qp_delta_abs(HEVCContext *s)
uint16_t display_primaries[3][2]
int ff_hevc_mvp_lx_flag_decode(HEVCContext *s)
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
uint8_t dependent_slice_segments_enabled_flag
int offset_sign[3][4]
sao_offset_sign
void(* put_hevc_epel_bi_w[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int ox0, int wx1, int ox1, intptr_t mx, intptr_t my, int width)
static av_cold int hevc_decode_free(AVCodecContext *avctx)