rocprofiler-sdk/rocdecode/details/rocdecode.h Source File

rocprofiler-sdk/rocdecode/details/rocdecode.h Source File#

Rocprofiler SDK Developer API: rocprofiler-sdk/rocdecode/details/rocdecode.h Source File
Rocprofiler SDK Developer API 0.6.0
ROCm Profiling API and tools
rocdecode.h
Go to the documentation of this file.
1/*
2Copyright (c) 2024 - 2025 Advanced Micro Devices, Inc. All rights reserved.
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20THE SOFTWARE.
21*/
22
23#pragma once
24
25#ifndef ROCDECAPI
26# if defined(_WIN32)
27# define ROCDECAPI __stdcall // for future: only linux is supported in this version
28# else
29# define ROCDECAPI
30# endif
31#endif
32
33#include "hip/hip_runtime.h"
34#if !defined(ROCPROFILER_SDK_USE_SYSTEM_ROCDECODE)
35# if defined __has_include
36# if __has_include(<rocdecode/rocdecode_version.h>)
37# define ROCPROFILER_SDK_USE_SYSTEM_ROCDECODE 1
38# else
39# define ROCPROFILER_SDK_USE_SYSTEM_ROCDECODE 0
40# endif
41# else
42# define ROCPROFILER_SDK_USE_SYSTEM_ROCDECODE 0
43# endif
44#endif
45
46#if ROCPROFILER_SDK_USE_SYSTEM_ROCDECODE > 0
47# include <rocdecode/rocdecode_version.h>
48#else
50#endif
51/*!
52 * \file
53 * \brief The AMD rocDecode Library.
54 *
55 * \defgroup group_amd_rocdecode rocDecode: AMD ROCm Decode API
56 * \brief AMD The rocDecode is a toolkit to decode videos and images using a hardware-accelerated
57 * video decoder on AMD’s GPUs.
58 */
59
60#if defined(__cplusplus)
61extern "C" {
62#endif // __cplusplus
63
64/*********************************************************************************/
65//! HANDLE pf rocDecDecoder
66//! Used in subsequent API calls after rocDecCreateDecoder
67/*********************************************************************************/
68
69typedef void* rocDecDecoderHandle;
70
71/*********************************************************************************/
72//! \enum rocDecStatus
73//! \ingroup group_amd_rocdecode
74//! rocDecoder return status enums
75//! These enums are used in all API calls to rocDecoder
76/*********************************************************************************/
89
90/*********************************************************************************/
91//! \enum rocDecodeVideoCodec
92//! \ingroup group_amd_rocdecode
93//! Video codec enums
94//! These enums are used in ROCDECODECREATEINFO and ROCDECODEVIDDECODECAPS structures
95/*********************************************************************************/
96typedef enum rocDecVideoCodec_enum
97{
98 rocDecVideoCodec_MPEG1 = 0, /**< MPEG1 */
101 rocDecVideoCodec_AVC, /**< AVC/H264 */
107 rocDecVideoCodec_NumCodecs, /**< Max codecs */
108 // Uncompressed YUV
110 (('I' << 24) | ('Y' << 16) | ('U' << 8) | ('V')), /**< Y,U,V (4:2:0) */
112 (('Y' << 24) | ('V' << 16) | ('1' << 8) | ('2')), /**< Y,V,U (4:2:0) */
114 (('N' << 24) | ('V' << 16) | ('1' << 8) | ('2')), /**< Y,UV (4:2:0) */
116 (('Y' << 24) | ('U' << 16) | ('Y' << 8) | ('V')), /**< YUYV/YUY2 (4:2:2) */
117 rocDecVideoCodec_UYVY = (('U' << 24) | ('Y' << 16) | ('V' << 8) | ('Y')) /**< UYVY (4:2:2) */
119
120/*********************************************************************************/
121//! \enum rocDecVideoSurfaceFormat
122//! \ingroup group_amd_rocdecode
123//! Video surface format enums used for output format of decoded output
124//! These enums are used in RocDecoderCreateInfo structure
125/*********************************************************************************/
126typedef enum rocDecVideoSurfaceFormat_enum
127{
129 0, /**< Semi-Planar YUV [Y plane followed by interleaved UV plane] */
131 1, /**< 16 bit Semi-Planar YUV [Y plane followed by interleaved UV plane].
132 Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */
133 rocDecVideoSurfaceFormat_YUV444 = 2, /**< Planar YUV [Y plane followed by U and V planes] */
135 3, /**< 16 bit Planar YUV [Y plane followed by U and V planes].
136 Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */
138 4, /**< Planar YUV [Y plane followed by U and V planes in 4:2:0 format] */
140 5, /**< 16 bit Planar YUV [Y plane followed by U and V planes in ].
141 Can be used for 10 bit(LSB), 12 bit (LSB) */
143
144/**************************************************************************************************************/
145//! \enum rocDecVideoChromaFormat
146//! \ingroup group_amd_rocdecode
147//! Chroma format enums
148//! These enums are used in ROCDCODECREATEINFO and RocdecDecodeCaps structures
149/**************************************************************************************************************/
150typedef enum rocDecVideoChromaFormat_enum
151{
155 rocDecVideoChromaFormat_444 /**< YUV 4:4:4 */
157
158/*************************************************************************/
159//! \enum rocDecDecodeStatus
160//! \ingroup group_amd_rocdecode
161//! Decode status enums
162//! These enums are used in RocdecGetDecodeStatus structure
163/*************************************************************************/
164typedef enum rocDecodeStatus_enum
165{
166 rocDecodeStatus_Invalid = 0, // Decode status is not valid
167 rocDecodeStatus_InProgress = 1, // Decode is in progress
168 rocDecodeStatus_Success = 2, // Decode is completed without any errors
169 // 3 to 7 enums are reserved for future use
170 rocDecodeStatus_Error = 8, // Decode is completed with an error (error is not concealed)
172 9, // Decode is completed with an error and error is concealed
173 rocDecodeStatus_Displaying = 10, // Decode is completed, displaying in progress
175
176/**************************************************************************************************************/
177//! \struct RocdecDecodeCaps;
178//! \ingroup group_amd_rocdecode
179//! This structure is used in rocDecGetDecoderCaps API
180/**************************************************************************************************************/
181typedef struct _RocdecDecodeCaps
182{
183 uint8_t device_id; /**< IN: the device id for which query the decode capability 0 for the first
184 device, 1 for the second device on the system, etc.*/
185 rocDecVideoCodec codec_type; /**< IN: rocDecVideoCodec_XXX */
186 rocDecVideoChromaFormat chroma_format; /**< IN: rocDecVideoChromaFormat_XXX */
187 uint32_t bit_depth_minus_8; /**< IN: The Value "BitDepth minus 8" */
188 uint32_t reserved_1[3]; /**< Reserved for future use - set to zero */
189 uint8_t is_supported; /**< OUT: 1 if codec supported, 0 if not supported */
190 uint8_t num_decoders; /**< OUT: Number of Decoders that can support IN params */
191 uint16_t output_format_mask; /**< OUT: each bit represents corresponding
192 rocDecVideoSurfaceFormat enum */
193 uint32_t max_width; /**< OUT: Max supported coded width in pixels */
194 uint32_t max_height; /**< OUT: Max supported coded height in pixels */
195 uint16_t min_width; /**< OUT: Min supported coded width in pixels */
196 uint16_t min_height; /**< OUT: Min supported coded height in pixels */
197 uint32_t reserved_2[6]; /**< Reserved for future use - set to zero */
199
200/**************************************************************************************************************/
201//! \struct RocDecoderCreateInfo
202//! \ingroup group_amd_rocdecode
203//! This structure is used in rocDecCreateDecoder API
204/**************************************************************************************************************/
205typedef struct _RocDecoderCreateInfo
206{
207 uint8_t device_id; /**< IN: the device id for which a decoder should be created
208 0 for the first device, 1 for the second device on the system, etc.*/
209 uint32_t width; /**< IN: Coded sequence width in pixels */
210 uint32_t height; /**< IN: Coded sequence height in pixels */
211 uint32_t num_decode_surfaces; /**< IN: Maximum number of internal decode surfaces */
212 rocDecVideoCodec codec_type; /**< IN: rocDecVideoCodec_XXX */
213 rocDecVideoChromaFormat chroma_format; /**< IN: rocDecVideoChromaFormat_XXX */
214 uint32_t bit_depth_minus_8; /**< IN: The value "BitDepth minus 8" */
215 uint32_t
216 intra_decode_only; /**< IN: Set 1 only if video has all intra frames (default value is 0).
217 This will optimize video memory for Intra frames only decoding. The
218 support is limited to specific codecs - AVC/H264, HEVC, VP9, the flag
219 will be ignored for codecs which are not supported. However decoding
220 might fail if the flag is enabled in case of supported codecs for
221 regular bit streams having P and/or B frames. */
222 uint32_t max_width; /**< IN: Coded sequence max width in pixels used with reconfigure Decoder */
223 uint32_t
224 max_height; /**< IN: Coded sequence max height in pixels used with reconfigure Decoder */
225 struct
226 {
227 int16_t left;
228 int16_t top;
229 int16_t right;
230 int16_t bottom;
231 } display_rect; /**< IN: area of the frame that should be displayed */
232 rocDecVideoSurfaceFormat output_format; /**< IN: rocDecVideoSurfaceFormat_XXX */
233 uint32_t target_width; /**< IN: Post-processed output width (Should be aligned to 2) */
234 uint32_t target_height; /**< IN: Post-processed output height (Should be aligned to 2) */
235 uint32_t
236 num_output_surfaces; /**< IN: Maximum number of output surfaces simultaneously mapped */
237 struct
238 {
239 int16_t left;
240 int16_t top;
241 int16_t right;
242 int16_t bottom;
243 } target_rect; /**< IN: (for future use) target rectangle in the output frame (for aspect ratio
244 conversion)
245 if a null rectangle is specified, {0,0,target_width,target_height} will
246 be used*/
247 uint32_t reserved_2[4]; /**< Reserved for future use - set to zero */
249
250/*********************************************************************************************************/
251//! \struct RocdecDecodeStatus
252//! \ingroup group_amd_rocdecode
253//! Struct for reporting decode status.
254//! This structure is used in RocdecGetDecodeStatus API.
255/*********************************************************************************************************/
256typedef struct _RocdecDecodeStatus
257{
259 uint32_t reserved[31];
260 void* p_reserved[8];
262
263/****************************************************/
264//! \struct RocdecReconfigureDecoderInfo
265//! \ingroup group_amd_rocdecode
266//! Struct for decoder reset
267//! This structure is used in rocDecReconfigureDecoder() API
268/****************************************************/
269typedef struct _RocdecReconfigureDecoderInfo
270{
271 uint32_t width; /**< IN: Coded sequence width in pixels, MUST be < = max_width defined at
272 RocDecoderCreateInfo */
273 uint32_t height; /**< IN: Coded sequence height in pixels, MUST be < = max_height defined at
274 RocDecoderCreateInfo */
275 uint32_t target_width; /**< IN: Post processed output width */
276 uint32_t target_height; /**< IN: Post Processed output height */
277 uint32_t num_decode_surfaces; /**< IN: Maximum number of internal decode surfaces */
278 uint32_t reserved_1[12]; /**< Reserved for future use. Set to Zero */
279 struct
280 {
281 int16_t left;
282 int16_t top;
283 int16_t right;
284 int16_t bottom;
285 } display_rect; /**< IN: area of the frame that should be displayed */
286 struct
287 {
288 int16_t left;
289 int16_t top;
290 int16_t right;
291 int16_t bottom;
292 } target_rect; /**< IN: (for future use) target rectangle in the output frame (for aspect ratio
293 conversion)
294 if a null rectangle is specified, {0,0,target_width,target_height} will be
295 used */
296 uint32_t reserved_2[11]; /**< Reserved for future use. Set to Zero */
298
299/*********************************************************/
300//! \struct RocdecAvcPicture
301//! \ingroup group_amd_rocdecode
302//! AVC/H.264 Picture Entry
303//! This structure is used in RocdecAvcPicParams structure
304/*********************************************************/
305typedef struct _RocdecAvcPicture
306{
307 int pic_idx; /**< picture index of reference frame */
308 uint32_t frame_idx; /**< frame_num(int16_t-term) or LongTermFrameIdx(long-term) */
309 uint32_t flags; /**< See below for definitions */
310 int32_t top_field_order_cnt; /**< field order count of top field */
311 int32_t bottom_field_order_cnt; /**< field order count of bottom field */
312 uint32_t reserved[4];
314
315/* flags in RocdecAvcPicture could be OR of the following */
316#define RocdecAvcPicture_FLAGS_INVALID 0x00000001
317#define RocdecAvcPicture_FLAGS_TOP_FIELD 0x00000002
318#define RocdecAvcPicture_FLAGS_BOTTOM_FIELD 0x00000004
319#define RocdecAvcPicture_FLAGS_SHORT_TERM_REFERENCE 0x00000008
320#define RocdecAvcPicture_FLAGS_LONG_TERM_REFERENCE 0x00000010
321#define RocdecAvcPicture_FLAGS_NON_EXISTING 0x00000020
322
323/*********************************************************/
324//! \struct RocdecHevcPicture
325//! \ingroup group_amd_rocdecode
326//! HEVC Picture Entry
327//! This structure is used in RocdecHevcPicParams structure
328/*********************************************************/
329typedef struct _RocdecHevcPicture
330{
331 int pic_idx; /**< reconstructed picture surface ID */
332 /** \brief picture order count.
333 //! \ingroup group_amd_rocdecode
334 * in HEVC, POCs for top and bottom fields of same picture should
335 * take different values.
336 */
337 int poc;
338 uint32_t flags; /**< See below for definitions */
339 uint32_t reserved[4]; /**< reserved for future; must be zero */
341
342/* flags in RocdecHevcPicture could be OR of the following */
343#define RocdecHevcPicture_INVALID 0x00000001
344/** \brief indication of interlace scan picture.
345 * should take same value for all the pictures in sequence.
346 */
347#define RocdecHevcPicture_FIELD_PIC 0x00000002
348/** \brief polarity of the field picture.
349 * top field takes even lines of buffer surface.
350 * bottom field takes odd lines of buffer surface.
351 */
352#define RocdecHevcPicture_BOTTOM_FIELD 0x00000004
353/** \brief Long term reference picture */
354#define RocdecHevcPicture_LONG_TERM_REFERENCE 0x00000008
355/**
356 * RocdecHevcPicture_ST_CURR_BEFORE, RocdecHevcPicture_RPS_ST_CURR_AFTER
357 * and RocdecHevcPicture_RPS_LT_CURR of any picture in ReferenceFrames[] should
358 * be exclusive. No more than one of them can be set for any picture.
359 * Sum of NumPocStCurrBefore, NumPocStCurrAfter and NumPocLtCurr
360 * equals NumPocTotalCurr, which should be equal to or smaller than 8.
361 * Application should provide valid values for both int16_t format and long format.
362 * The pictures in DPB with any of these three flags turned on are referred by
363 * the current picture.
364 */
365/** \brief RefPicSetStCurrBefore of HEVC spec variable
366 * Number of ReferenceFrames[] entries with this bit set equals
367 * NumPocStCurrBefore.
368 */
369#define RocdecHevcPicture_RPS_ST_CURR_BEFORE 0x00000010
370/** \brief RefPicSetStCurrAfter of HEVC spec variable
371 * Number of ReferenceFrames[] entries with this bit set equals
372 * NumPocStCurrAfter.
373 */
374#define RocdecHevcPicture_RPS_ST_CURR_AFTER 0x00000020
375/** \brief RefPicSetLtCurr of HEVC spec variable
376 * Number of ReferenceFrames[] entries with this bit set equals
377 * NumPocLtCurr.
378 */
379#define RocdecHevcPicture_RPS_LT_CURR 0x00000040
380
381/***********************************************************/
382//! \struct RocdecJPEGPicParams placeholder
383//! \ingroup group_amd_rocdecode
384//! JPEG picture parameters
385//! This structure is used in RocdecPicParams structure
386/***********************************************************/
387typedef struct _RocdecJPEGPicParams
388{
391
392/***********************************************************/
393//! \struct RocdecMpeg2QMatrix
394//! \ingroup group_amd_rocdecode
395//! MPEG2 QMatrix
396//! This structure is used in _RocdecMpeg2PicParams structure
397/***********************************************************/
398typedef struct _RocdecMpeg2QMatrix
399{
404 uint8_t intra_quantiser_matrix[64];
405 uint8_t non_intra_quantiser_matrix[64];
406 uint8_t chroma_intra_quantiser_matrix[64];
407 uint8_t chroma_non_intra_quantiser_matrix[64];
409
410/***********************************************************/
411//! \struct RocdecMpeg2PicParams
412//! \ingroup group_amd_rocdecode
413//! MPEG2 picture parameters
414//! This structure is used in RocdecMpeg2PicParams structure
415/***********************************************************/
416typedef struct _RocdecMpeg2PicParams
417{
420 uint32_t forward_reference_pic; // surface_id for forward reference
421 uint32_t backward_reference_picture; // surface_id for backward reference
422 /* meanings of the following fields are the same as in the standard */
424 int32_t f_code; /* pack all four fcode into this */
425 union
426 {
427 struct
428 {
429 uint32_t intra_dc_precision : 2;
430 uint32_t picture_structure : 2;
431 uint32_t top_field_first : 1;
432 uint32_t frame_pred_frame_dct : 1;
433 uint32_t concealment_motion_vectors : 1;
434 uint32_t q_scale_type : 1;
435 uint32_t intra_vlc_format : 1;
436 uint32_t alternate_scan : 1;
437 uint32_t repeat_first_field : 1;
438 uint32_t progressive_frame : 1;
439 uint32_t is_first_field : 1; // indicate whether the current field is the first field
440 // for field picture
441 } bits;
442 uint32_t value;
443 } picture_coding_extension;
444
446 uint32_t reserved[4];
448
449/***********************************************************/
450//! \struct RocdecVc1PicParams placeholder
451//! \ingroup group_amd_rocdecode
452//! JPEG picture parameters
453//! This structure is used in RocdecVc1PicParams structure
454/***********************************************************/
455typedef struct _RocdecVc1PicParams
456{
459
460/***********************************************************/
461//! \struct RocdecAvcPicParams
462//! \ingroup group_amd_rocdecode
463//! AVC picture parameters
464//! This structure is used in RocdecAvcPicParams structure
465//! This structure is configured to be the same as VA-API VAPictureParameterBufferH264 structure
466/***********************************************************/
467typedef struct _RocdecAvcPicParams
468{
470 RocdecAvcPicture ref_frames[16]; /* in DPB */
476 union
477 {
478 struct
479 {
480 uint32_t chroma_format_idc : 2;
481 uint32_t residual_colour_transform_flag : 1;
482 uint32_t gaps_in_frame_num_value_allowed_flag : 1;
483 uint32_t frame_mbs_only_flag : 1;
484 uint32_t mb_adaptive_frame_field_flag : 1;
485 uint32_t direct_8x8_inference_flag : 1;
486 uint32_t MinLumaBiPredSize8x8 : 1; /* see A.3.3.2 */
487 uint32_t log2_max_frame_num_minus4 : 4;
488 uint32_t pic_order_cnt_type : 2;
489 uint32_t log2_max_pic_order_cnt_lsb_minus4 : 4;
490 uint32_t delta_pic_order_always_zero_flag : 1;
491 } bits;
492 uint32_t value;
493 } seq_fields;
494
495 // FMO/ASO
503 union
504 {
505 struct
506 {
507 uint32_t entropy_coding_mode_flag : 1;
508 uint32_t weighted_pred_flag : 1;
509 uint32_t weighted_bipred_idc : 2;
510 uint32_t transform_8x8_mode_flag : 1;
511 uint32_t field_pic_flag : 1;
512 uint32_t constrained_intra_pred_flag : 1;
513 uint32_t pic_order_present_flag : 1;
514 uint32_t deblocking_filter_control_present_flag : 1;
515 uint32_t redundant_pic_cnt_present_flag : 1;
516 uint32_t reference_pic_flag : 1; /* nal_ref_idc != 0 */
517 } bits;
518 uint32_t value;
519 } pic_fields;
520 uint16_t frame_num;
521
522 uint32_t reserved[8];
524
525/***********************************************************/
526//! \struct RocdecAvcSliceParams
527//! \ingroup group_amd_rocdecode
528//! AVC slice parameter buffer
529//! This structure is configured to be the same as VA-API VASliceParameterBufferH264 structure
530/***********************************************************/
531typedef struct _RocdecAvcSliceParams
532{
533 uint32_t slice_data_size; // slice size in bytes
534 uint32_t slice_data_offset; // byte offset of the current slice in the slice data buffer
535 uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
536 /**
537 * \brief Bit offset from NAL Header Unit to the begining of slice_data().
538 *
539 * This bit offset is relative to and includes the NAL unit byte
540 * and represents the number of bits parsed in the slice_header()
541 * after the removal of any emulation prevention bytes in
542 * there. However, the slice data buffer passed to the hardware is
543 * the original bitstream, thus including any emulation prevention
544 * bytes.
545 */
548 uint8_t slice_type;
557 RocdecAvcPicture ref_pic_list_0[32]; // 8.2.4.2
558 RocdecAvcPicture ref_pic_list_1[32]; // 8.2.4.2
562 int16_t luma_weight_l0[32];
563 int16_t luma_offset_l0[32];
565 int16_t chroma_weight_l0[32][2];
566 int16_t chroma_offset_l0[32][2];
568 int16_t luma_weight_l1[32];
569 int16_t luma_offset_l1[32];
571 int16_t chroma_weight_l1[32][2];
572 int16_t chroma_offset_l1[32][2];
573 uint32_t reserved[4];
575
576/***********************************************************/
577//! \struct RocdecAvcIQMatrix
578//! \ingroup group_amd_rocdecode
579//! AVC Inverse Quantization Matrix
580//! This structure is configured to be the same as VA-API VAIQMatrixBufferH264 structure
581/***********************************************************/
582typedef struct _RocdecAvcIQMatrix
583{
584 /** \brief 4x4 scaling list, in raster scan order. */
585 uint8_t scaling_list_4x4[6][16];
586 /** \brief 8x8 scaling list, in raster scan order. */
587 uint8_t scaling_list_8x8[2][64];
588 /** \brief Reserved bytes for future use, must be zero */
589 uint32_t reserved[4];
591
592/***********************************************************/
593//! \struct RocdecHevcPicParams
594//! \ingroup group_amd_rocdecode
595//! HEVC picture parameters
596//! This structure is used in RocdecHevcPicParams structure
597/***********************************************************/
598typedef struct _RocdecHevcPicParams
599{
601 RocdecHevcPicture ref_frames[15]; /* reference frame list in DPB */
604 union
605 {
606 struct
607 {
608 /** following flags have same syntax and semantic as those in HEVC spec */
609 uint32_t chroma_format_idc : 2;
610 uint32_t separate_colour_plane_flag : 1;
611 uint32_t pcm_enabled_flag : 1;
612 uint32_t scaling_list_enabled_flag : 1;
613 uint32_t transform_skip_enabled_flag : 1;
614 uint32_t amp_enabled_flag : 1;
615 uint32_t strong_intra_smoothing_enabled_flag : 1;
616 uint32_t sign_data_hiding_enabled_flag : 1;
617 uint32_t constrained_intra_pred_flag : 1;
618 uint32_t cu_qp_delta_enabled_flag : 1;
619 uint32_t weighted_pred_flag : 1;
620 uint32_t weighted_bipred_flag : 1;
621 uint32_t transquant_bypass_enabled_flag : 1;
622 uint32_t tiles_enabled_flag : 1;
623 uint32_t entropy_coding_sync_enabled_flag : 1;
624 uint32_t pps_loop_filter_across_slices_enabled_flag : 1;
625 uint32_t loop_filter_across_tiles_enabled_flag : 1;
626 uint32_t pcm_loop_filter_disabled_flag : 1;
627 /** set based on sps_max_num_reorder_pics of current temporal layer. */
628 uint32_t no_pic_reordering_flag : 1;
629 /** picture has no B slices */
630 uint32_t no_bi_pred_flag : 1;
631 uint32_t reserved_bits : 11;
632 } bits;
633 uint32_t value;
634 } pic_fields;
635
636 /** SPS fields: the following parameters have same syntax with those in HEVC spec */
637 uint8_t sps_max_dec_pic_buffering_minus1; /**< IN: DPB size for current temporal layer */
657 /**
658 * when uniform_spacing_flag equals 1, application should populate
659 * column_width_minus[], and row_height_minus1[] with approperiate values.
660 */
661 uint16_t column_width_minus1[19];
662 uint16_t row_height_minus1[21];
663
664 union
665 {
666 struct
667 {
668 /** following parameters have same syntax with those in HEVC spec */
669 uint32_t lists_modification_present_flag : 1;
670 uint32_t long_term_ref_pics_present_flag : 1;
671 uint32_t sps_temporal_mvp_enabled_flag : 1;
672 uint32_t cabac_init_present_flag : 1;
673 uint32_t output_flag_present_flag : 1;
674 uint32_t dependent_slice_segments_enabled_flag : 1;
675 uint32_t pps_slice_chroma_qp_offsets_present_flag : 1;
676 uint32_t sample_adaptive_offset_enabled_flag : 1;
677 uint32_t deblocking_filter_override_enabled_flag : 1;
678 uint32_t pps_disable_deblocking_filter_flag : 1;
679 uint32_t slice_segment_header_extension_present_flag : 1;
680
681 /** current picture with NUT between 16 and 21 inclusive */
682 uint32_t rap_pic_flag : 1;
683 /** current picture with NUT between 19 and 20 inclusive */
684 uint32_t idr_pic_flag : 1;
685 /** current picture has only intra slices */
686 uint32_t intra_pic_flag : 1;
687
688 uint32_t reserved_bits : 18;
689 } bits;
690 uint32_t value;
691 } slice_parsing_fields;
692
693 /** following parameters have same syntax with those in HEVC spec */
702 /**
703 * \brief number of bits that structure
704 * short_term_ref_pic_set( num_short_term_ref_pic_sets ) takes in slice
705 * segment header when short_term_ref_pic_set_sps_flag equals 0.
706 * if short_term_ref_pic_set_sps_flag equals 1, the value should be 0.
707 * the bit count is calculated after emulation prevention bytes are removed
708 * from bit streams.
709 * This variable is used for accelorater to skip parsing the
710 * short_term_ref_pic_set( num_short_term_ref_pic_sets ) structure.
711 */
712 uint32_t st_rps_bits;
713 uint32_t reserved[8];
715
716/***********************************************************/
717//! \struct RocdecHevcSliceParams
718//! \ingroup group_amd_rocdecode
719//! HEVC slice parameters
720//! This structure is used in RocdecPicParams structure
721/***********************************************************/
722typedef struct _RocdecHevcSliceParams
723{
724 /** \brief Number of bytes in the slice data buffer for this slice
725 * counting from and including NAL unit header.
726 */
728 /** \brief The offset to the NAL unit header for this slice */
730 /** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_XXX. */
732 /**
733 * \brief Byte offset from NAL unit header to the begining of slice_data().
734 *
735 * This byte offset is relative to and includes the NAL unit header
736 * and represents the number of bytes parsed in the slice_header()
737 * after the removal of any emulation prevention bytes in
738 * there. However, the slice data buffer passed to the hardware is
739 * the original bitstream, thus including any emulation prevention
740 * bytes.
741 */
743 /** HEVC syntax element. */
745 /** \brief index into ReferenceFrames[]
746 * ref_pic_list[0][] corresponds to RefPicList0[] of HEVC variable.
747 * ref_pic_list[1][] corresponds to RefPicList1[] of HEVC variable.
748 * value range [0..14, 0xFF], where 0xFF indicates invalid entry.
749 */
750 uint8_t ref_pic_list[2][15];
751 union
752 {
753 uint32_t value;
754 struct
755 {
756 /** current slice is last slice of picture. */
757 uint32_t last_slice_of_pic : 1;
758 /** HEVC syntax element. */
759 uint32_t dependent_slice_segment_flag : 1;
760 uint32_t slice_type : 2;
761 uint32_t color_plane_id : 2;
762 uint32_t slice_sao_luma_flag : 1;
763 uint32_t slice_sao_chroma_flag : 1;
764 uint32_t mvd_l1_zero_flag : 1;
765 uint32_t cabac_init_flag : 1;
766 uint32_t slice_temporal_mvp_enabled_flag : 1;
767 uint32_t slice_deblocking_filter_disabled_flag : 1;
768 uint32_t collocated_from_l0_flag : 1;
769 uint32_t slice_loop_filter_across_slices_enabled_flag : 1;
770 uint32_t reserved : 18;
771 } fields;
772 } long_slice_flags;
773
774 /** HEVC syntax element. */
785 int8_t delta_luma_weight_l0[15];
786 int8_t luma_offset_l0[15];
787 int8_t delta_chroma_weight_l0[15][2];
788 /** corresponds to HEVC spec variable of the same name. */
789 int8_t chroma_offset_l0[15][2];
790 /** HEVC syntax element. */
791 int8_t delta_luma_weight_l1[15];
792 int8_t luma_offset_l1[15];
793 int8_t delta_chroma_weight_l1[15][2];
794 /** corresponds to HEVC spec variable of the same name. */
795 int8_t chroma_offset_l1[15][2];
796 /** HEVC syntax element. */
800 /** \brief Number of emulation prevention bytes in slice header. */
802
803 uint32_t reserved[2];
805
806/***********************************************************/
807//! \struct RocdecHevcIQMatrix
808//! \ingroup group_amd_rocdecode
809//! HEVC IQMatrix
810//! This structure is sent once per frame,
811//! and only when scaling_list_enabled_flag = 1.
812//! When sps_scaling_list_data_present_flag = 0, app still
813//! needs to send in this structure with default matrix values.
814//! This structure is used in RocdecHevcQMatrix structure
815/***********************************************************/
816typedef struct _RocdecHevcIQMatrix
817{
818 /**
819 * \brief 4x4 scaling,
820 * correspongs i = 0, MatrixID is in the range of 0 to 5,
821 * inclusive. And j is in the range of 0 to 15, inclusive.
822 */
823 uint8_t scaling_list_4x4[6][16];
824 /**
825 * \brief 8x8 scaling,
826 * correspongs i = 1, MatrixID is in the range of 0 to 5,
827 * inclusive. And j is in the range of 0 to 63, inclusive.
828 */
829 uint8_t scaling_list_8x8[6][64];
830 /**
831 * \brief 16x16 scaling,
832 * correspongs i = 2, MatrixID is in the range of 0 to 5,
833 * inclusive. And j is in the range of 0 to 63, inclusive.
834 */
835 uint8_t scaling_list_16x16[6][64];
836 /**
837 * \brief 32x32 scaling,
838 * correspongs i = 3, MatrixID is in the range of 0 to 1,
839 * inclusive. And j is in the range of 0 to 63, inclusive.
840 */
841 uint8_t scaling_list_32x32[2][64];
842 /**
843 * \brief DC values of the 16x16 scaling lists,
844 * corresponds to HEVC spec syntax
845 * scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
846 * with sizeID = 2 and matrixID in the range of 0 to 5, inclusive.
847 */
848 uint8_t scaling_list_dc_16x16[6];
849 /**
850 * \brief DC values of the 32x32 scaling lists,
851 * corresponds to HEVC spec syntax
852 * scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
853 * with sizeID = 3 and matrixID in the range of 0 to 1, inclusive.
854 */
855 uint8_t scaling_list_dc_32x32[2];
856 uint32_t reserved[4];
858
859/***********************************************************/
860//! \struct RocdecVp9PicParams
861//! \ingroup group_amd_rocdecode
862//! VP9 picture parameters
863//! This structure is configured to be the same as VA-API VADecPictureParameterBufferVP9 structure.
864/***********************************************************/
865typedef struct _RocdecVp9PicParams
866{
867 /** \brief picture width
868 * Picture original resolution. The value may not be multiple of 8.
869 */
870 uint16_t frame_width;
871 /** \brief picture height
872 * Picture original resolution. The value may not be multiple of 8.
873 */
874 uint16_t frame_height;
875
876 /** \brief Surface indices of reference frames in DPB.
877 *
878 * Each entry of the list specifies the surface index of the picture
879 * that is referred by current picture or will be referred by any future
880 * picture.
881 * Application who calls this API should update this list based on the
882 * refreshing information from VP9 bitstream.
883 */
884 uint32_t reference_frames[8];
885
886 union
887 {
888 struct
889 {
890 /** \brief flags for current picture
891 * same syntax and semantic as those in VP9 code
892 */
893 uint32_t subsampling_x : 1;
894 uint32_t subsampling_y : 1;
895 uint32_t frame_type : 1;
896 uint32_t show_frame : 1;
897 uint32_t error_resilient_mode : 1;
898 uint32_t intra_only : 1;
899 uint32_t allow_high_precision_mv : 1;
900 uint32_t mcomp_filter_type : 3;
901 uint32_t frame_parallel_decoding_mode : 1;
902 uint32_t reset_frame_context : 2;
903 uint32_t refresh_frame_context : 1;
904 uint32_t frame_context_idx : 2;
905 uint32_t segmentation_enabled : 1;
906
907 /** \brief corresponds to variable temporal_update in VP9 code.
908 */
909 uint32_t segmentation_temporal_update : 1;
910 /** \brief corresponds to variable update_mb_segmentation_map
911 * in VP9 code.
912 */
913 uint32_t segmentation_update_map : 1;
914
915 /** \brief Index of reference_frames[] and points to the
916 * LAST reference frame.
917 * It corresponds to active_ref_idx[0] in VP9 code.
918 */
919 uint32_t last_ref_frame : 3;
920 /** \brief Sign Bias of the LAST reference frame.
921 * It corresponds to ref_frame_sign_bias[LAST_FRAME] in VP9 code.
922 */
923 uint32_t last_ref_frame_sign_bias : 1;
924 /** \brief Index of reference_frames[] and points to the
925 * GOLDERN reference frame.
926 * It corresponds to active_ref_idx[1] in VP9 code.
927 */
928 uint32_t golden_ref_frame : 3;
929 /** \brief Sign Bias of the GOLDERN reference frame.
930 * Corresponds to ref_frame_sign_bias[GOLDERN_FRAME] in VP9 code.
931 */
932 uint32_t golden_ref_frame_sign_bias : 1;
933 /** \brief Index of reference_frames[] and points to the
934 * ALTERNATE reference frame.
935 * Corresponds to active_ref_idx[2] in VP9 code.
936 */
937 uint32_t alt_ref_frame : 3;
938 /** \brief Sign Bias of the ALTERNATE reference frame.
939 * Corresponds to ref_frame_sign_bias[ALTREF_FRAME] in VP9 code.
940 */
941 uint32_t alt_ref_frame_sign_bias : 1;
942 /** \brief Lossless Mode
943 * LosslessFlag = base_qindex == 0 &&
944 * y_dc_delta_q == 0 &&
945 * uv_dc_delta_q == 0 &&
946 * uv_ac_delta_q == 0;
947 * Where base_qindex, y_dc_delta_q, uv_dc_delta_q and uv_ac_delta_q
948 * are all variables in VP9 code.
949 */
950 uint32_t lossless_flag : 1;
951 } bits;
952 uint32_t value;
953 } pic_fields;
954
955 /* following parameters have same syntax with those in VP9 code */
958
959 /** \brief number of tile rows specified by (1 << log2_tile_rows).
960 * It corresponds the variable with same name in VP9 code.
961 */
963 /** \brief number of tile columns specified by (1 << log2_tile_columns).
964 * It corresponds the variable with same name in VP9 code.
965 */
967 /** \brief Number of bytes taken up by the uncompressed frame header,
968 * which corresponds to byte length of function
969 * read_uncompressed_header() in VP9 code.
970 * Specifically, it is the byte count from bit stream buffer start to
971 * the last byte of uncompressed frame header.
972 * If there are other meta data in the buffer before uncompressed header,
973 * its size should be also included here.
974 */
976
977 /** \brief The byte count of compressed header the bitstream buffer,
978 * which corresponds to syntax first_partition_size in code.
979 */
981
982 /** These values are segment probabilities with same names in VP9
983 * function setup_segmentation(). They should be parsed directly from
984 * bitstream by application.
985 */
986 uint8_t mb_segment_tree_probs[7];
987 uint8_t segment_pred_probs[3];
988
989 /** \brief VP9 Profile definition
990 * value range [0..3].
991 */
992 uint8_t profile;
993
994 /** \brief VP9 bit depth per sample
995 * same for both luma and chroma samples.
996 */
997 uint8_t bit_depth;
998
999 /** \brief Reserved bytes for future use, must be zero */
1000 uint32_t va_reserved[8];
1001
1003
1004/**
1005 * \brief VP9 Segmentation Parameter Data Structure
1006 * This structure is configured to be the same as VA-API VASegmentParameterVP9 structure.
1007 */
1008typedef struct _RocdecVp9SegmentParameter
1009{
1010 union
1011 {
1012 struct
1013 {
1014 /** \brief Indicates if per segment reference frame indicator
1015 * is enabled.
1016 * Corresponding to variable feature_enabled when
1017 * j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
1018 */
1019 uint16_t segment_reference_enabled : 1;
1020 /** \brief Specifies per segment reference indication.
1021 * 0: reserved
1022 * 1: Last ref
1023 * 2: golden
1024 * 3: altref
1025 * Value can be derived from variable data when
1026 * j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
1027 */
1028 uint16_t segment_reference : 2;
1029 /** \brief Indicates if per segment skip feature is enabled.
1030 * Corresponding to variable feature_enabled when
1031 * j == SEG_LVL_SKIP in function setup_segmentation() VP9 code.
1032 */
1033 uint16_t segment_reference_skipped : 1;
1034 } fields;
1035 uint16_t value;
1036 } segment_flags;
1037
1038 /** \brief Specifies the filter level information per segment.
1039 * The value corresponds to variable lfi->lvl[seg][ref][mode] in VP9 code,
1040 * where m is [ref], and n is [mode] in FilterLevel[m][n].
1041 */
1042 uint8_t filter_level[4][2];
1043 /** \brief Specifies per segment Luma AC quantization scale.
1044 * Corresponding to y_dequant[qindex][1] in vp9_mb_init_quantizer()
1045 * function of VP9 code.
1046 */
1048 /** \brief Specifies per segment Luma DC quantization scale.
1049 * Corresponding to y_dequant[qindex][0] in vp9_mb_init_quantizer()
1050 * function of VP9 code.
1051 */
1053 /** \brief Specifies per segment Chroma AC quantization scale.
1054 * Corresponding to uv_dequant[qindex][1] in vp9_mb_init_quantizer()
1055 * function of VP9 code.
1056 */
1058 /** \brief Specifies per segment Chroma DC quantization scale.
1059 * Corresponding to uv_dequant[qindex][0] in vp9_mb_init_quantizer()
1060 * function of VP9 code.
1061 */
1063
1064 /** \brief Reserved bytes for future use, must be zero */
1065 uint32_t va_reserved[4];
1066
1068
1069/***********************************************************/
1070//! \struct RocdecVp9SliceParams
1071//! \ingroup group_amd_rocdecode
1072//! VP9 slice parameter buffer
1073//! This structure is configured to be the same as VA-API VASliceParameterBufferVP9 structure.
1074/***********************************************************/
1075typedef struct _RocdecVp9SliceParams
1076{
1077 /** \brief The byte count of current frame in the bitstream buffer,
1078 * starting from first byte of the buffer.
1079 * It uses the name slice_data_size to be consitent with other codec,
1080 * but actually means frame_data_size.
1081 */
1083 /**
1084 * offset to the first byte of partition data (control partition)
1085 */
1087 /**
1088 * see VA_SLICE_DATA_FLAG_XXX definitions
1089 */
1091
1092 /**
1093 * \brief per segment information
1094 */
1096
1097 /** \brief Reserved bytes for future use, must be zero */
1098 uint32_t va_reserved[4];
1099
1101
1102/** \brief Segmentation Information for AV1
1103 */
1104typedef struct _RocdecAv1SegmentationStruct
1105{
1106 union
1107 {
1108 struct
1109 {
1110 /** Indicates whether segmentation map related syntax elements
1111 * are present or not for current frame. If equal to 0,
1112 * the segmentation map related syntax elements are
1113 * not present for the current frame and the control flags of
1114 * segmentation map related tables feature_data[][], and
1115 * feature_mask[] are not valid and shall be ignored by accelerator.
1116 */
1117 uint32_t enabled : 1;
1118 /** Value 1 indicates that the segmentation map are updated
1119 * during the decoding of this frame.
1120 * Value 0 means that the segmentation map from the previous
1121 * frame is used.
1122 */
1123 uint32_t update_map : 1;
1124 /** Value 1 indicates that the updates to the segmentation map
1125 * are coded relative to the existing segmentation map.
1126 * Value 0 indicates that the new segmentation map is coded
1127 * without reference to the existing segmentation map.
1128 */
1129 uint32_t temporal_update : 1;
1130 /** Value 1 indicates that new parameters are about to be
1131 * specified for each segment.
1132 * Value 0 indicates that the segmentation parameters
1133 * should keep their existing values.
1134 */
1135 uint32_t update_data : 1;
1136
1137 /** \brief Reserved bytes for future use, must be zero */
1138 uint32_t reserved : 28;
1139 } bits;
1140 uint32_t value;
1141 } segment_info_fields;
1142
1143 /** \brief Segmentation parameters for current frame.
1144 * feature_data[segment_id][feature_id]
1145 * where segment_id has value range [0..7] indicating the segment id.
1146 * and feature_id is defined as
1147 typedef enum {
1148 SEG_LVL_ALT_Q, // Use alternate Quantizer ....
1149 SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical
1150 SEG_LVL_ALT_LF_Y_H, // Use alternate loop filter value on y plane horizontal
1151 SEG_LVL_ALT_LF_U, // Use alternate loop filter value on u plane
1152 SEG_LVL_ALT_LF_V, // Use alternate loop filter value on v plane
1153 SEG_LVL_REF_FRAME, // Optional Segment reference frame
1154 SEG_LVL_SKIP, // Optional Segment (0,0) + skip mode
1155 SEG_LVL_GLOBALMV,
1156 SEG_LVL_MAX
1157 } SEG_LVL_FEATURES;
1158 * feature_data[][] is equivalent to variable FeatureData[][] in spec,
1159 * which is after clip3() operation.
1160 * Clip3(x, y, z) = (z < x)? x : ((z > y)? y : z);
1161 * The limit is defined in Segmentation_Feature_Max[ SEG_LVL_MAX ] = {
1162 * 255, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, 7, 0, 0 }
1163 */
1164 int16_t feature_data[8][8];
1165
1166 /** \brief indicates if a feature is enabled or not.
1167 * Each bit field itself is the feature_id. Index is segment_id.
1168 * feature_mask[segment_id] & (1 << feature_id) equal to 1 specify that the feature of
1169 * feature_id for segment of segment_id is enabled, otherwise disabled.
1170 */
1171 uint8_t feature_mask[8];
1172
1173 /** \brief Reserved bytes for future use, must be zero */
1174 uint32_t reserved[4];
1176
1177/** \brief Film Grain Information for AV1
1178 */
1179typedef struct _RocdecAv1FilmGrainStruct
1180{
1181 union
1182 {
1183 struct
1184 {
1185 /** \brief Specify whether or not film grain is applied on current frame.
1186 * If set to 0, all the rest parameters should be set to zero
1187 * and ignored.
1188 */
1189 uint32_t apply_grain : 1;
1190 uint32_t chroma_scaling_from_luma : 1;
1191 uint32_t grain_scaling_minus_8 : 2;
1192 uint32_t ar_coeff_lag : 2;
1193 uint32_t ar_coeff_shift_minus_6 : 2;
1194 uint32_t grain_scale_shift : 2;
1195 uint32_t overlap_flag : 1;
1196 uint32_t clip_to_restricted_range : 1;
1197 /** \brief Reserved bytes for future use, must be zero */
1198 uint32_t reserved : 20;
1199 } bits;
1200 uint32_t value;
1201 } film_grain_info_fields;
1202
1203 uint16_t grain_seed;
1204 /* value range [0..14] */
1206 uint8_t point_y_value[14];
1207 uint8_t point_y_scaling[14];
1208 /* value range [0..10] */
1210 uint8_t point_cb_value[10];
1211 uint8_t point_cb_scaling[10];
1212 /* value range [0..10] */
1214 uint8_t point_cr_value[10];
1215 uint8_t point_cr_scaling[10];
1216 /* value range [-128..127] */
1217 int8_t ar_coeffs_y[24];
1218 int8_t ar_coeffs_cb[25];
1219 int8_t ar_coeffs_cr[25];
1220 uint8_t cb_mult;
1222 uint16_t cb_offset;
1223 uint8_t cr_mult;
1225 uint16_t cr_offset;
1226
1227 /** \brief Reserved bytes for future use, must be zero */
1228 uint32_t reserved[4];
1230
1231typedef enum
1232{
1233 /** identity transformation, 0-parameter */
1235 /** translational motion, 2-parameter */
1237 /** simplified affine with rotation + zoom only, 4-parameter */
1239 /** affine, 6-parameter */
1241 /** transformation count */
1244
1245typedef struct _RocdecAv1WarpedMotionParams
1246{
1247 /** \brief Specify the type of warped motion */
1249
1250 /** \brief Specify warp motion parameters
1251 * wm.wmmat[] corresponds to gm_params[][] in spec.
1252 * Details in AV1 spec section 5.9.24 or refer to libaom code
1253 * https://aomedia.googlesource.com/aom/+/refs/heads/master/av1/decoder/decodeframe.c
1254 */
1255 int32_t wmmat[8];
1256
1257 /* valid or invalid on affine set */
1258 uint8_t invalid;
1259
1260 /** \brief Reserved bytes for future use, must be zero */
1261 uint32_t reserved[4];
1263
1264/***********************************************************/
1265//! \struct RocdecAv1PicParams
1266//! \ingroup group_amd_rocdecode
1267//! AV1 picture parameters
1268//! This structure is used in RocdecAv1PicParams structure
1269/***********************************************************/
1270typedef struct _RocdecAV1PicParams
1271{
1272 /** \brief sequence level information
1273 */
1274
1275 /** \brief AV1 bit stream profile
1276 */
1277 uint8_t profile;
1278
1280
1281 /** \brief bit depth index
1282 * value range [0..2]
1283 * 0 - bit depth 8;
1284 * 1 - bit depth 10;
1285 * 2 - bit depth 12;
1286 */
1288
1289 /** \brief corresponds to AV1 spec variable of the same name. */
1291
1292 union
1293 {
1294 struct
1295 {
1296 uint32_t still_picture : 1;
1297 uint32_t use_128x128_superblock : 1;
1298 uint32_t enable_filter_intra : 1;
1299 uint32_t enable_intra_edge_filter : 1;
1300
1301 /** read_compound_tools */
1302 uint32_t enable_interintra_compound : 1;
1303 uint32_t enable_masked_compound : 1;
1304
1305 uint32_t enable_dual_filter : 1;
1306 uint32_t enable_order_hint : 1;
1307 uint32_t enable_jnt_comp : 1;
1308 uint32_t enable_cdef : 1;
1309 uint32_t mono_chrome : 1;
1310 uint32_t color_range : 1;
1311 uint32_t subsampling_x : 1;
1312 uint32_t subsampling_y : 1;
1313 uint32_t chroma_sample_position : 1;
1314 uint32_t film_grain_params_present : 1;
1315 /** \brief Reserved bytes for future use, must be zero */
1316 uint32_t reserved : 16;
1317 } fields;
1318 uint32_t value;
1319 } seq_info_fields;
1320
1321 /** \brief Picture level information
1322 */
1323
1324 /** \brief buffer description of decoded current picture
1325 */
1327
1328 /** \brief display buffer of current picture
1329 * Used for film grain applied decoded picture.
1330 * Valid only when apply_grain equals 1.
1331 */
1333
1334 /** \brief number of anchor frames for large scale tile
1335 * This parameter gives the number of entries of anchor_frames_list[].
1336 * Value range [0..128].
1337 */
1339
1340 /** \brief anchor frame list for large scale tile
1341 * For large scale tile applications, the anchor frames could come from
1342 * previously decoded frames in current sequence (aka. internal), or
1343 * from external sources.
1344 * For external anchor frames, application should call API
1345 * vaCreateBuffer() to generate frame buffers and populate them with
1346 * pixel frames. And this process may happen multiple times.
1347 * The array anchor_frames_list[] is used to register all the available
1348 * anchor frames from both external and internal, up to the current
1349 * frame instance. If a previously registerred anchor frame is no longer
1350 * needed, it should be removed from the list. But it does not prevent
1351 * applications from relacing the frame buffer with new anchor frames.
1352 * Please note that the internal anchor frames may not still be present
1353 * in the current DPB buffer. But if it is in the anchor_frames_list[],
1354 * it should not be replaced with other frames or removed from memory
1355 * until it is not shown in the list.
1356 * This number of entries of the list is given by parameter anchor_frames_num.
1357 */
1359
1360 /** \brief Picture resolution minus 1
1361 * Picture original resolution. If SuperRes is enabled,
1362 * this is the upscaled resolution.
1363 * value range [0..65535]
1364 */
1367
1368 /** \brief Output frame buffer size in unit of tiles
1369 * Valid only when large_scale_tile equals 1.
1370 * value range [0..65535]
1371 */
1374
1375 /** \brief Surface indices of reference frames in DPB.
1376 *
1377 * Contains a list of uncompressed frame buffer surface indices as references.
1378 * Application needs to make sure all the entries point to valid frames
1379 * except for intra frames by checking ref_frame_id[]. If missing frame
1380 * is identified, application may choose to perform error recovery by
1381 * pointing problematic index to an alternative frame buffer.
1382 * Driver is not responsible to validate reference frames' id.
1383 */
1384 int ref_frame_map[8];
1385
1386 /** \brief Reference frame indices.
1387 *
1388 * Contains a list of indices into ref_frame_map[8].
1389 * It specifies the reference frame correspondence.
1390 * The indices of the array are defined as [LAST_FRAME – LAST_FRAME,
1391 * LAST2_FRAME – LAST_FRAME, …, ALTREF_FRAME – LAST_FRAME], where each
1392 * symbol is defined as:
1393 * enum{INTRA_FRAME = 0, LAST_FRAME, LAST2_FRAME, LAST3_FRAME, GOLDEN_FRAME,
1394 * BWDREF_FRAME, ALTREF2_FRAME, ALTREF_FRAME};
1395 */
1396 uint8_t ref_frame_idx[7];
1397
1398 /** \brief primary reference frame index
1399 * Index into ref_frame_idx[], specifying which reference frame contains
1400 * propagated info that should be loaded at the start of the frame.
1401 * When value equals PRIMARY_REF_NONE (7), it indicates there is
1402 * no primary reference frame.
1403 * value range [0..7]
1404 */
1406 uint8_t order_hint;
1407
1410
1411 /** \brief tile structure
1412 * When uniform_tile_spacing_flag == 1, width_in_sbs_minus_1[] and
1413 * height_in_sbs_minus_1[] should be ignored, which will be generated
1414 * by driver based on tile_cols and tile_rows.
1415 */
1416 uint8_t tile_cols;
1417 uint8_t tile_rows;
1418
1419 /* The width/height of a tile minus 1 in units of superblocks. Though the
1420 * maximum number of tiles is 64, since ones of the last tile are computed
1421 * from ones of the other tiles and frame_width/height, they are not
1422 * necessarily specified.
1423 */
1424 uint16_t width_in_sbs_minus_1[63];
1425 uint16_t height_in_sbs_minus_1[63];
1426
1427 /** \brief number of tiles minus 1 in large scale tile list
1428 * Same as AV1 semantic element.
1429 * Valid only when large_scale_tiles == 1.
1430 */
1432
1433 /* specify the tile index for context updating */
1435
1436 union
1437 {
1438 /** \brief flags for current picture
1439 * same syntax and semantic as those in AV1 code
1440 */
1441 struct
1442 {
1443 /** \brief Frame Type:
1444 * 0: KEY_FRAME;
1445 * 1: INTER_FRAME;
1446 * 2: INTRA_ONLY_FRAME;
1447 * 3: SWITCH_FRAME
1448 * For SWITCH_FRAME, application shall set error_resilient_mode = 1,
1449 * refresh_frame_flags, etc. appropriately. And driver will convert it
1450 * to INTER_FRAME.
1451 */
1452 uint32_t frame_type : 2;
1453 uint32_t show_frame : 1;
1454 uint32_t showable_frame : 1;
1455 uint32_t error_resilient_mode : 1;
1456 uint32_t disable_cdf_update : 1;
1457 uint32_t allow_screen_content_tools : 1;
1458 uint32_t force_integer_mv : 1;
1459 uint32_t allow_intrabc : 1;
1460 uint32_t use_superres : 1;
1461 uint32_t allow_high_precision_mv : 1;
1462 uint32_t is_motion_mode_switchable : 1;
1463 uint32_t use_ref_frame_mvs : 1;
1464 /* disable_frame_end_update_cdf is coded as refresh_frame_context. */
1465 uint32_t disable_frame_end_update_cdf : 1;
1466 uint32_t uniform_tile_spacing_flag : 1;
1467 uint32_t allow_warped_motion : 1;
1468 /** \brief indicate if current frame in large scale tile mode */
1469 uint32_t large_scale_tile : 1;
1470
1471 /** \brief Reserved bytes for future use, must be zero */
1472 uint32_t reserved : 15;
1473 } bits;
1474 uint32_t value;
1475 } pic_info_fields;
1476
1477 /** \brief Supper resolution scale denominator.
1478 * When use_superres=1, superres_scale_denominator must be in the range [9..16].
1479 * When use_superres=0, superres_scale_denominator must be 8.
1480 */
1482
1483 /** \brief Interpolation filter.
1484 * value range [0..4]
1485 */
1487
1488 /** \brief luma loop filter levels.
1489 * value range [0..63].
1490 */
1491 uint8_t filter_level[2];
1492
1493 /** \brief chroma loop filter levels.
1494 * value range [0..63].
1495 */
1498
1499 union
1500 {
1501 struct
1502 {
1503 /** \brief flags for reference pictures
1504 * same syntax and semantic as those in AV1 code
1505 */
1506 uint8_t sharpness_level : 3;
1507 uint8_t mode_ref_delta_enabled : 1;
1508 uint8_t mode_ref_delta_update : 1;
1509
1510 /** \brief Reserved bytes for future use, must be zero */
1511 uint8_t reserved : 3;
1512 } bits;
1513 uint8_t value;
1514 } loop_filter_info_fields;
1515
1516 /** \brief The adjustment needed for the filter level based on
1517 * the chosen reference frame.
1518 * value range [-64..63].
1519 */
1520 int8_t ref_deltas[8];
1521
1522 /** \brief The adjustment needed for the filter level based on
1523 * the chosen mode.
1524 * value range [-64..63].
1525 */
1526 int8_t mode_deltas[2];
1527
1528 /** \brief quantization
1529 */
1530 /** \brief Y AC index
1531 * value range [0..255]
1532 */
1534 /** \brief Y DC delta from Y AC
1535 * value range [-64..63]
1536 */
1538 /** \brief U DC delta from Y AC
1539 * value range [-64..63]
1540 */
1542 /** \brief U AC delta from Y AC
1543 * value range [-64..63]
1544 */
1546 /** \brief V DC delta from Y AC
1547 * value range [-64..63]
1548 */
1550 /** \brief V AC delta from Y AC
1551 * value range [-64..63]
1552 */
1554
1555 /** \brief quantization_matrix
1556 */
1557 union
1558 {
1559 struct
1560 {
1561 uint16_t using_qmatrix : 1;
1562 /** \brief qm level
1563 * value range [0..15]
1564 * Invalid if using_qmatrix equals 0.
1565 */
1566 uint16_t qm_y : 4;
1567 uint16_t qm_u : 4;
1568 uint16_t qm_v : 4;
1569
1570 /** \brief Reserved bytes for future use, must be zero */
1571 uint16_t reserved : 3;
1572 } bits;
1573 uint16_t value;
1574 } qmatrix_fields;
1575
1576 union
1577 {
1578 struct
1579 {
1580 /** \brief delta_q parameters
1581 */
1582 uint32_t delta_q_present_flag : 1;
1583 uint32_t log2_delta_q_res : 2;
1584
1585 /** \brief delta_lf parameters
1586 */
1587 uint32_t delta_lf_present_flag : 1;
1588 uint32_t log2_delta_lf_res : 2;
1589
1590 /** \brief CONFIG_LOOPFILTER_LEVEL
1591 */
1592 uint32_t delta_lf_multi : 1;
1593
1594 /** \brief read_tx_mode
1595 * value range [0..2]
1596 */
1597 uint32_t tx_mode : 2;
1598
1599 /* AV1 frame reference mode semantic */
1600 uint32_t reference_select : 1;
1601
1602 uint32_t reduced_tx_set_used : 1;
1603
1604 uint32_t skip_mode_present : 1;
1605
1606 /** \brief Reserved bytes for future use, must be zero */
1607 uint32_t reserved : 20;
1608 } bits;
1609 uint32_t value;
1610 } mode_control_fields;
1611
1612 /** \brief CDEF parameters
1613 */
1614 /* value range [0..3] */
1616 /* value range [0..3] */
1617 uint8_t cdef_bits;
1618
1619 /** Encode cdef strength:
1620 *
1621 * The cdef_y_strengths[] and cdef_uv_strengths[] are expected to be packed
1622 * with both primary and secondary strength. The secondary strength is
1623 * given in the lower two bits and the primary strength is given in the next
1624 * four bits.
1625 *
1626 * cdef_y_strengths[] & cdef_uv_strengths[] should be derived as:
1627 * (cdef_y_strengths[]) = (cdef_y_pri_strength[] << 2) | (cdef_y_sec_strength[] & 0x03)
1628 * (cdef_uv_strengths[]) = (cdef_uv_pri_strength[] << 2) | (cdef_uv_sec_strength[] & 0x03)
1629 * In which,
1630 * cdef_y_pri_strength[]/cdef_y_sec_strength[]/cdef_uv_pri_strength[]/cdef_uv_sec_strength[] are
1631 * variables defined in AV1 Spec 5.9.19. The cdef_y_strengths[] & cdef_uv_strengths[] are
1632 * corresponding to LIBAOM variables cm->cdef_strengths[] & cm->cdef_uv_strengths[]
1633 * respectively.
1634 */
1635 /* value range [0..63] */
1636 uint8_t cdef_y_strengths[8];
1637 /* value range [0..63] */
1638 uint8_t cdef_uv_strengths[8];
1639
1640 /** \brief loop restoration parameters
1641 */
1642 union
1643 {
1644 struct
1645 {
1646 uint16_t yframe_restoration_type : 2;
1647 uint16_t cbframe_restoration_type : 2;
1648 uint16_t crframe_restoration_type : 2;
1649 uint16_t lr_unit_shift : 2;
1650 uint16_t lr_uv_shift : 1;
1651
1652 /** \brief Reserved bytes for future use, must be zero */
1653 uint16_t reserved : 7;
1654 } bits;
1655 uint16_t value;
1656 } loop_restoration_fields;
1657
1658 /** \brief global motion
1659 */
1661
1662 /**@}*/
1663
1664 /** \brief Reserved bytes for future use, must be zero */
1665 uint32_t reserved[8];
1667
1668/***********************************************************/
1669//! \struct RocdecAv1SliceParams
1670//! \ingroup group_amd_rocdecode
1671//! AV1 slice parameter buffer
1672//! This structure is configured to be the same as VA-API VASliceParameterBufferAV1 structure.
1673//! This structure conveys parameters related to bit stream data and should be sent once per tile.
1674//! It uses the name RocdecAv1SliceParams to be consistent with other codec, but actually means
1675//! RocdecTileParameterAV1. Slice data buffer of VASliceDataBufferType is used to send the
1676//! bitstream.
1677/***********************************************************/
1678typedef struct _RocdecAv1SliceParams
1679{
1680 /** \brief The byte count of current tile in the bitstream buffer,
1681 * starting from first byte of the buffer.
1682 * It uses the name slice_data_size to be consistent with other codec,
1683 * but actually means tile_data_size.
1684 */
1686 /**
1687 * offset to the first byte of the data buffer.
1688 */
1690 /**
1691 * see VA_SLICE_DATA_FLAG_XXX definitions
1692 */
1694
1695 uint16_t tile_row;
1696 uint16_t tile_column;
1697
1698 uint16_t tg_start;
1699 uint16_t tg_end;
1700
1701 /** \brief anchor frame index for large scale tile.
1702 * index into an array AnchorFrames of the frames that the tile uses
1703 * for prediction.
1704 * valid only when large_scale_tile equals 1.
1705 */
1707
1708 /** \brief tile index in the tile list.
1709 * Valid only when large_scale_tile is enabled.
1710 * Driver uses this field to decide the tile output location.
1711 */
1713
1714 /** \brief Reserved bytes for future use, must be zero */
1715 uint32_t reserved[4];
1717
1718/******************************************************************************************/
1719//! \struct _RocdecPicParams
1720//! \ingroup group_amd_rocdecode
1721//! Picture parameters for decoding
1722//! This structure is used in rocDecDecodePicture API
1723//! IN for rocDecDecodePicture
1724/******************************************************************************************/
1725typedef struct _RocdecPicParams
1726{
1727 int pic_width; /**< IN: Coded frame width */
1728 int pic_height; /**< IN: Coded frame height */
1729 int curr_pic_idx; /**< IN: Output index of the current picture */
1730 int field_pic_flag; /**< IN: 0=frame picture, 1=field picture */
1731 int bottom_field_flag; /**< IN: 0=top field, 1=bottom field (ignored if field_pic_flag=0) */
1732 int second_field; /**< IN: Second field of a complementary field pair */
1733 // Bitstream data
1734 uint32_t bitstream_data_len; /**< IN: Number of bytes in bitstream data buffer */
1735 const uint8_t* bitstream_data; /**< IN: Ptr to bitstream data for this picture (slice-layer) */
1736 uint32_t num_slices; /**< IN: Number of slices in this picture */
1737
1738 int ref_pic_flag; /**< IN: This picture is a reference picture */
1739 int intra_pic_flag; /**< IN: This picture is entirely intra coded */
1740 uint32_t reserved[30]; /**< Reserved for future use */
1741
1742 // IN: Codec-specific data
1743 union
1744 {
1745 RocdecMpeg2PicParams mpeg2; /**< Also used for MPEG-1 */
1752 uint32_t codec_reserved[256];
1753 } pic_params;
1754
1755 /*! \brief Variable size array. The user should allocate one slice param struct for each slice.
1756 */
1757 union
1758 {
1759 // Todo: Add slice params defines for other codecs.
1764 } slice_params;
1765
1766 union
1767 {
1768 // Todo: Added IQ matrix defines for other codecs.
1770 RocdecHevcIQMatrix hevc;
1771 } iq_matrix;
1773
1774/******************************************************/
1775//! \struct RocdecProcParams
1776//! \ingroup group_amd_rocdecode
1777//! Picture parameters for postprocessing
1778//! This structure is used in rocDecGetVideoFrame API
1779/******************************************************/
1780typedef struct _RocdecProcParams
1781{
1782 int progressive_frame; /**< IN: Input is progressive (deinterlace_mode will be ignored) */
1783 int top_field_first; /**< IN: Input frame is top field first (1st field is top, 2nd field is
1784 bottom) */
1785 uint32_t reserved_flags[2]; /**< Reserved for future use (set to zero) */
1786
1787 // The fields below are used for raw YUV input
1788 uint64_t raw_input_dptr; /**< IN: Input HIP device ptr for raw YUV extensions */
1789 uint32_t raw_input_pitch; /**< IN: pitch in bytes of raw YUV input (should be aligned
1790 appropriately) */
1791 uint32_t raw_input_format; /**< IN: Input YUV format (rocDecVideoCodec_enum) */
1792 uint64_t raw_output_dptr; /**< IN: Output HIP device mem ptr for raw YUV extensions */
1793 uint32_t raw_output_pitch; /**< IN: pitch in bytes of raw YUV output (should be aligned
1794 appropriately) */
1795 uint32_t raw_output_format; /**< IN: Output YUV format (rocDecVideoCodec_enum) */
1796 uint32_t reserved[16]; /**< Reserved for future use (set to zero) */
1798
1799/*****************************************************************************************************/
1800//! \fn rocDecStatus ROCDECAPI rocDecCreateDecoder(rocDecDecoderHandle *decoder_handle,
1801//! RocDecoderCreateInfo *decoder_create_info) \ingroup group_amd_rocdecode Create the decoder
1802//! object based on decoder_create_info. A handle to the created decoder is returned
1803/*****************************************************************************************************/
1805rocDecCreateDecoder(rocDecDecoderHandle* decoder_handle, RocDecoderCreateInfo* decoder_create_info);
1806
1807/*****************************************************************************************************/
1808//! \fn rocDecStatus ROCDECAPI rocDecDestroyDecoder(rocDecDecoderHandle decoder_handle)
1809//! \ingroup group_amd_rocdecode
1810//! Destroy the decoder object
1811/*****************************************************************************************************/
1814
1815/**********************************************************************************************************************/
1816//! \fn rocDecStatus ROCDECAPI rocdecGetDecoderCaps(RocdecDecodeCaps *decode_caps)
1817//! \ingroup group_amd_rocdecode
1818//! Queries decode capabilities of AMD's VCN decoder based on codec type, chroma_format and
1819//! BitDepthMinus8 parameters.
1820//! 1. Application fills IN parameters codec_type, chroma_format and BitDepthMinus8 of
1821//! RocdecDecodeCaps structure
1822//! 2. On calling rocdecGetDecoderCaps, driver fills OUT parameters (for GPU device) if the IN
1823//! parameters are supported
1824//! If IN parameters passed to the driver are not supported by AMD-VCN-HW, then all OUT params
1825//! are set to 0.
1826/**********************************************************************************************************************/
1829
1830/*****************************************************************************************************/
1831//! \fn rocDecStatus ROCDECAPI rocDecDecodeFrame(rocDecDecoderHandle decoder_handle, RocdecPicParams
1832//! *pic_params) \ingroup group_amd_rocdecode Decodes a single picture Submits the frame for HW
1833//! decoding
1834/*****************************************************************************************************/
1837
1838/************************************************************************************************************/
1839//! \fn rocDecStatus ROCDECAPI rocDecGetDecodeStatus(rocDecDecoderHandle decoder_handle, int
1840//! pic_idx, RocdecDecodeStatus* decode_status); \ingroup group_amd_rocdecode Get the decode status
1841//! for frame corresponding to nPicIdx API is currently supported for HEVC, AVC/H264 and JPEG
1842//! codecs. API returns ROCDEC_NOT_SUPPORTED error code for unsupported GPU or codec.
1843/************************************************************************************************************/
1846 int pic_idx,
1847 RocdecDecodeStatus* decode_status);
1848
1849/*********************************************************************************************************/
1850//! \fn rocDecStatus ROCDECAPI rocDecReconfigureDecoder(rocDecDecoderHandle decoder_handle,
1851//! RocdecReconfigureDecoderInfo *reconfig_params) \ingroup group_amd_rocdecode Used to reuse single
1852//! decoder for multiple clips. Currently supports resolution change, resize params params, target
1853//! area params change for same codec. Must be called during
1854//! RocdecParserParams::pfn_sequence_callback
1855/*********************************************************************************************************/
1858 RocdecReconfigureDecoderInfo* reconfig_params);
1859
1860/************************************************************************************************************************/
1861//! \fn extern rocDecStatus ROCDECAPI rocDecGetVideoFrame(rocDecDecoderHandle decoder_handle, int
1862//! pic_idx,
1863//! uint32_t *dev_mem_ptr, uint32_t *horizontal_pitch,
1864//! RocdecProcParams *vid_postproc_params);
1865//! \ingroup group_amd_rocdecode
1866//! Post-process and map video frame corresponding to pic_idx for use in HIP. Returns HIP device
1867//! pointer and associated pitch(horizontal stride) of the video frame. Returns device memory
1868//! pointers and pitch for each plane (Y, U and V) seperately horizontal_pitch is a pointer to an
1869//! unsigned 32-bit integer array of size 3.
1870/************************************************************************************************************************/
1873 int pic_idx,
1874 void* dev_mem_ptr[3],
1875 uint32_t* horizontal_pitch,
1876 RocdecProcParams* vid_postproc_params);
1877
1878/*****************************************************************************************************/
1879//! \fn const char* ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status)
1880//! \ingroup group_amd_rocdecode
1881//! Return name of the specified error code in text form.
1882/*****************************************************************************************************/
1883extern const char* ROCDECAPI
1885
1886#ifdef __cplusplus
1887}
1888#endif
int8_t u_dc_delta_q
U DC delta from Y AC value range [-64..63].
Definition rocdecode.h:1541
uint32_t slice_data_offset
Definition rocdecode.h:1689
uint32_t backward_reference_picture
Definition rocdecode.h:421
uint16_t min_width
Definition rocdecode.h:195
uint32_t raw_input_format
Definition rocdecode.h:1791
uint32_t bit_depth_minus_8
Definition rocdecode.h:214
uint8_t bit_depth
VP9 bit depth per sample same for both luma and chroma samples.
Definition rocdecode.h:997
uint32_t bit_depth_minus_8
Definition rocdecode.h:187
uint8_t log2_max_pic_order_cnt_lsb_minus4
Definition rocdecode.h:694
uint8_t profile
VP9 Profile definition value range [0..3].
Definition rocdecode.h:992
uint16_t frame_width
picture width Picture original resolution. The value may not be multiple of 8.
Definition rocdecode.h:870
int32_t picture_coding_type
Definition rocdecode.h:423
int current_frame
Picture level information.
Definition rocdecode.h:1326
uint16_t slice_data_num_emu_prevn_bytes
Number of emulation prevention bytes in slice header.
Definition rocdecode.h:801
rocDecVideoChromaFormat chroma_format
Definition rocdecode.h:213
rocDecVideoChromaFormat chroma_format
Definition rocdecode.h:186
int current_display_picture
display buffer of current picture Used for film grain applied decoded picture. Valid only when apply_...
Definition rocdecode.h:1332
rocDecDecodeStatus decode_status
Definition rocdecode.h:258
int8_t pic_init_qp_minus26
Definition rocdecode.h:499
int8_t slice_beta_offset_div2
Definition rocdecode.h:781
uint8_t log2_tile_rows
number of tile rows specified by (1 << log2_tile_rows). It corresponds the variable with same name in...
Definition rocdecode.h:962
uint64_t raw_input_dptr
Definition rocdecode.h:1788
int32_t bottom_field_order_cnt
Definition rocdecode.h:311
uint8_t log2_diff_max_min_pcm_luma_coding_block_size
Definition rocdecode.h:647
uint16_t picture_width_in_luma_samples
Definition rocdecode.h:602
uint16_t min_height
Definition rocdecode.h:196
uint8_t log2_diff_max_min_transform_block_size
Definition rocdecode.h:645
uint32_t slice_data_offset
Definition rocdecode.h:1086
int32_t load_chroma_intra_quantiser_matrix
Definition rocdecode.h:402
uint8_t luma_log2_weight_denom
Definition rocdecode.h:783
uint8_t log2_tile_columns
number of tile columns specified by (1 << log2_tile_columns). It corresponds the variable with same n...
Definition rocdecode.h:966
uint32_t num_decode_surfaces
Definition rocdecode.h:211
uint8_t log2_min_luma_coding_block_size_minus3
Definition rocdecode.h:642
uint32_t slice_data_size
Definition rocdecode.h:533
int8_t v_ac_delta_q
V AC delta from Y AC value range [-64..63].
Definition rocdecode.h:1553
uint8_t num_decoders
Definition rocdecode.h:190
uint8_t num_ref_idx_l1_active_minus1
Definition rocdecode.h:551
int8_t pps_tc_offset_div2
Definition rocdecode.h:700
uint8_t order_hint_bits_minus_1
Definition rocdecode.h:1279
uint8_t num_ref_idx_l1_active_minus1
Definition rocdecode.h:777
uint8_t slice_group_map_type
Definition rocdecode.h:497
uint32_t raw_input_pitch
Definition rocdecode.h:1789
uint8_t tile_cols
tile structure When uniform_tile_spacing_flag == 1, width_in_sbs_minus_1[] and height_in_sbs_minus_1[...
Definition rocdecode.h:1416
uint8_t cdef_damping_minus_3
CDEF parameters.
Definition rocdecode.h:1615
int32_t load_non_intra_quantiser_matrix
Definition rocdecode.h:401
uint32_t forward_reference_pic
Definition rocdecode.h:420
uint16_t slice_group_change_rate_minus1
Definition rocdecode.h:498
int32_t load_intra_quantiser_matrix
Definition rocdecode.h:400
uint8_t superres_scale_denominator
Supper resolution scale denominator. When use_superres=1, superres_scale_denominator must be in the r...
Definition rocdecode.h:1481
uint8_t num_short_term_ref_pic_sets
Definition rocdecode.h:695
uint32_t slice_data_offset
Definition rocdecode.h:534
uint8_t diff_cu_qp_delta_depth
Definition rocdecode.h:651
RocdecAv1FilmGrainStruct film_grain_info
Definition rocdecode.h:1409
uint32_t raw_output_pitch
Definition rocdecode.h:1793
uint16_t picture_width_in_mbs_minus1
Definition rocdecode.h:471
uint8_t anchor_frame_idx
anchor frame index for large scale tile. index into an array AnchorFrames of the frames that the tile...
Definition rocdecode.h:1706
uint8_t num_ref_idx_l0_default_active_minus1
Definition rocdecode.h:697
uint32_t slice_data_flag
Slice data buffer flags. See VA_SLICE_DATA_FLAG_XXX.
Definition rocdecode.h:731
uint8_t num_ref_frames
Definition rocdecode.h:475
uint32_t st_rps_bits
number of bits that structure short_term_ref_pic_set( num_short_term_ref_pic_sets ) takes in slice se...
Definition rocdecode.h:712
uint8_t filter_level_u
chroma loop filter levels. value range [0..63].
Definition rocdecode.h:1496
uint8_t chroma_weight_l1_flag
Definition rocdecode.h:570
uint16_t picture_height_in_luma_samples
Definition rocdecode.h:603
uint8_t pcm_sample_bit_depth_luma_minus1
Definition rocdecode.h:640
int8_t slice_alpha_c0_offset_div2
Definition rocdecode.h:555
RocdecAvcPicture curr_pic
Definition rocdecode.h:469
uint32_t raw_output_format
Definition rocdecode.h:1795
uint16_t first_mb_in_slice
Definition rocdecode.h:547
int8_t v_dc_delta_q
V DC delta from Y AC value range [-64..63].
Definition rocdecode.h:1549
uint8_t chroma_log2_weight_denom
Definition rocdecode.h:560
uint32_t max_width
Definition rocdecode.h:193
uint32_t num_output_surfaces
Definition rocdecode.h:236
uint32_t slice_data_size
Number of bytes in the slice data buffer for this slice counting from and including NAL unit header.
Definition rocdecode.h:727
uint8_t num_extra_slice_header_bits
Definition rocdecode.h:701
uint32_t slice_data_size
The byte count of current tile in the bitstream buffer, starting from first byte of the buffer....
Definition rocdecode.h:1685
uint16_t entry_offset_to_subset_array
Definition rocdecode.h:799
RocdecMpeg2QMatrix q_matrix
Definition rocdecode.h:445
uint8_t is_supported
Definition rocdecode.h:189
uint16_t frame_width_minus1
Picture resolution minus 1 Picture original resolution. If SuperRes is enabled, this is the upscaled ...
Definition rocdecode.h:1365
rocDecVideoSurfaceFormat output_format
Definition rocdecode.h:232
uint8_t direct_spatial_mv_pred_flag
Definition rocdecode.h:549
int8_t pps_beta_offset_div2
Definition rocdecode.h:699
uint16_t frame_height
picture height Picture original resolution. The value may not be multiple of 8.
Definition rocdecode.h:874
uint8_t num_ref_idx_l0_active_minus1
Definition rocdecode.h:776
uint8_t num_long_term_ref_pic_sps
Definition rocdecode.h:696
uint8_t max_transform_hierarchy_depth_intra
Definition rocdecode.h:648
int8_t slice_beta_offset_div2
Definition rocdecode.h:556
uint16_t output_frame_width_in_tiles_minus_1
Output frame buffer size in unit of tiles Valid only when large_scale_tile equals 1....
Definition rocdecode.h:1372
uint8_t primary_ref_frame
primary reference frame index Index into ref_frame_idx[], specifying which reference frame contains p...
Definition rocdecode.h:1405
uint8_t sps_max_dec_pic_buffering_minus1
Definition rocdecode.h:637
uint8_t device_id
Definition rocdecode.h:183
RocdecAv1SegmentationStruct seg_info
Definition rocdecode.h:1408
uint32_t slice_data_flag
Definition rocdecode.h:535
int8_t pic_init_qs_minus26
Definition rocdecode.h:500
uint8_t interp_filter
Interpolation filter. value range [0..4].
Definition rocdecode.h:1486
int * anchor_frames_list
anchor frame list for large scale tile For large scale tile applications, the anchor frames could com...
Definition rocdecode.h:1358
uint8_t num_ref_idx_l0_active_minus1
Definition rocdecode.h:550
uint8_t base_qindex
quantization
Definition rocdecode.h:1533
uint8_t bit_depth_luma_minus8
Definition rocdecode.h:473
int8_t chroma_qp_index_offset
Definition rocdecode.h:501
uint8_t log2_min_pcm_luma_coding_block_size_minus3
Definition rocdecode.h:646
uint8_t bit_depth_chroma_minus8
Definition rocdecode.h:639
uint16_t tile_count_minus_1
number of tiles minus 1 in large scale tile list Same as AV1 semantic element. Valid only when large_...
Definition rocdecode.h:1431
int8_t delta_chroma_log2_weight_denom
Definition rocdecode.h:784
uint8_t luma_weight_l0_flag
Definition rocdecode.h:561
uint16_t output_format_mask
Definition rocdecode.h:191
uint8_t num_tile_rows_minus1
Definition rocdecode.h:656
uint8_t num_tile_columns_minus1
Definition rocdecode.h:655
uint8_t log2_parallel_merge_level_minus2
Definition rocdecode.h:654
uint8_t sharpness_level
Definition rocdecode.h:957
uint8_t bit_depth_idx
bit depth index value range [0..2] 0 - bit depth 8; 1 - bit depth 10; 2 - bit depth 12;
Definition rocdecode.h:1287
uint16_t slice_data_bit_offset
Bit offset from NAL Header Unit to the begining of slice_data().
Definition rocdecode.h:546
uint32_t slice_data_byte_offset
Byte offset from NAL unit header to the begining of slice_data().
Definition rocdecode.h:742
uint8_t frame_header_length_in_bytes
Number of bytes taken up by the uncompressed frame header, which corresponds to byte length of functi...
Definition rocdecode.h:975
uint8_t log2_min_transform_block_size_minus2
Definition rocdecode.h:644
uint32_t slice_segment_address
Definition rocdecode.h:744
uint8_t anchor_frames_num
number of anchor frames for large scale tile This parameter gives the number of entries of anchor_fra...
Definition rocdecode.h:1338
uint8_t log2_diff_max_min_luma_coding_block_size
Definition rocdecode.h:643
uint8_t chroma_weight_l0_flag
Definition rocdecode.h:564
uint16_t picture_height_in_mbs_minus1
Definition rocdecode.h:472
uint16_t num_entry_point_offsets
Definition rocdecode.h:798
uint8_t luma_log2_weight_denom
Definition rocdecode.h:559
uint8_t luma_weight_l1_flag
Definition rocdecode.h:567
RocdecHevcPicture curr_pic
Definition rocdecode.h:600
uint8_t num_ref_idx_l1_default_active_minus1
Definition rocdecode.h:698
int32_t load_chroma_non_intra_quantiser_matrix
Definition rocdecode.h:403
uint32_t max_height
Definition rocdecode.h:194
uint8_t disable_deblocking_filter_idc
Definition rocdecode.h:554
uint32_t frame_idx
Definition rocdecode.h:308
uint8_t matrix_coefficients
corresponds to AV1 spec variable of the same name.
Definition rocdecode.h:1290
uint16_t frame_height_minus1
Definition rocdecode.h:1366
int8_t u_ac_delta_q
U AC delta from Y AC value range [-64..63].
Definition rocdecode.h:1545
rocDecVideoCodec codec_type
Definition rocdecode.h:212
uint64_t raw_output_dptr
Definition rocdecode.h:1792
uint8_t five_minus_max_num_merge_cand
Definition rocdecode.h:797
uint16_t tile_idx_in_tile_list
tile index in the tile list. Valid only when large_scale_tile is enabled. Driver uses this field to d...
Definition rocdecode.h:1712
uint8_t pcm_sample_bit_depth_chroma_minus1
Definition rocdecode.h:641
int32_t top_field_order_cnt
Definition rocdecode.h:310
uint32_t slice_data_size
The byte count of current frame in the bitstream buffer, starting from first byte of the buffer....
Definition rocdecode.h:1082
uint8_t max_transform_hierarchy_depth_inter
Definition rocdecode.h:649
int8_t second_chroma_qp_index_offset
Definition rocdecode.h:502
uint16_t horizontal_size
Definition rocdecode.h:418
int8_t y_dc_delta_q
Y DC delta from Y AC value range [-64..63].
Definition rocdecode.h:1537
uint8_t num_slice_groups_minus1
Definition rocdecode.h:496
uint16_t output_frame_height_in_tiles_minus_1
Definition rocdecode.h:1373
rocDecVideoCodec codec_type
Definition rocdecode.h:185
uint16_t context_update_tile_id
Definition rocdecode.h:1434
uint8_t bit_depth_chroma_minus8
Definition rocdecode.h:474
uint8_t profile
sequence level information
Definition rocdecode.h:1277
uint16_t first_partition_size
The byte count of compressed header the bitstream buffer, which corresponds to syntax first_partition...
Definition rocdecode.h:980
uint8_t bit_depth_luma_minus8
Definition rocdecode.h:638
uint32_t slice_data_offset
The offset to the NAL unit header for this slice.
Definition rocdecode.h:729
uint32_t intra_decode_only
Definition rocdecode.h:216
int poc
picture order count. ! in HEVC, POCs for top and bottom fields of same picture should take different ...
Definition rocdecode.h:337
Picture parameters for decoding This structure is used in rocDecDecodePicture API IN for rocDecDecode...
This structure is used in rocDecCreateDecoder API.
Definition rocdecode.h:206
AV1 picture parameters This structure is used in RocdecAv1PicParams structure.
Definition rocdecode.h:1271
AV1 slice parameter buffer This structure is configured to be the same as VA-API VASliceParameterBuff...
Definition rocdecode.h:1679
AVC Inverse Quantization Matrix This structure is configured to be the same as VA-API VAIQMatrixBuffe...
Definition rocdecode.h:583
AVC picture parameters This structure is used in RocdecAvcPicParams structure This structure is confi...
Definition rocdecode.h:468
AVC/H.264 Picture Entry This structure is used in RocdecAvcPicParams structure.
Definition rocdecode.h:306
AVC slice parameter buffer This structure is configured to be the same as VA-API VASliceParameterBuff...
Definition rocdecode.h:532
This structure is used in rocDecGetDecoderCaps API.
Definition rocdecode.h:182
Struct for reporting decode status. This structure is used in RocdecGetDecodeStatus API.
Definition rocdecode.h:257
HEVC IQMatrix This structure is sent once per frame, and only when scaling_list_enabled_flag = 1....
Definition rocdecode.h:817
HEVC picture parameters This structure is used in RocdecHevcPicParams structure.
Definition rocdecode.h:599
HEVC Picture Entry This structure is used in RocdecHevcPicParams structure.
Definition rocdecode.h:330
HEVC slice parameters This structure is used in RocdecPicParams structure.
Definition rocdecode.h:723
JPEG picture parameters This structure is used in RocdecPicParams structure.
Definition rocdecode.h:388
MPEG2 picture parameters This structure is used in RocdecMpeg2PicParams structure.
Definition rocdecode.h:417
MPEG2 QMatrix This structure is used in _RocdecMpeg2PicParams structure.
Definition rocdecode.h:399
Picture parameters for postprocessing This structure is used in rocDecGetVideoFrame API.
Definition rocdecode.h:1781
Struct for decoder reset This structure is used in rocDecReconfigureDecoder() API.
Definition rocdecode.h:270
JPEG picture parameters This structure is used in RocdecVc1PicParams structure.
Definition rocdecode.h:456
VP9 picture parameters This structure is configured to be the same as VA-API VADecPictureParameterBuf...
Definition rocdecode.h:866
VP9 slice parameter buffer This structure is configured to be the same as VA-API VASliceParameterBuff...
Definition rocdecode.h:1076
rocDecStatus
Definition rocdecode.h:78
@ ROCDEC_DEVICE_INVALID
Definition rocdecode.h:79
@ ROCDEC_OUTOF_MEMORY
Definition rocdecode.h:82
@ ROCDEC_CONTEXT_INVALID
Definition rocdecode.h:80
@ ROCDEC_NOT_SUPPORTED
Definition rocdecode.h:86
@ ROCDEC_RUNTIME_ERROR
Definition rocdecode.h:81
@ ROCDEC_NOT_INITIALIZED
Definition rocdecode.h:85
@ ROCDEC_NOT_IMPLEMENTED
Definition rocdecode.h:84
@ ROCDEC_INVALID_PARAMETER
Definition rocdecode.h:83
@ ROCDEC_SUCCESS
Definition rocdecode.h:87
rocDecStatus rocDecGetVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx, void *dev_mem_ptr[3], uint32_t *horizontal_pitch, RocdecProcParams *vid_postproc_params)
rocDecStatus rocDecCreateDecoder(rocDecDecoderHandle *decoder_handle, RocDecoderCreateInfo *decoder_create_info)
object based on decoder_create_info. A handle to the created decoder is returned
rocDecStatus rocDecReconfigureDecoder(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params)
decoder for multiple clips. Currently supports resolution change, resize params params,...
rocDecVideoCodec
Definition rocdecode.h:97
@ rocDecVideoCodec_NV12
Definition rocdecode.h:113
@ rocDecVideoCodec_YV12
Definition rocdecode.h:111
@ rocDecVideoCodec_YUV420
Definition rocdecode.h:109
@ rocDecVideoCodec_UYVY
Definition rocdecode.h:117
@ rocDecVideoCodec_YUYV
Definition rocdecode.h:115
@ rocDecVideoCodec_AV1
Definition rocdecode.h:103
@ rocDecVideoCodec_MPEG4
Definition rocdecode.h:100
@ rocDecVideoCodec_HEVC
Definition rocdecode.h:102
@ rocDecVideoCodec_MPEG1
Definition rocdecode.h:98
@ rocDecVideoCodec_JPEG
Definition rocdecode.h:106
@ rocDecVideoCodec_VP9
Definition rocdecode.h:105
@ rocDecVideoCodec_AVC
Definition rocdecode.h:101
@ rocDecVideoCodec_MPEG2
Definition rocdecode.h:99
@ rocDecVideoCodec_VP8
Definition rocdecode.h:104
@ rocDecVideoCodec_NumCodecs
Definition rocdecode.h:107
int16_t chroma_dc_quant_scale
Specifies per segment Chroma DC quantization scale. Corresponding to uv_dequant[qindex][0] in vp9_mb_...
Definition rocdecode.h:1062
RocdecAv1TransformationType wmtype
Specify the type of warped motion.
Definition rocdecode.h:1248
int16_t luma_ac_quant_scale
Specifies per segment Luma AC quantization scale. Corresponding to y_dequant[qindex][1] in vp9_mb_ini...
Definition rocdecode.h:1047
uint32_t bitstream_data_len
Definition rocdecode.h:1734
const char * rocDecGetErrorName(rocDecStatus rocdec_status)
rocDecDecodeStatus
Definition rocdecode.h:165
@ rocDecodeStatus_Displaying
Definition rocdecode.h:173
@ rocDecodeStatus_Error
Definition rocdecode.h:170
@ rocDecodeStatus_Error_Concealed
Definition rocdecode.h:171
@ rocDecodeStatus_Invalid
Definition rocdecode.h:166
@ rocDecodeStatus_Success
Definition rocdecode.h:168
@ rocDecodeStatus_InProgress
Definition rocdecode.h:167
int16_t luma_dc_quant_scale
Specifies per segment Luma DC quantization scale. Corresponding to y_dequant[qindex][0] in vp9_mb_ini...
Definition rocdecode.h:1052
rocDecStatus rocDecGetDecoderCaps(RocdecDecodeCaps *decode_caps)
const uint8_t * bitstream_data
Definition rocdecode.h:1735
rocDecStatus rocDecDecodeFrame(rocDecDecoderHandle decoder_handle, RocdecPicParams *pic_params)
decoding
int16_t chroma_ac_quant_scale
Specifies per segment Chroma AC quantization scale. Corresponding to uv_dequant[qindex][1] in vp9_mb_...
Definition rocdecode.h:1057
void * rocDecDecoderHandle
HANDLE pf rocDecDecoder Used in subsequent API calls after rocDecCreateDecoder.
Definition rocdecode.h:69
uint32_t num_slices
Definition rocdecode.h:1736
rocDecVideoChromaFormat
Definition rocdecode.h:151
@ rocDecVideoChromaFormat_422
Definition rocdecode.h:154
@ rocDecVideoChromaFormat_444
Definition rocdecode.h:155
@ rocDecVideoChromaFormat_420
Definition rocdecode.h:153
@ rocDecVideoChromaFormat_Monochrome
Definition rocdecode.h:152
rocDecStatus rocDecDestroyDecoder(rocDecDecoderHandle decoder_handle)
rocDecStatus rocDecGetDecodeStatus(rocDecDecoderHandle decoder_handle, int pic_idx, RocdecDecodeStatus *decode_status)
RocdecAv1TransformationType
Definition rocdecode.h:1232
@ RocdecAv1TransformationTranslation
Definition rocdecode.h:1236
@ RocdecAv1TransformationAffine
Definition rocdecode.h:1240
@ RocdecAv1TransformationCount
Definition rocdecode.h:1242
@ RocdecAv1TransformationRotzoom
Definition rocdecode.h:1238
@ RocdecAv1TransformationIdentity
Definition rocdecode.h:1234
rocDecVideoSurfaceFormat
Definition rocdecode.h:127
@ rocDecVideoSurfaceFormat_YUV420
Definition rocdecode.h:137
@ rocDecVideoSurfaceFormat_YUV444_16Bit
Definition rocdecode.h:134
@ rocDecVideoSurfaceFormat_YUV420_16Bit
Definition rocdecode.h:139
@ rocDecVideoSurfaceFormat_P016
Definition rocdecode.h:130
@ rocDecVideoSurfaceFormat_NV12
Definition rocdecode.h:128
@ rocDecVideoSurfaceFormat_YUV444
Definition rocdecode.h:133
#define ROCDECAPI
Definition rocdecode.h:29
Film Grain Information for AV1.
Definition rocdecode.h:1180
Segmentation Information for AV1.
Definition rocdecode.h:1105
VP9 Segmentation Parameter Data Structure This structure is configured to be the same as VA-API VASeg...
Definition rocdecode.h:1009
rocDecode version