FFmpeg
Loading...
Searching...
No Matches
vaapi_av1.c
Go to the documentation of this file.
1/*
2 * AV1 HW decode acceleration through VA API
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "libavutil/frame.h"
22#include "libavutil/mem.h"
23#include "hwaccel_internal.h"
24#include "vaapi_decode.h"
25#include "internal.h"
26#include "av1dec.h"
27#include "thread.h"
28
33
34typedef struct VAAPIAV1DecContext {
36
37 /**
38 * For film grain case, VAAPI generate 2 output for each frame,
39 * current_frame will not apply film grain, and will be used for
40 * references for next frames. Maintain the reference list without
41 * applying film grain here. And current_display_picture will be
42 * used to apply film grain and push to downstream.
43 */
46
48 VASliceParameterBufferAV1 *slice_params;
50
51static VASurfaceID vaapi_av1_surface_id(AV1Frame *vf)
52{
53 if (vf->f)
54 return ff_vaapi_get_surface_id(vf->f);
55 else
56 return VA_INVALID_SURFACE;
57}
58
60{
61 AV1DecContext *s = avctx->priv_data;
62 const AV1RawSequenceHeader *seq = s->raw_seq;
63 int8_t bit_depth = 8;
64
65 if (seq->seq_profile == 2 && seq->color_config.high_bitdepth)
66 bit_depth = seq->color_config.twelve_bit ? 12 : 10;
67 else if (seq->seq_profile <= 2)
68 bit_depth = seq->color_config.high_bitdepth ? 10 : 8;
69 else {
70 av_log(avctx, AV_LOG_ERROR,
71 "Couldn't get bit depth from profile:%d.\n", seq->seq_profile);
72 return -1;
73 }
74 return bit_depth == 8 ? 0 : bit_depth == 10 ? 1 : 2;
75}
76
78{
80
81 av_frame_free(&ctx->tmp_frame);
82
83 for (int i = 0; i < FF_ARRAY_ELEMS(ctx->ref_tab); i++)
84 av_frame_free(&ctx->ref_tab[i].frame);
85
86 av_freep(&ctx->slice_params);
87
88 return ff_vaapi_decode_uninit(avctx);
89}
90
92{
94
95 int ret = ff_vaapi_decode_init(avctx);
96 if (ret < 0)
97 return ret;
98
99 ctx->tmp_frame = av_frame_alloc();
100 if (!ctx->tmp_frame) {
102 return AVERROR(ENOMEM);
103 }
104
105 for (int i = 0; i < FF_ARRAY_ELEMS(ctx->ref_tab); i++) {
106 ctx->ref_tab[i].frame = av_frame_alloc();
107 if (!ctx->ref_tab[i].frame) {
109 return AVERROR(ENOMEM);
110 }
111 ctx->ref_tab[i].valid = 0;
112 }
113
114 return ret;
115}
116
118 av_unused const AVBufferRef *buffer_ref,
119 av_unused const uint8_t *buffer,
120 av_unused uint32_t size)
121{
122 AV1DecContext *s = avctx->priv_data;
123 const AV1RawSequenceHeader *seq = s->raw_seq;
124 const AV1RawFrameHeader *frame_header = s->raw_frame_header;
125 const AV1RawFilmGrainParams *film_grain = &s->cur_frame.film_grain;
126 VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private;
128 VADecPictureParameterBufferAV1 pic_param;
129 int8_t bit_depth_idx;
130 int err = 0;
131 int apply_grain = !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) && film_grain->apply_grain;
133 uint8_t segmentation_feature_signed[AV1_SEG_LVL_MAX] = {1, 1, 1, 1, 1, 0, 0, 0};
134 uint8_t segmentation_feature_max[AV1_SEG_LVL_MAX] = {255, AV1_MAX_LOOP_FILTER,
136
137 bit_depth_idx = vaapi_av1_get_bit_depth_idx(avctx);
138 if (bit_depth_idx < 0)
139 goto fail;
140
141 if (apply_grain) {
142 if (ctx->tmp_frame->buf[0])
143 av_frame_unref(ctx->tmp_frame);
144 err = ff_thread_get_buffer(avctx, ctx->tmp_frame, AV_GET_BUFFER_FLAG_REF);
145 if (err < 0)
146 goto fail;
147 pic->output_surface = ff_vaapi_get_surface_id(ctx->tmp_frame);
148 } else {
149 pic->output_surface = ff_vaapi_get_surface_id(s->cur_frame.f);
150 }
151
152 memset(&pic_param, 0, sizeof(VADecPictureParameterBufferAV1));
153 pic_param = (VADecPictureParameterBufferAV1) {
154 .profile = seq->seq_profile,
155 .order_hint_bits_minus_1 = seq->order_hint_bits_minus_1,
156 .bit_depth_idx = bit_depth_idx,
157 .matrix_coefficients = seq->color_config.matrix_coefficients,
158 .current_frame = pic->output_surface,
159 .current_display_picture = ff_vaapi_get_surface_id(s->cur_frame.f),
160 .frame_width_minus1 = frame_header->frame_width_minus_1,
161 .frame_height_minus1 = frame_header->frame_height_minus_1,
162 .primary_ref_frame = frame_header->primary_ref_frame,
163 .order_hint = frame_header->order_hint,
164 .tile_cols = frame_header->tile_cols,
165 .tile_rows = frame_header->tile_rows,
166 .context_update_tile_id = frame_header->context_update_tile_id,
167 .superres_scale_denominator = frame_header->use_superres ?
168 frame_header->coded_denom + AV1_SUPERRES_DENOM_MIN :
170 .interp_filter = frame_header->interpolation_filter,
171 .filter_level[0] = frame_header->loop_filter_level[0],
172 .filter_level[1] = frame_header->loop_filter_level[1],
173 .filter_level_u = frame_header->loop_filter_level[2],
174 .filter_level_v = frame_header->loop_filter_level[3],
175 .base_qindex = frame_header->base_q_idx,
176 .y_dc_delta_q = frame_header->delta_q_y_dc,
177 .u_dc_delta_q = frame_header->delta_q_u_dc,
178 .u_ac_delta_q = frame_header->delta_q_u_ac,
179 .v_dc_delta_q = frame_header->delta_q_v_dc,
180 .v_ac_delta_q = frame_header->delta_q_v_ac,
181 .cdef_damping_minus_3 = frame_header->cdef_damping_minus_3,
182 .cdef_bits = frame_header->cdef_bits,
183 .seq_info_fields.fields = {
184 .still_picture = seq->still_picture,
185 .use_128x128_superblock = seq->use_128x128_superblock,
186 .enable_filter_intra = seq->enable_filter_intra,
187 .enable_intra_edge_filter = seq->enable_intra_edge_filter,
188 .enable_interintra_compound = seq->enable_interintra_compound,
189 .enable_masked_compound = seq->enable_masked_compound,
190 .enable_dual_filter = seq->enable_dual_filter,
191 .enable_order_hint = seq->enable_order_hint,
192 .enable_jnt_comp = seq->enable_jnt_comp,
193 .enable_cdef = seq->enable_cdef,
194 .mono_chrome = seq->color_config.mono_chrome,
195 .color_range = seq->color_config.color_range,
196 .subsampling_x = seq->color_config.subsampling_x,
197 .subsampling_y = seq->color_config.subsampling_y,
198 .film_grain_params_present = seq->film_grain_params_present &&
200 },
201 .seg_info.segment_info_fields.bits = {
202 .enabled = frame_header->segmentation_enabled,
203 .update_map = frame_header->segmentation_update_map,
204 .temporal_update = frame_header->segmentation_temporal_update,
205 .update_data = frame_header->segmentation_update_data,
206 },
207 .film_grain_info = {
208 .film_grain_info_fields.bits = {
209 .apply_grain = apply_grain,
210 .chroma_scaling_from_luma = film_grain->chroma_scaling_from_luma,
211 .grain_scaling_minus_8 = film_grain->grain_scaling_minus_8,
212 .ar_coeff_lag = film_grain->ar_coeff_lag,
213 .ar_coeff_shift_minus_6 = film_grain->ar_coeff_shift_minus_6,
214 .grain_scale_shift = film_grain->grain_scale_shift,
215 .overlap_flag = film_grain->overlap_flag,
216 .clip_to_restricted_range = film_grain->clip_to_restricted_range,
217 },
218 .grain_seed = film_grain->grain_seed,
219 .num_y_points = film_grain->num_y_points,
220 .num_cb_points = film_grain->num_cb_points,
221 .num_cr_points = film_grain->num_cr_points,
222 .cb_mult = film_grain->cb_mult,
223 .cb_luma_mult = film_grain->cb_luma_mult,
224 .cb_offset = film_grain->cb_offset,
225 .cr_mult = film_grain->cr_mult,
226 .cr_luma_mult = film_grain->cr_luma_mult,
227 .cr_offset = film_grain->cr_offset,
228 },
229 .pic_info_fields.bits = {
230 .frame_type = frame_header->frame_type,
231 .show_frame = frame_header->show_frame,
232 .showable_frame = frame_header->showable_frame,
233 .error_resilient_mode = frame_header->error_resilient_mode,
234 .disable_cdf_update = frame_header->disable_cdf_update,
235 .allow_screen_content_tools = frame_header->allow_screen_content_tools,
236 .force_integer_mv = s->cur_frame.force_integer_mv,
237 .allow_intrabc = frame_header->allow_intrabc,
238 .use_superres = frame_header->use_superres,
239 .allow_high_precision_mv = frame_header->allow_high_precision_mv,
240 .is_motion_mode_switchable = frame_header->is_motion_mode_switchable,
241 .use_ref_frame_mvs = frame_header->use_ref_frame_mvs,
242 .disable_frame_end_update_cdf = frame_header->disable_frame_end_update_cdf,
243 .uniform_tile_spacing_flag = frame_header->uniform_tile_spacing_flag,
244 .allow_warped_motion = frame_header->allow_warped_motion,
245 },
246 .loop_filter_info_fields.bits = {
247 .sharpness_level = frame_header->loop_filter_sharpness,
248 .mode_ref_delta_enabled = frame_header->loop_filter_delta_enabled,
249 .mode_ref_delta_update = frame_header->loop_filter_delta_update,
250 },
251 .mode_control_fields.bits = {
252 .delta_q_present_flag = frame_header->delta_q_present,
253 .log2_delta_q_res = frame_header->delta_q_res,
254 .delta_lf_present_flag = frame_header->delta_lf_present,
255 .log2_delta_lf_res = frame_header->delta_lf_res,
256 .delta_lf_multi = frame_header->delta_lf_multi,
257 .tx_mode = frame_header->tx_mode,
258 .reference_select = frame_header->reference_select,
259 .reduced_tx_set_used = frame_header->reduced_tx_set,
260 .skip_mode_present = frame_header->skip_mode_present,
261 },
262 .loop_restoration_fields.bits = {
263 .yframe_restoration_type = remap_lr_type[frame_header->lr_type[0]],
264 .cbframe_restoration_type = remap_lr_type[frame_header->lr_type[1]],
265 .crframe_restoration_type = remap_lr_type[frame_header->lr_type[2]],
266 .lr_unit_shift = frame_header->lr_unit_shift,
267 .lr_uv_shift = frame_header->lr_uv_shift,
268 },
269 .qmatrix_fields.bits = {
270 .using_qmatrix = frame_header->using_qmatrix,
271 .qm_y = frame_header->qm_y,
272 .qm_u = frame_header->qm_u,
273 .qm_v = frame_header->qm_v,
274 }
275 };
276
277 for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
278 if (pic_param.pic_info_fields.bits.frame_type == AV1_FRAME_KEY && frame_header->show_frame)
279 pic_param.ref_frame_map[i] = VA_INVALID_ID;
280 else
281 pic_param.ref_frame_map[i] = ctx->ref_tab[i].valid ?
282 ff_vaapi_get_surface_id(ctx->ref_tab[i].frame) :
283 vaapi_av1_surface_id(&s->ref[i]);
284 }
285 for (int i = 0; i < AV1_REFS_PER_FRAME; i++) {
286 pic_param.ref_frame_idx[i] = frame_header->ref_frame_idx[i];
287 }
288 for (int i = 0; i < AV1_TOTAL_REFS_PER_FRAME; i++) {
289 pic_param.ref_deltas[i] = frame_header->loop_filter_ref_deltas[i];
290 }
291 for (int i = 0; i < 2; i++) {
292 pic_param.mode_deltas[i] = frame_header->loop_filter_mode_deltas[i];
293 }
294 for (int i = 0; i < (1 << frame_header->cdef_bits); i++) {
295 pic_param.cdef_y_strengths[i] =
296 (frame_header->cdef_y_pri_strength[i] << 2) +
297 frame_header->cdef_y_sec_strength[i];
298 pic_param.cdef_uv_strengths[i] =
299 (frame_header->cdef_uv_pri_strength[i] << 2) +
300 frame_header->cdef_uv_sec_strength[i];
301 }
302 for (int i = 0; i < frame_header->tile_cols; i++) {
303 pic_param.width_in_sbs_minus_1[i] =
304 frame_header->width_in_sbs_minus_1[i];
305 }
306 for (int i = 0; i < frame_header->tile_rows; i++) {
307 pic_param.height_in_sbs_minus_1[i] =
308 frame_header->height_in_sbs_minus_1[i];
309 }
310 for (int i = AV1_REF_FRAME_LAST; i <= AV1_REF_FRAME_ALTREF; i++) {
311 pic_param.wm[i - 1].invalid = s->cur_frame.gm_invalid[i];
312 pic_param.wm[i - 1].wmtype = s->cur_frame.gm_type[i];
313 for (int j = 0; j < 6; j++)
314 pic_param.wm[i - 1].wmmat[j] = s->cur_frame.gm_params[i][j];
315 }
316 for (int i = 0; i < AV1_MAX_SEGMENTS; i++) {
317 for (int j = 0; j < AV1_SEG_LVL_MAX; j++) {
318 pic_param.seg_info.feature_mask[i] |= (frame_header->feature_enabled[i][j] << j);
319 if (segmentation_feature_signed[j])
320 pic_param.seg_info.feature_data[i][j] = av_clip(frame_header->feature_value[i][j],
321 -segmentation_feature_max[j], segmentation_feature_max[j]);
322 else
323 pic_param.seg_info.feature_data[i][j] = av_clip(frame_header->feature_value[i][j],
324 0, segmentation_feature_max[j]);
325 }
326 }
327 if (apply_grain) {
328 for (int i = 0; i < film_grain->num_y_points; i++) {
329 pic_param.film_grain_info.point_y_value[i] =
330 film_grain->point_y_value[i];
331 pic_param.film_grain_info.point_y_scaling[i] =
332 film_grain->point_y_scaling[i];
333 }
334 for (int i = 0; i < film_grain->num_cb_points; i++) {
335 pic_param.film_grain_info.point_cb_value[i] =
336 film_grain->point_cb_value[i];
337 pic_param.film_grain_info.point_cb_scaling[i] =
338 film_grain->point_cb_scaling[i];
339 }
340 for (int i = 0; i < film_grain->num_cr_points; i++) {
341 pic_param.film_grain_info.point_cr_value[i] =
342 film_grain->point_cr_value[i];
343 pic_param.film_grain_info.point_cr_scaling[i] =
344 film_grain->point_cr_scaling[i];
345 }
346 for (int i = 0; i < 24; i++) {
347 pic_param.film_grain_info.ar_coeffs_y[i] =
348 film_grain->ar_coeffs_y_plus_128[i] - 128;
349 }
350 for (int i = 0; i < 25; i++) {
351 pic_param.film_grain_info.ar_coeffs_cb[i] =
352 film_grain->ar_coeffs_cb_plus_128[i] - 128;
353 pic_param.film_grain_info.ar_coeffs_cr[i] =
354 film_grain->ar_coeffs_cr_plus_128[i] - 128;
355 }
356 }
357 err = ff_vaapi_decode_make_param_buffer(avctx, pic,
358 VAPictureParameterBufferType,
359 &pic_param, sizeof(pic_param));
360 if (err < 0)
361 goto fail;
362
363 return 0;
364
365fail:
366 ff_vaapi_decode_cancel(avctx, pic);
367 return err;
368}
369
371{
372 const AV1DecContext *s = avctx->priv_data;
373 const AV1RawFrameHeader *header = s->raw_frame_header;
374 const AV1RawFilmGrainParams *film_grain = &s->cur_frame.film_grain;
375 VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private;
377
378 int apply_grain = !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) && film_grain->apply_grain;
379 int ret;
380 ret = ff_vaapi_decode_issue(avctx, pic);
381 if (ret < 0)
382 return ret;
383
384 for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
385 if (header->refresh_frame_flags & (1 << i)) {
386 if (ctx->ref_tab[i].frame->buf[0])
387 av_frame_unref(ctx->ref_tab[i].frame);
388
389 if (apply_grain) {
390 ret = av_frame_ref(ctx->ref_tab[i].frame, ctx->tmp_frame);
391 if (ret < 0)
392 return ret;
393 ctx->ref_tab[i].valid = 1;
394 } else {
395 ctx->ref_tab[i].valid = 0;
396 }
397 }
398 }
399
400 return 0;
401}
402
404 const uint8_t *buffer,
405 uint32_t size)
406{
407 const AV1DecContext *s = avctx->priv_data;
408 VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private;
410 int err, nb_params;
411
412 nb_params = s->tg_end - s->tg_start + 1;
413 if (ctx->nb_slice_params < nb_params) {
414 VASliceParameterBufferAV1 *tmp = av_realloc_array(ctx->slice_params,
415 nb_params,
416 sizeof(*ctx->slice_params));
417 if (!tmp) {
418 ctx->nb_slice_params = 0;
419 err = AVERROR(ENOMEM);
420 goto fail;
421 }
422 ctx->slice_params = tmp;
423 ctx->nb_slice_params = nb_params;
424 }
425
426 for (int i = s->tg_start; i <= s->tg_end; i++) {
427 ctx->slice_params[i - s->tg_start] = (VASliceParameterBufferAV1) {
428 .slice_data_size = s->tile_group_info[i].tile_size,
429 .slice_data_offset = s->tile_group_info[i].tile_offset,
430 .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
431 .tile_row = s->tile_group_info[i].tile_row,
432 .tile_column = s->tile_group_info[i].tile_column,
433 };
434 }
435
436 err = ff_vaapi_decode_make_slice_buffer(avctx, pic, ctx->slice_params, nb_params,
437 sizeof(VASliceParameterBufferAV1),
438 buffer,
439 size);
440 if (err)
441 goto fail;
442
443 return 0;
444
445fail:
446 ff_vaapi_decode_cancel(avctx, pic);
447 return err;
448}
449
451 .p.name = "av1_vaapi",
452 .p.type = AVMEDIA_TYPE_VIDEO,
453 .p.id = AV_CODEC_ID_AV1,
454 .p.pix_fmt = AV_PIX_FMT_VAAPI,
455 .start_frame = vaapi_av1_start_frame,
456 .end_frame = vaapi_av1_end_frame,
457 .decode_slice = vaapi_av1_decode_slice,
458 .frame_priv_data_size = sizeof(VAAPIDecodePicture),
461 .frame_params = ff_vaapi_common_frame_params,
462 .priv_data_size = sizeof(VAAPIAV1DecContext),
463 .caps_internal = HWACCEL_CAP_ASYNC_SAFE,
464};
uint8_t ptrdiff_t const uint8_t ptrdiff_t int const int8_t const int8_t * vf
Definition dsp.h:262
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
Definition af_astats.c:246
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
#define av_clip
Definition common.h:100
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
reference-counted frame API
#define fail
Definition test.h:479
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
Definition avcodec.h:415
#define AV_CODEC_EXPORT_DATA_FILM_GRAIN
Decoding only.
Definition avcodec.h:404
@ AV_CODEC_ID_AV1
Definition codec_id.h:275
#define AVERROR(e)
Definition error.h:45
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition frame.c:496
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition frame.c:278
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition frame.c:52
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition mem.c:217
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define HWACCEL_CAP_ASYNC_SAFE
Header providing the internals of AVHWAccel.
const struct FFHWAccel ff_av1_vaapi_hwaccel
Definition vaapi_av1.c:450
static av_cold void uninit(AVBitStreamFilterContext *ctx)
@ AV1_REF_FRAME_LAST
Definition av1.h:63
@ AV1_REF_FRAME_ALTREF
Definition av1.h:69
@ AV1_RESTORE_WIENER
Definition av1.h:174
@ AV1_RESTORE_SWITCHABLE
Definition av1.h:176
@ AV1_RESTORE_NONE
Definition av1.h:173
@ AV1_RESTORE_SGRPROJ
Definition av1.h:175
@ AV1_FRAME_KEY
Definition av1.h:53
@ AV1_SUPERRES_DENOM_MIN
Definition av1.h:102
@ AV1_SEG_LVL_MAX
Definition av1.h:90
@ AV1_SUPERRES_NUM
Definition av1.h:101
@ AV1_NUM_REF_FRAMES
Definition av1.h:84
@ AV1_MAX_LOOP_FILTER
Definition av1.h:124
@ AV1_MAX_SEGMENTS
Definition av1.h:89
@ AV1_REFS_PER_FRAME
Definition av1.h:85
@ AV1_TOTAL_REFS_PER_FRAME
Definition av1.h:86
common internal api header.
Multithreading API for decoders.
#define av_unused
Definition attributes.h:164
#define av_cold
Definition attributes.h:117
Memory handling functions.
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Definition pixfmt.h:126
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
static const uint8_t header[24]
Definition sdr2.c:68
#define FF_ARRAY_ELEMS(a)
uint8_t twelve_bit
Definition cbs_av1.h:52
uint8_t matrix_coefficients
Definition cbs_av1.h:58
uint8_t subsampling_x
Definition cbs_av1.h:61
uint8_t high_bitdepth
Definition cbs_av1.h:51
uint8_t mono_chrome
Definition cbs_av1.h:53
uint8_t color_range
Definition cbs_av1.h:60
uint8_t subsampling_y
Definition cbs_av1.h:62
uint8_t ar_coeffs_y_plus_128[24]
Definition cbs_av1.h:159
uint8_t ar_coeff_shift_minus_6
Definition cbs_av1.h:162
uint8_t point_y_value[14]
Definition cbs_av1.h:148
uint8_t grain_scale_shift
Definition cbs_av1.h:163
uint8_t point_cb_scaling[10]
Definition cbs_av1.h:153
uint8_t point_cr_scaling[10]
Definition cbs_av1.h:156
uint8_t ar_coeffs_cr_plus_128[25]
Definition cbs_av1.h:161
uint8_t clip_to_restricted_range
Definition cbs_av1.h:171
uint8_t point_cr_value[10]
Definition cbs_av1.h:155
uint8_t point_cb_value[10]
Definition cbs_av1.h:152
uint8_t chroma_scaling_from_luma
Definition cbs_av1.h:150
uint8_t grain_scaling_minus_8
Definition cbs_av1.h:157
uint8_t point_y_scaling[14]
Definition cbs_av1.h:149
uint8_t ar_coeffs_cb_plus_128[25]
Definition cbs_av1.h:160
uint8_t use_128x128_superblock
Definition cbs_av1.h:114
uint8_t enable_dual_filter
Definition cbs_av1.h:120
uint8_t enable_intra_edge_filter
Definition cbs_av1.h:116
uint8_t enable_filter_intra
Definition cbs_av1.h:115
uint8_t seq_profile
Definition cbs_av1.h:83
uint8_t film_grain_params_present
Definition cbs_av1.h:139
uint8_t enable_jnt_comp
Definition cbs_av1.h:123
uint8_t enable_interintra_compound
Definition cbs_av1.h:117
AV1RawColorConfig color_config
Definition cbs_av1.h:137
uint8_t enable_masked_compound
Definition cbs_av1.h:118
uint8_t still_picture
Definition cbs_av1.h:84
uint8_t order_hint_bits_minus_1
Definition cbs_av1.h:131
uint8_t enable_order_hint
Definition cbs_av1.h:122
A reference to a data buffer.
Definition buffer.h:82
main external API structure.
Definition avcodec.h:443
int export_side_data
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame,...
Definition avcodec.h:1779
struct AVCodecInternal * internal
Private context used for internal data.
Definition avcodec.h:478
void * priv_data
Definition avcodec.h:470
void * hwaccel_priv_data
hwaccel-specific private data
Definition internal.h:130
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
AVFrame * tmp_frame
Definition vaapi_av1.c:45
VASliceParameterBufferAV1 * slice_params
Definition vaapi_av1.c:48
VAAPIAV1FrameRef ref_tab[AV1_NUM_REF_FRAMES]
For film grain case, VAAPI generate 2 output for each frame, current_frame will not apply film grain,...
Definition vaapi_av1.c:44
VAAPIDecodeContext base
Definition vaapi_av1.c:35
AVFrame * frame
Definition vaapi_av1.c:30
VASurfaceID output_surface
#define av_freep(p)
#define av_log(a,...)
static uint8_t tmp[40]
Definition aes_ctr.c:52
static AVFormatContext * ctx
Definition movenc.c:49
static char buffer[20]
Definition seek.c:32
int size
static int vaapi_av1_end_frame(AVCodecContext *avctx)
Definition vaapi_av1.c:370
static VASurfaceID vaapi_av1_surface_id(AV1Frame *vf)
Definition vaapi_av1.c:51
static int vaapi_av1_start_frame(AVCodecContext *avctx, av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition vaapi_av1.c:117
static av_cold int vaapi_av1_decode_init(AVCodecContext *avctx)
Definition vaapi_av1.c:91
static av_cold int vaapi_av1_decode_uninit(AVCodecContext *avctx)
Definition vaapi_av1.c:77
static int8_t vaapi_av1_get_bit_depth_idx(AVCodecContext *avctx)
Definition vaapi_av1.c:59
static int vaapi_av1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Definition vaapi_av1.c:403
int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, int type, const void *data, size_t size)
int ff_vaapi_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
int ff_vaapi_decode_issue(AVCodecContext *avctx, VAAPIDecodePicture *pic)
int ff_vaapi_decode_init(AVCodecContext *avctx)
int ff_vaapi_decode_uninit(AVCodecContext *avctx)
int ff_vaapi_decode_cancel(AVCodecContext *avctx, VAAPIDecodePicture *pic)
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, const void *params_data, int nb_params, size_t params_size, const void *slice_data, size_t slice_size)
static VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)