FFmpeg
nvdec_av1.c
Go to the documentation of this file.
1 /*
2  * AV1 HW decode acceleration through NVDEC
3  *
4  * Copyright (c) 2020 Timo Rothenpieler
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 "config_components.h"
24 
25 #include "libavutil/mem.h"
26 #include "avcodec.h"
27 #include "nvdec.h"
28 #include "decode.h"
29 #include "hwaccel_internal.h"
30 #include "internal.h"
31 #include "av1dec.h"
32 
33 
35 {
36  if (seq->seq_profile == 2 && seq->color_config.high_bitdepth)
37  return seq->color_config.twelve_bit ? 12 : 10;
38  else if (seq->seq_profile <= 2 && seq->color_config.high_bitdepth)
39  return 10;
40  else
41  return 8;
42 }
43 
45  const AVBufferRef *buffer_ref,
46  const uint8_t *buffer, uint32_t size)
47 {
48  const AV1DecContext *s = avctx->priv_data;
49  const AV1RawSequenceHeader *seq = s->raw_seq;
50  const AV1RawFrameHeader *frame_header = s->raw_frame_header;
51  const AV1RawFilmGrainParams *film_grain = &s->cur_frame.film_grain;
52 
54  CUVIDPICPARAMS *pp = &ctx->pic_params;
55  CUVIDAV1PICPARAMS *ppc = &pp->CodecSpecific.av1;
56  FrameDecodeData *fdd;
57  NVDECFrame *cf;
58  AVFrame *cur_frame = s->cur_frame.f;
59 
60  unsigned char remap_lr_type[4] = { AV1_RESTORE_NONE, AV1_RESTORE_SWITCHABLE, AV1_RESTORE_WIENER, AV1_RESTORE_SGRPROJ };
61 
62  int apply_grain = !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) && film_grain->apply_grain;
63  int ret, i, j;
64 
65  ret = ff_nvdec_start_frame_sep_ref(avctx, cur_frame, apply_grain);
66  if (ret < 0)
67  return ret;
68 
69  fdd = cur_frame->private_ref;
70  cf = (NVDECFrame*)fdd->hwaccel_priv;
71 
72  *pp = (CUVIDPICPARAMS) {
73  .PicWidthInMbs = (cur_frame->width + 15) / 16,
74  .FrameHeightInMbs = (cur_frame->height + 15) / 16,
75  .CurrPicIdx = cf->idx,
76  .ref_pic_flag = !!frame_header->refresh_frame_flags,
77  .intra_pic_flag = frame_header->frame_type == AV1_FRAME_INTRA_ONLY ||
78  frame_header->frame_type == AV1_FRAME_KEY,
79 
80  .CodecSpecific.av1 = {
81  .width = cur_frame->width,
82  .height = cur_frame->height,
83 
84  .frame_offset = frame_header->order_hint,
85  .decodePicIdx = cf->ref_idx,
86 
87  /* Sequence Header */
88  .profile = seq->seq_profile,
89  .use_128x128_superblock = seq->use_128x128_superblock,
90  .subsampling_x = seq->color_config.subsampling_x,
91  .subsampling_y = seq->color_config.subsampling_y,
92  .mono_chrome = seq->color_config.mono_chrome,
93  .bit_depth_minus8 = get_bit_depth_from_seq(seq) - 8,
94  .enable_filter_intra = seq->enable_filter_intra,
95  .enable_intra_edge_filter = seq->enable_intra_edge_filter,
96  .enable_interintra_compound = seq->enable_interintra_compound,
97  .enable_masked_compound = seq->enable_masked_compound,
98  .enable_dual_filter = seq->enable_dual_filter,
99  .enable_order_hint = seq->enable_order_hint,
100  .order_hint_bits_minus1 = seq->order_hint_bits_minus_1,
101  .enable_jnt_comp = seq->enable_jnt_comp,
102  .enable_superres = seq->enable_superres,
103  .enable_cdef = seq->enable_cdef,
104  .enable_restoration = seq->enable_restoration,
105  .enable_fgs = seq->film_grain_params_present &&
107 
108  /* Frame Header */
109  .frame_type = frame_header->frame_type,
110  .show_frame = frame_header->show_frame,
111  .disable_cdf_update = frame_header->disable_cdf_update,
112  .allow_screen_content_tools = frame_header->allow_screen_content_tools,
113  .force_integer_mv = s->cur_frame.force_integer_mv,
114  .coded_denom = frame_header->coded_denom,
115  .allow_intrabc = frame_header->allow_intrabc,
116  .allow_high_precision_mv = frame_header->allow_high_precision_mv,
117  .interp_filter = frame_header->interpolation_filter,
118  .switchable_motion_mode = frame_header->is_motion_mode_switchable,
119  .use_ref_frame_mvs = frame_header->use_ref_frame_mvs,
120  .disable_frame_end_update_cdf = frame_header->disable_frame_end_update_cdf,
121  .delta_q_present = frame_header->delta_q_present,
122  .delta_q_res = frame_header->delta_q_res,
123  .using_qmatrix = frame_header->using_qmatrix,
124  .coded_lossless = s->cur_frame.coded_lossless,
125  .use_superres = frame_header->use_superres,
126  .tx_mode = frame_header->tx_mode,
127  .reference_mode = frame_header->reference_select,
128  .allow_warped_motion = frame_header->allow_warped_motion,
129  .reduced_tx_set = frame_header->reduced_tx_set,
130  .skip_mode = frame_header->skip_mode_present,
131 
132  /* Tiling Info */
133  .num_tile_cols = frame_header->tile_cols,
134  .num_tile_rows = frame_header->tile_rows,
135  .context_update_tile_id = frame_header->context_update_tile_id,
136 
137  /* CDEF */
138  .cdef_damping_minus_3 = frame_header->cdef_damping_minus_3,
139  .cdef_bits = frame_header->cdef_bits,
140 
141  /* SkipModeFrames */
142  .SkipModeFrame0 = frame_header->skip_mode_present ?
143  s->cur_frame.skip_mode_frame_idx[0] : 0,
144  .SkipModeFrame1 = frame_header->skip_mode_present ?
145  s->cur_frame.skip_mode_frame_idx[1] : 0,
146 
147  /* QP Information */
148  .base_qindex = frame_header->base_q_idx,
149  .qp_y_dc_delta_q = frame_header->delta_q_y_dc,
150  .qp_u_dc_delta_q = frame_header->delta_q_u_dc,
151  .qp_v_dc_delta_q = frame_header->delta_q_v_dc,
152  .qp_u_ac_delta_q = frame_header->delta_q_u_ac,
153  .qp_v_ac_delta_q = frame_header->delta_q_v_ac,
154  .qm_y = frame_header->qm_y,
155  .qm_u = frame_header->qm_u,
156  .qm_v = frame_header->qm_v,
157 
158  /* Segmentation */
159  .segmentation_enabled = frame_header->segmentation_enabled,
160  .segmentation_update_map = frame_header->segmentation_update_map,
161  .segmentation_update_data = frame_header->segmentation_update_data,
162  .segmentation_temporal_update = frame_header->segmentation_temporal_update,
163 
164  /* Loopfilter */
165  .loop_filter_level[0] = frame_header->loop_filter_level[0],
166  .loop_filter_level[1] = frame_header->loop_filter_level[1],
167  .loop_filter_level_u = frame_header->loop_filter_level[2],
168  .loop_filter_level_v = frame_header->loop_filter_level[3],
169  .loop_filter_sharpness = frame_header->loop_filter_sharpness,
170  .loop_filter_delta_enabled = frame_header->loop_filter_delta_enabled,
171  .loop_filter_delta_update = frame_header->loop_filter_delta_update,
172  .loop_filter_mode_deltas[0] = frame_header->loop_filter_mode_deltas[0],
173  .loop_filter_mode_deltas[1] = frame_header->loop_filter_mode_deltas[1],
174  .delta_lf_present = frame_header->delta_lf_present,
175  .delta_lf_res = frame_header->delta_lf_res,
176  .delta_lf_multi = frame_header->delta_lf_multi,
177 
178  /* Restoration */
179  .lr_type[0] = remap_lr_type[frame_header->lr_type[0]],
180  .lr_type[1] = remap_lr_type[frame_header->lr_type[1]],
181  .lr_type[2] = remap_lr_type[frame_header->lr_type[2]],
182  .lr_unit_size[0] = 1 + frame_header->lr_unit_shift,
183  .lr_unit_size[1] = 1 + frame_header->lr_unit_shift - frame_header->lr_uv_shift,
184  .lr_unit_size[2] = 1 + frame_header->lr_unit_shift - frame_header->lr_uv_shift,
185 
186  /* Reference Frames */
187  .temporal_layer_id = s->cur_frame.temporal_id,
188  .spatial_layer_id = s->cur_frame.spatial_id,
189 
190  /* Film Grain Params */
191  .apply_grain = apply_grain,
192  .overlap_flag = film_grain->overlap_flag,
193  .scaling_shift_minus8 = film_grain->grain_scaling_minus_8,
194  .chroma_scaling_from_luma = film_grain->chroma_scaling_from_luma,
195  .ar_coeff_lag = film_grain->ar_coeff_lag,
196  .ar_coeff_shift_minus6 = film_grain->ar_coeff_shift_minus_6,
197  .grain_scale_shift = film_grain->grain_scale_shift,
198  .clip_to_restricted_range = film_grain->clip_to_restricted_range,
199  .num_y_points = film_grain->num_y_points,
200  .num_cb_points = film_grain->num_cb_points,
201  .num_cr_points = film_grain->num_cr_points,
202  .random_seed = film_grain->grain_seed,
203  .cb_mult = film_grain->cb_mult,
204  .cb_luma_mult = film_grain->cb_luma_mult,
205  .cb_offset = film_grain->cb_offset,
206  .cr_mult = film_grain->cr_mult,
207  .cr_luma_mult = film_grain->cr_luma_mult,
208  .cr_offset = film_grain->cr_offset
209  }
210  };
211 
212  /* Tiling Info */
213  for (i = 0; i < frame_header->tile_cols; ++i) {
214  ppc->tile_widths[i] = frame_header->width_in_sbs_minus_1[i] + 1;
215  }
216  for (i = 0; i < frame_header->tile_rows; ++i) {
217  ppc->tile_heights[i] = frame_header->height_in_sbs_minus_1[i] + 1;
218  }
219 
220  /* CDEF */
221  for (i = 0; i < (1 << frame_header->cdef_bits); ++i) {
222  ppc->cdef_y_strength[i] = (frame_header->cdef_y_pri_strength[i] & 0x0F) | (frame_header->cdef_y_sec_strength[i] << 4);
223  ppc->cdef_uv_strength[i] = (frame_header->cdef_uv_pri_strength[i] & 0x0F) | (frame_header->cdef_uv_sec_strength[i] << 4);
224  }
225 
226  /* Segmentation */
227  for (i = 0; i < AV1_MAX_SEGMENTS; ++i) {
228  ppc->segmentation_feature_mask[i] = 0;
229  for (j = 0; j < AV1_SEG_LVL_MAX; ++j) {
230  ppc->segmentation_feature_mask[i] |= frame_header->feature_enabled[i][j] << j;
231  ppc->segmentation_feature_data[i][j] = frame_header->feature_value[i][j];
232  }
233  }
234 
235  for (i = 0; i < AV1_NUM_REF_FRAMES; ++i) {
236  /* Loopfilter */
237  ppc->loop_filter_ref_deltas[i] = frame_header->loop_filter_ref_deltas[i];
238 
239  /* Reference Frames */
240  ppc->ref_frame_map[i] = ff_nvdec_get_ref_idx(s->ref[i].f);
241  }
242 
243  if (frame_header->primary_ref_frame == AV1_PRIMARY_REF_NONE) {
244  ppc->primary_ref_frame = -1;
245  } else {
246  int8_t pri_ref_idx = frame_header->ref_frame_idx[frame_header->primary_ref_frame];
247  ppc->primary_ref_frame = ppc->ref_frame_map[pri_ref_idx];
248  }
249 
250  for (i = 0; i < AV1_REFS_PER_FRAME; ++i) {
251  /* Ref Frame List */
252  int8_t ref_idx = frame_header->ref_frame_idx[i];
253  AVFrame *ref_frame = s->ref[ref_idx].f;
254 
255  ppc->ref_frame[i].index = ppc->ref_frame_map[ref_idx];
256  ppc->ref_frame[i].width = ref_frame ? ref_frame->width : 0;
257  ppc->ref_frame[i].height = ref_frame ? ref_frame->height : 0;
258 
259  /* Global Motion */
260  ppc->global_motion[i].invalid = !frame_header->is_global[AV1_REF_FRAME_LAST + i];
261  ppc->global_motion[i].wmtype = s->cur_frame.gm_type[AV1_REF_FRAME_LAST + i];
262  for (j = 0; j < 6; ++j) {
263  ppc->global_motion[i].wmmat[j] = s->cur_frame.gm_params[AV1_REF_FRAME_LAST + i][j];
264  }
265  }
266 
267  /* Film Grain Params */
268  if (apply_grain) {
269  for (i = 0; i < 14; ++i) {
270  ppc->scaling_points_y[i][0] = film_grain->point_y_value[i];
271  ppc->scaling_points_y[i][1] = film_grain->point_y_scaling[i];
272  }
273  for (i = 0; i < 10; ++i) {
274  ppc->scaling_points_cb[i][0] = film_grain->point_cb_value[i];
275  ppc->scaling_points_cb[i][1] = film_grain->point_cb_scaling[i];
276  ppc->scaling_points_cr[i][0] = film_grain->point_cr_value[i];
277  ppc->scaling_points_cr[i][1] = film_grain->point_cr_scaling[i];
278  }
279  for (i = 0; i < 24; ++i) {
280  ppc->ar_coeffs_y[i] = (short)film_grain->ar_coeffs_y_plus_128[i] - 128;
281  }
282  for (i = 0; i < 25; ++i) {
283  ppc->ar_coeffs_cb[i] = (short)film_grain->ar_coeffs_cb_plus_128[i] - 128;
284  ppc->ar_coeffs_cr[i] = (short)film_grain->ar_coeffs_cr_plus_128[i] - 128;
285  }
286  }
287 
288  return 0;
289 }
290 
291 static int nvdec_av1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
292 {
293  const AV1DecContext *s = avctx->priv_data;
294  const AV1RawFrameHeader *frame_header = s->raw_frame_header;
296  void *tmp;
297 
298  ctx->nb_slices = frame_header->tile_cols * frame_header->tile_rows;
299 
300  tmp = av_fast_realloc(ctx->slice_offsets, &ctx->slice_offsets_allocated,
301  ctx->nb_slices * 2 * sizeof(*ctx->slice_offsets));
302  if (!tmp) {
303  return AVERROR(ENOMEM);
304  }
305  ctx->slice_offsets = tmp;
306 
307  /* Shortcut if all tiles are in the same buffer */
308  if (ctx->nb_slices == s->tg_end - s->tg_start + 1) {
309  ctx->bitstream = buffer;
310  ctx->bitstream_len = size;
311 
312  for (int i = 0; i < ctx->nb_slices; ++i) {
313  ctx->slice_offsets[i*2 ] = s->tile_group_info[i].tile_offset;
314  ctx->slice_offsets[i*2 + 1] = ctx->slice_offsets[i*2] + s->tile_group_info[i].tile_size;
315  }
316 
317  return 0;
318  }
319 
320  tmp = av_fast_realloc(ctx->bitstream_internal, &ctx->bitstream_allocated,
321  ctx->bitstream_len + size);
322  if (!tmp) {
323  return AVERROR(ENOMEM);
324  }
325  ctx->bitstream = ctx->bitstream_internal = tmp;
326 
327  memcpy(ctx->bitstream_internal + ctx->bitstream_len, buffer, size);
328 
329  for (uint32_t tile_num = s->tg_start; tile_num <= s->tg_end; ++tile_num) {
330  ctx->slice_offsets[tile_num*2 ] = ctx->bitstream_len + s->tile_group_info[tile_num].tile_offset;
331  ctx->slice_offsets[tile_num*2 + 1] = ctx->slice_offsets[tile_num*2] + s->tile_group_info[tile_num].tile_size;
332  }
333  ctx->bitstream_len += size;
334 
335  return 0;
336 }
337 
339  AVBufferRef *hw_frames_ctx,
340  enum AVPixelFormat hw_format)
341 {
342  /* Maximum of 8 reference frames, but potentially stored twice due to film grain */
343  return ff_nvdec_frame_params(avctx, hw_frames_ctx, hw_format, 8 * 2, 0);
344 }
345 
346 #if CONFIG_AV1_NVDEC_HWACCEL
347 static int nvdec_av1_cuda_frame_params(AVCodecContext *avctx,
348  AVBufferRef *hw_frames_ctx)
349 {
350  return nvdec_av1_frame_params(avctx, hw_frames_ctx, AV_PIX_FMT_CUDA);
351 }
352 
354  .p.name = "av1_nvdec",
355  .p.type = AVMEDIA_TYPE_VIDEO,
356  .p.id = AV_CODEC_ID_AV1,
357  .p.pix_fmt = AV_PIX_FMT_CUDA,
358  .start_frame = nvdec_av1_start_frame,
359  .end_frame = ff_nvdec_simple_end_frame,
360  .decode_slice = nvdec_av1_decode_slice,
361  .frame_params = nvdec_av1_cuda_frame_params,
362  .init = ff_nvdec_decode_init,
363  .uninit = ff_nvdec_decode_uninit,
364  .priv_data_size = sizeof(NVDECContext),
365 };
366 #endif
367 
368 #if CONFIG_AV1_NVDEC_CUARRAY_HWACCEL
369 static int nvdec_av1_cuarray_frame_params(AVCodecContext *avctx,
370  AVBufferRef *hw_frames_ctx)
371 {
372  return nvdec_av1_frame_params(avctx, hw_frames_ctx, AV_PIX_FMT_CUARRAY);
373 }
374 
376  .p.name = "av1_nvdec_cuarray",
377  .p.type = AVMEDIA_TYPE_VIDEO,
378  .p.id = AV_CODEC_ID_AV1,
379  .p.pix_fmt = AV_PIX_FMT_CUARRAY,
380  .start_frame = nvdec_av1_start_frame,
381  .end_frame = ff_nvdec_simple_end_frame,
382  .decode_slice = nvdec_av1_decode_slice,
383  .frame_params = nvdec_av1_cuarray_frame_params,
384  .init = ff_nvdec_decode_init,
385  .uninit = ff_nvdec_decode_uninit,
386  .priv_data_size = sizeof(NVDECContext),
387 };
388 #endif
AV1_RESTORE_WIENER
@ AV1_RESTORE_WIENER
Definition: av1.h:174
AV_PIX_FMT_CUDA
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
Definition: pixfmt.h:260
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AV1RawFilmGrainParams::clip_to_restricted_range
uint8_t clip_to_restricted_range
Definition: cbs_av1.h:171
AV1RawFilmGrainParams::grain_seed
uint16_t grain_seed
Definition: cbs_av1.h:144
AV1RawSequenceHeader
Definition: cbs_av1.h:82
AV1RawFilmGrainParams::point_cb_value
uint8_t point_cb_value[10]
Definition: cbs_av1.h:152
AV1RawFilmGrainParams::apply_grain
uint8_t apply_grain
Definition: cbs_av1.h:143
ff_nvdec_get_ref_idx
int ff_nvdec_get_ref_idx(AVFrame *frame)
Definition: nvdec.c:1180
FFHWAccel::p
AVHWAccel p
The public AVHWAccel.
Definition: hwaccel_internal.h:38
FrameDecodeData
This struct stores per-frame lavc-internal data and is attached to it via private_ref.
Definition: decode.h:33
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:472
AVFrame::width
int width
Definition: frame.h:544
AV1RawFilmGrainParams::point_y_value
uint8_t point_y_value[14]
Definition: cbs_av1.h:148
internal.h
AV1RawSequenceHeader::seq_profile
uint8_t seq_profile
Definition: cbs_av1.h:83
AV1RawColorConfig::subsampling_y
uint8_t subsampling_y
Definition: cbs_av1.h:62
AV1RawFilmGrainParams::cr_mult
uint8_t cr_mult
Definition: cbs_av1.h:167
AV1RawFilmGrainParams::chroma_scaling_from_luma
uint8_t chroma_scaling_from_luma
Definition: cbs_av1.h:150
AV1_REF_FRAME_LAST
@ AV1_REF_FRAME_LAST
Definition: av1.h:63
AV1_NUM_REF_FRAMES
@ AV1_NUM_REF_FRAMES
Definition: av1.h:84
AV1RawFilmGrainParams::ar_coeffs_cr_plus_128
uint8_t ar_coeffs_cr_plus_128[25]
Definition: cbs_av1.h:161
AV1RawSequenceHeader::film_grain_params_present
uint8_t film_grain_params_present
Definition: cbs_av1.h:139
FFHWAccel
Definition: hwaccel_internal.h:34
NVDECFrame::ref_idx
unsigned int ref_idx
Definition: nvdec.h:56
AV1_REFS_PER_FRAME
@ AV1_REFS_PER_FRAME
Definition: av1.h:85
AV1RawSequenceHeader::enable_filter_intra
uint8_t enable_filter_intra
Definition: cbs_av1.h:115
AV1RawFilmGrainParams::point_cr_scaling
uint8_t point_cr_scaling[10]
Definition: cbs_av1.h:156
AV1RawFilmGrainParams::ar_coeff_shift_minus_6
uint8_t ar_coeff_shift_minus_6
Definition: cbs_av1.h:162
AV1RawFilmGrainParams::num_y_points
uint8_t num_y_points
Definition: cbs_av1.h:147
ff_av1_nvdec_cuarray_hwaccel
const struct FFHWAccel ff_av1_nvdec_cuarray_hwaccel
AV1RawFilmGrainParams::num_cb_points
uint8_t num_cb_points
Definition: cbs_av1.h:151
AV1RawFilmGrainParams::cb_luma_mult
uint8_t cb_luma_mult
Definition: cbs_av1.h:165
AV1RawFilmGrainParams::overlap_flag
uint8_t overlap_flag
Definition: cbs_av1.h:170
AV1RawSequenceHeader::enable_masked_compound
uint8_t enable_masked_compound
Definition: cbs_av1.h:118
AV1RawFilmGrainParams::grain_scaling_minus_8
uint8_t grain_scaling_minus_8
Definition: cbs_av1.h:157
ff_nvdec_start_frame_sep_ref
int ff_nvdec_start_frame_sep_ref(AVCodecContext *avctx, AVFrame *frame, int has_sep_ref)
Definition: nvdec.c:984
av_fast_realloc
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
Definition: mem.c:495
AV1_RESTORE_NONE
@ AV1_RESTORE_NONE
Definition: av1.h:173
NVDECFrame
Definition: nvdec.h:54
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
decode.h
av1dec.h
get_bit_depth_from_seq
static int get_bit_depth_from_seq(const AV1RawSequenceHeader *seq)
Definition: nvdec_av1.c:34
tmp
static uint8_t tmp[40]
Definition: aes_ctr.c:52
AV1_FRAME_INTRA_ONLY
@ AV1_FRAME_INTRA_ONLY
Definition: av1.h:55
ff_nvdec_simple_end_frame
int ff_nvdec_simple_end_frame(AVCodecContext *avctx)
Definition: nvdec.c:1051
AV1RawFilmGrainParams::cb_mult
uint8_t cb_mult
Definition: cbs_av1.h:164
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:275
hwaccel_internal.h
AV1RawFrameHeader
Definition: cbs_av1.h:174
ff_nvdec_decode_init
int ff_nvdec_decode_init(AVCodecContext *avctx)
Definition: nvdec.c:404
AVCodecContext::internal
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:478
AV1_RESTORE_SGRPROJ
@ AV1_RESTORE_SGRPROJ
Definition: av1.h:175
AV1RawSequenceHeader::enable_jnt_comp
uint8_t enable_jnt_comp
Definition: cbs_av1.h:123
nvdec_av1_frame_params
static int nvdec_av1_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx, enum AVPixelFormat hw_format)
Definition: nvdec_av1.c:338
AV1RawFilmGrainParams::point_cr_value
uint8_t point_cr_value[10]
Definition: cbs_av1.h:155
AV1RawFilmGrainParams::cb_offset
uint16_t cb_offset
Definition: cbs_av1.h:166
AVCodecInternal::hwaccel_priv_data
void * hwaccel_priv_data
hwaccel-specific private data
Definition: internal.h:130
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
NVDECFrame::idx
unsigned int idx
Definition: nvdec.h:55
size
int size
Definition: twinvq_data.h:10344
AV1DecContext
Definition: av1dec.h:85
AV1RawSequenceHeader::use_128x128_superblock
uint8_t use_128x128_superblock
Definition: cbs_av1.h:114
ref_frame
static int ref_frame(VVCFrame *dst, const VVCFrame *src)
Definition: dec.c:616
ff_nvdec_frame_params
int ff_nvdec_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx, enum AVPixelFormat hw_format, int dpb_size, int supports_444)
Definition: nvdec.c:1083
nvdec_av1_decode_slice
static int nvdec_av1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Definition: nvdec_av1.c:291
AV1_MAX_SEGMENTS
@ AV1_MAX_SEGMENTS
Definition: av1.h:89
nvdec.h
AV1RawFilmGrainParams::grain_scale_shift
uint8_t grain_scale_shift
Definition: cbs_av1.h:163
AV1RawSequenceHeader::enable_interintra_compound
uint8_t enable_interintra_compound
Definition: cbs_av1.h:117
ff_nvdec_decode_uninit
int ff_nvdec_decode_uninit(AVCodecContext *avctx)
Definition: nvdec.c:297
AVHWAccel::name
const char * name
Name of the hardware accelerated codec.
Definition: avcodec.h:1954
AVFrame::private_ref
void * private_ref
RefStruct reference for internal use by a single libav* library.
Definition: frame.h:810
AV1RawSequenceHeader::enable_dual_filter
uint8_t enable_dual_filter
Definition: cbs_av1.h:120
frame_type
frame_type
Definition: jpeg2000_parser.c:32
AV1RawSequenceHeader::enable_superres
uint8_t enable_superres
Definition: cbs_av1.h:133
AV_PIX_FMT_CUARRAY
@ AV_PIX_FMT_CUARRAY
hardware decoding through openharmony
Definition: pixfmt.h:506
s
uint8_t s
Definition: llvidencdsp.c:39
AV1RawSequenceHeader::enable_intra_edge_filter
uint8_t enable_intra_edge_filter
Definition: cbs_av1.h:116
AV1RawSequenceHeader::color_config
AV1RawColorConfig color_config
Definition: cbs_av1.h:137
AV1RawSequenceHeader::enable_order_hint
uint8_t enable_order_hint
Definition: cbs_av1.h:122
avcodec.h
ret
ret
Definition: filter_design.txt:187
AV1RawColorConfig::subsampling_x
uint8_t subsampling_x
Definition: cbs_av1.h:61
AV1RawColorConfig::high_bitdepth
uint8_t high_bitdepth
Definition: cbs_av1.h:51
AV1RawFilmGrainParams::cr_luma_mult
uint8_t cr_luma_mult
Definition: cbs_av1.h:168
AVCodecContext
main external API structure.
Definition: avcodec.h:443
AVFrame::height
int height
Definition: frame.h:544
frame_header
Definition: truemotion1.c:88
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
AV1RawFilmGrainParams::ar_coeff_lag
uint8_t ar_coeff_lag
Definition: cbs_av1.h:158
AV1RawColorConfig::mono_chrome
uint8_t mono_chrome
Definition: cbs_av1.h:53
AV1_RESTORE_SWITCHABLE
@ AV1_RESTORE_SWITCHABLE
Definition: av1.h:176
AVCodecContext::export_side_data
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
AV1RawFilmGrainParams::ar_coeffs_cb_plus_128
uint8_t ar_coeffs_cb_plus_128[25]
Definition: cbs_av1.h:160
AV1RawFilmGrainParams::ar_coeffs_y_plus_128
uint8_t ar_coeffs_y_plus_128[24]
Definition: cbs_av1.h:159
AV1RawSequenceHeader::order_hint_bits_minus_1
uint8_t order_hint_bits_minus_1
Definition: cbs_av1.h:131
AV1_FRAME_KEY
@ AV1_FRAME_KEY
Definition: av1.h:53
AV1RawFilmGrainParams::cr_offset
uint16_t cr_offset
Definition: cbs_av1.h:169
AV1RawFilmGrainParams::point_y_scaling
uint8_t point_y_scaling[14]
Definition: cbs_av1.h:149
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
mem.h
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
AV1RawFilmGrainParams::point_cb_scaling
uint8_t point_cb_scaling[10]
Definition: cbs_av1.h:153
AV1RawSequenceHeader::enable_restoration
uint8_t enable_restoration
Definition: cbs_av1.h:135
AV1_SEG_LVL_MAX
@ AV1_SEG_LVL_MAX
Definition: av1.h:90
AV1RawColorConfig::twelve_bit
uint8_t twelve_bit
Definition: cbs_av1.h:52
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:470
AV1RawSequenceHeader::enable_cdef
uint8_t enable_cdef
Definition: cbs_av1.h:134
AV1_PRIMARY_REF_NONE
@ AV1_PRIMARY_REF_NONE
Definition: av1.h:87
FrameDecodeData::hwaccel_priv
void * hwaccel_priv
Definition: decode.h:54
AV1RawFilmGrainParams
Definition: cbs_av1.h:142
nvdec_av1_start_frame
static int nvdec_av1_start_frame(AVCodecContext *avctx, const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size)
Definition: nvdec_av1.c:44
NVDECContext
Definition: nvdec.h:62
short
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are short
Definition: writing_filters.txt:89
AV1RawFilmGrainParams::num_cr_points
uint8_t num_cr_points
Definition: cbs_av1.h:154
AV_CODEC_EXPORT_DATA_FILM_GRAIN
#define AV_CODEC_EXPORT_DATA_FILM_GRAIN
Decoding only.
Definition: avcodec.h:404
ff_av1_nvdec_hwaccel
const struct FFHWAccel ff_av1_nvdec_hwaccel