FFmpeg
nvdec_hevc.c
Go to the documentation of this file.
1 /*
2  * HEVC HW decode acceleration through NVDEC
3  *
4  * Copyright (c) 2017 Anton Khirnov
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 <stdint.h>
26 #include <string.h>
27 
28 #include "libavutil/mem.h"
29 #include "avcodec.h"
30 #include "nvdec.h"
31 #include "decode.h"
32 #include "internal.h"
33 #include "hevc/hevcdec.h"
34 #include "hevc/data.h"
35 #include "hwaccel_internal.h"
36 
37 static void dpb_add(CUVIDHEVCPICPARAMS *pp, int idx, const HEVCFrame *src)
38 {
39  FrameDecodeData *fdd = src->f->private_ref;
40  const NVDECFrame *cf = fdd->hwaccel_priv;
41 
42  pp->RefPicIdx[idx] = cf ? cf->idx : -1;
43  pp->PicOrderCntVal[idx] = src->poc;
44  pp->IsLongTerm[idx] = !!(src->flags & HEVC_FRAME_FLAG_LONG_REF);
45 }
46 
47 static void fill_scaling_lists(CUVIDHEVCPICPARAMS *ppc, const HEVCContext *s)
48 {
49  const ScalingList *sl = s->pps->scaling_list_data_present_flag ?
50  &s->pps->scaling_list : &s->pps->sps->scaling_list;
51  int i, j, pos;
52 
53  for (i = 0; i < 6; i++) {
54  for (j = 0; j < 16; j++) {
56  ppc->ScalingList4x4[i][j] = sl->sl[0][i][pos];
57  }
58 
59  for (j = 0; j < 64; j++) {
61  ppc->ScalingList8x8[i][j] = sl->sl[1][i][pos];
62  ppc->ScalingList16x16[i][j] = sl->sl[2][i][pos];
63 
64  if (i < 2)
65  ppc->ScalingList32x32[i][j] = sl->sl[3][i * 3][pos];
66  }
67 
68  ppc->ScalingListDCCoeff16x16[i] = sl->sl_dc[0][i];
69  if (i < 2)
70  ppc->ScalingListDCCoeff32x32[i] = sl->sl_dc[1][i * 3];
71  }
72 }
73 
75  const AVBufferRef *buffer_ref,
76  const uint8_t *buffer, uint32_t size)
77 {
78  const HEVCContext *s = avctx->priv_data;
79  const HEVCLayerContext *l = &s->layers[s->cur_layer];
80  const HEVCPPS *pps = s->pps;
81  const HEVCSPS *sps = pps->sps;
82 
84  CUVIDPICPARAMS *pp = &ctx->pic_params;
85  CUVIDHEVCPICPARAMS *ppc = &pp->CodecSpecific.hevc;
86  FrameDecodeData *fdd;
87  NVDECFrame *cf;
88 
89  int i, j, dpb_size, ret;
90 
91  ret = ff_nvdec_start_frame(avctx, s->cur_frame->f);
92  if (ret < 0)
93  return ret;
94 
95  fdd = s->cur_frame->f->private_ref;
96  cf = (NVDECFrame*)fdd->hwaccel_priv;
97 
98  *pp = (CUVIDPICPARAMS) {
99  .PicWidthInMbs = sps->width / 16,
100  .FrameHeightInMbs = sps->height / 16,
101  .CurrPicIdx = cf->idx,
102  .ref_pic_flag = 1,
103  .intra_pic_flag = IS_IRAP(s),
104 
105  .CodecSpecific.hevc = {
106  .pic_width_in_luma_samples = sps->width,
107  .pic_height_in_luma_samples = sps->height,
108  .log2_min_luma_coding_block_size_minus3 = sps->log2_min_cb_size - 3,
109  .log2_diff_max_min_luma_coding_block_size = sps->log2_diff_max_min_coding_block_size,
110  .log2_min_transform_block_size_minus2 = sps->log2_min_tb_size - 2,
111  .log2_diff_max_min_transform_block_size = sps->log2_max_trafo_size - sps->log2_min_tb_size,
112  .pcm_enabled_flag = sps->pcm_enabled,
113  .log2_min_pcm_luma_coding_block_size_minus3 = sps->pcm_enabled ? sps->pcm.log2_min_pcm_cb_size - 3 : 0,
114  .log2_diff_max_min_pcm_luma_coding_block_size = sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size,
115  .pcm_sample_bit_depth_luma_minus1 = sps->pcm_enabled ? sps->pcm.bit_depth - 1 : 0,
116  .pcm_sample_bit_depth_chroma_minus1 = sps->pcm_enabled ? sps->pcm.bit_depth_chroma - 1 : 0,
117 #if NVDECAPI_CHECK_VERSION(8, 1)
118  .log2_max_transform_skip_block_size_minus2 = pps->log2_max_transform_skip_block_size - 2,
119  .log2_sao_offset_scale_luma = pps->log2_sao_offset_scale_luma,
120  .log2_sao_offset_scale_chroma = pps->log2_sao_offset_scale_chroma,
121  .high_precision_offsets_enabled_flag = sps->high_precision_offsets_enabled,
122 #endif
123  .pcm_loop_filter_disabled_flag = sps->pcm_loop_filter_disabled,
124  .strong_intra_smoothing_enabled_flag = sps->strong_intra_smoothing_enabled,
125  .max_transform_hierarchy_depth_intra = sps->max_transform_hierarchy_depth_intra,
126  .max_transform_hierarchy_depth_inter = sps->max_transform_hierarchy_depth_inter,
127  .amp_enabled_flag = sps->amp_enabled,
128  .separate_colour_plane_flag = sps->separate_colour_plane,
129  .log2_max_pic_order_cnt_lsb_minus4 = sps->log2_max_poc_lsb - 4,
130  .num_short_term_ref_pic_sets = sps->nb_st_rps,
131  .long_term_ref_pics_present_flag = sps->long_term_ref_pics_present,
132  .num_long_term_ref_pics_sps = sps->num_long_term_ref_pics_sps,
133  .sps_temporal_mvp_enabled_flag = sps->temporal_mvp_enabled,
134  .sample_adaptive_offset_enabled_flag = sps->sao_enabled,
135  .scaling_list_enable_flag = sps->scaling_list_enabled,
136  .IrapPicFlag = IS_IRAP(s),
137  .IdrPicFlag = IS_IDR(s),
138  .bit_depth_luma_minus8 = sps->bit_depth - 8,
139  .bit_depth_chroma_minus8 = sps->bit_depth - 8,
140 #if NVDECAPI_CHECK_VERSION(9, 0)
141  .sps_range_extension_flag = sps->range_extension,
142  .transform_skip_rotation_enabled_flag = sps->transform_skip_rotation_enabled,
143  .transform_skip_context_enabled_flag = sps->transform_skip_context_enabled,
144  .implicit_rdpcm_enabled_flag = sps->implicit_rdpcm_enabled,
145  .explicit_rdpcm_enabled_flag = sps->explicit_rdpcm_enabled,
146  .extended_precision_processing_flag = sps->extended_precision_processing,
147  .intra_smoothing_disabled_flag = sps->intra_smoothing_disabled,
148  .persistent_rice_adaptation_enabled_flag = sps->persistent_rice_adaptation_enabled,
149  .cabac_bypass_alignment_enabled_flag = sps->cabac_bypass_alignment_enabled,
150 #endif
151 
152  .dependent_slice_segments_enabled_flag = pps->dependent_slice_segments_enabled_flag,
153  .slice_segment_header_extension_present_flag = pps->slice_header_extension_present_flag,
154  .sign_data_hiding_enabled_flag = pps->sign_data_hiding_flag,
155  .cu_qp_delta_enabled_flag = pps->cu_qp_delta_enabled_flag,
156  .diff_cu_qp_delta_depth = pps->diff_cu_qp_delta_depth,
157  .init_qp_minus26 = pps->pic_init_qp_minus26,
158  .pps_cb_qp_offset = pps->cb_qp_offset,
159  .pps_cr_qp_offset = pps->cr_qp_offset,
160  .constrained_intra_pred_flag = pps->constrained_intra_pred_flag,
161  .weighted_pred_flag = pps->weighted_pred_flag,
162  .weighted_bipred_flag = pps->weighted_bipred_flag,
163  .transform_skip_enabled_flag = pps->transform_skip_enabled_flag,
164  .transquant_bypass_enabled_flag = pps->transquant_bypass_enable_flag,
165  .entropy_coding_sync_enabled_flag = pps->entropy_coding_sync_enabled_flag,
166  .log2_parallel_merge_level_minus2 = pps->log2_parallel_merge_level - 2,
167  .num_extra_slice_header_bits = pps->num_extra_slice_header_bits,
168  .loop_filter_across_tiles_enabled_flag = pps->loop_filter_across_tiles_enabled_flag,
169  .loop_filter_across_slices_enabled_flag = pps->seq_loop_filter_across_slices_enabled_flag,
170  .output_flag_present_flag = pps->output_flag_present_flag,
171  .num_ref_idx_l0_default_active_minus1 = pps->num_ref_idx_l0_default_active - 1,
172  .num_ref_idx_l1_default_active_minus1 = pps->num_ref_idx_l1_default_active - 1,
173  .lists_modification_present_flag = pps->lists_modification_present_flag,
174  .cabac_init_present_flag = pps->cabac_init_present_flag,
175  .pps_slice_chroma_qp_offsets_present_flag = pps->pic_slice_level_chroma_qp_offsets_present_flag,
176  .deblocking_filter_override_enabled_flag = pps->deblocking_filter_override_enabled_flag,
177  .pps_deblocking_filter_disabled_flag = pps->disable_dbf,
178  .pps_beta_offset_div2 = pps->beta_offset / 2,
179  .pps_tc_offset_div2 = pps->tc_offset / 2,
180  .tiles_enabled_flag = pps->tiles_enabled_flag,
181  .uniform_spacing_flag = pps->uniform_spacing_flag,
182  .num_tile_columns_minus1 = pps->num_tile_columns - 1,
183  .num_tile_rows_minus1 = pps->num_tile_rows - 1,
184 #if NVDECAPI_CHECK_VERSION(9, 0)
185  .pps_range_extension_flag = pps->pps_range_extensions_flag,
186  .cross_component_prediction_enabled_flag = pps->cross_component_prediction_enabled_flag,
187  .chroma_qp_offset_list_enabled_flag = pps->chroma_qp_offset_list_enabled_flag,
188  .diff_cu_chroma_qp_offset_depth = pps->diff_cu_chroma_qp_offset_depth,
189  .chroma_qp_offset_list_len_minus1 = pps->chroma_qp_offset_list_len_minus1,
190 #endif
191 
192  .NumBitsForShortTermRPSInSlice = s->sh.short_term_rps ? s->sh.short_term_ref_pic_set_size : 0,
193  .NumDeltaPocsOfRefRpsIdx = s->sh.short_term_rps ? s->sh.short_term_rps->rps_idx_num_delta_pocs : 0,
194  .NumPocTotalCurr = ff_hevc_frame_nb_refs(&s->sh, pps, s->cur_layer),
195  .NumPocStCurrBefore = s->rps[ST_CURR_BEF].nb_refs,
196  .NumPocStCurrAfter = s->rps[ST_CURR_AFT].nb_refs,
197  .NumPocLtCurr = s->rps[LT_CURR].nb_refs,
198  .CurrPicOrderCntVal = s->cur_frame->poc,
199  },
200  };
201 
202  if (pps->num_tile_columns > FF_ARRAY_ELEMS(ppc->column_width_minus1) ||
203  pps->num_tile_rows > FF_ARRAY_ELEMS(ppc->row_height_minus1)) {
204  av_log(avctx, AV_LOG_ERROR, "Too many tiles\n");
205  return AVERROR(ENOSYS);
206  }
207  for (i = 0; i < pps->num_tile_columns; i++)
208  ppc->column_width_minus1[i] = pps->column_width[i] - 1;
209  for (i = 0; i < pps->num_tile_rows; i++)
210  ppc->row_height_minus1[i] = pps->row_height[i] - 1;
211 
212 #if NVDECAPI_CHECK_VERSION(9, 0)
213  if (pps->chroma_qp_offset_list_len_minus1 >= FF_ARRAY_ELEMS(ppc->cb_qp_offset_list) ||
214  pps->chroma_qp_offset_list_len_minus1 >= FF_ARRAY_ELEMS(ppc->cr_qp_offset_list)) {
215  av_log(avctx, AV_LOG_ERROR, "Too many chroma_qp_offsets\n");
216  return AVERROR(ENOSYS);
217  }
218  for (i = 0; i <= pps->chroma_qp_offset_list_len_minus1; i++) {
219  ppc->cb_qp_offset_list[i] = pps->cb_qp_offset_list[i];
220  ppc->cr_qp_offset_list[i] = pps->cr_qp_offset_list[i];
221  }
222 #endif
223 
224  if (s->rps[LT_CURR].nb_refs > FF_ARRAY_ELEMS(ppc->RefPicSetLtCurr) ||
225  s->rps[ST_CURR_BEF].nb_refs > FF_ARRAY_ELEMS(ppc->RefPicSetStCurrBefore) ||
226  s->rps[ST_CURR_AFT].nb_refs > FF_ARRAY_ELEMS(ppc->RefPicSetStCurrAfter)) {
227  av_log(avctx, AV_LOG_ERROR, "Too many reference frames\n");
228  return AVERROR(ENOSYS);
229  }
230 
231  dpb_size = 0;
232  for (i = 0; i < FF_ARRAY_ELEMS(l->DPB); i++) {
233  const HEVCFrame *ref = &l->DPB[i];
235  continue;
236  if (dpb_size >= FF_ARRAY_ELEMS(ppc->RefPicIdx)) {
237  av_log(avctx, AV_LOG_ERROR, "Too many reference frames\n");
238  return AVERROR_INVALIDDATA;
239  }
240  dpb_add(ppc, dpb_size++, ref);
241 
242  }
243  for (i = dpb_size; i < FF_ARRAY_ELEMS(ppc->RefPicIdx); i++)
244  ppc->RefPicIdx[i] = -1;
245 
246  for (i = 0; i < s->rps[ST_CURR_BEF].nb_refs; i++) {
247  for (j = 0; j < dpb_size; j++) {
248  if (ppc->PicOrderCntVal[j] == s->rps[ST_CURR_BEF].list[i]) {
249  ppc->RefPicSetStCurrBefore[i] = j;
250  break;
251  }
252  }
253  }
254  for (i = 0; i < s->rps[ST_CURR_AFT].nb_refs; i++) {
255  for (j = 0; j < dpb_size; j++) {
256  if (ppc->PicOrderCntVal[j] == s->rps[ST_CURR_AFT].list[i]) {
257  ppc->RefPicSetStCurrAfter[i] = j;
258  break;
259  }
260  }
261  }
262  for (i = 0; i < s->rps[LT_CURR].nb_refs; i++) {
263  for (j = 0; j < dpb_size; j++) {
264  if (ppc->PicOrderCntVal[j] == s->rps[LT_CURR].list[i]) {
265  ppc->RefPicSetLtCurr[i] = j;
266  break;
267  }
268  }
269  }
270 
271  fill_scaling_lists(ppc, s);
272 
273  return 0;
274 }
275 
276 static int nvdec_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
277  uint32_t size)
278 {
280  void *tmp;
281 
282  tmp = av_fast_realloc(ctx->bitstream_internal, &ctx->bitstream_allocated,
283  ctx->bitstream_len + size + 3);
284  if (!tmp)
285  return AVERROR(ENOMEM);
286  ctx->bitstream = ctx->bitstream_internal = tmp;
287 
288  tmp = av_fast_realloc(ctx->slice_offsets, &ctx->slice_offsets_allocated,
289  (ctx->nb_slices + 1) * sizeof(*ctx->slice_offsets));
290  if (!tmp)
291  return AVERROR(ENOMEM);
292  ctx->slice_offsets = tmp;
293 
294  AV_WB24(ctx->bitstream_internal + ctx->bitstream_len, 1);
295  memcpy(ctx->bitstream_internal + ctx->bitstream_len + 3, buffer, size);
296  ctx->slice_offsets[ctx->nb_slices] = ctx->bitstream_len ;
297  ctx->bitstream_len += size + 3;
298  ctx->nb_slices++;
299 
300  return 0;
301 }
302 
304  AVBufferRef *hw_frames_ctx,
305  enum AVPixelFormat hw_format)
306 {
307  const HEVCContext *s = avctx->priv_data;
308  const HEVCSPS *sps = s->pps->sps;
309  int dpb_size = sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering + 1;
310 
311  return ff_nvdec_frame_params(avctx, hw_frames_ctx, hw_format, dpb_size, 1);
312 }
313 
316  ctx->supports_444 = 1;
317 
318  if (avctx->profile != AV_PROFILE_HEVC_MAIN &&
319  avctx->profile != AV_PROFILE_HEVC_MAIN_10 &&
321  avctx->profile != AV_PROFILE_HEVC_REXT) {
322  av_log(avctx, AV_LOG_ERROR, "Unsupported HEVC profile: %d\n", avctx->profile);
323  return AVERROR(ENOTSUP);
324  }
325 
326  return ff_nvdec_decode_init(avctx);
327 }
328 
329 #if CONFIG_HEVC_NVDEC_HWACCEL
330 static int nvdec_hevc_cuda_frame_params(AVCodecContext *avctx,
331  AVBufferRef *hw_frames_ctx)
332 {
333  return nvdec_hevc_frame_params(avctx, hw_frames_ctx, AV_PIX_FMT_CUDA);
334 }
335 
337  .p.name = "hevc_nvdec",
338  .p.type = AVMEDIA_TYPE_VIDEO,
339  .p.id = AV_CODEC_ID_HEVC,
340  .p.pix_fmt = AV_PIX_FMT_CUDA,
341  .start_frame = nvdec_hevc_start_frame,
342  .end_frame = ff_nvdec_end_frame,
343  .decode_slice = nvdec_hevc_decode_slice,
344  .frame_params = nvdec_hevc_cuda_frame_params,
345  .init = nvdec_hevc_decode_init,
346  .uninit = ff_nvdec_decode_uninit,
347  .priv_data_size = sizeof(NVDECContext),
348 };
349 #endif
350 
351 #if CONFIG_HEVC_NVDEC_CUARRAY_HWACCEL
352 static int nvdec_hevc_cuarray_frame_params(AVCodecContext *avctx,
353  AVBufferRef *hw_frames_ctx)
354 {
355  return nvdec_hevc_frame_params(avctx, hw_frames_ctx, AV_PIX_FMT_CUARRAY);
356 }
357 
359  .p.name = "hevc_nvdec_cuarray",
360  .p.type = AVMEDIA_TYPE_VIDEO,
361  .p.id = AV_CODEC_ID_HEVC,
362  .p.pix_fmt = AV_PIX_FMT_CUARRAY,
363  .start_frame = nvdec_hevc_start_frame,
364  .end_frame = ff_nvdec_end_frame,
365  .decode_slice = nvdec_hevc_decode_slice,
366  .frame_params = nvdec_hevc_cuarray_frame_params,
367  .init = nvdec_hevc_decode_init,
368  .uninit = ff_nvdec_decode_uninit,
369  .priv_data_size = sizeof(NVDECContext),
370 };
371 #endif
AV_PIX_FMT_CUDA
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
Definition: pixfmt.h:260
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
ff_hevc_nvdec_hwaccel
const struct FFHWAccel ff_hevc_nvdec_hwaccel
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
AV_PROFILE_HEVC_MAIN
#define AV_PROFILE_HEVC_MAIN
Definition: defs.h:159
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
internal.h
ScalingList::sl
uint8_t sl[4][6][64]
Definition: ps.h:248
HEVC_FRAME_FLAG_LONG_REF
#define HEVC_FRAME_FLAG_LONG_REF
Definition: hevcdec.h:356
FFHWAccel
Definition: hwaccel_internal.h:34
ff_nvdec_start_frame
int ff_nvdec_start_frame(AVCodecContext *avctx, AVFrame *frame)
Definition: nvdec.c:946
ff_hevc_diag_scan8x8_y
const uint8_t ff_hevc_diag_scan8x8_y[64]
Definition: data.c:58
NVDECAPI_CHECK_VERSION
#define NVDECAPI_CHECK_VERSION(major, minor)
Definition: nvdec.h:40
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
nvdec_hevc_decode_init
static int nvdec_hevc_decode_init(AVCodecContext *avctx)
Definition: nvdec_hevc.c:314
nvdec_hevc_start_frame
static int nvdec_hevc_start_frame(AVCodecContext *avctx, const AVBufferRef *buffer_ref, const uint8_t *buffer, uint32_t size)
Definition: nvdec_hevc.c:74
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
NVDECFrame
Definition: nvdec.h:54
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
decode.h
IS_IDR
#define IS_IDR(s)
Definition: hevcdec.h:74
HEVC_FRAME_FLAG_SHORT_REF
#define HEVC_FRAME_FLAG_SHORT_REF
Definition: hevcdec.h:355
nvdec_hevc_decode_slice
static int nvdec_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Definition: nvdec_hevc.c:276
ScalingList
Definition: ps.h:245
tmp
static uint8_t tmp[40]
Definition: aes_ctr.c:52
dpb_size
int dpb_size
Definition: h264_levels.c:111
ff_hevc_diag_scan4x4_y
const uint8_t ff_hevc_diag_scan4x4_y[16]
Definition: data.c:32
ScalingList::sl_dc
uint8_t sl_dc[2][6]
Definition: ps.h:249
hwaccel_internal.h
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
AV_PROFILE_HEVC_MAIN_STILL_PICTURE
#define AV_PROFILE_HEVC_MAIN_STILL_PICTURE
Definition: defs.h:161
fill_scaling_lists
static void fill_scaling_lists(CUVIDHEVCPICPARAMS *ppc, const HEVCContext *s)
Definition: nvdec_hevc.c:47
nvdec_hevc_frame_params
static int nvdec_hevc_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx, enum AVPixelFormat hw_format)
Definition: nvdec_hevc.c:303
data.h
AV_PROFILE_HEVC_MAIN_10
#define AV_PROFILE_HEVC_MAIN_10
Definition: defs.h:160
AV_PROFILE_HEVC_REXT
#define AV_PROFILE_HEVC_REXT
Definition: defs.h:162
IS_IRAP
#define IS_IRAP(s)
Definition: hevcdec.h:77
hevcdec.h
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
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:424
NVDECFrame::idx
unsigned int idx
Definition: nvdec.h:55
size
int size
Definition: twinvq_data.h:10344
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
AV_WB24
#define AV_WB24(p, d)
Definition: intreadwrite.h:446
dpb_add
static void dpb_add(CUVIDHEVCPICPARAMS *pp, int idx, const HEVCFrame *src)
Definition: nvdec_hevc.c:37
nvdec.h
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
ff_hevc_frame_nb_refs
int ff_hevc_frame_nb_refs(const SliceHeader *sh, const HEVCPPS *pps, unsigned layer_idx)
Get the number of candidate references for the current frame.
Definition: refs.c:617
HEVCFrame
Definition: hevcdec.h:360
AV_PIX_FMT_CUARRAY
@ AV_PIX_FMT_CUARRAY
hardware decoding through openharmony
Definition: pixfmt.h:506
HEVCLayerContext
Definition: hevcdec.h:452
ff_nvdec_end_frame
int ff_nvdec_end_frame(AVCodecContext *avctx)
Definition: nvdec.c:1014
s
uint8_t s
Definition: llvidencdsp.c:39
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:223
ff_hevc_diag_scan4x4_x
const uint8_t ff_hevc_diag_scan4x4_x[16]
Definition: data.c:25
avcodec.h
ret
ret
Definition: filter_design.txt:187
ST_CURR_BEF
@ ST_CURR_BEF
Definition: hevcdec.h:84
sps
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
Definition: cbs_h264_syntax_template.c:260
pos
unsigned int pos
Definition: spdifenc.c:431
LT_CURR
@ LT_CURR
Definition: hevcdec.h:87
AVCodecContext
main external API structure.
Definition: avcodec.h:443
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
HEVCContext
Definition: hevcdec.h:490
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1636
HEVCLayerContext::DPB
HEVCFrame DPB[32]
Definition: hevcdec.h:453
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
pps
uint64_t pps
Definition: dovi_rpuenc.c:36
ff_hevc_diag_scan8x8_x
const uint8_t ff_hevc_diag_scan8x8_x[64]
Definition: data.c:39
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
mem.h
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
HEVCSPS
Definition: ps.h:252
HEVCPPS
Definition: ps.h:371
ff_hevc_nvdec_cuarray_hwaccel
const struct FFHWAccel ff_hevc_nvdec_cuarray_hwaccel
ST_CURR_AFT
@ ST_CURR_AFT
Definition: hevcdec.h:85
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:470
FrameDecodeData::hwaccel_priv
void * hwaccel_priv
Definition: decode.h:54
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
NVDECContext
Definition: nvdec.h:62
src
#define src
Definition: vp8dsp.c:248