History

lavc/vaapi_dec: Add VVC decoder

Fei Wang committed 2 years ago

Commit e726fde1 parent 4dc18c78 files · +682 −2Browse files

Unified · Split

8 files
  1. Changelog +1 −0
  2. configure +3 −0
  3. libavcodec/Makefile +1 −0
  4. libavcodec/hwaccels.h +1 −0
  5. libavcodec/vaapi_decode.c +4 −0
  6. libavcodec/vaapi_vvc.c +657 −0
  7. libavcodec/version.h +1 −1
  8. libavcodec/vvc/dec.c +14 −1
Changelog+1−0
@@ -3,6 +3,7 @@ releases are sorted from youngest to oldest. · 2 unmodified lines
3 3
4version <next>:4version <next>:
5- yasm support dropped, users need to use nasm5- yasm support dropped, users need to use nasm
6- VVC VAAPI decoder
6 7
7version 7.1:8version 7.1:
8- Raw Captions with Time (RCWT) closed caption demuxer9- Raw Captions with Time (RCWT) closed caption demuxer
configure+3−0
@@ -3289,6 +3289,8 @@ vp9_vdpau_hwaccel_deps="vdpau VdpPictureInfoVP9" · 3288 unmodified lines
3289vp9_vdpau_hwaccel_select="vp9_decoder"3289vp9_vdpau_hwaccel_select="vp9_decoder"
3290vp9_videotoolbox_hwaccel_deps="videotoolbox"3290vp9_videotoolbox_hwaccel_deps="videotoolbox"
3291vp9_videotoolbox_hwaccel_select="vp9_decoder"3291vp9_videotoolbox_hwaccel_select="vp9_decoder"
3292vvc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVVC"
3293vvc_vaapi_hwaccel_select="vvc_decoder"
3292wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"3294wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
3293wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"3295wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
3294wmv3_d3d12va_hwaccel_select="vc1_d3d12va_hwaccel"3296wmv3_d3d12va_hwaccel_select="vc1_d3d12va_hwaccel"
@@ -7310,6 +7312,7 @@ if enabled vaapi; then · 4015 unmodified lines
7310 check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)"7312 check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)"
7311 7313
7312 check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"7314 check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
7315 check_type "va/va.h va/va_dec_vvc.h" "VAPictureParameterBufferVVC"
7313 check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth7316 check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
7314 check_struct "va/va.h" "VADecPictureParameterBufferAV1" bit_depth_idx7317 check_struct "va/va.h" "VADecPictureParameterBufferAV1" bit_depth_idx
7315 check_type "va/va.h va/va_vpp.h" "VAProcFilterParameterBufferHDRToneMapping"7318 check_type "va/va.h va/va_vpp.h" "VAProcFilterParameterBufferHDRToneMapping"
libavcodec/Makefile+1−0
@@ -1064,6 +1064,7 @@ OBJS-$(CONFIG_VP9_VAAPI_HWACCEL) += vaapi_vp9.o · 1063 unmodified lines
1064OBJS-$(CONFIG_VP9_VDPAU_HWACCEL) += vdpau_vp9.o1064OBJS-$(CONFIG_VP9_VDPAU_HWACCEL) += vdpau_vp9.o
1065OBJS-$(CONFIG_VP9_VIDEOTOOLBOX_HWACCEL) += videotoolbox_vp9.o1065OBJS-$(CONFIG_VP9_VIDEOTOOLBOX_HWACCEL) += videotoolbox_vp9.o
1066OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o1066OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o
1067OBJS-$(CONFIG_VVC_VAAPI_HWACCEL) += vaapi_vvc.o
1067 1068
1068# Objects duplicated from other libraries for shared builds1069# Objects duplicated from other libraries for shared builds
1069SHLIBOBJS += log2_tab.o reverse.o1070SHLIBOBJS += log2_tab.o reverse.o
libavcodec/hwaccels.h+1−0
@@ -83,6 +83,7 @@ extern const struct FFHWAccel ff_vp9_nvdec_hwaccel; · 82 unmodified lines
83extern const struct FFHWAccel ff_vp9_vaapi_hwaccel;83extern const struct FFHWAccel ff_vp9_vaapi_hwaccel;
84extern const struct FFHWAccel ff_vp9_vdpau_hwaccel;84extern const struct FFHWAccel ff_vp9_vdpau_hwaccel;
85extern const struct FFHWAccel ff_vp9_videotoolbox_hwaccel;85extern const struct FFHWAccel ff_vp9_videotoolbox_hwaccel;
86extern const struct FFHWAccel ff_vvc_vaapi_hwaccel;
86extern const struct FFHWAccel ff_wmv3_d3d11va_hwaccel;87extern const struct FFHWAccel ff_wmv3_d3d11va_hwaccel;
87extern const struct FFHWAccel ff_wmv3_d3d11va2_hwaccel;88extern const struct FFHWAccel ff_wmv3_d3d11va2_hwaccel;
88extern const struct FFHWAccel ff_wmv3_d3d12va_hwaccel;89extern const struct FFHWAccel ff_wmv3_d3d12va_hwaccel;
libavcodec/vaapi_decode.c+4−0
@@ -464,6 +464,9 @@ static const struct { · 463 unmodified lines
464 MAP(AV1, AV1_MAIN, AV1Profile0),464 MAP(AV1, AV1_MAIN, AV1Profile0),
465 MAP(AV1, AV1_HIGH, AV1Profile1),465 MAP(AV1, AV1_HIGH, AV1Profile1),
466#endif466#endif
467#if VA_CHECK_VERSION(1, 22, 0)
468 MAP(H266, VVC_MAIN_10, VVCMain10),
469#endif
467 470
468#undef MAP471#undef MAP
469};472};
@@ -629,6 +632,7 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, · 159 unmodified lines
629 // Add per-codec number of surfaces used for storing reference frames.632 // Add per-codec number of surfaces used for storing reference frames.
630 switch (avctx->codec_id) {633 switch (avctx->codec_id) {
631 case AV_CODEC_ID_H264:634 case AV_CODEC_ID_H264:
635 case AV_CODEC_ID_H266:
632 case AV_CODEC_ID_HEVC:636 case AV_CODEC_ID_HEVC:
633 case AV_CODEC_ID_AV1:637 case AV_CODEC_ID_AV1:
634 frames->initial_pool_size += 16;638 frames->initial_pool_size += 16;
libavcodec/vaapi_vvc.c+657−0
@@ -0,0 +1,657 @@
1/*
2 * VVC HW decode acceleration through VA API
3 *
4 * Copyright (c) 2024 Intel Corporation
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include <va/va.h>
24#include <va/va_dec_vvc.h>
25
26#include "vvc/dec.h"
27#include "vvc/refs.h"
28#include "hwaccel_internal.h"
29#include "vaapi_decode.h"
30
31typedef struct VAAPIDecodePictureVVC {
32 VAAPIDecodePicture pic;
33 VAPictureParameterBufferVVC pic_param;
34 VASliceParameterBufferVVC slice_param;
35 int decode_issued;
36} VAAPIDecodePictureVVC;
37
38static void init_vaapi_pic(VAPictureVVC *va_pic)
39{
40 va_pic->picture_id = VA_INVALID_ID;
41 va_pic->flags = VA_PICTURE_VVC_INVALID;
42 va_pic->pic_order_cnt = 0;
43}
44
45static void fill_vaapi_pic(VAPictureVVC *va_pic, const VVCFrame *pic)
46{
47 va_pic->picture_id = ff_vaapi_get_surface_id(pic->frame);
48 va_pic->pic_order_cnt = pic->poc;
49 va_pic->flags = 0;
50
51 if (pic->flags & VVC_FRAME_FLAG_LONG_REF)
52 va_pic->flags |= VA_PICTURE_VVC_LONG_TERM_REFERENCE;
53}
54
55static void fill_vaapi_reference_frames(const VVCFrameContext *h, VAPictureParameterBufferVVC *pp)
56{
57 const VVCFrame *current_picture = h->ref;
58 int i, j;
59
60 for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->ReferenceFrames); i++) {
61 const VVCFrame *frame = NULL;
62
63 while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) {
64 if ((&h->DPB[j] != current_picture ) &&
65 (h->DPB[j].flags & (VVC_FRAME_FLAG_LONG_REF | VVC_FRAME_FLAG_SHORT_REF)))
66 frame = &h->DPB[j];
67 j++;
68 }
69
70 init_vaapi_pic(&pp->ReferenceFrames[i]);
71
72 if (frame) {
73 VAAPIDecodePictureVVC *pic;
74 fill_vaapi_pic(&pp->ReferenceFrames[i], frame);
75 pic = frame->hwaccel_picture_private;
76 if (!pic->decode_issued)
77 pp->ReferenceFrames[i].flags |= VA_PICTURE_VVC_UNAVAILABLE_REFERENCE;
78 }
79 }
80}
81
82static int vaapi_vvc_start_frame(AVCodecContext *avctx,
83 av_unused const uint8_t *buffer,
84 av_unused uint32_t size)
85{
86 const VVCContext *h = avctx->priv_data;
87 VVCFrameContext *fc = &h->fcs[(h->nb_frames + h->nb_fcs) % h->nb_fcs];
88 const H266RawSPS *sps = fc->ps.sps->r;
89 const H266RawPPS *pps = fc->ps.pps->r;
90 const H266RawPictureHeader *ph = fc->ps.ph.r;
91 VAAPIDecodePictureVVC *pic = fc->ref->hwaccel_picture_private;
92 VAPictureParameterBufferVVC *pic_param = &pic->pic_param;
93 uint16_t tile_dim, exp_slice_height_in_ctus[VVC_MAX_SLICES] = {0};
94 int i, j, k, err;
95
96 pic->pic.output_surface = ff_vaapi_get_surface_id(fc->ref->frame);
97
98 *pic_param = (VAPictureParameterBufferVVC) {
99 .pps_pic_width_in_luma_samples = pps->pps_pic_width_in_luma_samples,
100 .pps_pic_height_in_luma_samples = pps->pps_pic_height_in_luma_samples,
101 .sps_num_subpics_minus1 = sps->sps_num_subpics_minus1,
102 .sps_chroma_format_idc = sps->sps_chroma_format_idc,
103 .sps_bitdepth_minus8 = sps->sps_bitdepth_minus8,
104 .sps_log2_ctu_size_minus5 = sps->sps_log2_ctu_size_minus5,
105 .sps_log2_min_luma_coding_block_size_minus2 = sps->sps_log2_min_luma_coding_block_size_minus2,
106 .sps_log2_transform_skip_max_size_minus2 = sps->sps_log2_transform_skip_max_size_minus2,
107 .sps_six_minus_max_num_merge_cand = sps->sps_six_minus_max_num_merge_cand,
108 .sps_five_minus_max_num_subblock_merge_cand = sps->sps_five_minus_max_num_subblock_merge_cand,
109 .sps_max_num_merge_cand_minus_max_num_gpm_cand = sps->sps_max_num_merge_cand_minus_max_num_gpm_cand,
110 .sps_log2_parallel_merge_level_minus2 = sps->sps_log2_parallel_merge_level_minus2,
111 .sps_min_qp_prime_ts = sps->sps_min_qp_prime_ts,
112 .sps_six_minus_max_num_ibc_merge_cand = sps->sps_six_minus_max_num_ibc_merge_cand,
113 .sps_num_ladf_intervals_minus2 = sps->sps_num_ladf_intervals_minus2,
114 .sps_ladf_lowest_interval_qp_offset = sps->sps_ladf_lowest_interval_qp_offset,
115 .sps_flags.bits = {
116 .sps_subpic_info_present_flag = sps->sps_subpic_info_present_flag,
117 .sps_independent_subpics_flag = sps->sps_independent_subpics_flag,
118 .sps_subpic_same_size_flag = sps->sps_subpic_same_size_flag,
119 .sps_entropy_coding_sync_enabled_flag = sps->sps_entropy_coding_sync_enabled_flag,
120 .sps_qtbtt_dual_tree_intra_flag = sps->sps_qtbtt_dual_tree_intra_flag,
121 .sps_max_luma_transform_size_64_flag = sps->sps_max_luma_transform_size_64_flag,
122 .sps_transform_skip_enabled_flag = sps->sps_transform_skip_enabled_flag,
123 .sps_bdpcm_enabled_flag = sps->sps_bdpcm_enabled_flag,
124 .sps_mts_enabled_flag = sps->sps_mts_enabled_flag,
125 .sps_explicit_mts_intra_enabled_flag = sps->sps_explicit_mts_intra_enabled_flag,
126 .sps_explicit_mts_inter_enabled_flag = sps->sps_explicit_mts_inter_enabled_flag,
127 .sps_lfnst_enabled_flag = sps->sps_lfnst_enabled_flag,
128 .sps_joint_cbcr_enabled_flag = sps->sps_joint_cbcr_enabled_flag,
129 .sps_same_qp_table_for_chroma_flag = sps->sps_same_qp_table_for_chroma_flag,
130 .sps_sao_enabled_flag = sps->sps_sao_enabled_flag,
131 .sps_alf_enabled_flag = sps->sps_alf_enabled_flag,
132 .sps_ccalf_enabled_flag = sps->sps_ccalf_enabled_flag,
133 .sps_lmcs_enabled_flag = sps->sps_lmcs_enabled_flag,
134 .sps_sbtmvp_enabled_flag = sps->sps_sbtmvp_enabled_flag,
135 .sps_amvr_enabled_flag = sps->sps_amvr_enabled_flag,
136 .sps_smvd_enabled_flag = sps->sps_smvd_enabled_flag,
137 .sps_mmvd_enabled_flag = sps->sps_mmvd_enabled_flag,
138 .sps_sbt_enabled_flag = sps->sps_sbt_enabled_flag,
139 .sps_affine_enabled_flag = sps->sps_affine_enabled_flag,
140 .sps_6param_affine_enabled_flag = sps->sps_6param_affine_enabled_flag,
141 .sps_affine_amvr_enabled_flag = sps->sps_affine_amvr_enabled_flag,
142 .sps_affine_prof_enabled_flag = sps->sps_affine_prof_enabled_flag,
143 .sps_bcw_enabled_flag = sps->sps_bcw_enabled_flag,
144 .sps_ciip_enabled_flag = sps->sps_ciip_enabled_flag,
145 .sps_gpm_enabled_flag = sps->sps_gpm_enabled_flag,
146 .sps_isp_enabled_flag = sps->sps_isp_enabled_flag,
147 .sps_mrl_enabled_flag = sps->sps_mrl_enabled_flag,
148 .sps_mip_enabled_flag = sps->sps_mip_enabled_flag,
149 .sps_cclm_enabled_flag = sps->sps_cclm_enabled_flag,
150 .sps_chroma_horizontal_collocated_flag = sps->sps_chroma_horizontal_collocated_flag,
151 .sps_chroma_vertical_collocated_flag = sps->sps_chroma_vertical_collocated_flag,
152 .sps_palette_enabled_flag = sps->sps_palette_enabled_flag,
153 .sps_act_enabled_flag = sps->sps_act_enabled_flag,
154 .sps_ibc_enabled_flag = sps->sps_ibc_enabled_flag,
155 .sps_ladf_enabled_flag = sps->sps_ladf_enabled_flag,
156 .sps_explicit_scaling_list_enabled_flag = sps->sps_explicit_scaling_list_enabled_flag,
157 .sps_scaling_matrix_for_lfnst_disabled_flag = sps->sps_scaling_matrix_for_lfnst_disabled_flag,
158 .sps_scaling_matrix_for_alternative_colour_space_disabled_flag = sps->sps_scaling_matrix_for_alternative_colour_space_disabled_flag,
159 .sps_scaling_matrix_designated_colour_space_flag = sps->sps_scaling_matrix_designated_colour_space_flag,
160 .sps_virtual_boundaries_enabled_flag = sps->sps_virtual_boundaries_enabled_flag,
161 .sps_virtual_boundaries_present_flag = sps->sps_virtual_boundaries_present_flag,
162 },
163 .NumVerVirtualBoundaries = sps->sps_virtual_boundaries_present_flag ?
164 sps->sps_num_ver_virtual_boundaries :
165 ph->ph_num_ver_virtual_boundaries,
166 .NumHorVirtualBoundaries = sps->sps_virtual_boundaries_present_flag ?
167 sps->sps_num_hor_virtual_boundaries :
168 ph->ph_num_hor_virtual_boundaries,
169 .pps_scaling_win_left_offset = pps->pps_scaling_win_left_offset,
170 .pps_scaling_win_right_offset = pps->pps_scaling_win_right_offset,
171 .pps_scaling_win_top_offset = pps->pps_scaling_win_top_offset,
172 .pps_scaling_win_bottom_offset = pps->pps_scaling_win_bottom_offset,
173 .pps_num_exp_tile_columns_minus1 = pps->pps_num_exp_tile_columns_minus1,
174 .pps_num_exp_tile_rows_minus1 = pps->pps_num_exp_tile_rows_minus1,
175 .pps_num_slices_in_pic_minus1 = pps->pps_num_slices_in_pic_minus1,
176 .pps_pic_width_minus_wraparound_offset = pps->pps_pic_width_minus_wraparound_offset,
177 .pps_cb_qp_offset = pps->pps_cb_qp_offset,
178 .pps_cr_qp_offset = pps->pps_cr_qp_offset,
179 .pps_joint_cbcr_qp_offset_value = pps->pps_joint_cbcr_qp_offset_value,
180 .pps_chroma_qp_offset_list_len_minus1 = pps->pps_chroma_qp_offset_list_len_minus1,
181 .pps_flags.bits = {
182 .pps_loop_filter_across_tiles_enabled_flag = pps->pps_loop_filter_across_tiles_enabled_flag,
183 .pps_rect_slice_flag = pps->pps_rect_slice_flag,
184 .pps_single_slice_per_subpic_flag = pps->pps_single_slice_per_subpic_flag,
185 .pps_loop_filter_across_slices_enabled_flag = pps->pps_loop_filter_across_slices_enabled_flag,
186 .pps_weighted_pred_flag = pps->pps_weighted_pred_flag,
187 .pps_weighted_bipred_flag = pps->pps_weighted_bipred_flag,
188 .pps_ref_wraparound_enabled_flag = pps->pps_ref_wraparound_enabled_flag,
189 .pps_cu_qp_delta_enabled_flag = pps->pps_cu_qp_delta_enabled_flag,
190 .pps_cu_chroma_qp_offset_list_enabled_flag = pps->pps_cu_chroma_qp_offset_list_enabled_flag,
191 .pps_deblocking_filter_override_enabled_flag = pps->pps_deblocking_filter_override_enabled_flag,
192 .pps_deblocking_filter_disabled_flag = pps->pps_deblocking_filter_disabled_flag,
193 .pps_dbf_info_in_ph_flag = pps->pps_dbf_info_in_ph_flag,
194 .pps_sao_info_in_ph_flag = pps->pps_sao_info_in_ph_flag,
195 .pps_alf_info_in_ph_flag = pps->pps_alf_info_in_ph_flag,
196 },
197 .ph_lmcs_aps_id = ph->ph_lmcs_aps_id,
198 .ph_scaling_list_aps_id = ph->ph_scaling_list_aps_id,
199 .ph_log2_diff_min_qt_min_cb_intra_slice_luma = ph->ph_log2_diff_min_qt_min_cb_intra_slice_luma,
200 .ph_max_mtt_hierarchy_depth_intra_slice_luma = ph->ph_max_mtt_hierarchy_depth_intra_slice_luma,
201 .ph_log2_diff_max_bt_min_qt_intra_slice_luma = ph->ph_log2_diff_max_bt_min_qt_intra_slice_luma,
202 .ph_log2_diff_max_tt_min_qt_intra_slice_luma = ph->ph_log2_diff_max_tt_min_qt_intra_slice_luma,
203 .ph_log2_diff_min_qt_min_cb_intra_slice_chroma = ph->ph_log2_diff_min_qt_min_cb_intra_slice_chroma,
204 .ph_max_mtt_hierarchy_depth_intra_slice_chroma = ph->ph_max_mtt_hierarchy_depth_intra_slice_chroma,
205 .ph_log2_diff_max_bt_min_qt_intra_slice_chroma = ph->ph_log2_diff_max_bt_min_qt_intra_slice_chroma,
206 .ph_log2_diff_max_tt_min_qt_intra_slice_chroma = ph->ph_log2_diff_max_tt_min_qt_intra_slice_chroma,
207 .ph_cu_qp_delta_subdiv_intra_slice = ph->ph_cu_qp_delta_subdiv_intra_slice,
208 .ph_cu_chroma_qp_offset_subdiv_intra_slice = ph->ph_cu_chroma_qp_offset_subdiv_intra_slice,
209 .ph_log2_diff_min_qt_min_cb_inter_slice = ph->ph_log2_diff_min_qt_min_cb_inter_slice,
210 .ph_max_mtt_hierarchy_depth_inter_slice = ph->ph_max_mtt_hierarchy_depth_inter_slice,
211 .ph_log2_diff_max_bt_min_qt_inter_slice = ph->ph_log2_diff_max_bt_min_qt_inter_slice,
212 .ph_log2_diff_max_tt_min_qt_inter_slice = ph->ph_log2_diff_max_tt_min_qt_inter_slice,
213 .ph_cu_qp_delta_subdiv_inter_slice = ph->ph_cu_qp_delta_subdiv_inter_slice,
214 .ph_cu_chroma_qp_offset_subdiv_inter_slice = ph->ph_cu_chroma_qp_offset_subdiv_inter_slice,
215 .ph_flags.bits= {
216 .ph_non_ref_pic_flag = ph->ph_non_ref_pic_flag,
217 .ph_alf_enabled_flag = ph->ph_alf_enabled_flag,
218 .ph_alf_cb_enabled_flag = ph->ph_alf_cb_enabled_flag,
219 .ph_alf_cr_enabled_flag = ph->ph_alf_cr_enabled_flag,
220 .ph_alf_cc_cb_enabled_flag = ph->ph_alf_cc_cb_enabled_flag,
221 .ph_alf_cc_cr_enabled_flag = ph->ph_alf_cc_cr_enabled_flag,
222 .ph_lmcs_enabled_flag = ph->ph_lmcs_enabled_flag,
223 .ph_chroma_residual_scale_flag = ph->ph_chroma_residual_scale_flag,
224 .ph_explicit_scaling_list_enabled_flag = ph->ph_explicit_scaling_list_enabled_flag,
225 .ph_virtual_boundaries_present_flag = ph->ph_virtual_boundaries_present_flag,
226 .ph_temporal_mvp_enabled_flag = ph->ph_temporal_mvp_enabled_flag,
227 .ph_mmvd_fullpel_only_flag = ph->ph_mmvd_fullpel_only_flag,
228 .ph_mvd_l1_zero_flag = ph->ph_mvd_l1_zero_flag,
229 .ph_bdof_disabled_flag = ph->ph_bdof_disabled_flag,
230 .ph_dmvr_disabled_flag = ph->ph_dmvr_disabled_flag,
231 .ph_prof_disabled_flag = ph->ph_prof_disabled_flag,
232 .ph_joint_cbcr_sign_flag = ph->ph_joint_cbcr_sign_flag,
233 .ph_sao_luma_enabled_flag = ph->ph_sao_luma_enabled_flag,
234 .ph_sao_chroma_enabled_flag = ph->ph_sao_chroma_enabled_flag,
235 .ph_deblocking_filter_disabled_flag = ph->ph_deblocking_filter_disabled_flag,
236 },
237 .PicMiscFlags.fields = {
238 .IntraPicFlag = pps->pps_mixed_nalu_types_in_pic_flag ? 0 : IS_IRAP(h) ? 1 : 0,
239 }
240 };
241
242 fill_vaapi_pic(&pic_param->CurrPic, fc->ref);
243 fill_vaapi_reference_frames(fc, pic_param);
244
245 for (i = 0; i < VVC_MAX_SAMPLE_ARRAYS; i++)
246 for (j = 0; j < VVC_MAX_POINTS_IN_QP_TABLE; j++)
247 pic_param->ChromaQpTable[i][j] = fc->ps.sps->chroma_qp_table[i][j];
248 for (i = 0; i < 4; i++) {
249 pic_param->sps_ladf_qp_offset[i] = sps->sps_ladf_qp_offset[i];
250 pic_param->sps_ladf_delta_threshold_minus1[i] = sps->sps_ladf_delta_threshold_minus1[i];
251 }
252
253 for (i = 0; i < (sps->sps_virtual_boundaries_present_flag ? sps->sps_num_ver_virtual_boundaries : ph->ph_num_ver_virtual_boundaries); i++) {
254 pic_param->VirtualBoundaryPosX[i] = (sps->sps_virtual_boundaries_present_flag ?
255 (sps->sps_virtual_boundary_pos_x_minus1[i] + 1) :
256 (ph->ph_virtual_boundary_pos_x_minus1[i] + 1)) * 8;
257 }
258
259 for (i = 0; i < (sps->sps_virtual_boundaries_present_flag ? sps->sps_num_hor_virtual_boundaries : ph->ph_num_hor_virtual_boundaries); i++) {
260 pic_param->VirtualBoundaryPosY[i] = (sps->sps_virtual_boundaries_present_flag ?
261 (sps->sps_virtual_boundary_pos_y_minus1[i] + 1) :
262 (ph->ph_virtual_boundary_pos_y_minus1[i] + 1)) * 8;
263 }
264
265 for (i = 0; i < 6; i++) {
266 pic_param->pps_cb_qp_offset_list[i] = pps->pps_cb_qp_offset_list[i];
267 pic_param->pps_cr_qp_offset_list[i] = pps->pps_cr_qp_offset_list[i];
268 pic_param->pps_joint_cbcr_qp_offset_list[i] = pps->pps_joint_cbcr_qp_offset_list[i];
269 }
270
271 err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
272 VAPictureParameterBufferType,
273 &pic->pic_param, sizeof(VAPictureParameterBufferVVC));
274 if (err < 0)
275 goto fail;
276
277 for (i = 0; i <= sps->sps_num_subpics_minus1 && sps->sps_subpic_info_present_flag; i++) {
278 VASubPicVVC subpic_param = {
279 .sps_subpic_ctu_top_left_x = sps->sps_subpic_ctu_top_left_x[i],
280 .sps_subpic_ctu_top_left_y = sps->sps_subpic_ctu_top_left_y[i],
281 .sps_subpic_width_minus1 = sps->sps_subpic_width_minus1[i],
282 .sps_subpic_height_minus1 = sps->sps_subpic_height_minus1[i],
283 .SubpicIdVal = pps->sub_pic_id_val[i],
284 .subpic_flags.bits = {
285 .sps_subpic_treated_as_pic_flag = sps->sps_subpic_treated_as_pic_flag[i],
286 .sps_loop_filter_across_subpic_enabled_flag = sps->sps_loop_filter_across_subpic_enabled_flag[i],
287 }
288 };
289 err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
290 VASubPicBufferType,
291 &subpic_param, sizeof(VASubPicVVC));
292 if (err < 0)
293 goto fail;
294 }
295
296 for (i = 0; i < VVC_MAX_ALF_COUNT; i++) {
297 const VVCALF *alf_list = h->ps.alf_list[i];
298 if (alf_list) {
299 const H266RawAPS *alf = alf_list->r;
300 VAAlfDataVVC alf_param = {
301 .aps_adaptation_parameter_set_id = i,
302 .alf_luma_num_filters_signalled_minus1 = alf->alf_luma_num_filters_signalled_minus1,
303 .alf_chroma_num_alt_filters_minus1 = alf->alf_chroma_num_alt_filters_minus1,
304 .alf_cc_cb_filters_signalled_minus1 = alf->alf_cc_cb_filters_signalled_minus1,
305 .alf_cc_cr_filters_signalled_minus1 = alf->alf_cc_cr_filters_signalled_minus1,
306 .alf_flags.bits = {
307 .alf_luma_filter_signal_flag = alf->alf_luma_filter_signal_flag,
308 .alf_chroma_filter_signal_flag = alf->alf_chroma_filter_signal_flag,
309 .alf_cc_cb_filter_signal_flag = alf->alf_cc_cb_filter_signal_flag,
310 .alf_cc_cr_filter_signal_flag = alf->alf_cc_cr_filter_signal_flag,
311 .alf_luma_clip_flag = alf->alf_luma_clip_flag,
312 .alf_chroma_clip_flag = alf->alf_chroma_clip_flag,
313 }
314 };
315
316 for (j = 0; j < 25; j++)
317 alf_param.alf_luma_coeff_delta_idx[j] = alf->alf_luma_coeff_delta_idx[j];
318
319 for (j = 0; j < 25; j++) {
320 for (k = 0; k < 12; k++) {
321 alf_param.filtCoeff[j][k] = alf->alf_luma_coeff_abs[j][k] * (1 - 2 * alf->alf_luma_coeff_sign[j][k]);
322 alf_param.alf_luma_clip_idx[j][k] = alf->alf_luma_clip_idx[j][k];
323 }
324 }
325
326 for (j = 0; j < 8; j++) {
327 for (k = 0; k < 6; k++) {
328 alf_param.AlfCoeffC[j][k] = alf->alf_chroma_coeff_abs[j][k] * (1 - 2 * alf->alf_chroma_coeff_sign[j][k]);
329 alf_param.alf_chroma_clip_idx[j][k] = alf->alf_chroma_clip_idx[j][k];
330 }
331 }
332
333 for (j = 0; j < 4; j++) {
334 for (k = 0; k < 7; k++) {
335 if (alf->alf_cc_cb_mapped_coeff_abs[j][k])
336 alf_param.CcAlfApsCoeffCb[j][k] = (1 - 2 * alf->alf_cc_cb_coeff_sign[j][k]) * (1 << (alf->alf_cc_cb_mapped_coeff_abs[j][k] - 1));
337 if (alf->alf_cc_cr_mapped_coeff_abs[j][k])
338 alf_param.CcAlfApsCoeffCr[j][k] = (1 - 2 * alf->alf_cc_cr_coeff_sign[j][k]) * (1 << (alf->alf_cc_cr_mapped_coeff_abs[j][k] - 1));
339 }
340 }
341
342 err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
343 VAAlfBufferType,
344 &alf_param, sizeof(VAAlfDataVVC));
345 if (err < 0)
346 goto fail;
347 }
348 }
349
350 for (i = 0; i < VVC_MAX_LMCS_COUNT; i++) {
351 const H266RawAPS *lmcs = h->ps.lmcs_list[i];
352 if (lmcs) {
353 VALmcsDataVVC lmcs_param = {
354 .aps_adaptation_parameter_set_id = i,
355 .lmcs_min_bin_idx = lmcs->lmcs_min_bin_idx,
356 .lmcs_delta_max_bin_idx = lmcs->lmcs_delta_max_bin_idx,
357 .lmcsDeltaCrs = (1 - 2 * lmcs->lmcs_delta_sign_crs_flag) * lmcs->lmcs_delta_abs_crs,
358 };
359
360 for (j = lmcs->lmcs_min_bin_idx; j <= 15 - lmcs->lmcs_delta_max_bin_idx; j++)
361 lmcs_param.lmcsDeltaCW[j] = (1 - 2 * lmcs->lmcs_delta_sign_cw_flag[j]) * lmcs->lmcs_delta_abs_cw[j];
362
363 err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
364 VALmcsBufferType,
365 &lmcs_param, sizeof(VALmcsDataVVC));
366 if (err < 0)
367 goto fail;
368 }
369 }
370
371 for (i = 0; i < VVC_MAX_SL_COUNT; i++) {
372 const VVCScalingList *sl = h->ps.scaling_list[i];
373 if (sl) {
374 int l;
375
376 VAScalingListVVC sl_param = {
377 .aps_adaptation_parameter_set_id = i,
378 };
379
380 for (j = 0; j < 14; j++)
381 sl_param.ScalingMatrixDCRec[j] = sl->scaling_matrix_dc_rec[j];
382
383 for (j = 0; j < 2; j++)
384 for (k = 0; k < 2; k++)
385 for (l = 0; l < 2; l++)
386 sl_param.ScalingMatrixRec2x2[j][k][l] = sl->scaling_matrix_rec[j][l * 2 + k];
387
388 for (j = 2; j < 8; j++)
389 for (k = 0; k < 4; k++)
390 for (l = 0; l < 4; l++)
391 sl_param.ScalingMatrixRec4x4[j - 2][k][l] = sl->scaling_matrix_rec[j][l * 4 + k];
392
393 for (j = 8; j < 28; j++)
394 for (k = 0; k < 8; k++)
395 for (l = 0; l < 8; l++)
396 sl_param.ScalingMatrixRec8x8[j - 8][k][l] = sl->scaling_matrix_rec[j][l * 8 + k];
397
398 err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
399 VAIQMatrixBufferType,
400 &sl_param, sizeof(VAScalingListVVC));
401 if (err < 0)
402 goto fail;
403 }
404 }
405
406 for (i = 0; i <= pps->pps_num_exp_tile_columns_minus1; i++) {
407 tile_dim = pps->pps_tile_column_width_minus1[i];
408 err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
409 VATileBufferType,
410 &tile_dim, sizeof(tile_dim));
411 if (err < 0)
412 goto fail;
413 }
414
415 for (i = 0; i <= pps->pps_num_exp_tile_rows_minus1; i++) {
416 tile_dim = pps->pps_tile_row_height_minus1[i];
417 err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
418 VATileBufferType,
419 &tile_dim, sizeof(tile_dim));
420 if (err < 0)
421 goto fail;
422 }
423
424 if (!pps->pps_no_pic_partition_flag && pps->pps_rect_slice_flag && !pps->pps_single_slice_per_subpic_flag) {
425 for (i = 0; i <= pps->pps_num_slices_in_pic_minus1; i++) {
426 for (j = 0; j < pps->pps_num_exp_slices_in_tile[i]; j++) {
427 exp_slice_height_in_ctus[i + j] = pps->pps_exp_slice_height_in_ctus_minus1[i][j] + 1;
428 }
429 }
430 for (i = 0; i <= pps->pps_num_slices_in_pic_minus1; i++) {
431 VASliceStructVVC ss_param = {
432 .SliceTopLeftTileIdx = pps->slice_top_left_tile_idx[i],
433 .pps_slice_width_in_tiles_minus1 = pps->pps_slice_width_in_tiles_minus1[i],
434 .pps_slice_height_in_tiles_minus1 = pps->pps_slice_height_in_tiles_minus1[i],
435 };
436
437 if (pps->pps_slice_width_in_tiles_minus1[i] > 0 || pps->pps_slice_height_in_tiles_minus1[i] > 0)
438 ss_param.pps_exp_slice_height_in_ctus_minus1 = 0;
439 else {
440 if (pps->num_slices_in_tile[i] == 1)
441 ss_param.pps_exp_slice_height_in_ctus_minus1 = pps->row_height_val[pps->slice_top_left_tile_idx[i] / pps->num_tile_columns] - 1;
442 else if (exp_slice_height_in_ctus[i])
443 ss_param.pps_exp_slice_height_in_ctus_minus1 = exp_slice_height_in_ctus[i] - 1;
444 else
445 continue;
446 }
447
448 err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
449 VASliceStructBufferType,
450 &ss_param, sizeof(VASliceStructVVC));
451 if (err < 0)
452 goto fail;
453 }
454 }
455
456 return 0;
457
458fail:
459 ff_vaapi_decode_cancel(avctx, &pic->pic);
460 return err;
461}
462
463static uint8_t get_ref_pic_index(const VVCContext *h, const VVCFrame *frame)
464{
465 VVCFrameContext *fc = &h->fcs[(h->nb_frames + h->nb_fcs) % h->nb_fcs];
466 VAAPIDecodePictureVVC *pic = fc->ref->hwaccel_picture_private;
467 VAPictureParameterBufferVVC *pp = (VAPictureParameterBufferVVC *)&pic->pic_param;
468 uint8_t i;
469
470 if (!frame)
471 return 0xFF;
472
473 for (i = 0; i < FF_ARRAY_ELEMS(pp->ReferenceFrames); i++) {
474 VASurfaceID pid = pp->ReferenceFrames[i].picture_id;
475 int poc = pp->ReferenceFrames[i].pic_order_cnt;
476 if (pid != VA_INVALID_ID && pid == ff_vaapi_get_surface_id(frame->frame) && poc == frame->poc)
477 return i;
478 }
479
480 return 0xFF;
481}
482
483static int get_slice_data_byte_offset(const uint8_t *buffer, uint32_t size, const SliceContext* sc)
484{
485 const H266RawSlice *slice = sc->ref;
486 int num_identical_bytes = slice->data_size < 32 ? slice->data_size : 32;
487
488 for (int i = 0; i < size; i++) {
489 int skip_bytes = 0;
490 if (i >=2 && buffer[i] == 0x03 && !buffer[i - 1] && !buffer[i - 2])
491 continue;
492
493 for (int j = 0; j < num_identical_bytes; j++) {
494 if (i >= 2 && buffer[i + j + skip_bytes] == 0x03 && !buffer[i + j + skip_bytes - 1] && !buffer[i + j + skip_bytes - 2])
495 skip_bytes++;
496
497 if (buffer[i + j + skip_bytes] != slice->data[j])
498 break;
499
500 if (j + 1 == num_identical_bytes)
501 return i;
502 }
503 }
504
505 return 0;
506}
507
508static int vaapi_vvc_decode_slice(AVCodecContext *avctx,
509 const uint8_t *buffer,
510 uint32_t size)
511{
512 const VVCContext *h = avctx->priv_data;
513 VVCFrameContext *fc = &h->fcs[(h->nb_frames + h->nb_fcs) % h->nb_fcs];
514 const SliceContext *sc = fc->slices[fc->nb_slices];
515 const H266RawPPS *pps = fc->ps.pps->r;
516 const H266RawPictureHeader *ph = fc->ps.ph.r;
517 const H266RawSliceHeader *sh = sc->sh.r;
518 VAAPIDecodePictureVVC *pic = fc->ref->hwaccel_picture_private;
519 VASliceParameterBufferVVC *slice_param = &pic->slice_param;
520 int nb_list, i, err;
521
522 *slice_param = (VASliceParameterBufferVVC) {
523 .slice_data_size = size,
524 .slice_data_offset = 0,
525 .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
526 .slice_data_byte_offset = get_slice_data_byte_offset(buffer, size, sc),
527 .sh_subpic_id = sh->sh_subpic_id,
528 .sh_slice_address = sh->sh_slice_address,
529 .sh_num_tiles_in_slice_minus1 = sh->sh_num_tiles_in_slice_minus1,
530 .sh_slice_type = sh->sh_slice_type,
531 .sh_num_alf_aps_ids_luma = sh->sh_num_alf_aps_ids_luma,
532 .sh_alf_aps_id_chroma = sh->sh_alf_aps_id_chroma,
533 .sh_alf_cc_cb_aps_id = sh->sh_alf_cc_cb_aps_id,
534 .sh_alf_cc_cr_aps_id = sh->sh_alf_cc_cr_aps_id,
535 .NumRefIdxActive[0] = sh->num_ref_idx_active[0],
536 .NumRefIdxActive[1] = sh->num_ref_idx_active[1],
537 .sh_collocated_ref_idx = sh->sh_collocated_ref_idx,
538 .SliceQpY = pps->pps_qp_delta_info_in_ph_flag ?
539 26 + pps->pps_init_qp_minus26 + ph->ph_qp_delta :
540 26 + pps->pps_init_qp_minus26 + sh->sh_qp_delta,
541 .sh_cb_qp_offset = sh->sh_cb_qp_offset,
542 .sh_cr_qp_offset = sh->sh_cr_qp_offset,
543 .sh_joint_cbcr_qp_offset = sh->sh_joint_cbcr_qp_offset,
544 .sh_luma_beta_offset_div2 = sh->sh_luma_beta_offset_div2,
545 .sh_luma_tc_offset_div2 = sh->sh_luma_tc_offset_div2,
546 .sh_cb_beta_offset_div2 = sh->sh_cb_beta_offset_div2,
547 .sh_cb_tc_offset_div2 = sh->sh_cb_tc_offset_div2,
548 .sh_cr_beta_offset_div2 = sh->sh_cr_beta_offset_div2,
549 .sh_cr_tc_offset_div2 = sh->sh_cr_tc_offset_div2,
550 .WPInfo = {
551 .luma_log2_weight_denom = sh->sh_pred_weight_table.luma_log2_weight_denom,
552 .delta_chroma_log2_weight_denom = sh->sh_pred_weight_table.delta_chroma_log2_weight_denom,
553 .num_l0_weights = sh->sh_pred_weight_table.num_l0_weights,
554 .num_l1_weights = sh->sh_pred_weight_table.num_l1_weights,
555 },
556 .sh_flags.bits = {
557 .sh_alf_enabled_flag = sh->sh_alf_enabled_flag,
558 .sh_alf_cb_enabled_flag = sh->sh_alf_cb_enabled_flag,
559 .sh_alf_cr_enabled_flag = sh->sh_alf_cr_enabled_flag,
560 .sh_alf_cc_cb_enabled_flag = sh->sh_alf_cc_cb_enabled_flag,
561 .sh_alf_cc_cr_enabled_flag = sh->sh_alf_cc_cr_enabled_flag,
562 .sh_lmcs_used_flag = sh->sh_lmcs_used_flag,
563 .sh_explicit_scaling_list_used_flag = sh->sh_explicit_scaling_list_used_flag,
564 .sh_cabac_init_flag = sh->sh_cabac_init_flag,
565 .sh_collocated_from_l0_flag = sh->sh_collocated_from_l0_flag,
566 .sh_cu_chroma_qp_offset_enabled_flag = sh->sh_cu_chroma_qp_offset_enabled_flag,
567 .sh_sao_luma_used_flag = sh->sh_sao_luma_used_flag,
568 .sh_sao_chroma_used_flag = sh->sh_sao_chroma_used_flag,
569 .sh_deblocking_filter_disabled_flag = sh->sh_deblocking_filter_disabled_flag,
570 .sh_dep_quant_used_flag = sh->sh_dep_quant_used_flag,
571 .sh_sign_data_hiding_used_flag = sh->sh_sign_data_hiding_used_flag,
572 .sh_ts_residual_coding_disabled_flag = sh->sh_ts_residual_coding_disabled_flag,
573 },
574 };
575
576 memset(&slice_param->RefPicList, 0xFF, sizeof(slice_param->RefPicList));
577
578 nb_list = (sh->sh_slice_type == VVC_SLICE_TYPE_B) ?
579 2 : (sh->sh_slice_type == VVC_SLICE_TYPE_I ? 0 : 1);
580 for (int list_idx = 0; list_idx < nb_list; list_idx++) {
581 RefPicList *rpl = &sc->rpl[list_idx];
582
583 for (i = 0; i < rpl->nb_refs; i++)
584 slice_param->RefPicList[list_idx][i] = get_ref_pic_index(h, rpl->refs[i].ref);
585 }
586
587 for (i = 0; i < 7; i++)
588 slice_param->sh_alf_aps_id_luma[i] = sh->sh_alf_aps_id_luma[i];
589
590 for (i = 0; i < 15; i++) {
591 slice_param->WPInfo.luma_weight_l0_flag[i] = sh->sh_pred_weight_table.luma_weight_l0_flag[i];
592 slice_param->WPInfo.chroma_weight_l0_flag[i] = sh->sh_pred_weight_table.chroma_weight_l0_flag[i];
593 slice_param->WPInfo.delta_luma_weight_l0[i] = sh->sh_pred_weight_table.delta_luma_weight_l0[i];
594 slice_param->WPInfo.luma_offset_l0[i] = sh->sh_pred_weight_table.luma_offset_l0[i];
595 slice_param->WPInfo.luma_weight_l1_flag[i] = sh->sh_pred_weight_table.luma_weight_l1_flag[i];
596 slice_param->WPInfo.chroma_weight_l1_flag[i] = sh->sh_pred_weight_table.chroma_weight_l1_flag[i];
597 slice_param->WPInfo.delta_luma_weight_l1[i] = sh->sh_pred_weight_table.delta_luma_weight_l1[i];
598 slice_param->WPInfo.luma_offset_l1[i] = sh->sh_pred_weight_table.luma_offset_l1[i];
599 }
600
601 for (i = 0; i < 15; i++) {
602 for (int j = 0; j < 2; j++) {
603 slice_param->WPInfo.delta_chroma_weight_l0[i][j] = sh->sh_pred_weight_table.delta_chroma_weight_l0[i][j];
604 slice_param->WPInfo.delta_chroma_offset_l0[i][j] = sh->sh_pred_weight_table.delta_chroma_offset_l0[i][j];
605 slice_param->WPInfo.delta_chroma_weight_l1[i][j] = sh->sh_pred_weight_table.delta_chroma_weight_l1[i][j];
606 slice_param->WPInfo.delta_chroma_offset_l1[i][j] = sh->sh_pred_weight_table.delta_chroma_offset_l1[i][j];
607 }
608 }
609
610 err = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic,
611 &pic->slice_param, 1,
612 sizeof(VASliceParameterBufferVVC),
613 buffer, size);
614 if (err) {
615 ff_vaapi_decode_cancel(avctx, &pic->pic);
616 return err;
617 }
618
619 return 0;
620}
621
622static int vaapi_vvc_end_frame(AVCodecContext *avctx)
623{
624
625 const VVCContext *h = avctx->priv_data;
626 VVCFrameContext *fc = &h->fcs[(h->nb_frames + h->nb_fcs) % h->nb_fcs];
627 VAAPIDecodePictureVVC *pic = fc->ref->hwaccel_picture_private;
628 int ret;
629
630 ret = ff_vaapi_decode_issue(avctx, &pic->pic);
631 if (ret < 0)
632 goto fail;
633
634 pic->decode_issued = 1;
635
636 return 0;
637
638fail:
639 ff_vaapi_decode_cancel(avctx, &pic->pic);
640 return ret;
641}
642
643const FFHWAccel ff_vvc_vaapi_hwaccel = {
644 .p.name = "vvc_vaapi",
645 .p.type = AVMEDIA_TYPE_VIDEO,
646 .p.id = AV_CODEC_ID_VVC,
647 .p.pix_fmt = AV_PIX_FMT_VAAPI,
648 .start_frame = &vaapi_vvc_start_frame,
649 .end_frame = &vaapi_vvc_end_frame,
650 .decode_slice = &vaapi_vvc_decode_slice,
651 .frame_priv_data_size = sizeof(VAAPIDecodePictureVVC),
652 .init = &ff_vaapi_decode_init,
653 .uninit = &ff_vaapi_decode_uninit,
654 .frame_params = &ff_vaapi_common_frame_params,
655 .priv_data_size = sizeof(VAAPIDecodeContext),
656 .caps_internal = HWACCEL_CAP_ASYNC_SAFE,
657};
libavcodec/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29 29
30#include "version_major.h"30#include "version_major.h"
31 31
32#define LIBAVCODEC_VERSION_MINOR 2232#define LIBAVCODEC_VERSION_MINOR 23
33#define LIBAVCODEC_VERSION_MICRO 10033#define LIBAVCODEC_VERSION_MICRO 100
34 34
35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
libavcodec/vvc/dec.c+14−1
@@ -35,6 +35,7 @@ · 34 unmodified lines
35#include "data.h"35#include "data.h"
36#include "refs.h"36#include "refs.h"
37#include "thread.h"37#include "thread.h"
38#include "config_components.h"
38 39
39#define TAB_MAX 3240#define TAB_MAX 32
40 41
@@ -772,14 +773,20 @@ static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, · 731 unmodified lines
772 773
773static enum AVPixelFormat get_format(AVCodecContext *avctx, const VVCSPS *sps)774static enum AVPixelFormat get_format(AVCodecContext *avctx, const VVCSPS *sps)
774{775{
775#define HWACCEL_MAX 0776#define HWACCEL_MAX CONFIG_VVC_VAAPI_HWACCEL
776 777
777 enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;778 enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;
778 779
779 switch (sps->pix_fmt) {780 switch (sps->pix_fmt) {
780 case AV_PIX_FMT_YUV420P:781 case AV_PIX_FMT_YUV420P:
782#if CONFIG_VVC_VAAPI_HWACCEL
783 *fmt++ = AV_PIX_FMT_VAAPI;
784#endif
781 break;785 break;
782 case AV_PIX_FMT_YUV420P10:786 case AV_PIX_FMT_YUV420P10:
787#if CONFIG_VVC_VAAPI_HWACCEL
788 *fmt++ = AV_PIX_FMT_VAAPI;
789#endif
783 break;790 break;
784 }791 }
785 792
@@ -1171,4 +1178,10 @@ const FFCodec ff_vvc_decoder = { · 385 unmodified lines
1171 .caps_internal = FF_CODEC_CAP_EXPORTS_CROPPING | FF_CODEC_CAP_INIT_CLEANUP |1178 .caps_internal = FF_CODEC_CAP_EXPORTS_CROPPING | FF_CODEC_CAP_INIT_CLEANUP |
1172 FF_CODEC_CAP_AUTO_THREADS,1179 FF_CODEC_CAP_AUTO_THREADS,
1173 .p.profiles = NULL_IF_CONFIG_SMALL(ff_vvc_profiles),1180 .p.profiles = NULL_IF_CONFIG_SMALL(ff_vvc_profiles),
1181 .hw_configs = (const AVCodecHWConfigInternal *const []) {
1182#if CONFIG_VVC_VAAPI_HWACCEL
1183 HWACCEL_VAAPI(vvc),
1184#endif
1185 NULL
1186 },
1174};1187};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t