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)
142 if (!
s->tab_mvf_pool || !
s->rpl_tab_pool)
156 uint8_t luma_weight_l0_flag[16];
157 uint8_t chroma_weight_l0_flag[16];
158 uint8_t luma_weight_l1_flag[16];
159 uint8_t chroma_weight_l1_flag[16];
160 int luma_log2_weight_denom;
163 if (luma_log2_weight_denom < 0 || luma_log2_weight_denom > 7) {
164 av_log(
s->avctx,
AV_LOG_ERROR,
"luma_log2_weight_denom %d is invalid\n", luma_log2_weight_denom);
167 s->sh.luma_log2_weight_denom =
av_clip_uintp2(luma_log2_weight_denom, 3);
168 if (
s->ps.sps->chroma_format_idc != 0) {
169 int64_t chroma_log2_weight_denom = luma_log2_weight_denom + (int64_t)
get_se_golomb(gb);
170 if (chroma_log2_weight_denom < 0 || chroma_log2_weight_denom > 7) {
171 av_log(
s->avctx,
AV_LOG_ERROR,
"chroma_log2_weight_denom %"PRId64
" is invalid\n", chroma_log2_weight_denom);
174 s->sh.chroma_log2_weight_denom = chroma_log2_weight_denom;
177 for (
i = 0;
i <
s->sh.nb_refs[
L0];
i++) {
179 if (!luma_weight_l0_flag[
i]) {
180 s->sh.luma_weight_l0[
i] = 1 <<
s->sh.luma_log2_weight_denom;
181 s->sh.luma_offset_l0[
i] = 0;
184 if (
s->ps.sps->chroma_format_idc != 0) {
185 for (
i = 0;
i <
s->sh.nb_refs[
L0];
i++)
188 for (
i = 0;
i <
s->sh.nb_refs[
L0];
i++)
189 chroma_weight_l0_flag[
i] = 0;
191 for (
i = 0;
i <
s->sh.nb_refs[
L0];
i++) {
192 if (luma_weight_l0_flag[
i]) {
194 if ((int8_t)delta_luma_weight_l0 != delta_luma_weight_l0)
196 s->sh.luma_weight_l0[
i] = (1 <<
s->sh.luma_log2_weight_denom) + delta_luma_weight_l0;
199 if (chroma_weight_l0_flag[
i]) {
200 for (j = 0; j < 2; j++) {
204 if ( (int8_t)delta_chroma_weight_l0 != delta_chroma_weight_l0
205 || delta_chroma_offset_l0 < -(1<<17) || delta_chroma_offset_l0 > (1<<17)) {
209 s->sh.chroma_weight_l0[
i][j] = (1 <<
s->sh.chroma_log2_weight_denom) + delta_chroma_weight_l0;
210 s->sh.chroma_offset_l0[
i][j] =
av_clip((delta_chroma_offset_l0 - ((128 *
s->sh.chroma_weight_l0[
i][j])
211 >>
s->sh.chroma_log2_weight_denom) + 128), -128, 127);
214 s->sh.chroma_weight_l0[
i][0] = 1 <<
s->sh.chroma_log2_weight_denom;
215 s->sh.chroma_offset_l0[
i][0] = 0;
216 s->sh.chroma_weight_l0[
i][1] = 1 <<
s->sh.chroma_log2_weight_denom;
217 s->sh.chroma_offset_l0[
i][1] = 0;
221 for (
i = 0;
i <
s->sh.nb_refs[
L1];
i++) {
223 if (!luma_weight_l1_flag[
i]) {
224 s->sh.luma_weight_l1[
i] = 1 <<
s->sh.luma_log2_weight_denom;
225 s->sh.luma_offset_l1[
i] = 0;
228 if (
s->ps.sps->chroma_format_idc != 0) {
229 for (
i = 0;
i <
s->sh.nb_refs[
L1];
i++)
232 for (
i = 0;
i <
s->sh.nb_refs[
L1];
i++)
233 chroma_weight_l1_flag[
i] = 0;
235 for (
i = 0;
i <
s->sh.nb_refs[
L1];
i++) {
236 if (luma_weight_l1_flag[
i]) {
238 if ((int8_t)delta_luma_weight_l1 != delta_luma_weight_l1)
240 s->sh.luma_weight_l1[
i] = (1 <<
s->sh.luma_log2_weight_denom) + delta_luma_weight_l1;
243 if (chroma_weight_l1_flag[
i]) {
244 for (j = 0; j < 2; j++) {
248 if ( (int8_t)delta_chroma_weight_l1 != delta_chroma_weight_l1
249 || delta_chroma_offset_l1 < -(1<<17) || delta_chroma_offset_l1 > (1<<17)) {
253 s->sh.chroma_weight_l1[
i][j] = (1 <<
s->sh.chroma_log2_weight_denom) + delta_chroma_weight_l1;
254 s->sh.chroma_offset_l1[
i][j] =
av_clip((delta_chroma_offset_l1 - ((128 *
s->sh.chroma_weight_l1[
i][j])
255 >>
s->sh.chroma_log2_weight_denom) + 128), -128, 127);
258 s->sh.chroma_weight_l1[
i][0] = 1 <<
s->sh.chroma_log2_weight_denom;
259 s->sh.chroma_offset_l1[
i][0] = 0;
260 s->sh.chroma_weight_l1[
i][1] = 1 <<
s->sh.chroma_log2_weight_denom;
261 s->sh.chroma_offset_l1[
i][1] = 0;
271 int max_poc_lsb = 1 <<
sps->log2_max_poc_lsb;
272 int prev_delta_msb = 0;
273 unsigned int nb_sps = 0, nb_sh;
277 if (!
sps->long_term_ref_pics_present_flag)
280 if (
sps->num_long_term_ref_pics_sps > 0)
284 if (nb_sps >
sps->num_long_term_ref_pics_sps)
294 uint8_t lt_idx_sps = 0;
296 if (
sps->num_long_term_ref_pics_sps > 1)
299 rps->
poc[
i] =
sps->lt_ref_pic_poc_lsb_sps[lt_idx_sps];
300 rps->
used[
i] =
sps->used_by_curr_pic_lt_sps_flag[lt_idx_sps];
311 if (
i &&
i != nb_sps)
312 delta += prev_delta_msb;
314 poc = rps->
poc[
i] +
s->poc -
delta * max_poc_lsb -
s->sh.pic_order_cnt_lsb;
318 prev_delta_msb =
delta;
331 unsigned int num = 0, den = 0;
336 avctx->
width =
sps->width - ow->left_offset - ow->right_offset;
337 avctx->
height =
sps->height - ow->top_offset - ow->bottom_offset;
339 avctx->
profile =
sps->ptl.general_ptl.profile_idc;
340 avctx->
level =
sps->ptl.general_ptl.level_idc;
344 if (
sps->vui.common.video_signal_type_present_flag)
350 if (
sps->vui.common.colour_description_present_flag) {
352 avctx->
color_trc =
sps->vui.common.transfer_characteristics;
361 if (
sps->chroma_format_idc == 1) {
362 if (
sps->vui.common.chroma_loc_info_present_flag) {
363 if (
sps->vui.common.chroma_sample_loc_type_top_field <= 5)
369 if (
vps->vps_timing_info_present_flag) {
370 num =
vps->vps_num_units_in_tick;
371 den =
vps->vps_time_scale;
372 }
else if (
sps->vui.vui_timing_info_present_flag) {
373 num =
sps->vui.vui_num_units_in_tick;
374 den =
sps->vui.vui_time_scale;
377 if (num != 0 && den != 0)
386 if (
s->sei.common.a53_caption.buf_ref)
389 if (
s->sei.common.alternative_transfer.present &&
392 avctx->
color_trc =
s->sei.common.alternative_transfer.preferred_transfer_characteristics;
395 if (
s->sei.common.film_grain_characteristics.present)
403 #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + \
404 CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \
405 CONFIG_HEVC_NVDEC_HWACCEL + \
406 CONFIG_HEVC_VAAPI_HWACCEL + \
407 CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + \
408 CONFIG_HEVC_VDPAU_HWACCEL)
411 switch (
sps->pix_fmt) {
414 #if CONFIG_HEVC_DXVA2_HWACCEL
417 #if CONFIG_HEVC_D3D11VA_HWACCEL
421 #if CONFIG_HEVC_VAAPI_HWACCEL
424 #if CONFIG_HEVC_VDPAU_HWACCEL
427 #if CONFIG_HEVC_NVDEC_HWACCEL
430 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
435 #if CONFIG_HEVC_DXVA2_HWACCEL
438 #if CONFIG_HEVC_D3D11VA_HWACCEL
442 #if CONFIG_HEVC_VAAPI_HWACCEL
445 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
448 #if CONFIG_HEVC_VDPAU_HWACCEL
451 #if CONFIG_HEVC_NVDEC_HWACCEL
456 #if CONFIG_HEVC_VAAPI_HWACCEL
459 #if CONFIG_HEVC_VDPAU_HWACCEL
462 #if CONFIG_HEVC_NVDEC_HWACCEL
465 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
471 #if CONFIG_HEVC_VAAPI_HWACCEL
474 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
479 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
484 #if CONFIG_HEVC_VAAPI_HWACCEL
487 #if CONFIG_HEVC_VDPAU_HWACCEL
490 #if CONFIG_HEVC_NVDEC_HWACCEL
495 #if CONFIG_HEVC_VAAPI_HWACCEL
501 *fmt++ =
sps->pix_fmt;
531 for (
i = 0;
i < 3;
i++) {
536 if (
sps->sao_enabled && !
s->avctx->hwaccel) {
537 int c_count = (
sps->chroma_format_idc != 0) ? 3 : 1;
540 for(c_idx = 0; c_idx < c_count; c_idx++) {
541 int w =
sps->width >>
sps->hshift[c_idx];
542 int h =
sps->height >>
sps->vshift[c_idx];
543 s->sao_pixel_buffer_h[c_idx] =
546 s->sao_pixel_buffer_v[c_idx] =
549 if (!
s->sao_pixel_buffer_h[c_idx] ||
550 !
s->sao_pixel_buffer_v[c_idx])
556 s->ps.vps = (
HEVCVPS*)
s->ps.vps_list[
s->ps.sps->vps_id]->data;
562 for (
i = 0;
i < 3;
i++) {
579 av_log(
s->avctx,
AV_LOG_ERROR,
"Two slices reporting being the first in the same frame.\n");
607 if (
s->ps.sps != (
HEVCSPS*)
s->ps.sps_list[
s->ps.pps->sps_id]->data) {
632 int slice_address_length;
634 if (
s->ps.pps->dependent_slice_segments_enabled_flag)
638 s->ps.sps->ctb_height);
642 "Invalid slice segment address: %u.\n",
654 s->slice_initialized = 0;
658 s->slice_initialized = 0;
660 for (
i = 0;
i <
s->ps.pps->num_extra_slice_header_bits;
i++)
678 if (
s->ps.pps->output_flag_present_flag)
681 if (
s->ps.sps->separate_colour_plane_flag)
691 "Ignoring POC change between slices: %d -> %d\n",
s->poc, poc);
707 int numbits, rps_idx;
709 if (!
s->ps.sps->nb_st_rps) {
715 rps_idx = numbits > 0 ?
get_bits(gb, numbits) : 0;
729 if (
s->ps.sps->sps_temporal_mvp_enabled_flag)
734 s->sh.short_term_rps =
NULL;
749 if (
s->ps.sps->sao_enabled) {
751 if (
s->ps.sps->chroma_format_idc) {
765 sh->
nb_refs[
L0] =
s->ps.pps->num_ref_idx_l0_default_active;
767 sh->
nb_refs[
L1] =
s->ps.pps->num_ref_idx_l1_default_active;
788 if (
s->ps.pps->lists_modification_present_flag && nb_refs > 1) {
806 if (
s->ps.pps->cabac_init_present_flag)
821 "Invalid collocated_ref_idx: %d.\n",
838 "Invalid number of merging MVP candidates: %d.\n",
846 if (
s->ps.pps->pic_slice_level_chroma_qp_offsets_present_flag) {
859 if (
s->ps.pps->chroma_qp_offset_list_enabled_flag)
864 if (
s->ps.pps->deblocking_filter_control_present_flag) {
865 int deblocking_filter_override_flag = 0;
867 if (
s->ps.pps->deblocking_filter_override_enabled_flag)
868 deblocking_filter_override_flag =
get_bits1(gb);
870 if (deblocking_filter_override_flag) {
875 if (beta_offset_div2 < -6 || beta_offset_div2 > 6 ||
876 tc_offset_div2 < -6 || tc_offset_div2 > 6) {
878 "Invalid deblock filter offsets: %d, %d\n",
879 beta_offset_div2, tc_offset_div2);
896 if (
s->ps.pps->seq_loop_filter_across_slices_enabled_flag &&
904 }
else if (!
s->slice_initialized) {
910 if (
s->ps.pps->tiles_enabled_flag ||
s->ps.pps->entropy_coding_sync_enabled_flag) {
914 av_log(
s->avctx,
AV_LOG_ERROR,
"num_entry_point_offsets %d is invalid\n", num_entry_point_offsets);
922 if (offset_len < 1 || offset_len > 32) {
943 if (
s->threads_number > 1 && (
s->ps.pps->num_tile_rows > 1 ||
s->ps.pps->num_tile_columns > 1)) {
944 s->enable_parallel_tiles = 0;
945 s->threads_number = 1;
947 s->enable_parallel_tiles = 0;
949 s->enable_parallel_tiles = 0;
952 if (
s->ps.pps->slice_header_extension_present_flag) {
958 for (
i = 0;
i < length;
i++)
965 sh->
slice_qp < -
s->ps.sps->qp_bd_offset) {
967 "The slice_qp %d is outside the valid range "
970 -
s->ps.sps->qp_bd_offset);
976 if (!
s->sh.slice_ctb_addr_rs &&
s->sh.dependent_slice_segment_flag) {
987 s->HEVClc->first_qp_group = !
s->sh.dependent_slice_segment_flag;
989 if (!
s->ps.pps->cu_qp_delta_enabled_flag)
990 s->HEVClc->qp_y =
s->sh.slice_qp;
992 s->slice_initialized = 1;
993 s->HEVClc->tu.cu_qp_offset_cb = 0;
994 s->HEVClc->tu.cu_qp_offset_cr = 0;
999 #define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)])
1001 #define SET_SAO(elem, value) \
1003 if (!sao_merge_up_flag && !sao_merge_left_flag) \
1004 sao->elem = value; \
1005 else if (sao_merge_left_flag) \
1006 sao->elem = CTB(s->sao, rx-1, ry).elem; \
1007 else if (sao_merge_up_flag) \
1008 sao->elem = CTB(s->sao, rx, ry-1).elem; \
1016 int sao_merge_left_flag = 0;
1017 int sao_merge_up_flag = 0;
1021 if (
s->sh.slice_sample_adaptive_offset_flag[0] ||
1022 s->sh.slice_sample_adaptive_offset_flag[1]) {
1027 if (ry > 0 && !sao_merge_left_flag) {
1033 for (c_idx = 0; c_idx < (
s->ps.sps->chroma_format_idc ? 3 : 1); c_idx++) {
1034 int log2_sao_offset_scale = c_idx == 0 ?
s->ps.pps->log2_sao_offset_scale_luma :
1035 s->ps.pps->log2_sao_offset_scale_chroma;
1037 if (!
s->sh.slice_sample_adaptive_offset_flag[c_idx]) {
1052 for (
i = 0;
i < 4;
i++)
1056 for (
i = 0;
i < 4;
i++) {
1065 }
else if (c_idx != 2) {
1071 for (
i = 0;
i < 4;
i++) {
1079 sao->
offset_val[c_idx][
i + 1] *= 1 << log2_sao_offset_scale;
1091 if (log2_res_scale_abs_plus1 != 0) {
1094 (1 - 2 * res_scale_sign_flag);
1104 int xBase,
int yBase,
int cb_xBase,
int cb_yBase,
1105 int log2_cb_size,
int log2_trafo_size,
1106 int blk_idx,
int cbf_luma,
int *cbf_cb,
int *cbf_cr)
1109 const int log2_trafo_size_c = log2_trafo_size -
s->ps.sps->hshift[1];
1113 int trafo_size = 1 << log2_trafo_size;
1116 s->hpc.intra_pred[log2_trafo_size - 2](lc, x0, y0, 0);
1119 if (cbf_luma || cbf_cb[0] || cbf_cr[0] ||
1120 (
s->ps.sps->chroma_format_idc == 2 && (cbf_cb[1] || cbf_cr[1]))) {
1123 int cbf_chroma = cbf_cb[0] || cbf_cr[0] ||
1124 (
s->ps.sps->chroma_format_idc == 2 &&
1125 (cbf_cb[1] || cbf_cr[1]));
1137 "The cu_qp_delta %d is outside the valid range "
1140 -(26 +
s->ps.sps->qp_bd_offset / 2),
1141 (25 +
s->ps.sps->qp_bd_offset / 2));
1148 if (
s->sh.cu_chroma_qp_offset_enabled_flag && cbf_chroma &&
1151 if (cu_chroma_qp_offset_flag) {
1152 int cu_chroma_qp_offset_idx = 0;
1153 if (
s->ps.pps->chroma_qp_offset_list_len_minus1 > 0) {
1156 "cu_chroma_qp_offset_idx not yet tested.\n");
1189 if (
s->ps.sps->chroma_format_idc && (log2_trafo_size > 2 ||
s->ps.sps->chroma_format_idc == 3)) {
1190 int trafo_size_h = 1 << (log2_trafo_size_c +
s->ps.sps->hshift[1]);
1191 int trafo_size_v = 1 << (log2_trafo_size_c +
s->ps.sps->vshift[1]);
1192 lc->
tu.
cross_pf = (
s->ps.pps->cross_component_prediction_enabled_flag && cbf_luma &&
1199 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1202 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (
i << log2_trafo_size_c), 1);
1206 log2_trafo_size_c, scan_idx_c, 1);
1209 ptrdiff_t
stride =
s->frame->linesize[1];
1210 int hshift =
s->ps.sps->hshift[1];
1211 int vshift =
s->ps.sps->vshift[1];
1214 int size = 1 << log2_trafo_size_c;
1216 uint8_t *dst = &
s->frame->data[1][(y0 >> vshift) *
stride +
1217 ((x0 >> hshift) <<
s->ps.sps->pixel_shift)];
1221 s->hevcdsp.add_residual[log2_trafo_size_c-2](dst, coeffs,
stride);
1228 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1231 trafo_size_h, trafo_size_v);
1232 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (
i << log2_trafo_size_c), 2);
1236 log2_trafo_size_c, scan_idx_c, 2);
1239 ptrdiff_t
stride =
s->frame->linesize[2];
1240 int hshift =
s->ps.sps->hshift[2];
1241 int vshift =
s->ps.sps->vshift[2];
1244 int size = 1 << log2_trafo_size_c;
1246 uint8_t *dst = &
s->frame->data[2][(y0 >> vshift) *
stride +
1247 ((x0 >> hshift) <<
s->ps.sps->pixel_shift)];
1251 s->hevcdsp.add_residual[log2_trafo_size_c-2](dst, coeffs,
stride);
1254 }
else if (
s->ps.sps->chroma_format_idc && blk_idx == 3) {
1255 int trafo_size_h = 1 << (log2_trafo_size + 1);
1256 int trafo_size_v = 1 << (log2_trafo_size +
s->ps.sps->vshift[1]);
1257 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1260 trafo_size_h, trafo_size_v);
1261 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (
i << log2_trafo_size), 1);
1265 log2_trafo_size, scan_idx_c, 1);
1267 for (
i = 0;
i < (
s->ps.sps->chroma_format_idc == 2 ? 2 : 1);
i++) {
1270 trafo_size_h, trafo_size_v);
1271 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (
i << log2_trafo_size), 2);
1275 log2_trafo_size, scan_idx_c, 2);
1279 if (log2_trafo_size > 2 ||
s->ps.sps->chroma_format_idc == 3) {
1280 int trafo_size_h = 1 << (log2_trafo_size_c +
s->ps.sps->hshift[1]);
1281 int trafo_size_v = 1 << (log2_trafo_size_c +
s->ps.sps->vshift[1]);
1283 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0, 1);
1284 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0, 2);
1285 if (
s->ps.sps->chroma_format_idc == 2) {
1287 trafo_size_h, trafo_size_v);
1288 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (1 << log2_trafo_size_c), 1);
1289 s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (1 << log2_trafo_size_c), 2);
1291 }
else if (blk_idx == 3) {
1292 int trafo_size_h = 1 << (log2_trafo_size + 1);
1293 int trafo_size_v = 1 << (log2_trafo_size +
s->ps.sps->vshift[1]);
1295 trafo_size_h, trafo_size_v);
1296 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase, 1);
1297 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase, 2);
1298 if (
s->ps.sps->chroma_format_idc == 2) {
1300 trafo_size_h, trafo_size_v);
1301 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (1 << log2_trafo_size), 1);
1302 s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (1 << log2_trafo_size), 2);
1312 int cb_size = 1 << log2_cb_size;
1313 int log2_min_pu_size =
s->ps.sps->log2_min_pu_size;
1315 int min_pu_width =
s->ps.sps->min_pu_width;
1316 int x_end =
FFMIN(x0 + cb_size,
s->ps.sps->width);
1317 int y_end =
FFMIN(y0 + cb_size,
s->ps.sps->height);
1320 for (j = (y0 >> log2_min_pu_size); j < (y_end >> log2_min_pu_size); j++)
1321 for (
i = (x0 >> log2_min_pu_size);
i < (x_end >> log2_min_pu_size);
i++)
1322 s->is_pcm[
i + j * min_pu_width] = 2;
1326 int xBase,
int yBase,
int cb_xBase,
int cb_yBase,
1327 int log2_cb_size,
int log2_trafo_size,
1328 int trafo_depth,
int blk_idx,
1329 const int *base_cbf_cb,
const int *base_cbf_cr)
1332 uint8_t split_transform_flag;
1337 cbf_cb[0] = base_cbf_cb[0];
1338 cbf_cb[1] = base_cbf_cb[1];
1339 cbf_cr[0] = base_cbf_cr[0];
1340 cbf_cr[1] = base_cbf_cr[1];
1343 if (trafo_depth == 1) {
1345 if (
s->ps.sps->chroma_format_idc == 3) {
1359 if (log2_trafo_size <= s->ps.sps->log2_max_trafo_size &&
1360 log2_trafo_size >
s->ps.sps->log2_min_tb_size &&
1361 trafo_depth < lc->cu.max_trafo_depth &&
1365 int inter_split =
s->ps.sps->max_transform_hierarchy_depth_inter == 0 &&
1370 split_transform_flag = log2_trafo_size >
s->ps.sps->log2_max_trafo_size ||
1375 if (
s->ps.sps->chroma_format_idc && (log2_trafo_size > 2 ||
s->ps.sps->chroma_format_idc == 3)) {
1376 if (trafo_depth == 0 || cbf_cb[0]) {
1378 if (
s->ps.sps->chroma_format_idc == 2 && (!split_transform_flag || log2_trafo_size == 3)) {
1383 if (trafo_depth == 0 || cbf_cr[0]) {
1385 if (
s->ps.sps->chroma_format_idc == 2 && (!split_transform_flag || log2_trafo_size == 3)) {
1391 if (split_transform_flag) {
1392 const int trafo_size_split = 1 << (log2_trafo_size - 1);
1393 const int x1 = x0 + trafo_size_split;
1394 const int y1 = y0 + trafo_size_split;
1396 #define SUBDIVIDE(x, y, idx) \
1398 ret = hls_transform_tree(lc, x, y, x0, y0, cb_xBase, cb_yBase, log2_cb_size,\
1399 log2_trafo_size - 1, trafo_depth + 1, idx, \
1412 int min_tu_size = 1 <<
s->ps.sps->log2_min_tb_size;
1413 int log2_min_tu_size =
s->ps.sps->log2_min_tb_size;
1414 int min_tu_width =
s->ps.sps->min_tb_width;
1418 cbf_cb[0] || cbf_cr[0] ||
1419 (
s->ps.sps->chroma_format_idc == 2 && (cbf_cb[1] || cbf_cr[1]))) {
1424 log2_cb_size, log2_trafo_size,
1425 blk_idx, cbf_luma, cbf_cb, cbf_cr);
1431 for (
i = 0;
i < (1 << log2_trafo_size);
i += min_tu_size)
1432 for (j = 0; j < (1 << log2_trafo_size); j += min_tu_size) {
1433 int x_tu = (x0 + j) >> log2_min_tu_size;
1434 int y_tu = (y0 +
i) >> log2_min_tu_size;
1435 s->cbf_luma[y_tu * min_tu_width + x_tu] = 1;
1438 if (!
s->sh.disable_deblocking_filter_flag) {
1440 if (
s->ps.pps->transquant_bypass_enable_flag &&
1452 int cb_size = 1 << log2_cb_size;
1453 ptrdiff_t stride0 =
s->frame->linesize[0];
1454 ptrdiff_t stride1 =
s->frame->linesize[1];
1455 ptrdiff_t stride2 =
s->frame->linesize[2];
1456 uint8_t *dst0 = &
s->frame->data[0][y0 * stride0 + (x0 <<
s->ps.sps->pixel_shift)];
1457 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)];
1458 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)];
1460 int length = cb_size * cb_size *
s->ps.sps->pcm.bit_depth +
1461 (((cb_size >>
s->ps.sps->hshift[1]) * (cb_size >>
s->ps.sps->vshift[1])) +
1462 ((cb_size >>
s->ps.sps->hshift[2]) * (cb_size >>
s->ps.sps->vshift[2]))) *
1463 s->ps.sps->pcm.bit_depth_chroma;
1464 const uint8_t *pcm =
skip_bytes(&lc->
cc, (length + 7) >> 3);
1467 if (!
s->sh.disable_deblocking_filter_flag)
1474 s->hevcdsp.put_pcm(dst0, stride0, cb_size, cb_size, &gb,
s->ps.sps->pcm.bit_depth);
1475 if (
s->ps.sps->chroma_format_idc) {
1476 s->hevcdsp.put_pcm(dst1, stride1,
1477 cb_size >>
s->ps.sps->hshift[1],
1478 cb_size >>
s->ps.sps->vshift[1],
1479 &gb,
s->ps.sps->pcm.bit_depth_chroma);
1480 s->hevcdsp.put_pcm(dst2, stride2,
1481 cb_size >>
s->ps.sps->hshift[2],
1482 cb_size >>
s->ps.sps->vshift[2],
1483 &gb,
s->ps.sps->pcm.bit_depth_chroma);
1507 int block_w,
int block_h,
int luma_weight,
int luma_offset)
1510 const uint8_t *
src =
ref->data[0];
1511 ptrdiff_t srcstride =
ref->linesize[0];
1512 int pic_width =
s->ps.sps->width;
1513 int pic_height =
s->ps.sps->height;
1516 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1517 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1520 x_off +=
mv->x >> 2;
1521 y_off +=
mv->y >> 2;
1522 src += y_off * srcstride + (x_off * (1 <<
s->ps.sps->pixel_shift));
1532 edge_emu_stride, srcstride,
1536 pic_width, pic_height);
1538 srcstride = edge_emu_stride;
1542 s->hevcdsp.put_hevc_qpel_uni[idx][!!my][!!mx](dst, dststride,
src, srcstride,
1543 block_h, mx, my, block_w);
1545 s->hevcdsp.put_hevc_qpel_uni_w[idx][!!my][!!mx](dst, dststride,
src, srcstride,
1546 block_h,
s->sh.luma_log2_weight_denom,
1547 luma_weight, luma_offset, mx, my, block_w);
1567 const AVFrame *ref0,
const Mv *mv0,
int x_off,
int y_off,
1568 int block_w,
int block_h,
const AVFrame *ref1,
1569 const Mv *mv1,
struct MvField *current_mv)
1572 ptrdiff_t src0stride = ref0->
linesize[0];
1573 ptrdiff_t src1stride = ref1->
linesize[0];
1574 int pic_width =
s->ps.sps->width;
1575 int pic_height =
s->ps.sps->height;
1576 int mx0 = mv0->
x & 3;
1577 int my0 = mv0->
y & 3;
1578 int mx1 = mv1->
x & 3;
1579 int my1 = mv1->
y & 3;
1580 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1581 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1582 int x_off0 = x_off + (mv0->
x >> 2);
1583 int y_off0 = y_off + (mv0->
y >> 2);
1584 int x_off1 = x_off + (mv1->
x >> 2);
1585 int y_off1 = y_off + (mv1->
y >> 2);
1588 const uint8_t *
src0 = ref0->
data[0] + y_off0 * src0stride + (
int)((
unsigned)x_off0 <<
s->ps.sps->pixel_shift);
1589 const uint8_t *
src1 = ref1->
data[0] + y_off1 * src1stride + (
int)((
unsigned)x_off1 <<
s->ps.sps->pixel_shift);
1599 edge_emu_stride, src0stride,
1603 pic_width, pic_height);
1605 src0stride = edge_emu_stride;
1616 edge_emu_stride, src1stride,
1620 pic_width, pic_height);
1622 src1stride = edge_emu_stride;
1625 s->hevcdsp.put_hevc_qpel[idx][!!my0][!!mx0](lc->
tmp,
src0, src0stride,
1626 block_h, mx0, my0, block_w);
1628 s->hevcdsp.put_hevc_qpel_bi[idx][!!my1][!!mx1](dst, dststride,
src1, src1stride, lc->
tmp,
1629 block_h, mx1, my1, block_w);
1631 s->hevcdsp.put_hevc_qpel_bi_w[idx][!!my1][!!mx1](dst, dststride,
src1, src1stride, lc->
tmp,
1632 block_h,
s->sh.luma_log2_weight_denom,
1633 s->sh.luma_weight_l0[current_mv->
ref_idx[0]],
1634 s->sh.luma_weight_l1[current_mv->
ref_idx[1]],
1635 s->sh.luma_offset_l0[current_mv->
ref_idx[0]],
1636 s->sh.luma_offset_l1[current_mv->
ref_idx[1]],
1659 ptrdiff_t dststride,
const uint8_t *
src0, ptrdiff_t srcstride,
int reflist,
1660 int x_off,
int y_off,
int block_w,
int block_h,
1661 const struct MvField *current_mv,
int chroma_weight,
int chroma_offset)
1664 int pic_width =
s->ps.sps->width >>
s->ps.sps->hshift[1];
1665 int pic_height =
s->ps.sps->height >>
s->ps.sps->vshift[1];
1666 const Mv *
mv = ¤t_mv->
mv[reflist];
1667 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1668 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1670 int hshift =
s->ps.sps->hshift[1];
1671 int vshift =
s->ps.sps->vshift[1];
1674 intptr_t _mx = mx << (1 - hshift);
1675 intptr_t _my = my << (1 - vshift);
1677 x_off +=
mv->x >> (2 + hshift);
1678 y_off +=
mv->y >> (2 + vshift);
1679 src0 += y_off * srcstride + (x_off * (1 <<
s->ps.sps->pixel_shift));
1687 (edge_emu_stride + (1 <<
s->ps.sps->pixel_shift));
1689 edge_emu_stride, srcstride,
1693 pic_width, pic_height);
1696 srcstride = edge_emu_stride;
1699 s->hevcdsp.put_hevc_epel_uni[idx][!!my][!!mx](dst0, dststride,
src0, srcstride,
1700 block_h, _mx, _my, block_w);
1702 s->hevcdsp.put_hevc_epel_uni_w[idx][!!my][!!mx](dst0, dststride,
src0, srcstride,
1703 block_h,
s->sh.chroma_log2_weight_denom,
1704 chroma_weight, chroma_offset, _mx, _my, block_w);
1726 int x_off,
int y_off,
int block_w,
int block_h,
const MvField *current_mv,
int cidx)
1729 const uint8_t *
src1 = ref0->
data[cidx+1];
1730 const uint8_t *
src2 = ref1->
data[cidx+1];
1731 ptrdiff_t src1stride = ref0->
linesize[cidx+1];
1732 ptrdiff_t src2stride = ref1->
linesize[cidx+1];
1733 int weight_flag = (
s->sh.slice_type ==
HEVC_SLICE_P &&
s->ps.pps->weighted_pred_flag) ||
1734 (
s->sh.slice_type ==
HEVC_SLICE_B &&
s->ps.pps->weighted_bipred_flag);
1735 int pic_width =
s->ps.sps->width >>
s->ps.sps->hshift[1];
1736 int pic_height =
s->ps.sps->height >>
s->ps.sps->vshift[1];
1737 const Mv *
const mv0 = ¤t_mv->
mv[0];
1738 const Mv *
const mv1 = ¤t_mv->
mv[1];
1739 int hshift =
s->ps.sps->hshift[1];
1740 int vshift =
s->ps.sps->vshift[1];
1746 intptr_t _mx0 = mx0 << (1 - hshift);
1747 intptr_t _my0 = my0 << (1 - vshift);
1748 intptr_t _mx1 = mx1 << (1 - hshift);
1749 intptr_t _my1 = my1 << (1 - vshift);
1751 int x_off0 = x_off + (mv0->
x >> (2 + hshift));
1752 int y_off0 = y_off + (mv0->
y >> (2 + vshift));
1753 int x_off1 = x_off + (mv1->
x >> (2 + hshift));
1754 int y_off1 = y_off + (mv1->
y >> (2 + vshift));
1756 src1 += y_off0 * src1stride + (
int)((
unsigned)x_off0 <<
s->ps.sps->pixel_shift);
1757 src2 += y_off1 * src2stride + (
int)((
unsigned)x_off1 <<
s->ps.sps->pixel_shift);
1765 (edge_emu_stride + (1 <<
s->ps.sps->pixel_shift));
1768 edge_emu_stride, src1stride,
1772 pic_width, pic_height);
1775 src1stride = edge_emu_stride;
1784 (edge_emu_stride + (1 <<
s->ps.sps->pixel_shift));
1787 edge_emu_stride, src2stride,
1791 pic_width, pic_height);
1794 src2stride = edge_emu_stride;
1797 s->hevcdsp.put_hevc_epel[idx][!!my0][!!mx0](lc->
tmp,
src1, src1stride,
1798 block_h, _mx0, _my0, block_w);
1800 s->hevcdsp.put_hevc_epel_bi[idx][!!my1][!!mx1](dst0,
s->frame->linesize[cidx+1],
1802 block_h, _mx1, _my1, block_w);
1804 s->hevcdsp.put_hevc_epel_bi_w[idx][!!my1][!!mx1](dst0,
s->frame->linesize[cidx+1],
1807 s->sh.chroma_log2_weight_denom,
1808 s->sh.chroma_weight_l0[current_mv->
ref_idx[0]][cidx],
1809 s->sh.chroma_weight_l1[current_mv->
ref_idx[1]][cidx],
1810 s->sh.chroma_offset_l0[current_mv->
ref_idx[0]][cidx],
1811 s->sh.chroma_offset_l1[current_mv->
ref_idx[1]][cidx],
1812 _mx1, _my1, block_w);
1826 int nPbH,
int log2_cb_size,
int part_idx,
1838 if (inter_pred_idc !=
PRED_L1) {
1839 if (
s->sh.nb_refs[
L0])
1846 part_idx, merge_idx,
mv, mvp_flag, 0);
1851 if (inter_pred_idc !=
PRED_L0) {
1852 if (
s->sh.nb_refs[
L1])
1855 if (
s->sh.mvd_l1_zero_flag == 1 && inter_pred_idc ==
PRED_BI) {
1864 part_idx, merge_idx,
mv, mvp_flag, 1);
1872 int log2_cb_size,
int partIdx,
int idx)
1874 #define POS(c_idx, x, y) \
1875 &s->frame->data[c_idx][((y) >> s->ps.sps->vshift[c_idx]) * s->frame->linesize[c_idx] + \
1876 (((x) >> s->ps.sps->hshift[c_idx]) << s->ps.sps->pixel_shift)]
1879 struct MvField current_mv = {{{ 0 }}};
1881 int min_pu_width =
s->ps.sps->min_pu_width;
1883 MvField *tab_mvf =
s->ref->tab_mvf;
1884 const RefPicList *refPicList =
s->ref->refPicList;
1886 uint8_t *dst0 =
POS(0, x0, y0);
1887 uint8_t *dst1 =
POS(1, x0, y0);
1888 uint8_t *dst2 =
POS(2, x0, y0);
1889 int log2_min_cb_size =
s->ps.sps->log2_min_cb_size;
1890 int min_cb_width =
s->ps.sps->min_cb_width;
1891 int x_cb = x0 >> log2_min_cb_size;
1892 int y_cb = y0 >> log2_min_cb_size;
1896 int skip_flag =
SAMPLE_CTB(
s->skip_flag, x_cb, y_cb);
1902 if (
s->sh.max_num_merge_cand > 1)
1908 partIdx, merge_idx, ¤t_mv);
1911 partIdx, merge_idx, ¤t_mv);
1914 x_pu = x0 >>
s->ps.sps->log2_min_pu_size;
1915 y_pu = y0 >>
s->ps.sps->log2_min_pu_size;
1917 for (j = 0; j < nPbH >>
s->ps.sps->log2_min_pu_size; j++)
1918 for (
i = 0; i < nPbW >>
s->ps.sps->log2_min_pu_size;
i++)
1919 tab_mvf[(y_pu + j) * min_pu_width + x_pu +
i] = current_mv;
1922 ref0 = refPicList[0].
ref[current_mv.
ref_idx[0]];
1928 ref1 = refPicList[1].
ref[current_mv.
ref_idx[1]];
1935 int x0_c = x0 >>
s->ps.sps->hshift[1];
1936 int y0_c = y0 >>
s->ps.sps->vshift[1];
1937 int nPbW_c = nPbW >>
s->ps.sps->hshift[1];
1938 int nPbH_c = nPbH >>
s->ps.sps->vshift[1];
1941 ¤t_mv.
mv[0], x0, y0, nPbW, nPbH,
1942 s->sh.luma_weight_l0[current_mv.
ref_idx[0]],
1943 s->sh.luma_offset_l0[current_mv.
ref_idx[0]]);
1945 if (
s->ps.sps->chroma_format_idc) {
1947 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1948 s->sh.chroma_weight_l0[current_mv.
ref_idx[0]][0],
s->sh.chroma_offset_l0[current_mv.
ref_idx[0]][0]);
1950 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1951 s->sh.chroma_weight_l0[current_mv.
ref_idx[0]][1],
s->sh.chroma_offset_l0[current_mv.
ref_idx[0]][1]);
1954 int x0_c = x0 >>
s->ps.sps->hshift[1];
1955 int y0_c = y0 >>
s->ps.sps->vshift[1];
1956 int nPbW_c = nPbW >>
s->ps.sps->hshift[1];
1957 int nPbH_c = nPbH >>
s->ps.sps->vshift[1];
1959 luma_mc_uni(lc, dst0,
s->frame->linesize[0], ref1->frame,
1960 ¤t_mv.
mv[1], x0, y0, nPbW, nPbH,
1961 s->sh.luma_weight_l1[current_mv.
ref_idx[1]],
1962 s->sh.luma_offset_l1[current_mv.
ref_idx[1]]);
1964 if (
s->ps.sps->chroma_format_idc) {
1965 chroma_mc_uni(lc, dst1,
s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1],
1966 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1967 s->sh.chroma_weight_l1[current_mv.
ref_idx[1]][0],
s->sh.chroma_offset_l1[current_mv.
ref_idx[1]][0]);
1969 chroma_mc_uni(lc, dst2,
s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2],
1970 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv,
1971 s->sh.chroma_weight_l1[current_mv.
ref_idx[1]][1],
s->sh.chroma_offset_l1[current_mv.
ref_idx[1]][1]);
1974 int x0_c = x0 >>
s->ps.sps->hshift[1];
1975 int y0_c = y0 >>
s->ps.sps->vshift[1];
1976 int nPbW_c = nPbW >>
s->ps.sps->hshift[1];
1977 int nPbH_c = nPbH >>
s->ps.sps->vshift[1];
1980 ¤t_mv.
mv[0], x0, y0, nPbW, nPbH,
1981 ref1->frame, ¤t_mv.
mv[1], ¤t_mv);
1983 if (
s->ps.sps->chroma_format_idc) {
1985 x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0);
1988 x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 1);
1997 int prev_intra_luma_pred_flag)
2000 int x_pu = x0 >>
s->ps.sps->log2_min_pu_size;
2001 int y_pu = y0 >>
s->ps.sps->log2_min_pu_size;
2002 int min_pu_width =
s->ps.sps->min_pu_width;
2003 int size_in_pus = pu_size >>
s->ps.sps->log2_min_pu_size;
2008 s->tab_ipm[(y_pu - 1) * min_pu_width + x_pu] :
INTRA_DC;
2010 s->tab_ipm[y_pu * min_pu_width + x_pu - 1] :
INTRA_DC;
2012 int y_ctb = (y0 >> (
s->ps.sps->log2_ctb_size)) << (
s->ps.sps->log2_ctb_size);
2014 MvField *tab_mvf =
s->ref->tab_mvf;
2015 int intra_pred_mode;
2020 if ((y0 - 1) < y_ctb)
2023 if (cand_left == cand_up) {
2024 if (cand_left < 2) {
2029 candidate[0] = cand_left;
2030 candidate[1] = 2 + ((cand_left - 2 - 1 + 32) & 31);
2031 candidate[2] = 2 + ((cand_left - 2 + 1) & 31);
2034 candidate[0] = cand_left;
2035 candidate[1] = cand_up;
2045 if (prev_intra_luma_pred_flag) {
2046 intra_pred_mode = candidate[lc->
pu.
mpm_idx];
2048 if (candidate[0] > candidate[1])
2049 FFSWAP(uint8_t, candidate[0], candidate[1]);
2050 if (candidate[0] > candidate[2])
2051 FFSWAP(uint8_t, candidate[0], candidate[2]);
2052 if (candidate[1] > candidate[2])
2053 FFSWAP(uint8_t, candidate[1], candidate[2]);
2056 for (
i = 0;
i < 3;
i++)
2057 if (intra_pred_mode >= candidate[
i])
2064 for (
i = 0;
i < size_in_pus;
i++) {
2065 memset(&
s->tab_ipm[(y_pu +
i) * min_pu_width + x_pu],
2066 intra_pred_mode, size_in_pus);
2068 for (j = 0; j < size_in_pus; j++) {
2073 return intra_pred_mode;
2077 int log2_cb_size,
int ct_depth)
2079 int length = (1 << log2_cb_size) >>
s->ps.sps->log2_min_cb_size;
2080 int x_cb = x0 >>
s->ps.sps->log2_min_cb_size;
2081 int y_cb = y0 >>
s->ps.sps->log2_min_cb_size;
2084 for (y = 0; y < length; y++)
2085 memset(&
s->tab_ct_depth[(y_cb + y) *
s->ps.sps->min_cb_width + x_cb],
2090 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20,
2091 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31};
2097 static const uint8_t intra_chroma_table[4] = { 0, 26, 10, 1 };
2098 uint8_t prev_intra_luma_pred_flag[4];
2100 int pb_size = (1 << log2_cb_size) >>
split;
2101 int side =
split + 1;
2105 for (
i = 0;
i < side;
i++)
2106 for (j = 0; j < side; j++)
2109 for (
i = 0;
i < side;
i++) {
2110 for (j = 0; j < side; j++) {
2111 if (prev_intra_luma_pred_flag[2 *
i + j])
2118 prev_intra_luma_pred_flag[2 *
i + j]);
2122 if (
s->ps.sps->chroma_format_idc == 3) {
2123 for (
i = 0;
i < side;
i++) {
2124 for (j = 0; j < side; j++) {
2126 if (chroma_mode != 4) {
2136 }
else if (
s->ps.sps->chroma_format_idc == 2) {
2139 if (chroma_mode != 4) {
2143 mode_idx = intra_chroma_table[chroma_mode];
2148 }
else if (
s->ps.sps->chroma_format_idc != 0) {
2150 if (chroma_mode != 4) {
2166 int pb_size = 1 << log2_cb_size;
2167 int size_in_pus = pb_size >>
s->ps.sps->log2_min_pu_size;
2168 int min_pu_width =
s->ps.sps->min_pu_width;
2169 MvField *tab_mvf =
s->ref->tab_mvf;
2170 int x_pu = x0 >>
s->ps.sps->log2_min_pu_size;
2171 int y_pu = y0 >>
s->ps.sps->log2_min_pu_size;
2174 if (size_in_pus == 0)
2176 for (j = 0; j < size_in_pus; j++)
2177 memset(&
s->tab_ipm[(y_pu + j) * min_pu_width + x_pu],
INTRA_DC, size_in_pus);
2179 for (j = 0; j < size_in_pus; j++)
2180 for (k = 0; k < size_in_pus; k++)
2186 int cb_size = 1 << log2_cb_size;
2187 int log2_min_cb_size =
s->ps.sps->log2_min_cb_size;
2188 int length = cb_size >> log2_min_cb_size;
2189 int min_cb_width =
s->ps.sps->min_cb_width;
2190 int x_cb = x0 >> log2_min_cb_size;
2191 int y_cb = y0 >> log2_min_cb_size;
2192 int idx = log2_cb_size - 2;
2193 int qp_block_mask = (1<<(
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_qp_delta_depth)) - 1;
2203 for (x = 0; x < 4; x++)
2205 if (
s->ps.pps->transquant_bypass_enable_flag) {
2215 x = y_cb * min_cb_width + x_cb;
2216 for (y = 0; y < length; y++) {
2217 memset(&
s->skip_flag[x], skip_flag, length);
2222 x = y_cb * min_cb_width + x_cb;
2223 for (y = 0; y < length; y++) {
2224 memset(&
s->skip_flag[x], 0, length);
2233 if (!
s->sh.disable_deblocking_filter_flag)
2241 log2_cb_size ==
s->ps.sps->log2_min_cb_size) {
2249 log2_cb_size >=
s->ps.sps->pcm.log2_min_pcm_cb_size &&
2250 log2_cb_size <= s->ps.sps->pcm.log2_max_pcm_cb_size) {
2256 if (
s->ps.sps->pcm.loop_filter_disable_flag)
2272 hls_prediction_unit(lc, x0, y0 + cb_size / 2, cb_size, cb_size / 2, log2_cb_size, 1, idx);
2276 hls_prediction_unit(lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1, idx - 1);
2280 hls_prediction_unit(lc, x0, y0 + cb_size / 4, cb_size, cb_size * 3 / 4, log2_cb_size, 1, idx);
2284 hls_prediction_unit(lc, x0, y0 + cb_size * 3 / 4, cb_size, cb_size / 4, log2_cb_size, 1, idx);
2288 hls_prediction_unit(lc, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1, idx - 2);
2292 hls_prediction_unit(lc, x0 + cb_size * 3 / 4, y0, cb_size / 4, cb_size, log2_cb_size, 1, idx - 2);
2296 hls_prediction_unit(lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size / 2, log2_cb_size, 1, idx - 1);
2297 hls_prediction_unit(lc, x0, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2, idx - 1);
2298 hls_prediction_unit(lc, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3, idx - 1);
2304 int rqt_root_cbf = 1;
2311 const static int cbf[2] = { 0 };
2314 s->ps.sps->max_transform_hierarchy_depth_inter;
2317 log2_cb_size, 0, 0, cbf, cbf);
2321 if (!
s->sh.disable_deblocking_filter_flag)
2330 x = y_cb * min_cb_width + x_cb;
2331 for (y = 0; y < length; y++) {
2332 memset(&
s->qp_y_tab[x], lc->
qp_y, length);
2336 if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
2337 ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0) {
2347 int log2_cb_size,
int cb_depth)
2350 const int cb_size = 1 << log2_cb_size;
2355 if (x0 + cb_size <= s->ps.sps->width &&
2356 y0 + cb_size <= s->ps.sps->height &&
2357 log2_cb_size >
s->ps.sps->log2_min_cb_size) {
2360 split_cu = (log2_cb_size >
s->ps.sps->log2_min_cb_size);
2362 if (
s->ps.pps->cu_qp_delta_enabled_flag &&
2363 log2_cb_size >=
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_qp_delta_depth) {
2368 if (
s->sh.cu_chroma_qp_offset_enabled_flag &&
2369 log2_cb_size >=
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_chroma_qp_offset_depth) {
2374 int qp_block_mask = (1<<(
s->ps.sps->log2_ctb_size -
s->ps.pps->diff_cu_qp_delta_depth)) - 1;
2375 const int cb_size_split = cb_size >> 1;
2376 const int x1 = x0 + cb_size_split;
2377 const int y1 = y0 + cb_size_split;
2385 if (more_data && x1 < s->ps.sps->width) {
2390 if (more_data && y1 < s->ps.sps->height) {
2395 if (more_data && x1 < s->ps.sps->width &&
2396 y1 < s->ps.sps->height) {
2402 if(((x0 + (1<<log2_cb_size)) & qp_block_mask) == 0 &&
2403 ((y0 + (1<<log2_cb_size)) & qp_block_mask) == 0)
2407 return ((x1 + cb_size_split) <
s->ps.sps->width ||
2408 (y1 + cb_size_split) <
s->ps.sps->height);
2415 if ((!((x0 + cb_size) %
2416 (1 << (
s->ps.sps->log2_ctb_size))) ||
2417 (x0 + cb_size >=
s->ps.sps->width)) &&
2419 (1 << (
s->ps.sps->log2_ctb_size))) ||
2420 (y0 + cb_size >=
s->ps.sps->height))) {
2422 return !end_of_slice_flag;
2435 int ctb_size = 1 <<
s->ps.sps->log2_ctb_size;
2436 int ctb_addr_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];
2437 int ctb_addr_in_slice = ctb_addr_rs -
s->sh.slice_addr;
2439 s->tab_slice_address[ctb_addr_rs] =
s->sh.slice_addr;
2441 if (
s->ps.pps->entropy_coding_sync_enabled_flag) {
2442 if (x_ctb == 0 && (y_ctb & (ctb_size - 1)) == 0)
2445 }
else if (
s->ps.pps->tiles_enabled_flag) {
2446 if (ctb_addr_ts &&
s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[ctb_addr_ts - 1]) {
2447 int idxX =
s->ps.pps->col_idxX[x_ctb >>
s->ps.sps->log2_ctb_size];
2448 lc->
end_of_tiles_x = x_ctb + (
s->ps.pps->column_width[idxX] <<
s->ps.sps->log2_ctb_size);
2458 if (
s->ps.pps->tiles_enabled_flag) {
2459 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]])
2461 if (x_ctb > 0 &&
s->tab_slice_address[ctb_addr_rs] !=
s->tab_slice_address[ctb_addr_rs - 1])
2463 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]])
2465 if (y_ctb > 0 &&
s->tab_slice_address[ctb_addr_rs] !=
s->tab_slice_address[ctb_addr_rs -
s->ps.sps->ctb_width])
2468 if (ctb_addr_in_slice <= 0)
2470 if (ctb_addr_in_slice < s->ps.sps->ctb_width)
2476 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]]));
2477 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]]));
2484 int ctb_size = 1 <<
s->ps.sps->log2_ctb_size;
2488 int ctb_addr_ts =
s->ps.pps->ctb_addr_rs_to_ts[
s->sh.slice_ctb_addr_rs];
2491 if (!ctb_addr_ts &&
s->sh.dependent_slice_segment_flag) {
2496 if (
s->sh.dependent_slice_segment_flag) {
2497 int prev_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1];
2498 if (
s->tab_slice_address[prev_rs] !=
s->sh.slice_addr) {
2504 while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) {
2505 int ctb_addr_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];
2507 x_ctb = (ctb_addr_rs % ((
s->ps.sps->width + ctb_size - 1) >>
s->ps.sps->log2_ctb_size)) <<
s->ps.sps->log2_ctb_size;
2508 y_ctb = (ctb_addr_rs / ((
s->ps.sps->width + ctb_size - 1) >>
s->ps.sps->log2_ctb_size)) <<
s->ps.sps->log2_ctb_size;
2513 s->tab_slice_address[ctb_addr_rs] = -1;
2517 hls_sao_param(lc, x_ctb >>
s->ps.sps->log2_ctb_size, y_ctb >>
s->ps.sps->log2_ctb_size);
2519 s->deblock[ctb_addr_rs].beta_offset =
s->sh.beta_offset;
2520 s->deblock[ctb_addr_rs].tc_offset =
s->sh.tc_offset;
2521 s->filter_slice_edges[ctb_addr_rs] =
s->sh.slice_loop_filter_across_slices_enabled_flag;
2524 if (more_data < 0) {
2525 s->tab_slice_address[ctb_addr_rs] = -1;
2535 if (x_ctb + ctb_size >=
s->ps.sps->width &&
2536 y_ctb + ctb_size >=
s->ps.sps->height)
2554 int job,
int self_id)
2558 int ctb_size = 1 <<
s->ps.sps->log2_ctb_size;
2561 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);
2562 int ctb_addr_ts =
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs];
2563 int thread = ctb_row %
s->threads_number;
2573 while(more_data && ctb_addr_ts < s->ps.sps->ctb_size) {
2574 int x_ctb = (ctb_addr_rs %
s->ps.sps->ctb_width) <<
s->ps.sps->log2_ctb_size;
2575 int y_ctb = (ctb_addr_rs /
s->ps.sps->ctb_width) <<
s->ps.sps->log2_ctb_size;
2592 hls_sao_param(lc, x_ctb >>
s->ps.sps->log2_ctb_size, y_ctb >>
s->ps.sps->log2_ctb_size);
2595 if (more_data < 0) {
2606 if (!more_data && (x_ctb+ctb_size) <
s->ps.sps->width && ctb_row !=
s->sh.num_entry_point_offsets) {
2613 if ((x_ctb+ctb_size) >=
s->ps.sps->width && (y_ctb+ctb_size) >=
s->ps.sps->height ) {
2618 ctb_addr_rs =
s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];
2621 if(x_ctb >=
s->ps.sps->width) {
2629 s->tab_slice_address[ctb_addr_rs] = -1;
2639 int length = nal->
size;
2643 int64_t startheader, cmpt = 0;
2646 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) {
2648 s->sh.slice_ctb_addr_rs,
s->sh.num_entry_point_offsets,
2649 s->ps.sps->ctb_width,
s->ps.sps->ctb_height
2654 for (
i = 1;
i <
s->threads_number;
i++) {
2655 if (
s->HEVClcList[
i])
2658 if (!
s->HEVClcList[
i])
2660 s->HEVClcList[
i]->logctx =
s->avctx;
2661 s->HEVClcList[
i]->parent =
s;
2662 s->HEVClcList[
i]->common_cabac_state = &
s->cabac;
2667 for (j = 0, cmpt = 0, startheader =
offset +
s->sh.entry_point_offset[0]; j < nal->skipped_bytes; j++) {
2674 for (
i = 1;
i <
s->sh.num_entry_point_offsets;
i++) {
2675 offset += (
s->sh.entry_point_offset[
i - 1] - cmpt);
2676 for (j = 0, cmpt = 0, startheader =
offset
2677 +
s->sh.entry_point_offset[
i]; j < nal->skipped_bytes; j++) {
2683 s->sh.size[
i - 1] =
s->sh.entry_point_offset[
i] - cmpt;
2687 if (
s->sh.num_entry_point_offsets != 0) {
2688 offset +=
s->sh.entry_point_offset[
s->sh.num_entry_point_offsets - 1] - cmpt;
2693 s->sh.size[
s->sh.num_entry_point_offsets - 1] = length -
offset;
2694 s->sh.offset[
s->sh.num_entry_point_offsets - 1] =
offset;
2699 for (
i = 1;
i <
s->threads_number;
i++) {
2700 s->HEVClcList[
i]->first_qp_group = 1;
2701 s->HEVClcList[
i]->qp_y =
s->HEVClc->qp_y;
2713 if (
s->ps.pps->entropy_coding_sync_enabled_flag)
2716 for (
i = 0;
i <=
s->sh.num_entry_point_offsets;
i++)
2730 if (
s->sei.mastering_display.present > 0 &&
2732 s->sei.mastering_display.present--;
2734 if (
s->sei.mastering_display.present) {
2736 const int mapping[3] = {2, 0, 1};
2737 const int chroma_den = 50000;
2738 const int luma_den = 10000;
2745 for (
i = 0;
i < 3;
i++) {
2746 const int j = mapping[
i];
2752 metadata->
white_point[0].
num =
s->sei.mastering_display.white_point[0];
2754 metadata->
white_point[1].
num =
s->sei.mastering_display.white_point[1];
2766 "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n",
2775 "min_luminance=%f, max_luminance=%f\n",
2780 if (
s->sei.content_light.present > 0 &&
2782 s->sei.content_light.present--;
2784 if (
s->sei.content_light.present) {
2789 metadata->
MaxCLL =
s->sei.content_light.max_content_light_level;
2790 metadata->
MaxFALL =
s->sei.content_light.max_pic_average_light_level;
2798 &
s->ps.sps->vui.common,
2799 s->ps.sps->bit_depth,
s->ps.sps->bit_depth_chroma,
2804 if (
s->sei.timecode.present) {
2808 sizeof(uint32_t) * 4);
2812 tc_sd = (uint32_t*)tcside->
data;
2813 tc_sd[0] =
s->sei.timecode.num_clock_ts;
2815 for (
int i = 0;
i < tc_sd[0];
i++) {
2816 int drop =
s->sei.timecode.cnt_dropped_flag[
i];
2817 int hh =
s->sei.timecode.hours_value[
i];
2818 int mm =
s->sei.timecode.minutes_value[
i];
2819 int ss =
s->sei.timecode.seconds_value[
i];
2820 int ff =
s->sei.timecode.n_frames[
i];
2827 s->sei.timecode.num_clock_ts = 0;
2830 if (
s->sei.common.dynamic_hdr_plus.info) {
2852 if (
s->sei.common.dynamic_hdr_vivid.info) {
2869 int pic_size_in_ctb = ((
s->ps.sps->width >>
s->ps.sps->log2_min_cb_size) + 1) *
2870 ((
s->ps.sps->height >>
s->ps.sps->log2_min_cb_size) + 1);
2873 memset(
s->horizontal_bs, 0,
s->bs_width *
s->bs_height);
2874 memset(
s->vertical_bs, 0,
s->bs_width *
s->bs_height);
2875 memset(
s->cbf_luma, 0,
s->ps.sps->min_tb_width *
s->ps.sps->min_tb_height);
2876 memset(
s->is_pcm, 0, (
s->ps.sps->min_pu_width + 1) * (
s->ps.sps->min_pu_height + 1));
2877 memset(
s->tab_slice_address, -1, pic_size_in_ctb *
sizeof(*
s->tab_slice_address));
2880 s->first_nal_type =
s->nal_unit_type;
2884 if (
s->ps.pps->tiles_enabled_flag)
2885 lc->
end_of_tiles_x =
s->ps.pps->column_width[0] <<
s->ps.sps->log2_ctb_size;
2899 s->ref->needs_fg =
s->sei.common.film_grain_characteristics.present &&
2903 if (
s->ref->needs_fg) {
2904 s->ref->frame_grain->format =
s->ref->frame->format;
2905 s->ref->frame_grain->width =
s->ref->frame->width;
2906 s->ref->frame_grain->height =
s->ref->frame->height;
2915 s->frame->pict_type = 3 -
s->sh.slice_type;
2925 if (!
s->avctx->hwaccel)
2943 if (
out->needs_fg) {
2963 int ctb_addr_ts,
ret;
2966 s->nal_unit_type = nal->
type;
2969 switch (
s->nal_unit_type) {
2971 if (
s->avctx->hwaccel &&
s->avctx->hwaccel->decode_params) {
2972 ret =
s->avctx->hwaccel->decode_params(
s->avctx,
2984 if (
s->avctx->hwaccel &&
s->avctx->hwaccel->decode_params) {
2985 ret =
s->avctx->hwaccel->decode_params(
s->avctx,
2993 s->apply_defdispwin);
2998 if (
s->avctx->hwaccel &&
s->avctx->hwaccel->decode_params) {
2999 ret =
s->avctx->hwaccel->decode_params(
s->avctx,
3012 if (
s->avctx->hwaccel &&
s->avctx->hwaccel->decode_params) {
3013 ret =
s->avctx->hwaccel->decode_params(
s->avctx,
3056 if (
s->sh.first_slice_in_pic_flag) {
3057 if (
s->max_ra == INT_MAX) {
3062 s->max_ra = INT_MIN;
3067 s->poc <=
s->max_ra) {
3072 s->max_ra = INT_MIN;
3079 }
else if (!
s->ref) {
3084 if (
s->nal_unit_type !=
s->first_nal_type) {
3086 "Non-matching NAL types of the VCL NALUs: %d %d\n",
3087 s->first_nal_type,
s->nal_unit_type);
3091 if (!
s->sh.dependent_slice_segment_flag &&
3096 "Error constructing the reference lists for the current slice.\n");
3101 if (
s->sh.first_slice_in_pic_flag &&
s->avctx->hwaccel) {
3102 ret =
s->avctx->hwaccel->start_frame(
s->avctx,
NULL, 0);
3107 if (
s->avctx->hwaccel) {
3112 if (
s->threads_number > 1 &&
s->sh.num_entry_point_offsets > 0)
3116 if (ctb_addr_ts >= (
s->ps.sps->ctb_width *
s->ps.sps->ctb_height)) {
3123 if (ctb_addr_ts < 0) {
3132 s->max_ra = INT_MAX;
3140 "Skipping NAL unit %d\n",
s->nal_unit_type);
3153 int eos_at_start = 1;
3156 s->last_eos =
s->eos;
3163 s->nal_length_size,
s->avctx->codec_id, 1, 0);
3166 "Error splitting the input into NAL units.\n");
3170 for (
i = 0;
i <
s->pkt.nb_nals;
i++) {
3192 s->pkt.nals[
s->pkt.nb_nals - 1].size > 2 && !
s->pkt.nals[
s->pkt.nb_nals - 1].nuh_layer_id
3193 && !
s->pkt.nals[
s->pkt.nb_nals - 1].temporal_id) {
3194 H2645NAL *nal = &
s->pkt.nals[
s->pkt.nb_nals - 1];
3197 av_log(
s->avctx,
AV_LOG_WARNING,
"Multiple Dolby Vision RPUs found in one AU. Skipping previous.\n");
3214 for (
i = 0;
i <
s->pkt.nb_nals;
i++) {
3223 if (
ret >= 0 &&
s->overlap > 2)
3227 "Error parsing NAL unit #%d.\n",
i);
3242 char msg_buf[4 * (50 + 2 * 2 * 16 )];
3250 pixel_shift =
desc->comp[0].depth > 8;
3255 if (pixel_shift && !
s->checksum_buf) {
3258 frame->linesize[2]));
3259 if (!
s->checksum_buf)
3266 int width =
s->avctx->coded_width;
3267 int height =
s->avctx->coded_height;
3273 for (j = 0; j <
h; j++) {
3277 s->bdsp.bswap16_buf((uint16_t *)
s->checksum_buf,
3278 (
const uint16_t *)
src,
w);
3279 src =
s->checksum_buf;
3286 #define MD5_PRI "%016" PRIx64 "%016" PRIx64
3287 #define MD5_PRI_ARG(buf) AV_RB64(buf), AV_RB64((const uint8_t*)(buf) + 8)
3289 if (!memcmp(
md5,
s->sei.picture_hash.md5[
i], 16)) {
3291 "plane %d - correct " MD5_PRI "; ",
3295 "mismatching checksum of plane %d - " MD5_PRI " != " MD5_PRI "; ",
3302 "Verifying checksum for frame with POC %d: %s\n",
3313 &
s->nal_length_size,
s->avctx->err_recognition,
3314 s->apply_defdispwin,
s->avctx);
3320 if (
first &&
s->ps.sps_list[
i]) {
3353 if (sd && sd_size > 0) {
3360 if (sd && sd_size > 0)
3371 "hardware accelerator failed to decode picture\n");
3378 s->sei.picture_hash.is_md5) {
3386 s->sei.picture_hash.is_md5 = 0;
3388 if (
s->is_decoded) {
3393 if (
s->output_frame->buf[0]) {
3409 if (
src->needs_fg) {
3435 if (
src->hwaccel_picture_private) {
3460 for (
i = 0;
i < 3;
i++) {
3478 if (
s->HEVClcList) {
3479 for (
i = 1;
i <
s->threads_number;
i++) {
3502 if (!
s->HEVClc || !
s->HEVClcList)
3504 s->HEVClc->parent =
s;
3505 s->HEVClc->logctx = avctx;
3506 s->HEVClc->common_cabac_state = &
s->cabac;
3507 s->HEVClcList[0] =
s->HEVClc;
3510 if (!
s->output_frame)
3515 if (!
s->DPB[
i].frame)
3517 s->DPB[
i].tf.f =
s->DPB[
i].frame;
3520 if (!
s->DPB[
i].frame_grain)
3524 s->max_ra = INT_MAX;
3532 s->dovi_ctx.logctx = avctx;
3550 if (
s0->DPB[
i].frame->buf[0]) {
3557 if (
s->ps.sps !=
s0->ps.sps)
3577 if (
s->ps.sps !=
s0->ps.sps)
3581 s->seq_decode =
s0->seq_decode;
3582 s->seq_output =
s0->seq_output;
3583 s->pocTid0 =
s0->pocTid0;
3584 s->max_ra =
s0->max_ra;
3586 s->no_rasl_output_flag =
s0->no_rasl_output_flag;
3588 s->is_nalff =
s0->is_nalff;
3589 s->nal_length_size =
s0->nal_length_size;
3591 s->threads_number =
s0->threads_number;
3592 s->threads_type =
s0->threads_type;
3596 s->max_ra = INT_MAX;
3604 s0->sei.common.dynamic_hdr_plus.info);
3617 s0->sei.common.dynamic_hdr_vivid.info);
3621 s->sei.common.frame_packing =
s0->sei.common.frame_packing;
3622 s->sei.common.display_orientation =
s0->sei.common.display_orientation;
3623 s->sei.common.alternative_transfer =
s0->sei.common.alternative_transfer;
3624 s->sei.mastering_display =
s0->sei.mastering_display;
3625 s->sei.content_light =
s0->sei.content_light;
3646 s->threads_number = 1;
3657 s->enable_parallel_tiles = 0;
3658 s->sei.picture_timing.picture_struct = 0;
3682 s->max_ra = INT_MAX;
3686 #define OFFSET(x) offsetof(HEVCContext, x)
3687 #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
3690 {
"apply_defdispwin",
"Apply default display window from VUI",
OFFSET(apply_defdispwin),
3692 {
"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_NVDEC_HWACCEL
3734 #if CONFIG_HEVC_VAAPI_HWACCEL
3737 #if CONFIG_HEVC_VDPAU_HWACCEL
3740 #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL