26 #include "config_components.h"
54 static const uint8_t
hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 };
96 int log2_min_cb_size =
sps->log2_min_cb_size;
99 int pic_size_in_ctb = ((
width >> log2_min_cb_size) + 1) *
100 ((
height >> log2_min_cb_size) + 1);
101 int ctb_count =
sps->ctb_width *
sps->ctb_height;
102 int min_pu_size =
sps->min_pu_width *
sps->min_pu_height;
104 s->bs_width = (
width >> 2) + 1;
105 s->bs_height = (
height >> 2) + 1;
108 s->deblock =
av_calloc(ctb_count,
sizeof(*
s->deblock));
109 if (!
s->sao || !
s->deblock)
114 if (!
s->skip_flag || !
s->tab_ct_depth)
120 if (!
s->tab_ipm || !
s->cbf_luma || !
s->is_pcm)
125 sizeof(*
s->tab_slice_address));
127 sizeof(*
s->qp_y_tab));
128 if (!
s->qp_y_tab || !
s->filter_slice_edges || !
s->tab_slice_address)
131 s->horizontal_bs =
av_calloc(
s->bs_width,
s->bs_height);
133 if (!
s->horizontal_bs || !
s->vertical_bs)
140 if (!
s->tab_mvf_pool || !
s->rpl_tab_pool)
154 uint8_t luma_weight_l0_flag[16];
155 uint8_t chroma_weight_l0_flag[16];
156 uint8_t luma_weight_l1_flag[16];
157 uint8_t chroma_weight_l1_flag[16];
158 int luma_log2_weight_denom;
161 if (luma_log2_weight_denom < 0 || luma_log2_weight_denom > 7) {
162 av_log(
s->avctx,
AV_LOG_ERROR,
"luma_log2_weight_denom %d is invalid\n", luma_log2_weight_denom);
165 s->sh.luma_log2_weight_denom =
av_clip_uintp2(luma_log2_weight_denom, 3);
166 if (
s->ps.sps->chroma_format_idc != 0) {
167 int64_t chroma_log2_weight_denom = luma_log2_weight_denom + (int64_t)
get_se_golomb(gb);
168 if (chroma_log2_weight_denom < 0 || chroma_log2_weight_denom > 7) {
169 av_log(
s->avctx,
AV_LOG_ERROR,
"chroma_log2_weight_denom %"PRId64
" is invalid\n", chroma_log2_weight_denom);
172 s->sh.chroma_log2_weight_denom = chroma_log2_weight_denom;
175 for (
i = 0;
i <
s->sh.nb_refs[
L0];
i++) {
177 if (!luma_weight_l0_flag[
i]) {
178 s->sh.luma_weight_l0[
i] = 1 <<
s->sh.luma_log2_weight_denom;
179 s->sh.luma_offset_l0[
i] = 0;
182 if (
s->ps.sps->chroma_format_idc != 0) {
183 for (
i = 0;
i <
s->sh.nb_refs[
L0];
i++)
186 for (
i = 0;
i <
s->sh.nb_refs[
L0];
i++)
187 chroma_weight_l0_flag[
i] = 0;
189 for (
i = 0;
i <
s->sh.nb_refs[
L0];
i++) {
190 if (luma_weight_l0_flag[
i]) {
192 if ((int8_t)delta_luma_weight_l0 != delta_luma_weight_l0)
194 s->sh.luma_weight_l0[
i] = (1 <<
s->sh.luma_log2_weight_denom) + delta_luma_weight_l0;
197 if (chroma_weight_l0_flag[
i]) {
198 for (j = 0; j < 2; j++) {
202 if ( (int8_t)delta_chroma_weight_l0 != delta_chroma_weight_l0
203 || delta_chroma_offset_l0 < -(1<<17) || delta_chroma_offset_l0 > (1<<17)) {
207 s->sh.chroma_weight_l0[
i][j] = (1 <<
s->sh.chroma_log2_weight_denom) + delta_chroma_weight_l0;
208 s->sh.chroma_offset_l0[
i][j] =
av_clip((delta_chroma_offset_l0 - ((128 *
s->sh.chroma_weight_l0[
i][j])
209 >>
s->sh.chroma_log2_weight_denom) + 128), -128, 127);
212 s->sh.chroma_weight_l0[
i][0] = 1 <<
s->sh.chroma_log2_weight_denom;
213 s->sh.chroma_offset_l0[
i][0] = 0;
214 s->sh.chroma_weight_l0[
i][1] = 1 <<
s->sh.chroma_log2_weight_denom;
215 s->sh.chroma_offset_l0[
i][1] = 0;
219 for (
i = 0;
i <
s->sh.nb_refs[
L1];
i++) {
221 if (!luma_weight_l1_flag[
i]) {
222 s->sh.luma_weight_l1[
i] = 1 <<
s->sh.luma_log2_weight_denom;
223 s->sh.luma_offset_l1[
i] = 0;
226 if (
s->ps.sps->chroma_format_idc != 0) {
227 for (
i = 0;
i <
s->sh.nb_refs[
L1];
i++)
230 for (
i = 0;
i <
s->sh.nb_refs[
L1];
i++)
231 chroma_weight_l1_flag[
i] = 0;
233 for (
i = 0;
i <
s->sh.nb_refs[
L1];
i++) {
234 if (luma_weight_l1_flag[
i]) {
236 if ((int8_t)delta_luma_weight_l1 != delta_luma_weight_l1)
238 s->sh.luma_weight_l1[
i] = (1 <<
s->sh.luma_log2_weight_denom) + delta_luma_weight_l1;
241 if (chroma_weight_l1_flag[
i]) {
242 for (j = 0; j < 2; j++) {
246 if ( (int8_t)delta_chroma_weight_l1 != delta_chroma_weight_l1
247 || delta_chroma_offset_l1 < -(1<<17) || delta_chroma_offset_l1 > (1<<17)) {
251 s->sh.chroma_weight_l1[
i][j] = (1 <<
s->sh.chroma_log2_weight_denom) + delta_chroma_weight_l1;
252 s->sh.chroma_offset_l1[
i][j] =
av_clip((delta_chroma_offset_l1 - ((128 *
s->sh.chroma_weight_l1[
i][j])
253 >>
s->sh.chroma_log2_weight_denom) + 128), -128, 127);
256 s->sh.chroma_weight_l1[
i][0] = 1 <<
s->sh.chroma_log2_weight_denom;
257 s->sh.chroma_offset_l1[
i][0] = 0;
258 s->sh.chroma_weight_l1[
i][1] = 1 <<
s->sh.chroma_log2_weight_denom;
259 s->sh.chroma_offset_l1[
i][1] = 0;
269 int max_poc_lsb = 1 <<
sps->log2_max_poc_lsb;
270 int prev_delta_msb = 0;
271 unsigned int nb_sps = 0, nb_sh;
275 if (!
sps->long_term_ref_pics_present_flag)
278 if (
sps->num_long_term_ref_pics_sps > 0)
282 if (nb_sps >
sps->num_long_term_ref_pics_sps)
292 uint8_t lt_idx_sps = 0;
294 if (
sps->num_long_term_ref_pics_sps > 1)
297 rps->
poc[
i] =
sps->lt_ref_pic_poc_lsb_sps[lt_idx_sps];
298 rps->
used[
i] =
sps->used_by_curr_pic_lt_sps_flag[lt_idx_sps];
309 if (
i &&
i != nb_sps)
310 delta += prev_delta_msb;
312 poc = rps->
poc[
i] +
s->poc -
delta * max_poc_lsb -
s->sh.pic_order_cnt_lsb;
316 prev_delta_msb =
delta;
329 unsigned int num = 0, den = 0;
337 avctx->
profile =
sps->ptl.general_ptl.profile_idc;
338 avctx->
level =
sps->ptl.general_ptl.level_idc;
342 if (
sps->vui.common.video_signal_type_present_flag)
348 if (
sps->vui.common.colour_description_present_flag) {
350 avctx->
color_trc =
sps->vui.common.transfer_characteristics;
359 if (
sps->chroma_format_idc == 1) {
360 if (
sps->vui.common.chroma_loc_info_present_flag) {
361 if (
sps->vui.common.chroma_sample_loc_type_top_field <= 5)
367 if (
vps->vps_timing_info_present_flag) {
368 num =
vps->vps_num_units_in_tick;
369 den =
vps->vps_time_scale;
370 }
else if (
sps->vui.vui_timing_info_present_flag) {
371 num =
sps->vui.vui_num_units_in_tick;
372 den =
sps->vui.vui_time_scale;
375 if (num != 0 && den != 0)
384 if (
s->sei.common.a53_caption.buf_ref)
387 if (
s->sei.common.alternative_transfer.present &&
390 avctx->
color_trc =
s->sei.common.alternative_transfer.preferred_transfer_characteristics;
393 if (
s->sei.common.film_grain_characteristics.present)
401 #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + \
402 CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \
403 CONFIG_HEVC_NVDEC_HWACCEL + \
404 CONFIG_HEVC_VAAPI_HWACCEL + \
405 CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + \
406 CONFIG_HEVC_VDPAU_HWACCEL + \
407 CONFIG_HEVC_VULKAN_HWACCEL)
410 switch (
sps->pix_fmt) {
413 #if CONFIG_HEVC_DXVA2_HWACCEL
416 #if CONFIG_HEVC_D3D11VA_HWACCEL
420 #if CONFIG_HEVC_VAAPI_HWACCEL
423 #if CONFIG_HEVC_VDPAU_HWACCEL
426 #if CONFIG_HEVC_NVDEC_HWACCEL
429 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
432 #if CONFIG_HEVC_VULKAN_HWACCEL
437 #if CONFIG_HEVC_DXVA2_HWACCEL
440 #if CONFIG_HEVC_D3D11VA_HWACCEL
444 #if CONFIG_HEVC_VAAPI_HWACCEL
447 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
450 #if CONFIG_HEVC_VULKAN_HWACCEL
453 #if CONFIG_HEVC_VDPAU_HWACCEL
456 #if CONFIG_HEVC_NVDEC_HWACCEL
461 #if CONFIG_HEVC_VAAPI_HWACCEL
464 #if CONFIG_HEVC_VDPAU_HWACCEL
467 #if CONFIG_HEVC_NVDEC_HWACCEL
470 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
473 #if CONFIG_HEVC_VULKAN_HWACCEL
479 #if CONFIG_HEVC_VAAPI_HWACCEL
482 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
485 #if CONFIG_HEVC_VULKAN_HWACCEL
490 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
496 #if CONFIG_HEVC_VAAPI_HWACCEL
499 #if CONFIG_HEVC_VDPAU_HWACCEL
502 #if CONFIG_HEVC_VULKAN_HWACCEL
505 #if CONFIG_HEVC_NVDEC_HWACCEL
510 #if CONFIG_HEVC_VAAPI_HWACCEL
513 #if CONFIG_HEVC_VULKAN_HWACCEL
519 *fmt++ =
sps->pix_fmt;
549 for (
i = 0;
i < 3;
i++) {
554 if (
sps->sao_enabled && !
s->avctx->hwaccel) {
555 int c_count = (
sps->chroma_format_idc != 0) ? 3 : 1;
558 for(c_idx = 0; c_idx < c_count; c_idx++) {
559 int w =
sps->width >>
sps->hshift[c_idx];
560 int h =
sps->height >>
sps->vshift[c_idx];
561 s->sao_pixel_buffer_h[c_idx] =
564 s->sao_pixel_buffer_v[c_idx] =
567 if (!
s->sao_pixel_buffer_h[c_idx] ||
568 !
s->sao_pixel_buffer_v[c_idx])
574 s->ps.vps =
s->ps.vps_list[
s->ps.sps->vps_id];
580 for (
i = 0;
i < 3;
i++) {
597 av_log(
s->avctx,
AV_LOG_ERROR,
"Two slices reporting being the first in the same frame.\n");
617 s->ps.pps !=
s->ps.pps_list[sh->
pps_id]) {
621 s->ps.pps =
s->ps.pps_list[sh->
pps_id];
625 if (
s->ps.sps !=
s->ps.sps_list[
s->ps.pps->sps_id]) {
650 int slice_address_length;
652 if (
s->ps.pps->dependent_slice_segments_enabled_flag)
656 s->ps.sps->ctb_height);
660 "Invalid slice segment address: %u.\n",
672 s->slice_initialized = 0;
676 s->slice_initialized = 0;
678 for (
i = 0;
i <
s->ps.pps->num_extra_slice_header_bits;
i++)
690 !
s->ps.pps->pps_curr_pic_ref_enabled_flag) {
697 if (
s->ps.pps->output_flag_present_flag)
700 if (
s->ps.sps->separate_colour_plane_flag)
710 "Ignoring POC change between slices: %d -> %d\n",
s->poc, poc);
726 int numbits, rps_idx;
728 if (!
s->ps.sps->nb_st_rps) {
734 rps_idx = numbits > 0 ?
get_bits(gb, numbits) : 0;
748 if (
s->ps.sps->sps_temporal_mvp_enabled_flag)
773 if (
s->ps.sps->sao_enabled) {
775 if (
s->ps.sps->chroma_format_idc) {
789 sh->
nb_refs[
L0] =
s->ps.pps->num_ref_idx_l0_default_active;
791 sh->
nb_refs[
L1] =
s->ps.pps->num_ref_idx_l1_default_active;
812 if (
s->ps.pps->lists_modification_present_flag && nb_refs > 1) {
830 if (
s->ps.pps->cabac_init_present_flag)
845 "Invalid collocated_ref_idx: %d.\n",
862 "Invalid number of merging MVP candidates: %d.\n",
868 if (
s->ps.sps->motion_vector_resolution_control_idc == 2)
878 if (
s->ps.pps->pic_slice_level_chroma_qp_offsets_present_flag) {
891 if (
s->ps.pps->pps_slice_act_qp_offsets_present_flag) {
897 if (
s->ps.pps->chroma_qp_offset_list_enabled_flag)
902 if (
s->ps.pps->deblocking_filter_control_present_flag) {
903 int deblocking_filter_override_flag = 0;
905 if (
s->ps.pps->deblocking_filter_override_enabled_flag)
906 deblocking_filter_override_flag =
get_bits1(gb);
908 if (deblocking_filter_override_flag) {
913 if (beta_offset_div2 < -6 || beta_offset_div2 > 6 ||
914 tc_offset_div2 < -6 || tc_offset_div2 > 6) {
916 "Invalid deblock filter offsets: %d, %d\n",
917 beta_offset_div2, tc_offset_div2);
934 if (
s->ps.pps->seq_loop_filter_across_slices_enabled_flag &&
942 }
else if (!
s->slice_initialized) {
948 if (
s->ps.pps->tiles_enabled_flag ||
s->ps.pps->entropy_coding_sync_enabled_flag) {
952 av_log(
s->avctx,
AV_LOG_ERROR,
"num_entry_point_offsets %d is invalid\n", num_entry_point_offsets);
960 if (offset_len < 1 || offset_len > 32) {
981 if (
s->threads_number > 1 && (
s->ps.pps->num_tile_rows > 1 ||
s->ps.pps->num_tile_columns > 1)) {
982 s->enable_parallel_tiles = 0;
983 s->threads_number = 1;
985 s->enable_parallel_tiles = 0;
987 s->enable_parallel_tiles = 0;
990 if (
s->ps.pps->slice_header_extension_present_flag) {
996 for (
i = 0;
i < length;
i++)
1003 sh->
slice_qp < -
s->ps.sps->qp_bd_offset) {
1005 "The slice_qp %d is outside the valid range "
1008 -
s->ps.sps->qp_bd_offset);
1014 if (!
s->sh.slice_ctb_addr_rs &&
s->sh.dependent_slice_segment_flag) {
1025 s->HEVClc->first_qp_group = !
s->sh.dependent_slice_segment_flag;
1027 if (!
s->ps.pps->cu_qp_delta_enabled_flag)
1028 s->HEVClc->qp_y =
s->sh.slice_qp;
1030 s->slice_initialized = 1;
1031 s->HEVClc->tu.cu_qp_offset_cb = 0;
1032 s->HEVClc->tu.cu_qp_offset_cr = 0;
1037 #define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)])
1039 #define SET_SAO(elem, value) \
1041 if (!sao_merge_up_flag && !sao_merge_left_flag) \
1042 sao->elem = value; \
1043 else if (sao_merge_left_flag) \
1044 sao->elem = CTB(s->sao, rx-1, ry).elem; \
1045 else if (sao_merge_up_flag) \
1046 sao->elem = CTB(s->sao, rx, ry-1).elem; \
1054 int sao_merge_left_flag = 0;
1055 int sao_merge_up_flag = 0;
1059 if (
s->sh.slice_sample_adaptive_offset_flag[0] ||
1060 s->sh.slice_sample_adaptive_offset_flag[1]) {
1065 if (ry > 0 && !sao_merge_left_flag) {
1071 for (c_idx = 0; c_idx < (
s->ps.sps->chroma_format_idc ? 3 : 1); c_idx++) {
1072 int log2_sao_offset_scale = c_idx == 0 ?
s->ps.pps->log2_sao_offset_scale_luma :
1073 s->ps.pps->log2_sao_offset_scale_chroma;
1075 if (!
s->sh.slice_sample_adaptive_offset_flag[c_idx]) {
1090 for (
i = 0;
i < 4;
i++)
1094 for (
i = 0;
i < 4;
i++) {
1103 }
else if (c_idx != 2) {
1109 for (
i = 0;
i < 4;
i++) {
1117 sao->
offset_val[c_idx][
i + 1] *= 1 << log2_sao_offset_scale;
1129 if (log2_res_scale_abs_plus1 != 0) {
1132 (1 - 2 * res_scale_sign_flag);
1142 int xBase,
int yBase,
int cb_xBase,
int cb_yBase,
1143 int log2_cb_size,
int log2_trafo_size,
1144 int blk_idx,
int cbf_luma,
int *cbf_cb,
int *cbf_cr)
1147 const int log2_trafo_size_c = log2_trafo_size -
s->ps.sps->hshift[1];
1151 int trafo_size = 1 << log2_trafo_size;
1154 s->hpc.intra_pred[log2_trafo_size - 2](lc, x0, y0, 0);
1157 if (cbf_luma || cbf_cb[0] || cbf_cr[0] ||
1158 (
s->ps.sps->chroma_format_idc == 2 && (cbf_cb[1] || cbf_cr[1]))) {
1161 int cbf_chroma = cbf_cb[0] || cbf_cr[0] ||
1162 (
s->ps.sps->chroma_format_idc == 2 &&
1163 (cbf_cb[1] || cbf_cr[1]));
1175 "The cu_qp_delta %d is outside the valid range "
1178 -(26 +
s->ps.sps->qp_bd_offset / 2),
1179 (25 +
s->ps.sps->qp_bd_offset / 2));
1186 if (
s->sh.cu_chroma_qp_offset_enabled_flag && cbf_chroma &&
1189 if (cu_chroma_qp_offset_flag) {
1190 int cu_chroma_qp_offset_idx = 0;
1191 if (
s->ps.pps->chroma_qp_offset_list_len_minus1 > 0) {
1194 "cu_chroma_qp_offset_idx not yet tested.\n");
1227 if (
s->ps.sps->chroma_format_idc && (log2_trafo_size > 2 ||
s->ps.sps->chroma_format_idc == 3)) {
1228 int trafo_size_h = 1 << (log2_trafo_size_c +
s->ps.sps->hshift[1]);
1229 int trafo_size_v = 1 << (log2_trafo_size_c +
s->ps.sps->vshift[1]);
1230 lc->
tu.
cross_pf = (
s->ps.pps->cross_component_prediction_enabled_flag && cbf_luma &&
1237 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1240 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (
i << log2_trafo_size_c), 1);
1244 log2_trafo_size_c, scan_idx_c, 1);
1247 ptrdiff_t
stride =
s->frame->linesize[1];
1248 int hshift =
s->ps.sps->hshift[1];
1249 int vshift =
s->ps.sps->vshift[1];
1252 int size = 1 << log2_trafo_size_c;
1254 uint8_t *dst = &
s->frame->data[1][(y0 >> vshift) *
stride +
1255 ((x0 >> hshift) <<
s->ps.sps->pixel_shift)];
1259 s->hevcdsp.add_residual[log2_trafo_size_c-2](dst, coeffs,
stride);
1266 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1269 trafo_size_h, trafo_size_v);
1270 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (
i << log2_trafo_size_c), 2);
1274 log2_trafo_size_c, scan_idx_c, 2);
1277 ptrdiff_t
stride =
s->frame->linesize[2];
1278 int hshift =
s->ps.sps->hshift[2];
1279 int vshift =
s->ps.sps->vshift[2];
1282 int size = 1 << log2_trafo_size_c;
1284 uint8_t *dst = &
s->frame->data[2][(y0 >> vshift) *
stride +
1285 ((x0 >> hshift) <<
s->ps.sps->pixel_shift)];
1289 s->hevcdsp.add_residual[log2_trafo_size_c-2](dst, coeffs,
stride);
1292 }
else if (
s->ps.sps->chroma_format_idc && blk_idx == 3) {
1293 int trafo_size_h = 1 << (log2_trafo_size + 1);
1294 int trafo_size_v = 1 << (log2_trafo_size +
s->ps.sps->vshift[1]);
1295 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1298 trafo_size_h, trafo_size_v);
1299 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (
i << log2_trafo_size), 1);
1303 log2_trafo_size, scan_idx_c, 1);
1305 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1308 trafo_size_h, trafo_size_v);
1309 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (
i << log2_trafo_size), 2);
1313 log2_trafo_size, scan_idx_c, 2);
1317 if (log2_trafo_size > 2 ||
s->ps.sps->chroma_format_idc == 3) {
1318 int trafo_size_h = 1 << (log2_trafo_size_c +
s->ps.sps->hshift[1]);
1319 int trafo_size_v = 1 << (log2_trafo_size_c +
s->ps.sps->vshift[1]);
1321 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0, 1);
1322 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0, 2);
1323 if (
s->ps.sps->chroma_format_idc == 2) {
1325 trafo_size_h, trafo_size_v);
1326 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (1 << log2_trafo_size_c), 1);
1327 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (1 << log2_trafo_size_c), 2);
1329 }
else if (blk_idx == 3) {
1330 int trafo_size_h = 1 << (log2_trafo_size + 1);
1331 int trafo_size_v = 1 << (log2_trafo_size +
s->ps.sps->vshift[1]);
1333 trafo_size_h, trafo_size_v);
1334 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase, 1);
1335 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase, 2);
1336 if (
s->ps.sps->chroma_format_idc == 2) {
1338 trafo_size_h, trafo_size_v);
1339 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (1 << log2_trafo_size), 1);
1340 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (1 << log2_trafo_size), 2);
1350 int cb_size = 1 << log2_cb_size;
1351 int log2_min_pu_size =
s->ps.sps->log2_min_pu_size;
1353 int min_pu_width =
s->ps.sps->min_pu_width;
1354 int x_end =
FFMIN(x0 + cb_size,
s->ps.sps->width);
1355 int y_end =
FFMIN(y0 + cb_size,
s->ps.sps->height);
1358 for (j = (y0 >> log2_min_pu_size); j < (y_end >> log2_min_pu_size); j++)
1359 for (
i = (x0 >> log2_min_pu_size);
i < (x_end >> log2_min_pu_size);
i++)
1360 s->is_pcm[
i + j * min_pu_width] = 2;
1364 int xBase,
int yBase,
int cb_xBase,
int cb_yBase,
1365 int log2_cb_size,
int log2_trafo_size,
1366 int trafo_depth,
int blk_idx,
1367 const int *base_cbf_cb,
const int *base_cbf_cr)
1370 uint8_t split_transform_flag;
1375 cbf_cb[0] = base_cbf_cb[0];
1376 cbf_cb[1] = base_cbf_cb[1];
1377 cbf_cr[0] = base_cbf_cr[0];
1378 cbf_cr[1] = base_cbf_cr[1];
1381 if (trafo_depth == 1) {
1383 if (
s->ps.sps->chroma_format_idc == 3) {
1397 if (log2_trafo_size <= s->ps.sps->log2_max_trafo_size &&
1398 log2_trafo_size >
s->ps.sps->log2_min_tb_size &&
1399 trafo_depth < lc->cu.max_trafo_depth &&
1403 int inter_split =
s->ps.sps->max_transform_hierarchy_depth_inter == 0 &&
1408 split_transform_flag = log2_trafo_size >
s->ps.sps->log2_max_trafo_size ||
1413 if (
s->ps.sps->chroma_format_idc && (log2_trafo_size > 2 ||
s->ps.sps->chroma_format_idc == 3)) {
1414 if (trafo_depth == 0 || cbf_cb[0]) {
1416 if (
s->ps.sps->chroma_format_idc == 2 && (!split_transform_flag || log2_trafo_size == 3)) {
1421 if (trafo_depth == 0 || cbf_cr[0]) {
1423 if (
s->ps.sps->chroma_format_idc == 2 && (!split_transform_flag || log2_trafo_size == 3)) {
1429 if (split_transform_flag) {
1430 const int trafo_size_split = 1 << (log2_trafo_size - 1);
1431 const int x1 = x0 + trafo_size_split;
1432 const int y1 = y0 + trafo_size_split;
1434 #define SUBDIVIDE(x, y, idx) \
1436 ret = hls_transform_tree(lc, x, y, x0, y0, cb_xBase, cb_yBase, log2_cb_size,\
1437 log2_trafo_size - 1, trafo_depth + 1, idx, \
1450 int min_tu_size = 1 <<
s->ps.sps->log2_min_tb_size;
1451 int log2_min_tu_size =
s->ps.sps->log2_min_tb_size;
1452 int min_tu_width =
s->ps.sps->min_tb_width;
1456 cbf_cb[0] || cbf_cr[0] ||
1457 (
s->ps.sps->chroma_format_idc == 2 && (cbf_cb[1] || cbf_cr[1]))) {
1462 log2_cb_size, log2_trafo_size,
1463 blk_idx, cbf_luma, cbf_cb, cbf_cr);
1469 for (
i = 0;
i < (1 << log2_trafo_size);
i += min_tu_size)
1470 for (j = 0; j < (1 << log2_trafo_size); j += min_tu_size) {
1471 int x_tu = (x0 + j) >> log2_min_tu_size;
1472 int y_tu = (y0 +
i) >> log2_min_tu_size;
1473 s->cbf_luma[y_tu * min_tu_width + x_tu] = 1;
1476 if (!
s->sh.disable_deblocking_filter_flag) {
1478 if (
s->ps.pps->transquant_bypass_enable_flag &&
1490 int cb_size = 1 << log2_cb_size;
1491 ptrdiff_t stride0 =
s->frame->linesize[0];
1492 ptrdiff_t stride1 =
s->frame->linesize[1];
1493 ptrdiff_t stride2 =
s->frame->linesize[2];
1494 uint8_t *dst0 = &
s->frame->data[0][y0 * stride0 + (x0 <<
s->ps.sps->pixel_shift)];
1495 uint8_t *dst1 = &
s->frame->data[1][(y0 >>
s->ps.sps->vshift[1]) * stride1 + ((x0 >>
s->ps.sps->hshift[1]) <<
s->ps.sps->pixel_shift)];
1496 uint8_t *dst2 = &
s->frame->data[2][(y0 >>
s->ps.sps->vshift[2]) * stride2 + ((x0 >>
s->ps.sps->hshift[2]) <<
s->ps.sps->pixel_shift)];
1498 int length = cb_size * cb_size *
s->ps.sps->pcm.bit_depth +
1499 (((cb_size >>
s->ps.sps->hshift[1]) * (cb_size >>
s->ps.sps->vshift[1])) +
1500 ((cb_size >>
s->ps.sps->hshift[2]) * (cb_size >>
s->ps.sps->vshift[2]))) *
1501 s->ps.sps->pcm.bit_depth_chroma;
1502 const uint8_t *pcm =
skip_bytes(&lc->
cc, (length + 7) >> 3);
1505 if (!
s->sh.disable_deblocking_filter_flag)
1512 s->hevcdsp.put_pcm(dst0, stride0, cb_size, cb_size, &gb,
s->ps.sps->pcm.bit_depth);
1513 if (
s->ps.sps->chroma_format_idc) {
1514 s->hevcdsp.put_pcm(dst1, stride1,
1515 cb_size >>
s->ps.sps->hshift[1],
1516 cb_size >>
s->ps.sps->vshift[1],
1517 &gb,
s->ps.sps->pcm.bit_depth_chroma);
1518 s->hevcdsp.put_pcm(dst2, stride2,
1519 cb_size >>
s->ps.sps->hshift[2],
1520 cb_size >>
s->ps.sps->vshift[2],
1521 &gb,
s->ps.sps->pcm.bit_depth_chroma);
1545 int block_w,
int block_h,
int luma_weight,
int luma_offset)
1548 const uint8_t *
src =
ref->data[0];
1549 ptrdiff_t srcstride =
ref->linesize[0];
1550 int pic_width =
s->ps.sps->width;
1551 int pic_height =
s->ps.sps->height;
1554 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1555 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1558 x_off +=
mv->x >> 2;
1559 y_off +=
mv->y >> 2;
1560 src += y_off * srcstride + (x_off * (1 <<
s->ps.sps->pixel_shift));
1571 edge_emu_stride, srcstride,
1575 pic_width, pic_height);
1577 srcstride = edge_emu_stride;
1581 s->hevcdsp.put_hevc_qpel_uni[idx][!!my][!!mx](dst, dststride,
src, srcstride,
1582 block_h, mx, my, block_w);
1584 s->hevcdsp.put_hevc_qpel_uni_w[idx][!!my][!!mx](dst, dststride,
src, srcstride,
1585 block_h,
s->sh.luma_log2_weight_denom,
1586 luma_weight, luma_offset, mx, my, block_w);
1606 const AVFrame *ref0,
const Mv *mv0,
int x_off,
int y_off,
1607 int block_w,
int block_h,
const AVFrame *ref1,
1608 const Mv *mv1,
struct MvField *current_mv)
1611 ptrdiff_t src0stride = ref0->
linesize[0];
1612 ptrdiff_t src1stride = ref1->
linesize[0];
1613 int pic_width =
s->ps.sps->width;
1614 int pic_height =
s->ps.sps->height;
1615 int mx0 = mv0->
x & 3;
1616 int my0 = mv0->
y & 3;
1617 int mx1 = mv1->
x & 3;
1618 int my1 = mv1->
y & 3;
1619 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1620 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1621 int x_off0 = x_off + (mv0->
x >> 2);
1622 int y_off0 = y_off + (mv0->
y >> 2);
1623 int x_off1 = x_off + (mv1->
x >> 2);
1624 int y_off1 = y_off + (mv1->
y >> 2);
1627 const uint8_t *
src0 = ref0->
data[0] + y_off0 * src0stride + (
int)((
unsigned)x_off0 <<
s->ps.sps->pixel_shift);
1628 const uint8_t *
src1 = ref1->
data[0] + y_off1 * src1stride + (
int)((
unsigned)x_off1 <<
s->ps.sps->pixel_shift);
1638 edge_emu_stride, src0stride,
1642 pic_width, pic_height);
1644 src0stride = edge_emu_stride;
1655 edge_emu_stride, src1stride,
1659 pic_width, pic_height);
1661 src1stride = edge_emu_stride;
1664 s->hevcdsp.put_hevc_qpel[idx][!!my0][!!mx0](lc->
tmp,
src0, src0stride,
1665 block_h, mx0, my0, block_w);
1667 s->hevcdsp.put_hevc_qpel_bi[idx][!!my1][!!mx1](dst, dststride,
src1, src1stride, lc->
tmp,
1668 block_h, mx1, my1, block_w);
1670 s->hevcdsp.put_hevc_qpel_bi_w[idx][!!my1][!!mx1](dst, dststride,
src1, src1stride, lc->
tmp,
1671 block_h,
s->sh.luma_log2_weight_denom,
1672 s->sh.luma_weight_l0[current_mv->
ref_idx[0]],
1673 s->sh.luma_weight_l1[current_mv->
ref_idx[1]],
1674 s->sh.luma_offset_l0[current_mv->
ref_idx[0]],
1675 s->sh.luma_offset_l1[current_mv->
ref_idx[1]],
1698 ptrdiff_t dststride,
const uint8_t *
src0, ptrdiff_t srcstride,
int reflist,
1699 int x_off,
int y_off,
int block_w,
int block_h,
1700 const struct MvField *current_mv,
int chroma_weight,
int chroma_offset)
1703 int pic_width =
s->ps.sps->width >>
s->ps.sps->hshift[1];
1704 int pic_height =
s->ps.sps->height >>
s->ps.sps->vshift[1];
1705 const Mv *
mv = ¤t_mv->
mv[reflist];
1706 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1707 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1709 int hshift =
s->ps.sps->hshift[1];
1710 int vshift =
s->ps.sps->vshift[1];
1713 intptr_t _mx = mx << (1 - hshift);
1714 intptr_t _my = my << (1 - vshift);
1715 int emu =
src0 ==
s->frame->data[1] ||
src0 ==
s->frame->data[2];
1717 x_off +=
mv->x >> (2 + hshift);
1718 y_off +=
mv->y >> (2 + vshift);
1719 src0 += y_off * srcstride + (x_off * (1 <<
s->ps.sps->pixel_shift));
1728 (edge_emu_stride + (1 <<
s->ps.sps->pixel_shift));
1730 edge_emu_stride, srcstride,
1734 pic_width, pic_height);
1737 srcstride = edge_emu_stride;
1740 s->hevcdsp.put_hevc_epel_uni[idx][!!my][!!mx](dst0, dststride,
src0, srcstride,
1741 block_h, _mx, _my, block_w);
1743 s->hevcdsp.put_hevc_epel_uni_w[idx][!!my][!!mx](dst0, dststride,
src0, srcstride,
1744 block_h,
s->sh.chroma_log2_weight_denom,
1745 chroma_weight, chroma_offset, _mx, _my, block_w);
1767 int x_off,
int y_off,
int block_w,
int block_h,
const MvField *current_mv,
int cidx)
1770 const uint8_t *
src1 = ref0->
data[cidx+1];
1771 const uint8_t *
src2 = ref1->
data[cidx+1];
1772 ptrdiff_t src1stride = ref0->
linesize[cidx+1];
1773 ptrdiff_t src2stride = ref1->
linesize[cidx+1];
1774 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1775 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1776 int pic_width =
s->ps.sps->width >>
s->ps.sps->hshift[1];
1777 int pic_height =
s->ps.sps->height >>
s->ps.sps->vshift[1];
1778 const Mv *
const mv0 = ¤t_mv->
mv[0];
1779 const Mv *
const mv1 = ¤t_mv->
mv[1];
1780 int hshift =
s->ps.sps->hshift[1];
1781 int vshift =
s->ps.sps->vshift[1];
1787 intptr_t _mx0 = mx0 << (1 - hshift);
1788 intptr_t _my0 = my0 << (1 - vshift);
1789 intptr_t _mx1 = mx1 << (1 - hshift);
1790 intptr_t _my1 = my1 << (1 - vshift);
1792 int x_off0 = x_off + (mv0->
x >> (2 + hshift));
1793 int y_off0 = y_off + (mv0->
y >> (2 + vshift));
1794 int x_off1 = x_off + (mv1->
x >> (2 + hshift));
1795 int y_off1 = y_off + (mv1->
y >> (2 + vshift));
1797 src1 += y_off0 * src1stride + (
int)((
unsigned)x_off0 <<
s->ps.sps->pixel_shift);
1798 src2 += y_off1 * src2stride + (
int)((
unsigned)x_off1 <<
s->ps.sps->pixel_shift);
1806 (edge_emu_stride + (1 <<
s->ps.sps->pixel_shift));
1809 edge_emu_stride, src1stride,
1813 pic_width, pic_height);
1816 src1stride = edge_emu_stride;
1825 (edge_emu_stride + (1 <<
s->ps.sps->pixel_shift));
1828 edge_emu_stride, src2stride,
1832 pic_width, pic_height);
1835 src2stride = edge_emu_stride;
1838 s->hevcdsp.put_hevc_epel[idx][!!my0][!!mx0](lc->
tmp,
src1, src1stride,
1839 block_h, _mx0, _my0, block_w);
1841 s->hevcdsp.put_hevc_epel_bi[idx][!!my1][!!mx1](dst0,
s->frame->linesize[cidx+1],
1843 block_h, _mx1, _my1, block_w);
1845 s->hevcdsp.put_hevc_epel_bi_w[idx][!!my1][!!mx1](dst0,
s->frame->linesize[cidx+1],
1848 s->sh.chroma_log2_weight_denom,
1849 s->sh.chroma_weight_l0[current_mv->
ref_idx[0]][cidx],
1850 s->sh.chroma_weight_l1[current_mv->
ref_idx[1]][cidx],
1851 s->sh.chroma_offset_l0[current_mv->
ref_idx[0]][cidx],
1852 s->sh.chroma_offset_l1[current_mv->
ref_idx[1]][cidx],
1853 _mx1, _my1, block_w);
1867 int nPbH,
int log2_cb_size,
int part_idx,
1879 if (inter_pred_idc !=
PRED_L1) {
1880 if (
s->sh.nb_refs[
L0])
1887 part_idx, merge_idx,
mv, mvp_flag, 0);
1892 if (inter_pred_idc !=
PRED_L0) {
1893 if (
s->sh.nb_refs[
L1])
1896 if (
s->sh.mvd_l1_zero_flag == 1 && inter_pred_idc ==
PRED_BI) {
1905 part_idx, merge_idx,
mv, mvp_flag, 1);
1913 int log2_cb_size,
int partIdx,
int idx)
1915 #define POS(c_idx, x, y) \
1916 &s->frame->data[c_idx][((y) >> s->ps.sps->vshift[c_idx]) * s->frame->linesize[c_idx] + \
1917 (((x) >> s->ps.sps->hshift[c_idx]) << s->ps.sps->pixel_shift)]
1920 struct MvField current_mv = {{{ 0 }}};
1922 int min_pu_width =
s->ps.sps->min_pu_width;
1924 MvField *tab_mvf =
s->ref->tab_mvf;
1925 const RefPicList *refPicList =
s->ref->refPicList;
1927 uint8_t *dst0 =
POS(0, x0, y0);
1928 uint8_t *dst1 =
POS(1, x0, y0);
1929 uint8_t *dst2 =
POS(2, x0, y0);
1930 int log2_min_cb_size =
s->ps.sps->log2_min_cb_size;
1931 int min_cb_width =
s->ps.sps->min_cb_width;
1932 int x_cb = x0 >> log2_min_cb_size;
1933 int y_cb = y0 >> log2_min_cb_size;
1937 int skip_flag =
SAMPLE_CTB(
s->skip_flag, x_cb, y_cb);
1943 if (
s->sh.max_num_merge_cand > 1)
1949 partIdx, merge_idx, ¤t_mv);
1952 partIdx, merge_idx, ¤t_mv);
1955 x_pu = x0 >>
s->ps.sps->log2_min_pu_size;
1956 y_pu = y0 >>
s->ps.sps->log2_min_pu_size;
1958 for (j = 0; j < nPbH >>
s->ps.sps->log2_min_pu_size; j++)
1959 for (
i = 0; i < nPbW >>
s->ps.sps->log2_min_pu_size;
i++)
1960 tab_mvf[(y_pu + j) * min_pu_width + x_pu +
i] = current_mv;
1963 ref0 = refPicList[0].
ref[current_mv.
ref_idx[0]];
1969 ref1 = refPicList[1].
ref[current_mv.
ref_idx[1]];
1970 if (!ref1 || !ref1->frame->data[0])
1976 int x0_c = x0 >>
s->ps.sps->hshift[1];
1977 int y0_c = y0 >>
s->ps.sps->vshift[1];
1978 int nPbW_c = nPbW >>
s->ps.sps->hshift[1];
1979 int nPbH_c = nPbH >>
s->ps.sps->vshift[1];
1982 ¤t_mv.
mv[0], x0, y0, nPbW, nPbH,
1983 s->sh.luma_weight_l0[current_mv.
ref_idx[0]],
1984 s->sh.luma_offset_l0[current_mv.
ref_idx[0]]);
1986 if (
s->ps.sps->chroma_format_idc) {
1988 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1989 s->sh.chroma_weight_l0[current_mv.
ref_idx[0]][0],
s->sh.chroma_offset_l0[current_mv.
ref_idx[0]][0]);
1991 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1992 s->sh.chroma_weight_l0[current_mv.
ref_idx[0]][1],
s->sh.chroma_offset_l0[current_mv.
ref_idx[0]][1]);
1995 int x0_c = x0 >>
s->ps.sps->hshift[1];
1996 int y0_c = y0 >>
s->ps.sps->vshift[1];
1997 int nPbW_c = nPbW >>
s->ps.sps->hshift[1];
1998 int nPbH_c = nPbH >>
s->ps.sps->vshift[1];
2000 luma_mc_uni(lc, dst0,
s->frame->linesize[0], ref1->frame,
2001 ¤t_mv.
mv[1], x0, y0, nPbW, nPbH,
2002 s->sh.luma_weight_l1[current_mv.
ref_idx[1]],
2003 s->sh.luma_offset_l1[current_mv.
ref_idx[1]]);
2005 if (
s->ps.sps->chroma_format_idc) {
2006 chroma_mc_uni(lc, dst1,
s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1],
2007 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
2008 s->sh.chroma_weight_l1[current_mv.
ref_idx[1]][0],
s->sh.chroma_offset_l1[current_mv.
ref_idx[1]][0]);
2010 chroma_mc_uni(lc, dst2,
s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2],
2011 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
2012 s->sh.chroma_weight_l1[current_mv.
ref_idx[1]][1],
s->sh.chroma_offset_l1[current_mv.
ref_idx[1]][1]);
2015 int x0_c = x0 >>
s->ps.sps->hshift[1];
2016 int y0_c = y0 >>
s->ps.sps->vshift[1];
2017 int nPbW_c = nPbW >>
s->ps.sps->hshift[1];
2018 int nPbH_c = nPbH >>
s->ps.sps->vshift[1];
2021 ¤t_mv.
mv[0], x0, y0, nPbW, nPbH,
2022 ref1->frame, ¤t_mv.
mv[1], ¤t_mv);
2024 if (
s->ps.sps->chroma_format_idc) {
2026 x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0);
2029 x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 1);
2038 int prev_intra_luma_pred_flag)
2041 int x_pu = x0 >>
s->ps.sps->log2_min_pu_size;
2042 int y_pu = y0 >>
s->ps.sps->log2_min_pu_size;
2043 int min_pu_width =
s->ps.sps->min_pu_width;
2044 int size_in_pus = pu_size >>
s->ps.sps->log2_min_pu_size;
2049 s->tab_ipm[(y_pu - 1) * min_pu_width + x_pu] :
INTRA_DC;
2051 s->tab_ipm[y_pu * min_pu_width + x_pu - 1] :
INTRA_DC;
2053 int y_ctb = (y0 >> (
s->ps.sps->log2_ctb_size)) << (
s->ps.sps->log2_ctb_size);
2055 MvField *tab_mvf =
s->ref->tab_mvf;
2056 int intra_pred_mode;
2061 if ((y0 - 1) < y_ctb)
2064 if (cand_left == cand_up) {
2065 if (cand_left < 2) {
2070 candidate[0] = cand_left;
2071 candidate[1] = 2 + ((cand_left - 2 - 1 + 32) & 31);
2072 candidate[2] = 2 + ((cand_left - 2 + 1) & 31);
2075 candidate[0] = cand_left;
2076 candidate[1] = cand_up;
2086 if (prev_intra_luma_pred_flag) {
2087 intra_pred_mode = candidate[lc->
pu.
mpm_idx];
2089 if (candidate[0] > candidate[1])
2090 FFSWAP(uint8_t, candidate[0], candidate[1]);
2091 if (candidate[0] > candidate[2])
2092 FFSWAP(uint8_t, candidate[0], candidate[2]);
2093 if (candidate[1] > candidate[2])
2094 FFSWAP(uint8_t, candidate[1], candidate[2]);
2097 for (
i = 0;
i < 3;
i++)
2098 if (intra_pred_mode >= candidate[
i])
2105 for (
i = 0;
i < size_in_pus;
i++) {
2106 memset(&
s->tab_ipm[(y_pu +
i) * min_pu_width + x_pu],
2107 intra_pred_mode, size_in_pus);
2109 for (j = 0; j < size_in_pus; j++) {
2114 return intra_pred_mode;
2118 int log2_cb_size,
int ct_depth)
2120 int length = (1 << log2_cb_size) >>
s->ps.sps->log2_min_cb_size;
2121 int x_cb = x0 >>
s->ps.sps->log2_min_cb_size;
2122 int y_cb = y0 >>
s->ps.sps->log2_min_cb_size;
2125 for (y = 0; y < length; y++)
2126 memset(&
s->tab_ct_depth[(y_cb + y) *
s->ps.sps->min_cb_width + x_cb],
2131 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20,
2132 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31};
2138 static const uint8_t intra_chroma_table[4] = { 0, 26, 10, 1 };
2139 uint8_t prev_intra_luma_pred_flag[4];
2141 int pb_size = (1 << log2_cb_size) >>
split;
2142 int side =
split + 1;
2146 for (
i = 0;
i < side;
i++)
2147 for (j = 0; j < side; j++)
2150 for (
i = 0;
i < side;
i++) {
2151 for (j = 0; j < side; j++) {
2152 if (prev_intra_luma_pred_flag[2 *
i + j])
2159 prev_intra_luma_pred_flag[2 *
i + j]);
2163 if (
s->ps.sps->chroma_format_idc == 3) {
2164 for (
i = 0;
i < side;
i++) {
2165 for (j = 0; j < side; j++) {
2167 if (chroma_mode != 4) {
2177 }
else if (
s->ps.sps->chroma_format_idc == 2) {
2180 if (chroma_mode != 4) {
2184 mode_idx = intra_chroma_table[chroma_mode];
2189 }
else if (
s->ps.sps->chroma_format_idc != 0) {
2191 if (chroma_mode != 4) {
2207 int pb_size = 1 << log2_cb_size;
2208 int size_in_pus = pb_size >>
s->ps.sps->log2_min_pu_size;
2209 int min_pu_width =
s->ps.sps->min_pu_width;
2210 MvField *tab_mvf =
s->ref->tab_mvf;
2211 int x_pu = x0 >>
s->ps.sps->log2_min_pu_size;
2212 int y_pu = y0 >>
s->ps.sps->log2_min_pu_size;
2215 if (size_in_pus == 0)
2217 for (j = 0; j < size_in_pus; j++)
2218 memset(&
s->tab_ipm[(y_pu + j) * min_pu_width + x_pu],
INTRA_DC, size_in_pus);
2220 for (j = 0; j < size_in_pus; j++)
2221 for (k = 0; k < size_in_pus; k++)
2227 int cb_size = 1 << log2_cb_size;
2228 int log2_min_cb_size =
s->ps.sps->log2_min_cb_size;
2229 int length = cb_size >> log2_min_cb_size;
2230 int min_cb_width =
s->ps.sps->min_cb_width;
2231 int x_cb = x0 >> log2_min_cb_size;
2232 int y_cb = y0 >> log2_min_cb_size;
2233 int idx = log2_cb_size - 2;
2234 int qp_block_mask = (1<<(
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_qp_delta_depth)) - 1;
2244 for (x = 0; x < 4; x++)
2246 if (
s->ps.pps->transquant_bypass_enable_flag) {
2256 x = y_cb * min_cb_width + x_cb;
2257 for (y = 0; y < length; y++) {
2258 memset(&
s->skip_flag[x], skip_flag, length);
2263 x = y_cb * min_cb_width + x_cb;
2264 for (y = 0; y < length; y++) {
2265 memset(&
s->skip_flag[x], 0, length);
2274 if (!
s->sh.disable_deblocking_filter_flag)
2282 log2_cb_size ==
s->ps.sps->log2_min_cb_size) {
2290 log2_cb_size >=
s->ps.sps->pcm.log2_min_pcm_cb_size &&
2291 log2_cb_size <= s->ps.sps->pcm.log2_max_pcm_cb_size) {
2297 if (
s->ps.sps->pcm.loop_filter_disable_flag)
2313 hls_prediction_unit(lc, x0, y0 + cb_size / 2, cb_size, cb_size / 2, log2_cb_size, 1, idx);
2317 hls_prediction_unit(lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1, idx - 1);
2321 hls_prediction_unit(lc, x0, y0 + cb_size / 4, cb_size, cb_size * 3 / 4, log2_cb_size, 1, idx);
2325 hls_prediction_unit(lc, x0, y0 + cb_size * 3 / 4, cb_size, cb_size / 4, log2_cb_size, 1, idx);
2329 hls_prediction_unit(lc, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1, idx - 2);
2333 hls_prediction_unit(lc, x0 + cb_size * 3 / 4, y0, cb_size / 4, cb_size, log2_cb_size, 1, idx - 2);
2337 hls_prediction_unit(lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size / 2, log2_cb_size, 1, idx - 1);
2338 hls_prediction_unit(lc, x0, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2, idx - 1);
2339 hls_prediction_unit(lc, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3, idx - 1);
2345 int rqt_root_cbf = 1;
2352 const static int cbf[2] = { 0 };
2355 s->ps.sps->max_transform_hierarchy_depth_inter;
2358 log2_cb_size, 0, 0, cbf, cbf);
2362 if (!
s->sh.disable_deblocking_filter_flag)
2371 x = y_cb * min_cb_width + x_cb;
2372 for (y = 0; y < length; y++) {
2373 memset(&
s->qp_y_tab[x], lc->
qp_y, length);
2377 if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
2378 ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0) {
2388 int log2_cb_size,
int cb_depth)
2391 const int cb_size = 1 << log2_cb_size;
2396 if (x0 + cb_size <= s->ps.sps->width &&
2397 y0 + cb_size <= s->ps.sps->height &&
2398 log2_cb_size >
s->ps.sps->log2_min_cb_size) {
2401 split_cu = (log2_cb_size >
s->ps.sps->log2_min_cb_size);
2403 if (
s->ps.pps->cu_qp_delta_enabled_flag &&
2404 log2_cb_size >=
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_qp_delta_depth) {
2409 if (
s->sh.cu_chroma_qp_offset_enabled_flag &&
2410 log2_cb_size >=
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_chroma_qp_offset_depth) {
2415 int qp_block_mask = (1<<(
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_qp_delta_depth)) - 1;
2416 const int cb_size_split = cb_size >> 1;
2417 const int x1 = x0 + cb_size_split;
2418 const int y1 = y0 + cb_size_split;
2426 if (more_data && x1 < s->ps.sps->width) {
2431 if (more_data && y1 < s->ps.sps->height) {
2436 if (more_data && x1 < s->ps.sps->width &&
2437 y1 < s->ps.sps->height) {
2443 if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
2444 ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0)
2448 return ((x1 + cb_size_split) <
s->ps.sps->width ||
2449 (y1 + cb_size_split) <
s->ps.sps->height);
2456 if ((!((x0 + cb_size) %
2457 (1 << (
s->ps.sps->log2_ctb_size))) ||
2458 (x0 + cb_size >=
s->ps.sps->width)) &&
2460 (1 << (
s->ps.sps->log2_ctb_size))) ||
2461 (y0 + cb_size >=
s->ps.sps->height))) {
2463 return !end_of_slice_flag;
2476 int ctb_size = 1 <<
s->ps.sps->log2_ctb_size;
2477 int ctb_addr_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];
2478 int ctb_addr_in_slice = ctb_addr_rs -
s->sh.slice_addr;
2480 s->tab_slice_address[ctb_addr_rs] =
s->sh.slice_addr;
2482 if (
s->ps.pps->entropy_coding_sync_enabled_flag) {
2483 if (x_ctb == 0 && (y_ctb & (ctb_size - 1)) == 0)
2486 }
else if (
s->ps.pps->tiles_enabled_flag) {
2487 if (ctb_addr_ts &&
s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[ctb_addr_ts - 1]) {
2488 int idxX =
s->ps.pps->col_idxX[x_ctb >>
s->ps.sps->log2_ctb_size];
2489 lc->
end_of_tiles_x = x_ctb + (
s->ps.pps->column_width[idxX] <<
s->ps.sps->log2_ctb_size);
2499 if (
s->ps.pps->tiles_enabled_flag) {
2500 if (x_ctb > 0 &&
s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs - 1]])
2502 if (x_ctb > 0 &&
s->tab_slice_address[ctb_addr_rs] !=
s->tab_slice_address[ctb_addr_rs - 1])
2504 if (y_ctb > 0 &&
s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs -
s->ps.sps->ctb_width]])
2506 if (y_ctb > 0 &&
s->tab_slice_address[ctb_addr_rs] !=
s->tab_slice_address[ctb_addr_rs -
s->ps.sps->ctb_width])
2509 if (ctb_addr_in_slice <= 0)
2511 if (ctb_addr_in_slice < s->ps.sps->ctb_width)
2517 lc->
ctb_up_right_flag = ((y_ctb > 0) && (ctb_addr_in_slice+1 >=
s->ps.sps->ctb_width) && (
s->ps.pps->tile_id[ctb_addr_ts] ==
s->ps.pps->tile_id[
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs+1 -
s->ps.sps->ctb_width]]));
2518 lc->
ctb_up_left_flag = ((x_ctb > 0) && (y_ctb > 0) && (ctb_addr_in_slice-1 >=
s->ps.sps->ctb_width) && (
s->ps.pps->tile_id[ctb_addr_ts] ==
s->ps.pps->tile_id[
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1 -
s->ps.sps->ctb_width]]));
2525 int ctb_size = 1 <<
s->ps.sps->log2_ctb_size;
2529 int ctb_addr_ts =
s->ps.pps->ctb_addr_rs_to_ts[
s->sh.slice_ctb_addr_rs];
2532 if (!ctb_addr_ts &&
s->sh.dependent_slice_segment_flag) {
2537 if (
s->sh.dependent_slice_segment_flag) {
2538 int prev_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1];
2539 if (
s->tab_slice_address[prev_rs] !=
s->sh.slice_addr) {
2545 while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) {
2546 int ctb_addr_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];
2548 x_ctb = (ctb_addr_rs % ((
s->ps.sps->width + ctb_size - 1) >>
s->ps.sps->log2_ctb_size)) <<
s->ps.sps->log2_ctb_size;
2549 y_ctb = (ctb_addr_rs / ((
s->ps.sps->width + ctb_size - 1) >>
s->ps.sps->log2_ctb_size)) <<
s->ps.sps->log2_ctb_size;
2554 s->tab_slice_address[ctb_addr_rs] = -1;
2558 hls_sao_param(lc, x_ctb >>
s->ps.sps->log2_ctb_size, y_ctb >>
s->ps.sps->log2_ctb_size);
2560 s->deblock[ctb_addr_rs].beta_offset =
s->sh.beta_offset;
2561 s->deblock[ctb_addr_rs].tc_offset =
s->sh.tc_offset;
2562 s->filter_slice_edges[ctb_addr_rs] =
s->sh.slice_loop_filter_across_slices_enabled_flag;
2565 if (more_data < 0) {
2566 s->tab_slice_address[ctb_addr_rs] = -1;
2576 if (x_ctb + ctb_size >=
s->ps.sps->width &&
2577 y_ctb + ctb_size >=
s->ps.sps->height)
2591 int job,
int self_id)
2595 int ctb_size = 1 <<
s->ps.sps->log2_ctb_size;
2598 int ctb_addr_rs =
s->sh.slice_ctb_addr_rs + ctb_row * ((
s->ps.sps->width + ctb_size - 1) >>
s->ps.sps->log2_ctb_size);
2599 int ctb_addr_ts =
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs];
2600 int thread = ctb_row %
s->threads_number;
2610 while(more_data && ctb_addr_ts < s->ps.sps->ctb_size) {
2611 int x_ctb = (ctb_addr_rs %
s->ps.sps->ctb_width) <<
s->ps.sps->log2_ctb_size;
2612 int y_ctb = (ctb_addr_rs /
s->ps.sps->ctb_width) <<
s->ps.sps->log2_ctb_size;
2629 hls_sao_param(lc, x_ctb >>
s->ps.sps->log2_ctb_size, y_ctb >>
s->ps.sps->log2_ctb_size);
2632 if (more_data < 0) {
2643 if (!more_data && (x_ctb+ctb_size) <
s->ps.sps->width && ctb_row !=
s->sh.num_entry_point_offsets) {
2650 if ((x_ctb+ctb_size) >=
s->ps.sps->width && (y_ctb+ctb_size) >=
s->ps.sps->height ) {
2655 ctb_addr_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];
2658 if(x_ctb >=
s->ps.sps->width) {
2666 s->tab_slice_address[ctb_addr_rs] = -1;
2676 int length = nal->
size;
2680 int64_t startheader, cmpt = 0;
2683 if (
s->sh.slice_ctb_addr_rs +
s->sh.num_entry_point_offsets *
s->ps.sps->ctb_width >=
s->ps.sps->ctb_width *
s->ps.sps->ctb_height) {
2685 s->sh.slice_ctb_addr_rs,
s->sh.num_entry_point_offsets,
2686 s->ps.sps->ctb_width,
s->ps.sps->ctb_height
2691 for (
i = 1;
i <
s->threads_number;
i++) {
2692 if (
s->HEVClcList[
i])
2695 if (!
s->HEVClcList[
i])
2697 s->HEVClcList[
i]->logctx =
s->avctx;
2698 s->HEVClcList[
i]->parent =
s;
2699 s->HEVClcList[
i]->common_cabac_state = &
s->cabac;
2704 for (j = 0, cmpt = 0, startheader =
offset +
s->sh.entry_point_offset[0]; j < nal->skipped_bytes; j++) {
2711 for (
i = 1;
i <
s->sh.num_entry_point_offsets;
i++) {
2712 offset += (
s->sh.entry_point_offset[
i - 1] - cmpt);
2713 for (j = 0, cmpt = 0, startheader =
offset
2714 +
s->sh.entry_point_offset[
i]; j < nal->skipped_bytes; j++) {
2720 s->sh.size[
i - 1] =
s->sh.entry_point_offset[
i] - cmpt;
2724 if (
s->sh.num_entry_point_offsets != 0) {
2725 offset +=
s->sh.entry_point_offset[
s->sh.num_entry_point_offsets - 1] - cmpt;
2730 s->sh.size[
s->sh.num_entry_point_offsets - 1] = length -
offset;
2731 s->sh.offset[
s->sh.num_entry_point_offsets - 1] =
offset;
2736 for (
i = 1;
i <
s->threads_number;
i++) {
2737 s->HEVClcList[
i]->first_qp_group = 1;
2738 s->HEVClcList[
i]->qp_y =
s->HEVClc->qp_y;
2750 if (
s->ps.pps->entropy_coding_sync_enabled_flag)
2753 for (
i = 0;
i <=
s->sh.num_entry_point_offsets;
i++)
2768 if (
IS_IRAP(
s) &&
s->no_rasl_output_flag) {
2769 if (
s->sei.common.mastering_display.present > 0)
2770 s->sei.common.mastering_display.present--;
2772 if (
s->sei.common.content_light.present > 0)
2773 s->sei.common.content_light.present--;
2777 &
s->ps.sps->vui.common,
2778 s->ps.sps->bit_depth,
s->ps.sps->bit_depth_chroma,
2783 if (
s->sei.timecode.present) {
2787 sizeof(uint32_t) * 4);
2791 tc_sd = (uint32_t*)tcside->
data;
2792 tc_sd[0] =
s->sei.timecode.num_clock_ts;
2794 for (
int i = 0;
i < tc_sd[0];
i++) {
2795 int drop =
s->sei.timecode.cnt_dropped_flag[
i];
2796 int hh =
s->sei.timecode.hours_value[
i];
2797 int mm =
s->sei.timecode.minutes_value[
i];
2798 int ss =
s->sei.timecode.seconds_value[
i];
2799 int ff =
s->sei.timecode.n_frames[
i];
2806 s->sei.timecode.num_clock_ts = 0;
2809 if (
s->sei.common.dynamic_hdr_plus.info) {
2831 if (
s->sei.common.dynamic_hdr_vivid.info) {
2848 int pic_size_in_ctb = ((
s->ps.sps->width >>
s->ps.sps->log2_min_cb_size) + 1) *
2849 ((
s->ps.sps->height >>
s->ps.sps->log2_min_cb_size) + 1);
2852 memset(
s->horizontal_bs, 0,
s->bs_width *
s->bs_height);
2853 memset(
s->vertical_bs, 0,
s->bs_width *
s->bs_height);
2854 memset(
s->cbf_luma, 0,
s->ps.sps->min_tb_width *
s->ps.sps->min_tb_height);
2855 memset(
s->is_pcm, 0, (
s->ps.sps->min_pu_width + 1) * (
s->ps.sps->min_pu_height + 1));
2856 memset(
s->tab_slice_address, -1, pic_size_in_ctb *
sizeof(*
s->tab_slice_address));
2859 s->first_nal_type =
s->nal_unit_type;
2863 if (
s->ps.pps->tiles_enabled_flag)
2864 lc->
end_of_tiles_x =
s->ps.pps->column_width[0] <<
s->ps.sps->log2_ctb_size;
2881 s->ref->needs_fg =
s->sei.common.film_grain_characteristics.present &&
2885 if (
s->ref->needs_fg &&
2887 s->ref->frame->format)) {
2889 "Unsupported film grain parameters. Ignoring film grain.\n");
2890 s->ref->needs_fg = 0;
2893 if (
s->ref->needs_fg) {
2894 s->ref->frame_grain->format =
s->ref->frame->format;
2895 s->ref->frame_grain->width =
s->ref->frame->width;
2896 s->ref->frame_grain->height =
s->ref->frame->height;
2905 s->frame->pict_type = 3 -
s->sh.slice_type;
2915 if (!
s->avctx->hwaccel)
2923 s->ref =
s->collocated_ref =
NULL;
2933 if (
out->needs_fg) {
2948 int ctb_addr_ts,
ret;
2951 s->nal_unit_type = nal->
type;
2954 switch (
s->nal_unit_type) {
2974 s->apply_defdispwin);
3033 if (
s->sh.first_slice_in_pic_flag) {
3034 if (
s->max_ra == INT_MAX) {
3039 s->max_ra = INT_MIN;
3044 s->poc <=
s->max_ra) {
3049 s->max_ra = INT_MIN;
3056 }
else if (!
s->ref) {
3061 if (
s->nal_unit_type !=
s->first_nal_type) {
3063 "Non-matching NAL types of the VCL NALUs: %d %d\n",
3064 s->first_nal_type,
s->nal_unit_type);
3068 if (!
s->sh.dependent_slice_segment_flag &&
3073 "Error constructing the reference lists for the current slice.\n");
3078 if (
s->sh.first_slice_in_pic_flag &&
s->avctx->hwaccel) {
3084 if (
s->avctx->hwaccel) {
3091 "SCC profile is not yet implemented in hevc native decoder.\n");
3096 if (
s->threads_number > 1 &&
s->sh.num_entry_point_offsets > 0)
3100 if (ctb_addr_ts >= (
s->ps.sps->ctb_width *
s->ps.sps->ctb_height)) {
3107 if (ctb_addr_ts < 0) {
3116 s->max_ra = INT_MAX;
3124 "Skipping NAL unit %d\n",
s->nal_unit_type);
3137 int eos_at_start = 1;
3139 s->ref =
s->collocated_ref =
NULL;
3140 s->last_eos =
s->eos;
3147 s->nal_length_size,
s->avctx->codec_id, 1, 0);
3150 "Error splitting the input into NAL units.\n");
3154 for (
i = 0;
i <
s->pkt.nb_nals;
i++) {
3176 s->pkt.nals[
s->pkt.nb_nals - 1].size > 2 && !
s->pkt.nals[
s->pkt.nb_nals - 1].nuh_layer_id
3177 && !
s->pkt.nals[
s->pkt.nb_nals - 1].temporal_id) {
3178 H2645NAL *nal = &
s->pkt.nals[
s->pkt.nb_nals - 1];
3181 av_log(
s->avctx,
AV_LOG_WARNING,
"Multiple Dolby Vision RPUs found in one AU. Skipping previous.\n");
3198 for (
i = 0;
i <
s->pkt.nb_nals;
i++) {
3207 if (
ret >= 0 &&
s->overlap > 2)
3211 "Error parsing NAL unit #%d.\n",
i);
3226 char msg_buf[4 * (50 + 2 * 2 * 16 )];
3234 pixel_shift =
desc->comp[0].depth > 8;
3239 if (pixel_shift && !
s->checksum_buf) {
3243 if (!
s->checksum_buf)
3250 int width =
s->avctx->coded_width;
3251 int height =
s->avctx->coded_height;
3257 for (j = 0; j <
h; j++) {
3261 s->bdsp.bswap16_buf((uint16_t *)
s->checksum_buf,
3262 (
const uint16_t *)
src,
w);
3263 src =
s->checksum_buf;
3270 #define MD5_PRI "%016" PRIx64 "%016" PRIx64
3271 #define MD5_PRI_ARG(buf) AV_RB64(buf), AV_RB64((const uint8_t*)(buf) + 8)
3273 if (!memcmp(
md5,
s->sei.picture_hash.md5[
i], 16)) {
3275 "plane %d - correct " MD5_PRI "; ",
3279 "mismatching checksum of plane %d - " MD5_PRI " != " MD5_PRI "; ",
3286 "Verifying checksum for frame with POC %d: %s\n",
3297 &
s->nal_length_size,
s->avctx->err_recognition,
3298 s->apply_defdispwin,
s->avctx);
3304 if (
first &&
s->ps.sps_list[
i]) {
3337 if (sd && sd_size > 0) {
3344 if (sd && sd_size > 0) {
3345 int old =
s->dovi_ctx.dv_profile;
3350 "New DOVI configuration record from input packet (profile %d -> %u).\n",
3351 old,
s->dovi_ctx.dv_profile);
3354 s->ref =
s->collocated_ref =
NULL;
3362 "hardware accelerator failed to decode picture\n");
3369 s->sei.picture_hash.is_md5) {
3377 s->sei.picture_hash.is_md5 = 0;
3379 if (
s->is_decoded) {
3384 if (
s->output_frame->buf[0]) {
3400 if (
src->needs_fg) {
3426 src->hwaccel_picture_private);
3446 for (
i = 0;
i < 3;
i++) {
3464 if (
s->HEVClcList) {
3465 for (
i = 1;
i <
s->threads_number;
i++) {
3488 if (!
s->HEVClc || !
s->HEVClcList)
3490 s->HEVClc->parent =
s;
3491 s->HEVClc->logctx = avctx;
3492 s->HEVClc->common_cabac_state = &
s->cabac;
3493 s->HEVClcList[0] =
s->HEVClc;
3496 if (!
s->output_frame)
3501 if (!
s->DPB[
i].frame)
3503 s->DPB[
i].tf.f =
s->DPB[
i].frame;
3506 if (!
s->DPB[
i].frame_grain)
3510 s->max_ra = INT_MAX;
3518 s->dovi_ctx.logctx = avctx;
3536 if (
s0->DPB[
i].frame->buf[0]) {
3543 if (
s->ps.sps !=
s0->ps.sps)
3554 if (
s->ps.sps !=
s0->ps.sps)
3558 s->seq_decode =
s0->seq_decode;
3559 s->seq_output =
s0->seq_output;
3560 s->pocTid0 =
s0->pocTid0;
3561 s->max_ra =
s0->max_ra;
3563 s->no_rasl_output_flag =
s0->no_rasl_output_flag;
3565 s->is_nalff =
s0->is_nalff;
3566 s->nal_length_size =
s0->nal_length_size;
3568 s->threads_number =
s0->threads_number;
3569 s->threads_type =
s0->threads_type;
3571 s->film_grain_warning_shown =
s0->film_grain_warning_shown;
3575 s->max_ra = INT_MAX;
3583 s0->sei.common.dynamic_hdr_plus.info);
3594 s0->sei.common.dynamic_hdr_vivid.info);
3598 s->sei.common.frame_packing =
s0->sei.common.frame_packing;
3599 s->sei.common.display_orientation =
s0->sei.common.display_orientation;
3600 s->sei.common.alternative_transfer =
s0->sei.common.alternative_transfer;
3601 s->sei.common.mastering_display =
s0->sei.common.mastering_display;
3602 s->sei.common.content_light =
s0->sei.common.content_light;
3623 s->threads_number = 1;
3634 s->enable_parallel_tiles = 0;
3635 s->sei.picture_timing.picture_struct = 0;
3651 if (sd && sd->
size > 0)
3665 s->max_ra = INT_MAX;
3672 #define OFFSET(x) offsetof(HEVCContext, x)
3673 #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
3676 {
"apply_defdispwin",
"Apply default display window from VUI",
OFFSET(apply_defdispwin),
3678 {
"strict-displaywin",
"stricly apply default display window size",
OFFSET(apply_defdispwin),
3708 #if CONFIG_HEVC_DXVA2_HWACCEL
3711 #if CONFIG_HEVC_D3D11VA_HWACCEL
3714 #if CONFIG_HEVC_D3D11VA2_HWACCEL
3717 #if CONFIG_HEVC_NVDEC_HWACCEL
3720 #if CONFIG_HEVC_VAAPI_HWACCEL
3723 #if CONFIG_HEVC_VDPAU_HWACCEL
3726 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
3729 #if CONFIG_HEVC_VULKAN_HWACCEL