26 #include "config_components.h"
56 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 };
98 int log2_min_cb_size =
sps->log2_min_cb_size;
101 int pic_size_in_ctb = ((
width >> log2_min_cb_size) + 1) *
102 ((
height >> log2_min_cb_size) + 1);
103 int ctb_count =
sps->ctb_width *
sps->ctb_height;
104 int min_pu_size =
sps->min_pu_width *
sps->min_pu_height;
106 s->bs_width = (
width >> 2) + 1;
107 s->bs_height = (
height >> 2) + 1;
110 s->deblock =
av_calloc(ctb_count,
sizeof(*
s->deblock));
111 if (!
s->sao || !
s->deblock)
116 if (!
s->skip_flag || !
s->tab_ct_depth)
122 if (!
s->tab_ipm || !
s->cbf_luma || !
s->is_pcm)
127 sizeof(*
s->tab_slice_address));
129 sizeof(*
s->qp_y_tab));
130 if (!
s->qp_y_tab || !
s->filter_slice_edges || !
s->tab_slice_address)
133 s->horizontal_bs =
av_calloc(
s->bs_width,
s->bs_height);
135 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)
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 & (1 << 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 ||
394 s->sei.common.aom_film_grain.enable)
402 #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + \
403 CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \
404 CONFIG_HEVC_D3D12VA_HWACCEL + \
405 CONFIG_HEVC_NVDEC_HWACCEL + \
406 CONFIG_HEVC_VAAPI_HWACCEL + \
407 CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + \
408 CONFIG_HEVC_VDPAU_HWACCEL + \
409 CONFIG_HEVC_VULKAN_HWACCEL)
412 switch (
sps->pix_fmt) {
415 #if CONFIG_HEVC_DXVA2_HWACCEL
418 #if CONFIG_HEVC_D3D11VA_HWACCEL
422 #if CONFIG_HEVC_D3D12VA_HWACCEL
425 #if CONFIG_HEVC_VAAPI_HWACCEL
428 #if CONFIG_HEVC_VDPAU_HWACCEL
431 #if CONFIG_HEVC_NVDEC_HWACCEL
434 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
437 #if CONFIG_HEVC_VULKAN_HWACCEL
442 #if CONFIG_HEVC_DXVA2_HWACCEL
445 #if CONFIG_HEVC_D3D11VA_HWACCEL
449 #if CONFIG_HEVC_D3D12VA_HWACCEL
452 #if CONFIG_HEVC_VAAPI_HWACCEL
455 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
458 #if CONFIG_HEVC_VULKAN_HWACCEL
461 #if CONFIG_HEVC_VDPAU_HWACCEL
464 #if CONFIG_HEVC_NVDEC_HWACCEL
469 #if CONFIG_HEVC_VAAPI_HWACCEL
472 #if CONFIG_HEVC_VDPAU_HWACCEL
475 #if CONFIG_HEVC_NVDEC_HWACCEL
478 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
481 #if CONFIG_HEVC_VULKAN_HWACCEL
487 #if CONFIG_HEVC_VAAPI_HWACCEL
490 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
493 #if CONFIG_HEVC_VULKAN_HWACCEL
498 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
504 #if CONFIG_HEVC_VAAPI_HWACCEL
507 #if CONFIG_HEVC_VDPAU_HWACCEL
510 #if CONFIG_HEVC_VULKAN_HWACCEL
513 #if CONFIG_HEVC_NVDEC_HWACCEL
518 #if CONFIG_HEVC_VAAPI_HWACCEL
521 #if CONFIG_HEVC_VULKAN_HWACCEL
527 *fmt++ =
sps->pix_fmt;
557 for (
i = 0;
i < 3;
i++) {
562 if (
sps->sao_enabled && !
s->avctx->hwaccel) {
563 int c_count = (
sps->chroma_format_idc != 0) ? 3 : 1;
566 for(c_idx = 0; c_idx < c_count; c_idx++) {
567 int w =
sps->width >>
sps->hshift[c_idx];
568 int h =
sps->height >>
sps->vshift[c_idx];
569 s->sao_pixel_buffer_h[c_idx] =
572 s->sao_pixel_buffer_v[c_idx] =
575 if (!
s->sao_pixel_buffer_h[c_idx] ||
576 !
s->sao_pixel_buffer_v[c_idx])
582 s->ps.vps =
s->ps.vps_list[
s->ps.sps->vps_id];
588 for (
i = 0;
i < 3;
i++) {
605 av_log(
s->avctx,
AV_LOG_ERROR,
"Two slices reporting being the first in the same frame.\n");
625 s->ps.pps !=
s->ps.pps_list[sh->
pps_id]) {
629 s->ps.pps =
s->ps.pps_list[sh->
pps_id];
633 if (
s->ps.sps !=
s->ps.sps_list[
s->ps.pps->sps_id]) {
658 int slice_address_length;
660 if (
s->ps.pps->dependent_slice_segments_enabled_flag)
664 s->ps.sps->ctb_height);
668 "Invalid slice segment address: %u.\n",
680 s->slice_initialized = 0;
684 s->slice_initialized = 0;
686 for (
i = 0;
i <
s->ps.pps->num_extra_slice_header_bits;
i++)
698 !
s->ps.pps->pps_curr_pic_ref_enabled_flag) {
705 if (
s->ps.pps->output_flag_present_flag)
708 if (
s->ps.sps->separate_colour_plane)
718 "Ignoring POC change between slices: %d -> %d\n",
s->poc, poc);
734 int numbits, rps_idx;
736 if (!
s->ps.sps->nb_st_rps) {
742 rps_idx = numbits > 0 ?
get_bits(gb, numbits) : 0;
756 if (
s->ps.sps->temporal_mvp_enabled)
781 if (
s->ps.sps->sao_enabled) {
783 if (
s->ps.sps->chroma_format_idc) {
797 sh->
nb_refs[
L0] =
s->ps.pps->num_ref_idx_l0_default_active;
799 sh->
nb_refs[
L1] =
s->ps.pps->num_ref_idx_l1_default_active;
820 if (
s->ps.pps->lists_modification_present_flag && nb_refs > 1) {
838 if (
s->ps.pps->cabac_init_present_flag)
853 "Invalid collocated_ref_idx: %d.\n",
870 "Invalid number of merging MVP candidates: %d.\n",
876 if (
s->ps.sps->motion_vector_resolution_control_idc == 2)
886 if (
s->ps.pps->pic_slice_level_chroma_qp_offsets_present_flag) {
899 if (
s->ps.pps->pps_slice_act_qp_offsets_present_flag) {
905 if (
s->ps.pps->chroma_qp_offset_list_enabled_flag)
910 if (
s->ps.pps->deblocking_filter_control_present_flag) {
911 int deblocking_filter_override_flag = 0;
913 if (
s->ps.pps->deblocking_filter_override_enabled_flag)
914 deblocking_filter_override_flag =
get_bits1(gb);
916 if (deblocking_filter_override_flag) {
921 if (beta_offset_div2 < -6 || beta_offset_div2 > 6 ||
922 tc_offset_div2 < -6 || tc_offset_div2 > 6) {
924 "Invalid deblock filter offsets: %d, %d\n",
925 beta_offset_div2, tc_offset_div2);
942 if (
s->ps.pps->seq_loop_filter_across_slices_enabled_flag &&
950 }
else if (!
s->slice_initialized) {
956 if (
s->ps.pps->tiles_enabled_flag ||
s->ps.pps->entropy_coding_sync_enabled_flag) {
960 av_log(
s->avctx,
AV_LOG_ERROR,
"num_entry_point_offsets %d is invalid\n", num_entry_point_offsets);
968 if (offset_len < 1 || offset_len > 32) {
989 if (
s->threads_number > 1 && (
s->ps.pps->num_tile_rows > 1 ||
s->ps.pps->num_tile_columns > 1)) {
990 s->enable_parallel_tiles = 0;
991 s->threads_number = 1;
993 s->enable_parallel_tiles = 0;
995 s->enable_parallel_tiles = 0;
998 if (
s->ps.pps->slice_header_extension_present_flag) {
1004 for (
i = 0;
i < length;
i++)
1011 sh->
slice_qp < -
s->ps.sps->qp_bd_offset) {
1013 "The slice_qp %d is outside the valid range "
1016 -
s->ps.sps->qp_bd_offset);
1022 if (!
s->sh.slice_ctb_addr_rs &&
s->sh.dependent_slice_segment_flag) {
1033 s->HEVClc->first_qp_group = !
s->sh.dependent_slice_segment_flag;
1035 if (!
s->ps.pps->cu_qp_delta_enabled_flag)
1036 s->HEVClc->qp_y =
s->sh.slice_qp;
1038 s->slice_initialized = 1;
1039 s->HEVClc->tu.cu_qp_offset_cb = 0;
1040 s->HEVClc->tu.cu_qp_offset_cr = 0;
1045 #define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)])
1047 #define SET_SAO(elem, value) \
1049 if (!sao_merge_up_flag && !sao_merge_left_flag) \
1050 sao->elem = value; \
1051 else if (sao_merge_left_flag) \
1052 sao->elem = CTB(s->sao, rx-1, ry).elem; \
1053 else if (sao_merge_up_flag) \
1054 sao->elem = CTB(s->sao, rx, ry-1).elem; \
1062 int sao_merge_left_flag = 0;
1063 int sao_merge_up_flag = 0;
1067 if (
s->sh.slice_sample_adaptive_offset_flag[0] ||
1068 s->sh.slice_sample_adaptive_offset_flag[1]) {
1073 if (ry > 0 && !sao_merge_left_flag) {
1079 for (c_idx = 0; c_idx < (
s->ps.sps->chroma_format_idc ? 3 : 1); c_idx++) {
1080 int log2_sao_offset_scale = c_idx == 0 ?
s->ps.pps->log2_sao_offset_scale_luma :
1081 s->ps.pps->log2_sao_offset_scale_chroma;
1083 if (!
s->sh.slice_sample_adaptive_offset_flag[c_idx]) {
1098 for (
i = 0;
i < 4;
i++)
1102 for (
i = 0;
i < 4;
i++) {
1111 }
else if (c_idx != 2) {
1117 for (
i = 0;
i < 4;
i++) {
1125 sao->
offset_val[c_idx][
i + 1] *= 1 << log2_sao_offset_scale;
1137 if (log2_res_scale_abs_plus1 != 0) {
1140 (1 - 2 * res_scale_sign_flag);
1150 int xBase,
int yBase,
int cb_xBase,
int cb_yBase,
1151 int log2_cb_size,
int log2_trafo_size,
1152 int blk_idx,
int cbf_luma,
int *cbf_cb,
int *cbf_cr)
1155 const int log2_trafo_size_c = log2_trafo_size -
s->ps.sps->hshift[1];
1159 int trafo_size = 1 << log2_trafo_size;
1162 s->hpc.intra_pred[log2_trafo_size - 2](lc, x0, y0, 0);
1165 if (cbf_luma || cbf_cb[0] || cbf_cr[0] ||
1166 (
s->ps.sps->chroma_format_idc == 2 && (cbf_cb[1] || cbf_cr[1]))) {
1169 int cbf_chroma = cbf_cb[0] || cbf_cr[0] ||
1170 (
s->ps.sps->chroma_format_idc == 2 &&
1171 (cbf_cb[1] || cbf_cr[1]));
1183 "The cu_qp_delta %d is outside the valid range "
1186 -(26 +
s->ps.sps->qp_bd_offset / 2),
1187 (25 +
s->ps.sps->qp_bd_offset / 2));
1194 if (
s->sh.cu_chroma_qp_offset_enabled_flag && cbf_chroma &&
1197 if (cu_chroma_qp_offset_flag) {
1198 int cu_chroma_qp_offset_idx = 0;
1199 if (
s->ps.pps->chroma_qp_offset_list_len_minus1 > 0) {
1202 "cu_chroma_qp_offset_idx not yet tested.\n");
1235 if (
s->ps.sps->chroma_format_idc && (log2_trafo_size > 2 ||
s->ps.sps->chroma_format_idc == 3)) {
1236 int trafo_size_h = 1 << (log2_trafo_size_c +
s->ps.sps->hshift[1]);
1237 int trafo_size_v = 1 << (log2_trafo_size_c +
s->ps.sps->vshift[1]);
1238 lc->
tu.
cross_pf = (
s->ps.pps->cross_component_prediction_enabled_flag && cbf_luma &&
1245 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1248 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (
i << log2_trafo_size_c), 1);
1252 log2_trafo_size_c, scan_idx_c, 1);
1255 ptrdiff_t
stride =
s->frame->linesize[1];
1256 int hshift =
s->ps.sps->hshift[1];
1257 int vshift =
s->ps.sps->vshift[1];
1260 int size = 1 << log2_trafo_size_c;
1262 uint8_t *dst = &
s->frame->data[1][(y0 >> vshift) *
stride +
1263 ((x0 >> hshift) <<
s->ps.sps->pixel_shift)];
1267 s->hevcdsp.add_residual[log2_trafo_size_c-2](dst, coeffs,
stride);
1274 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1277 trafo_size_h, trafo_size_v);
1278 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (
i << log2_trafo_size_c), 2);
1282 log2_trafo_size_c, scan_idx_c, 2);
1285 ptrdiff_t
stride =
s->frame->linesize[2];
1286 int hshift =
s->ps.sps->hshift[2];
1287 int vshift =
s->ps.sps->vshift[2];
1290 int size = 1 << log2_trafo_size_c;
1292 uint8_t *dst = &
s->frame->data[2][(y0 >> vshift) *
stride +
1293 ((x0 >> hshift) <<
s->ps.sps->pixel_shift)];
1297 s->hevcdsp.add_residual[log2_trafo_size_c-2](dst, coeffs,
stride);
1300 }
else if (
s->ps.sps->chroma_format_idc && blk_idx == 3) {
1301 int trafo_size_h = 1 << (log2_trafo_size + 1);
1302 int trafo_size_v = 1 << (log2_trafo_size +
s->ps.sps->vshift[1]);
1303 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1306 trafo_size_h, trafo_size_v);
1307 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (
i << log2_trafo_size), 1);
1311 log2_trafo_size, scan_idx_c, 1);
1313 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1316 trafo_size_h, trafo_size_v);
1317 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (
i << log2_trafo_size), 2);
1321 log2_trafo_size, scan_idx_c, 2);
1325 if (log2_trafo_size > 2 ||
s->ps.sps->chroma_format_idc == 3) {
1326 int trafo_size_h = 1 << (log2_trafo_size_c +
s->ps.sps->hshift[1]);
1327 int trafo_size_v = 1 << (log2_trafo_size_c +
s->ps.sps->vshift[1]);
1329 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0, 1);
1330 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0, 2);
1331 if (
s->ps.sps->chroma_format_idc == 2) {
1333 trafo_size_h, trafo_size_v);
1334 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (1 << log2_trafo_size_c), 1);
1335 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (1 << log2_trafo_size_c), 2);
1337 }
else if (blk_idx == 3) {
1338 int trafo_size_h = 1 << (log2_trafo_size + 1);
1339 int trafo_size_v = 1 << (log2_trafo_size +
s->ps.sps->vshift[1]);
1341 trafo_size_h, trafo_size_v);
1342 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase, 1);
1343 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase, 2);
1344 if (
s->ps.sps->chroma_format_idc == 2) {
1346 trafo_size_h, trafo_size_v);
1347 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (1 << log2_trafo_size), 1);
1348 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (1 << log2_trafo_size), 2);
1358 int cb_size = 1 << log2_cb_size;
1359 int log2_min_pu_size =
s->ps.sps->log2_min_pu_size;
1361 int min_pu_width =
s->ps.sps->min_pu_width;
1362 int x_end =
FFMIN(x0 + cb_size,
s->ps.sps->width);
1363 int y_end =
FFMIN(y0 + cb_size,
s->ps.sps->height);
1366 for (j = (y0 >> log2_min_pu_size); j < (y_end >> log2_min_pu_size); j++)
1367 for (
i = (x0 >> log2_min_pu_size);
i < (x_end >> log2_min_pu_size);
i++)
1368 s->is_pcm[
i + j * min_pu_width] = 2;
1372 int xBase,
int yBase,
int cb_xBase,
int cb_yBase,
1373 int log2_cb_size,
int log2_trafo_size,
1374 int trafo_depth,
int blk_idx,
1375 const int *base_cbf_cb,
const int *base_cbf_cr)
1378 uint8_t split_transform_flag;
1383 cbf_cb[0] = base_cbf_cb[0];
1384 cbf_cb[1] = base_cbf_cb[1];
1385 cbf_cr[0] = base_cbf_cr[0];
1386 cbf_cr[1] = base_cbf_cr[1];
1389 if (trafo_depth == 1) {
1391 if (
s->ps.sps->chroma_format_idc == 3) {
1405 if (log2_trafo_size <= s->ps.sps->log2_max_trafo_size &&
1406 log2_trafo_size >
s->ps.sps->log2_min_tb_size &&
1407 trafo_depth < lc->cu.max_trafo_depth &&
1411 int inter_split =
s->ps.sps->max_transform_hierarchy_depth_inter == 0 &&
1416 split_transform_flag = log2_trafo_size >
s->ps.sps->log2_max_trafo_size ||
1421 if (
s->ps.sps->chroma_format_idc && (log2_trafo_size > 2 ||
s->ps.sps->chroma_format_idc == 3)) {
1422 if (trafo_depth == 0 || cbf_cb[0]) {
1424 if (
s->ps.sps->chroma_format_idc == 2 && (!split_transform_flag || log2_trafo_size == 3)) {
1429 if (trafo_depth == 0 || cbf_cr[0]) {
1431 if (
s->ps.sps->chroma_format_idc == 2 && (!split_transform_flag || log2_trafo_size == 3)) {
1437 if (split_transform_flag) {
1438 const int trafo_size_split = 1 << (log2_trafo_size - 1);
1439 const int x1 = x0 + trafo_size_split;
1440 const int y1 = y0 + trafo_size_split;
1442 #define SUBDIVIDE(x, y, idx) \
1444 ret = hls_transform_tree(lc, x, y, x0, y0, cb_xBase, cb_yBase, log2_cb_size,\
1445 log2_trafo_size - 1, trafo_depth + 1, idx, \
1458 int min_tu_size = 1 <<
s->ps.sps->log2_min_tb_size;
1459 int log2_min_tu_size =
s->ps.sps->log2_min_tb_size;
1460 int min_tu_width =
s->ps.sps->min_tb_width;
1464 cbf_cb[0] || cbf_cr[0] ||
1465 (
s->ps.sps->chroma_format_idc == 2 && (cbf_cb[1] || cbf_cr[1]))) {
1470 log2_cb_size, log2_trafo_size,
1471 blk_idx, cbf_luma, cbf_cb, cbf_cr);
1477 for (
i = 0;
i < (1 << log2_trafo_size);
i += min_tu_size)
1478 for (j = 0; j < (1 << log2_trafo_size); j += min_tu_size) {
1479 int x_tu = (x0 + j) >> log2_min_tu_size;
1480 int y_tu = (y0 +
i) >> log2_min_tu_size;
1481 s->cbf_luma[y_tu * min_tu_width + x_tu] = 1;
1484 if (!
s->sh.disable_deblocking_filter_flag) {
1486 if (
s->ps.pps->transquant_bypass_enable_flag &&
1498 int cb_size = 1 << log2_cb_size;
1499 ptrdiff_t stride0 =
s->frame->linesize[0];
1500 ptrdiff_t stride1 =
s->frame->linesize[1];
1501 ptrdiff_t stride2 =
s->frame->linesize[2];
1502 uint8_t *dst0 = &
s->frame->data[0][y0 * stride0 + (x0 <<
s->ps.sps->pixel_shift)];
1503 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)];
1504 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)];
1506 int length = cb_size * cb_size *
s->ps.sps->pcm.bit_depth +
1507 (((cb_size >>
s->ps.sps->hshift[1]) * (cb_size >>
s->ps.sps->vshift[1])) +
1508 ((cb_size >>
s->ps.sps->hshift[2]) * (cb_size >>
s->ps.sps->vshift[2]))) *
1509 s->ps.sps->pcm.bit_depth_chroma;
1510 const uint8_t *pcm =
skip_bytes(&lc->
cc, (length + 7) >> 3);
1513 if (!
s->sh.disable_deblocking_filter_flag)
1520 s->hevcdsp.put_pcm(dst0, stride0, cb_size, cb_size, &gb,
s->ps.sps->pcm.bit_depth);
1521 if (
s->ps.sps->chroma_format_idc) {
1522 s->hevcdsp.put_pcm(dst1, stride1,
1523 cb_size >>
s->ps.sps->hshift[1],
1524 cb_size >>
s->ps.sps->vshift[1],
1525 &gb,
s->ps.sps->pcm.bit_depth_chroma);
1526 s->hevcdsp.put_pcm(dst2, stride2,
1527 cb_size >>
s->ps.sps->hshift[2],
1528 cb_size >>
s->ps.sps->vshift[2],
1529 &gb,
s->ps.sps->pcm.bit_depth_chroma);
1553 int block_w,
int block_h,
int luma_weight,
int luma_offset)
1556 const uint8_t *
src =
ref->data[0];
1557 ptrdiff_t srcstride =
ref->linesize[0];
1558 int pic_width =
s->ps.sps->width;
1559 int pic_height =
s->ps.sps->height;
1562 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1563 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1566 x_off +=
mv->x >> 2;
1567 y_off +=
mv->y >> 2;
1568 src += y_off * srcstride + (x_off * (1 <<
s->ps.sps->pixel_shift));
1579 edge_emu_stride, srcstride,
1583 pic_width, pic_height);
1585 srcstride = edge_emu_stride;
1589 s->hevcdsp.put_hevc_qpel_uni[idx][!!my][!!mx](dst, dststride,
src, srcstride,
1590 block_h, mx, my, block_w);
1592 s->hevcdsp.put_hevc_qpel_uni_w[idx][!!my][!!mx](dst, dststride,
src, srcstride,
1593 block_h,
s->sh.luma_log2_weight_denom,
1594 luma_weight, luma_offset, mx, my, block_w);
1614 const AVFrame *ref0,
const Mv *mv0,
int x_off,
int y_off,
1615 int block_w,
int block_h,
const AVFrame *ref1,
1616 const Mv *mv1,
struct MvField *current_mv)
1619 ptrdiff_t src0stride = ref0->
linesize[0];
1620 ptrdiff_t src1stride = ref1->
linesize[0];
1621 int pic_width =
s->ps.sps->width;
1622 int pic_height =
s->ps.sps->height;
1623 int mx0 = mv0->
x & 3;
1624 int my0 = mv0->
y & 3;
1625 int mx1 = mv1->
x & 3;
1626 int my1 = mv1->
y & 3;
1627 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1628 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1629 int x_off0 = x_off + (mv0->
x >> 2);
1630 int y_off0 = y_off + (mv0->
y >> 2);
1631 int x_off1 = x_off + (mv1->
x >> 2);
1632 int y_off1 = y_off + (mv1->
y >> 2);
1635 const uint8_t *
src0 = ref0->
data[0] + y_off0 * src0stride + (
int)((
unsigned)x_off0 <<
s->ps.sps->pixel_shift);
1636 const uint8_t *
src1 = ref1->
data[0] + y_off1 * src1stride + (
int)((
unsigned)x_off1 <<
s->ps.sps->pixel_shift);
1646 edge_emu_stride, src0stride,
1650 pic_width, pic_height);
1652 src0stride = edge_emu_stride;
1663 edge_emu_stride, src1stride,
1667 pic_width, pic_height);
1669 src1stride = edge_emu_stride;
1672 s->hevcdsp.put_hevc_qpel[idx][!!my0][!!mx0](lc->
tmp,
src0, src0stride,
1673 block_h, mx0, my0, block_w);
1675 s->hevcdsp.put_hevc_qpel_bi[idx][!!my1][!!mx1](dst, dststride,
src1, src1stride, lc->
tmp,
1676 block_h, mx1, my1, block_w);
1678 s->hevcdsp.put_hevc_qpel_bi_w[idx][!!my1][!!mx1](dst, dststride,
src1, src1stride, lc->
tmp,
1679 block_h,
s->sh.luma_log2_weight_denom,
1680 s->sh.luma_weight_l0[current_mv->
ref_idx[0]],
1681 s->sh.luma_weight_l1[current_mv->
ref_idx[1]],
1682 s->sh.luma_offset_l0[current_mv->
ref_idx[0]],
1683 s->sh.luma_offset_l1[current_mv->
ref_idx[1]],
1706 ptrdiff_t dststride,
const uint8_t *
src0, ptrdiff_t srcstride,
int reflist,
1707 int x_off,
int y_off,
int block_w,
int block_h,
1708 const struct MvField *current_mv,
int chroma_weight,
int chroma_offset)
1711 int pic_width =
s->ps.sps->width >>
s->ps.sps->hshift[1];
1712 int pic_height =
s->ps.sps->height >>
s->ps.sps->vshift[1];
1713 const Mv *
mv = ¤t_mv->
mv[reflist];
1714 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1715 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1717 int hshift =
s->ps.sps->hshift[1];
1718 int vshift =
s->ps.sps->vshift[1];
1721 intptr_t _mx = mx << (1 - hshift);
1722 intptr_t _my = my << (1 - vshift);
1723 int emu =
src0 ==
s->frame->data[1] ||
src0 ==
s->frame->data[2];
1725 x_off +=
mv->x >> (2 + hshift);
1726 y_off +=
mv->y >> (2 + vshift);
1727 src0 += y_off * srcstride + (x_off * (1 <<
s->ps.sps->pixel_shift));
1736 (edge_emu_stride + (1 <<
s->ps.sps->pixel_shift));
1738 edge_emu_stride, srcstride,
1742 pic_width, pic_height);
1745 srcstride = edge_emu_stride;
1748 s->hevcdsp.put_hevc_epel_uni[idx][!!my][!!mx](dst0, dststride,
src0, srcstride,
1749 block_h, _mx, _my, block_w);
1751 s->hevcdsp.put_hevc_epel_uni_w[idx][!!my][!!mx](dst0, dststride,
src0, srcstride,
1752 block_h,
s->sh.chroma_log2_weight_denom,
1753 chroma_weight, chroma_offset, _mx, _my, block_w);
1775 int x_off,
int y_off,
int block_w,
int block_h,
const MvField *current_mv,
int cidx)
1778 const uint8_t *
src1 = ref0->
data[cidx+1];
1779 const uint8_t *
src2 = ref1->
data[cidx+1];
1780 ptrdiff_t src1stride = ref0->
linesize[cidx+1];
1781 ptrdiff_t src2stride = ref1->
linesize[cidx+1];
1782 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1783 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1784 int pic_width =
s->ps.sps->width >>
s->ps.sps->hshift[1];
1785 int pic_height =
s->ps.sps->height >>
s->ps.sps->vshift[1];
1786 const Mv *
const mv0 = ¤t_mv->
mv[0];
1787 const Mv *
const mv1 = ¤t_mv->
mv[1];
1788 int hshift =
s->ps.sps->hshift[1];
1789 int vshift =
s->ps.sps->vshift[1];
1795 intptr_t _mx0 = mx0 << (1 - hshift);
1796 intptr_t _my0 = my0 << (1 - vshift);
1797 intptr_t _mx1 = mx1 << (1 - hshift);
1798 intptr_t _my1 = my1 << (1 - vshift);
1800 int x_off0 = x_off + (mv0->
x >> (2 + hshift));
1801 int y_off0 = y_off + (mv0->
y >> (2 + vshift));
1802 int x_off1 = x_off + (mv1->
x >> (2 + hshift));
1803 int y_off1 = y_off + (mv1->
y >> (2 + vshift));
1805 src1 += y_off0 * src1stride + (
int)((
unsigned)x_off0 <<
s->ps.sps->pixel_shift);
1806 src2 += y_off1 * src2stride + (
int)((
unsigned)x_off1 <<
s->ps.sps->pixel_shift);
1814 (edge_emu_stride + (1 <<
s->ps.sps->pixel_shift));
1817 edge_emu_stride, src1stride,
1821 pic_width, pic_height);
1824 src1stride = edge_emu_stride;
1833 (edge_emu_stride + (1 <<
s->ps.sps->pixel_shift));
1836 edge_emu_stride, src2stride,
1840 pic_width, pic_height);
1843 src2stride = edge_emu_stride;
1846 s->hevcdsp.put_hevc_epel[idx][!!my0][!!mx0](lc->
tmp,
src1, src1stride,
1847 block_h, _mx0, _my0, block_w);
1849 s->hevcdsp.put_hevc_epel_bi[idx][!!my1][!!mx1](dst0,
s->frame->linesize[cidx+1],
1851 block_h, _mx1, _my1, block_w);
1853 s->hevcdsp.put_hevc_epel_bi_w[idx][!!my1][!!mx1](dst0,
s->frame->linesize[cidx+1],
1856 s->sh.chroma_log2_weight_denom,
1857 s->sh.chroma_weight_l0[current_mv->
ref_idx[0]][cidx],
1858 s->sh.chroma_weight_l1[current_mv->
ref_idx[1]][cidx],
1859 s->sh.chroma_offset_l0[current_mv->
ref_idx[0]][cidx],
1860 s->sh.chroma_offset_l1[current_mv->
ref_idx[1]][cidx],
1861 _mx1, _my1, block_w);
1875 int nPbH,
int log2_cb_size,
int part_idx,
1887 if (inter_pred_idc !=
PRED_L1) {
1888 if (
s->sh.nb_refs[
L0])
1895 part_idx, merge_idx,
mv, mvp_flag, 0);
1900 if (inter_pred_idc !=
PRED_L0) {
1901 if (
s->sh.nb_refs[
L1])
1904 if (
s->sh.mvd_l1_zero_flag == 1 && inter_pred_idc ==
PRED_BI) {
1913 part_idx, merge_idx,
mv, mvp_flag, 1);
1921 int log2_cb_size,
int partIdx,
int idx)
1923 #define POS(c_idx, x, y) \
1924 &s->frame->data[c_idx][((y) >> s->ps.sps->vshift[c_idx]) * s->frame->linesize[c_idx] + \
1925 (((x) >> s->ps.sps->hshift[c_idx]) << s->ps.sps->pixel_shift)]
1928 struct MvField current_mv = {{{ 0 }}};
1930 int min_pu_width =
s->ps.sps->min_pu_width;
1932 MvField *tab_mvf =
s->ref->tab_mvf;
1933 const RefPicList *refPicList =
s->ref->refPicList;
1935 uint8_t *dst0 =
POS(0, x0, y0);
1936 uint8_t *dst1 =
POS(1, x0, y0);
1937 uint8_t *dst2 =
POS(2, x0, y0);
1938 int log2_min_cb_size =
s->ps.sps->log2_min_cb_size;
1939 int min_cb_width =
s->ps.sps->min_cb_width;
1940 int x_cb = x0 >> log2_min_cb_size;
1941 int y_cb = y0 >> log2_min_cb_size;
1945 int skip_flag =
SAMPLE_CTB(
s->skip_flag, x_cb, y_cb);
1951 if (
s->sh.max_num_merge_cand > 1)
1957 partIdx, merge_idx, ¤t_mv);
1960 partIdx, merge_idx, ¤t_mv);
1963 x_pu = x0 >>
s->ps.sps->log2_min_pu_size;
1964 y_pu = y0 >>
s->ps.sps->log2_min_pu_size;
1966 for (j = 0; j < nPbH >>
s->ps.sps->log2_min_pu_size; j++)
1967 for (
i = 0; i < nPbW >>
s->ps.sps->log2_min_pu_size;
i++)
1968 tab_mvf[(y_pu + j) * min_pu_width + x_pu +
i] = current_mv;
1971 ref0 = refPicList[0].
ref[current_mv.
ref_idx[0]];
1972 if (!ref0 || !ref0->
frame)
1977 ref1 = refPicList[1].
ref[current_mv.
ref_idx[1]];
1978 if (!ref1 || !ref1->frame)
1984 int x0_c = x0 >>
s->ps.sps->hshift[1];
1985 int y0_c = y0 >>
s->ps.sps->vshift[1];
1986 int nPbW_c = nPbW >>
s->ps.sps->hshift[1];
1987 int nPbH_c = nPbH >>
s->ps.sps->vshift[1];
1990 ¤t_mv.
mv[0], x0, y0, nPbW, nPbH,
1991 s->sh.luma_weight_l0[current_mv.
ref_idx[0]],
1992 s->sh.luma_offset_l0[current_mv.
ref_idx[0]]);
1994 if (
s->ps.sps->chroma_format_idc) {
1996 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1997 s->sh.chroma_weight_l0[current_mv.
ref_idx[0]][0],
s->sh.chroma_offset_l0[current_mv.
ref_idx[0]][0]);
1999 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
2000 s->sh.chroma_weight_l0[current_mv.
ref_idx[0]][1],
s->sh.chroma_offset_l0[current_mv.
ref_idx[0]][1]);
2003 int x0_c = x0 >>
s->ps.sps->hshift[1];
2004 int y0_c = y0 >>
s->ps.sps->vshift[1];
2005 int nPbW_c = nPbW >>
s->ps.sps->hshift[1];
2006 int nPbH_c = nPbH >>
s->ps.sps->vshift[1];
2008 luma_mc_uni(lc, dst0,
s->frame->linesize[0], ref1->frame,
2009 ¤t_mv.
mv[1], x0, y0, nPbW, nPbH,
2010 s->sh.luma_weight_l1[current_mv.
ref_idx[1]],
2011 s->sh.luma_offset_l1[current_mv.
ref_idx[1]]);
2013 if (
s->ps.sps->chroma_format_idc) {
2014 chroma_mc_uni(lc, dst1,
s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1],
2015 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
2016 s->sh.chroma_weight_l1[current_mv.
ref_idx[1]][0],
s->sh.chroma_offset_l1[current_mv.
ref_idx[1]][0]);
2018 chroma_mc_uni(lc, dst2,
s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2],
2019 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
2020 s->sh.chroma_weight_l1[current_mv.
ref_idx[1]][1],
s->sh.chroma_offset_l1[current_mv.
ref_idx[1]][1]);
2023 int x0_c = x0 >>
s->ps.sps->hshift[1];
2024 int y0_c = y0 >>
s->ps.sps->vshift[1];
2025 int nPbW_c = nPbW >>
s->ps.sps->hshift[1];
2026 int nPbH_c = nPbH >>
s->ps.sps->vshift[1];
2029 ¤t_mv.
mv[0], x0, y0, nPbW, nPbH,
2030 ref1->frame, ¤t_mv.
mv[1], ¤t_mv);
2032 if (
s->ps.sps->chroma_format_idc) {
2034 x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0);
2037 x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 1);
2046 int prev_intra_luma_pred_flag)
2049 int x_pu = x0 >>
s->ps.sps->log2_min_pu_size;
2050 int y_pu = y0 >>
s->ps.sps->log2_min_pu_size;
2051 int min_pu_width =
s->ps.sps->min_pu_width;
2052 int size_in_pus = pu_size >>
s->ps.sps->log2_min_pu_size;
2057 s->tab_ipm[(y_pu - 1) * min_pu_width + x_pu] :
INTRA_DC;
2059 s->tab_ipm[y_pu * min_pu_width + x_pu - 1] :
INTRA_DC;
2061 int y_ctb = (y0 >> (
s->ps.sps->log2_ctb_size)) << (
s->ps.sps->log2_ctb_size);
2063 MvField *tab_mvf =
s->ref->tab_mvf;
2064 int intra_pred_mode;
2069 if ((y0 - 1) < y_ctb)
2072 if (cand_left == cand_up) {
2073 if (cand_left < 2) {
2078 candidate[0] = cand_left;
2079 candidate[1] = 2 + ((cand_left - 2 - 1 + 32) & 31);
2080 candidate[2] = 2 + ((cand_left - 2 + 1) & 31);
2083 candidate[0] = cand_left;
2084 candidate[1] = cand_up;
2094 if (prev_intra_luma_pred_flag) {
2095 intra_pred_mode = candidate[lc->
pu.
mpm_idx];
2097 if (candidate[0] > candidate[1])
2098 FFSWAP(uint8_t, candidate[0], candidate[1]);
2099 if (candidate[0] > candidate[2])
2100 FFSWAP(uint8_t, candidate[0], candidate[2]);
2101 if (candidate[1] > candidate[2])
2102 FFSWAP(uint8_t, candidate[1], candidate[2]);
2105 for (
i = 0;
i < 3;
i++)
2106 if (intra_pred_mode >= candidate[
i])
2113 for (
i = 0;
i < size_in_pus;
i++) {
2114 memset(&
s->tab_ipm[(y_pu +
i) * min_pu_width + x_pu],
2115 intra_pred_mode, size_in_pus);
2117 for (j = 0; j < size_in_pus; j++) {
2122 return intra_pred_mode;
2126 int log2_cb_size,
int ct_depth)
2128 int length = (1 << log2_cb_size) >>
s->ps.sps->log2_min_cb_size;
2129 int x_cb = x0 >>
s->ps.sps->log2_min_cb_size;
2130 int y_cb = y0 >>
s->ps.sps->log2_min_cb_size;
2133 for (y = 0; y < length; y++)
2134 memset(&
s->tab_ct_depth[(y_cb + y) *
s->ps.sps->min_cb_width + x_cb],
2139 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20,
2140 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31};
2146 static const uint8_t intra_chroma_table[4] = { 0, 26, 10, 1 };
2147 uint8_t prev_intra_luma_pred_flag[4];
2149 int pb_size = (1 << log2_cb_size) >>
split;
2150 int side =
split + 1;
2154 for (
i = 0;
i < side;
i++)
2155 for (j = 0; j < side; j++)
2158 for (
i = 0;
i < side;
i++) {
2159 for (j = 0; j < side; j++) {
2160 if (prev_intra_luma_pred_flag[2 *
i + j])
2167 prev_intra_luma_pred_flag[2 *
i + j]);
2171 if (
s->ps.sps->chroma_format_idc == 3) {
2172 for (
i = 0;
i < side;
i++) {
2173 for (j = 0; j < side; j++) {
2175 if (chroma_mode != 4) {
2185 }
else if (
s->ps.sps->chroma_format_idc == 2) {
2188 if (chroma_mode != 4) {
2192 mode_idx = intra_chroma_table[chroma_mode];
2197 }
else if (
s->ps.sps->chroma_format_idc != 0) {
2199 if (chroma_mode != 4) {
2215 int pb_size = 1 << log2_cb_size;
2216 int size_in_pus = pb_size >>
s->ps.sps->log2_min_pu_size;
2217 int min_pu_width =
s->ps.sps->min_pu_width;
2218 MvField *tab_mvf =
s->ref->tab_mvf;
2219 int x_pu = x0 >>
s->ps.sps->log2_min_pu_size;
2220 int y_pu = y0 >>
s->ps.sps->log2_min_pu_size;
2223 if (size_in_pus == 0)
2225 for (j = 0; j < size_in_pus; j++)
2226 memset(&
s->tab_ipm[(y_pu + j) * min_pu_width + x_pu],
INTRA_DC, size_in_pus);
2228 for (j = 0; j < size_in_pus; j++)
2229 for (k = 0; k < size_in_pus; k++)
2235 int cb_size = 1 << log2_cb_size;
2236 int log2_min_cb_size =
s->ps.sps->log2_min_cb_size;
2237 int length = cb_size >> log2_min_cb_size;
2238 int min_cb_width =
s->ps.sps->min_cb_width;
2239 int x_cb = x0 >> log2_min_cb_size;
2240 int y_cb = y0 >> log2_min_cb_size;
2241 int idx = log2_cb_size - 2;
2242 int qp_block_mask = (1<<(
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_qp_delta_depth)) - 1;
2252 for (x = 0; x < 4; x++)
2254 if (
s->ps.pps->transquant_bypass_enable_flag) {
2264 x = y_cb * min_cb_width + x_cb;
2265 for (y = 0; y < length; y++) {
2266 memset(&
s->skip_flag[x], skip_flag, length);
2271 x = y_cb * min_cb_width + x_cb;
2272 for (y = 0; y < length; y++) {
2273 memset(&
s->skip_flag[x], 0, length);
2282 if (!
s->sh.disable_deblocking_filter_flag)
2290 log2_cb_size ==
s->ps.sps->log2_min_cb_size) {
2298 log2_cb_size >=
s->ps.sps->pcm.log2_min_pcm_cb_size &&
2299 log2_cb_size <= s->ps.sps->pcm.log2_max_pcm_cb_size) {
2305 if (
s->ps.sps->pcm_loop_filter_disabled)
2321 hls_prediction_unit(lc, x0, y0 + cb_size / 2, cb_size, cb_size / 2, log2_cb_size, 1, idx);
2325 hls_prediction_unit(lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1, idx - 1);
2329 hls_prediction_unit(lc, x0, y0 + cb_size / 4, cb_size, cb_size * 3 / 4, log2_cb_size, 1, idx);
2333 hls_prediction_unit(lc, x0, y0 + cb_size * 3 / 4, cb_size, cb_size / 4, log2_cb_size, 1, idx);
2337 hls_prediction_unit(lc, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1, idx - 2);
2341 hls_prediction_unit(lc, x0 + cb_size * 3 / 4, y0, cb_size / 4, cb_size, log2_cb_size, 1, idx - 2);
2345 hls_prediction_unit(lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size / 2, log2_cb_size, 1, idx - 1);
2346 hls_prediction_unit(lc, x0, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2, idx - 1);
2347 hls_prediction_unit(lc, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3, idx - 1);
2353 int rqt_root_cbf = 1;
2360 const static int cbf[2] = { 0 };
2363 s->ps.sps->max_transform_hierarchy_depth_inter;
2366 log2_cb_size, 0, 0, cbf, cbf);
2370 if (!
s->sh.disable_deblocking_filter_flag)
2379 x = y_cb * min_cb_width + x_cb;
2380 for (y = 0; y < length; y++) {
2381 memset(&
s->qp_y_tab[x], lc->
qp_y, length);
2385 if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
2386 ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0) {
2396 int log2_cb_size,
int cb_depth)
2399 const int cb_size = 1 << log2_cb_size;
2404 if (x0 + cb_size <= s->ps.sps->width &&
2405 y0 + cb_size <= s->ps.sps->height &&
2406 log2_cb_size >
s->ps.sps->log2_min_cb_size) {
2409 split_cu = (log2_cb_size >
s->ps.sps->log2_min_cb_size);
2411 if (
s->ps.pps->cu_qp_delta_enabled_flag &&
2412 log2_cb_size >=
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_qp_delta_depth) {
2417 if (
s->sh.cu_chroma_qp_offset_enabled_flag &&
2418 log2_cb_size >=
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_chroma_qp_offset_depth) {
2423 int qp_block_mask = (1<<(
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_qp_delta_depth)) - 1;
2424 const int cb_size_split = cb_size >> 1;
2425 const int x1 = x0 + cb_size_split;
2426 const int y1 = y0 + cb_size_split;
2434 if (more_data && x1 < s->ps.sps->width) {
2439 if (more_data && y1 < s->ps.sps->height) {
2444 if (more_data && x1 < s->ps.sps->width &&
2445 y1 < s->ps.sps->height) {
2451 if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
2452 ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0)
2456 return ((x1 + cb_size_split) <
s->ps.sps->width ||
2457 (y1 + cb_size_split) <
s->ps.sps->height);
2464 if ((!((x0 + cb_size) %
2465 (1 << (
s->ps.sps->log2_ctb_size))) ||
2466 (x0 + cb_size >=
s->ps.sps->width)) &&
2468 (1 << (
s->ps.sps->log2_ctb_size))) ||
2469 (y0 + cb_size >=
s->ps.sps->height))) {
2471 return !end_of_slice_flag;
2484 int ctb_size = 1 <<
s->ps.sps->log2_ctb_size;
2485 int ctb_addr_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];
2486 int ctb_addr_in_slice = ctb_addr_rs -
s->sh.slice_addr;
2488 s->tab_slice_address[ctb_addr_rs] =
s->sh.slice_addr;
2490 if (
s->ps.pps->entropy_coding_sync_enabled_flag) {
2491 if (x_ctb == 0 && (y_ctb & (ctb_size - 1)) == 0)
2494 }
else if (
s->ps.pps->tiles_enabled_flag) {
2495 if (ctb_addr_ts &&
s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[ctb_addr_ts - 1]) {
2496 int idxX =
s->ps.pps->col_idxX[x_ctb >>
s->ps.sps->log2_ctb_size];
2497 lc->
end_of_tiles_x = x_ctb + (
s->ps.pps->column_width[idxX] <<
s->ps.sps->log2_ctb_size);
2507 if (
s->ps.pps->tiles_enabled_flag) {
2508 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]])
2510 if (x_ctb > 0 &&
s->tab_slice_address[ctb_addr_rs] !=
s->tab_slice_address[ctb_addr_rs - 1])
2512 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]])
2514 if (y_ctb > 0 &&
s->tab_slice_address[ctb_addr_rs] !=
s->tab_slice_address[ctb_addr_rs -
s->ps.sps->ctb_width])
2517 if (ctb_addr_in_slice <= 0)
2519 if (ctb_addr_in_slice < s->ps.sps->ctb_width)
2525 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]]));
2526 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]]));
2532 int ctb_size = 1 <<
s->ps.sps->log2_ctb_size;
2536 int ctb_addr_ts =
s->ps.pps->ctb_addr_rs_to_ts[
s->sh.slice_ctb_addr_rs];
2539 if (!ctb_addr_ts &&
s->sh.dependent_slice_segment_flag) {
2544 if (
s->sh.dependent_slice_segment_flag) {
2545 int prev_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1];
2546 if (
s->tab_slice_address[prev_rs] !=
s->sh.slice_addr) {
2552 while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) {
2553 int ctb_addr_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];
2555 x_ctb = (ctb_addr_rs % ((
s->ps.sps->width + ctb_size - 1) >>
s->ps.sps->log2_ctb_size)) <<
s->ps.sps->log2_ctb_size;
2556 y_ctb = (ctb_addr_rs / ((
s->ps.sps->width + ctb_size - 1) >>
s->ps.sps->log2_ctb_size)) <<
s->ps.sps->log2_ctb_size;
2561 s->tab_slice_address[ctb_addr_rs] = -1;
2565 hls_sao_param(lc, x_ctb >>
s->ps.sps->log2_ctb_size, y_ctb >>
s->ps.sps->log2_ctb_size);
2567 s->deblock[ctb_addr_rs].beta_offset =
s->sh.beta_offset;
2568 s->deblock[ctb_addr_rs].tc_offset =
s->sh.tc_offset;
2569 s->filter_slice_edges[ctb_addr_rs] =
s->sh.slice_loop_filter_across_slices_enabled_flag;
2572 if (more_data < 0) {
2573 s->tab_slice_address[ctb_addr_rs] = -1;
2583 if (x_ctb + ctb_size >=
s->ps.sps->width &&
2584 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 if (
s->threads_number >
s->nb_local_ctx) {
2697 memcpy(
tmp,
s->local_ctx,
sizeof(*
s->local_ctx) *
s->nb_local_ctx);
2700 s->HEVClc = &
s->local_ctx[0];
2702 for (
unsigned i =
s->nb_local_ctx; i < s->threads_number;
i++) {
2703 tmp = &
s->local_ctx[
i];
2705 memset(
tmp, 0,
sizeof(*
tmp));
2707 tmp->logctx =
s->avctx;
2709 tmp->common_cabac_state = &
s->cabac;
2712 s->nb_local_ctx =
s->threads_number;
2715 lc = &
s->local_ctx[0];
2718 for (j = 0, cmpt = 0, startheader =
offset +
s->sh.entry_point_offset[0]; j < nal->skipped_bytes; j++) {
2725 for (
i = 1;
i <
s->sh.num_entry_point_offsets;
i++) {
2726 offset += (
s->sh.entry_point_offset[
i - 1] - cmpt);
2727 for (j = 0, cmpt = 0, startheader =
offset
2728 +
s->sh.entry_point_offset[
i]; j < nal->skipped_bytes; j++) {
2734 s->sh.size[
i - 1] =
s->sh.entry_point_offset[
i] - cmpt;
2738 if (
s->sh.num_entry_point_offsets != 0) {
2739 offset +=
s->sh.entry_point_offset[
s->sh.num_entry_point_offsets - 1] - cmpt;
2744 s->sh.size[
s->sh.num_entry_point_offsets - 1] = length -
offset;
2745 s->sh.offset[
s->sh.num_entry_point_offsets - 1] =
offset;
2750 for (
i = 1;
i <
s->threads_number;
i++) {
2751 s->local_ctx[
i].first_qp_group = 1;
2752 s->local_ctx[
i].qp_y =
s->HEVClc->qp_y;
2764 if (
s->ps.pps->entropy_coding_sync_enabled_flag)
2767 for (
i = 0;
i <=
s->sh.num_entry_point_offsets;
i++)
2782 if (
IS_IRAP(
s) &&
s->no_rasl_output_flag) {
2783 if (
s->sei.common.mastering_display.present > 0)
2784 s->sei.common.mastering_display.present--;
2786 if (
s->sei.common.content_light.present > 0)
2787 s->sei.common.content_light.present--;
2791 &
s->ps.sps->vui.common,
2792 s->ps.sps->bit_depth,
s->ps.sps->bit_depth_chroma,
2797 if (
s->sei.timecode.present) {
2802 sizeof(uint32_t) * 4, &tcside);
2807 tc_sd = (uint32_t*)tcside->
data;
2808 tc_sd[0] =
s->sei.timecode.num_clock_ts;
2810 for (
int i = 0;
i < tc_sd[0];
i++) {
2811 int drop =
s->sei.timecode.cnt_dropped_flag[
i];
2812 int hh =
s->sei.timecode.hours_value[
i];
2813 int mm =
s->sei.timecode.minutes_value[
i];
2814 int ss =
s->sei.timecode.seconds_value[
i];
2815 int ff =
s->sei.timecode.n_frames[
i];
2823 s->sei.timecode.num_clock_ts = 0;
2826 if (
s->sei.common.dynamic_hdr_plus.info) {
2847 if (
s->sei.common.dynamic_hdr_vivid.info) {
2864 int pic_size_in_ctb = ((
s->ps.sps->width >>
s->ps.sps->log2_min_cb_size) + 1) *
2865 ((
s->ps.sps->height >>
s->ps.sps->log2_min_cb_size) + 1);
2868 memset(
s->horizontal_bs, 0,
s->bs_width *
s->bs_height);
2869 memset(
s->vertical_bs, 0,
s->bs_width *
s->bs_height);
2870 memset(
s->cbf_luma, 0,
s->ps.sps->min_tb_width *
s->ps.sps->min_tb_height);
2871 memset(
s->is_pcm, 0, (
s->ps.sps->min_pu_width + 1) * (
s->ps.sps->min_pu_height + 1));
2872 memset(
s->tab_slice_address, -1, pic_size_in_ctb *
sizeof(*
s->tab_slice_address));
2875 s->first_nal_type =
s->nal_unit_type;
2879 if (
s->ps.pps->tiles_enabled_flag)
2880 lc->
end_of_tiles_x =
s->ps.pps->column_width[0] <<
s->ps.sps->log2_ctb_size;
2897 s->ref->needs_fg = (
s->sei.common.film_grain_characteristics.present ||
2898 s->sei.common.aom_film_grain.enable) &&
2906 if (
s->ref->needs_fg &&
2907 (
s->sei.common.film_grain_characteristics.present &&
2909 s->ref->frame->format)
2912 "Unsupported film grain parameters. Ignoring film grain.\n");
2913 s->ref->needs_fg = 0;
2916 if (
s->ref->needs_fg) {
2917 s->ref->frame_grain->format =
s->ref->frame->format;
2918 s->ref->frame_grain->width =
s->ref->frame->width;
2919 s->ref->frame_grain->height =
s->ref->frame->height;
2924 s->frame->pict_type = 3 -
s->sh.slice_type;
2934 if (!
s->avctx->hwaccel)
2942 s->ref =
s->collocated_ref =
NULL;
2952 if (
out->needs_fg) {
2955 switch (fgp->
type) {
2977 int ctb_addr_ts,
ret;
2980 s->nal_unit_type = nal->
type;
2983 switch (
s->nal_unit_type) {
3003 s->apply_defdispwin);
3062 if (
s->sh.first_slice_in_pic_flag) {
3063 if (
s->max_ra == INT_MAX) {
3068 s->max_ra = INT_MIN;
3073 s->poc <=
s->max_ra) {
3078 s->max_ra = INT_MIN;
3085 }
else if (!
s->ref) {
3090 if (
s->nal_unit_type !=
s->first_nal_type) {
3092 "Non-matching NAL types of the VCL NALUs: %d %d\n",
3093 s->first_nal_type,
s->nal_unit_type);
3097 if (!
s->sh.dependent_slice_segment_flag &&
3102 "Error constructing the reference lists for the current slice.\n");
3107 if (
s->sh.first_slice_in_pic_flag &&
s->avctx->hwaccel) {
3113 if (
s->avctx->hwaccel) {
3120 "SCC profile is not yet implemented in hevc native decoder.\n");
3125 if (
s->threads_number > 1 &&
s->sh.num_entry_point_offsets > 0)
3129 if (ctb_addr_ts >= (
s->ps.sps->ctb_width *
s->ps.sps->ctb_height)) {
3136 if (ctb_addr_ts < 0) {
3145 s->max_ra = INT_MAX;
3153 "Skipping NAL unit %d\n",
s->nal_unit_type);
3166 int eos_at_start = 1;
3168 s->ref =
s->collocated_ref =
NULL;
3169 s->last_eos =
s->eos;
3176 s->nal_length_size,
s->avctx->codec_id, 1, 0);
3179 "Error splitting the input into NAL units.\n");
3183 for (
i = 0;
i <
s->pkt.nb_nals;
i++) {
3205 s->pkt.nals[
s->pkt.nb_nals - 1].size > 2 && !
s->pkt.nals[
s->pkt.nb_nals - 1].nuh_layer_id
3206 && !
s->pkt.nals[
s->pkt.nb_nals - 1].temporal_id) {
3207 H2645NAL *nal = &
s->pkt.nals[
s->pkt.nb_nals - 1];
3210 av_log(
s->avctx,
AV_LOG_WARNING,
"Multiple Dolby Vision RPUs found in one AU. Skipping previous.\n");
3219 s->avctx->err_recognition);
3228 for (
i = 0;
i <
s->pkt.nb_nals;
i++) {
3237 if (
ret >= 0 &&
s->overlap > 2)
3241 "Error parsing NAL unit #%d.\n",
i);
3256 char msg_buf[4 * (50 + 2 * 2 * 16 )];
3264 pixel_shift =
desc->comp[0].depth > 8;
3269 if (pixel_shift && !
s->checksum_buf) {
3272 frame->linesize[2]));
3273 if (!
s->checksum_buf)
3280 int width =
s->avctx->coded_width;
3281 int height =
s->avctx->coded_height;
3287 for (j = 0; j <
h; j++) {
3291 s->bdsp.bswap16_buf((uint16_t *)
s->checksum_buf,
3292 (
const uint16_t *)
src,
w);
3293 src =
s->checksum_buf;
3300 #define MD5_PRI "%016" PRIx64 "%016" PRIx64
3301 #define MD5_PRI_ARG(buf) AV_RB64(buf), AV_RB64((const uint8_t*)(buf) + 8)
3303 if (!memcmp(
md5,
s->sei.picture_hash.md5[
i], 16)) {
3305 "plane %d - correct " MD5_PRI "; ",
3309 "mismatching checksum of plane %d - " MD5_PRI " != " MD5_PRI "; ",
3316 "Verifying checksum for frame with POC %d: %s\n",
3327 &
s->nal_length_size,
s->avctx->err_recognition,
3328 s->apply_defdispwin,
s->avctx);
3334 if (
first &&
s->ps.sps_list[
i]) {
3367 if (sd && sd_size > 0) {
3374 if (sd && sd_size >=
sizeof(
s->dovi_ctx.cfg)) {
3375 int old =
s->dovi_ctx.cfg.dv_profile;
3379 "New DOVI configuration record from input packet (profile %d -> %u).\n",
3380 old,
s->dovi_ctx.cfg.dv_profile);
3383 s->ref =
s->collocated_ref =
NULL;
3391 "hardware accelerator failed to decode picture\n");
3398 s->sei.picture_hash.is_md5) {
3406 s->sei.picture_hash.is_md5 = 0;
3408 if (
s->is_decoded) {
3413 if (
s->output_frame->buf[0]) {
3427 if (
src->needs_fg) {
3447 src->hwaccel_picture_private);
3464 for (
i = 0;
i < 3;
i++) {
3500 s->nb_local_ctx = 1;
3502 s->HEVClc = &
s->local_ctx[0];
3504 s->HEVClc->parent =
s;
3505 s->HEVClc->logctx = avctx;
3506 s->HEVClc->common_cabac_state = &
s->cabac;
3509 if (!
s->output_frame)
3514 if (!
s->DPB[
i].frame_grain)
3518 s->max_ra = INT_MAX;
3526 s->dovi_ctx.logctx = avctx;
3544 if (
s0->DPB[
i].frame) {
3551 if (
s->ps.sps !=
s0->ps.sps)
3562 if (
s->ps.sps !=
s0->ps.sps)
3566 s->seq_decode =
s0->seq_decode;
3567 s->seq_output =
s0->seq_output;
3568 s->pocTid0 =
s0->pocTid0;
3569 s->max_ra =
s0->max_ra;
3571 s->no_rasl_output_flag =
s0->no_rasl_output_flag;
3573 s->is_nalff =
s0->is_nalff;
3574 s->nal_length_size =
s0->nal_length_size;
3576 s->threads_number =
s0->threads_number;
3577 s->threads_type =
s0->threads_type;
3579 s->film_grain_warning_shown =
s0->film_grain_warning_shown;
3583 s->max_ra = INT_MAX;
3591 s0->sei.common.dynamic_hdr_plus.info);
3602 s0->sei.common.dynamic_hdr_vivid.info);
3606 s->sei.common.frame_packing =
s0->sei.common.frame_packing;
3607 s->sei.common.display_orientation =
s0->sei.common.display_orientation;
3608 s->sei.common.alternative_transfer =
s0->sei.common.alternative_transfer;
3609 s->sei.common.mastering_display =
s0->sei.common.mastering_display;
3610 s->sei.common.content_light =
s0->sei.common.content_light;
3611 s->sei.common.aom_film_grain =
s0->sei.common.aom_film_grain;
3632 s->threads_number = 1;
3643 s->enable_parallel_tiles = 0;
3644 s->sei.picture_timing.picture_struct = 0;
3664 if (sd && sd->
size >=
sizeof(
s->dovi_ctx.cfg))
3678 s->max_ra = INT_MAX;
3685 #define OFFSET(x) offsetof(HEVCContext, x)
3686 #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
3689 {
"apply_defdispwin",
"Apply default display window from VUI",
OFFSET(apply_defdispwin),
3691 {
"strict-displaywin",
"stricly apply default display window size",
OFFSET(apply_defdispwin),
3722 #if CONFIG_HEVC_DXVA2_HWACCEL
3725 #if CONFIG_HEVC_D3D11VA_HWACCEL
3728 #if CONFIG_HEVC_D3D11VA2_HWACCEL
3731 #if CONFIG_HEVC_D3D12VA_HWACCEL
3734 #if CONFIG_HEVC_NVDEC_HWACCEL
3737 #if CONFIG_HEVC_VAAPI_HWACCEL
3740 #if CONFIG_HEVC_VDPAU_HWACCEL
3743 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
3746 #if CONFIG_HEVC_VULKAN_HWACCEL