docs-7.0.0/api/rocdecode/rocparser.h Source File

docs-7.0.0/api/rocdecode/rocparser.h Source File#

rocDecode: docs-7.0.0/api/rocdecode/rocparser.h Source File
rocparser.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2023 - 2025 Advanced Micro Devices, Inc. All rights reserved.
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 */
22 
23 #pragma once
24 
25 #include "rocdecode/rocdecode.h"
26 
37 #if defined(__cplusplus)
38 extern "C" {
39 #endif /* __cplusplus */
40 
41 /*********************************************************************************/
44 /*********************************************************************************/
45 
46 typedef void *RocdecVideoParser;
47 typedef uint64_t RocdecTimeStamp;
48 
49 /***************************************************************/
53 /***************************************************************/
54 typedef enum {
58 
64 typedef struct {
65  rocDecVideoCodec codec;
69  struct {
71  uint32_t numerator;
73  uint32_t denominator;
74  } frame_rate;
88  uint32_t coded_width;
89  uint32_t coded_height;
96  struct {
97  int left;
98  int top;
99  int right;
100  int bottom;
101  } display_area;
102  rocDecVideoChromaFormat chroma_format;
103  uint32_t bitrate;
107  struct {
108  int x;
109  int y;
110  } display_aspect_ratio;
115  struct {
116  uint8_t video_format : 3;
117  uint8_t video_full_range_flag : 1;
118  uint8_t reserved_zero_bits : 4;
119  uint8_t color_primaries;
122  } video_signal_description;
124  uint32_t reconfig_options;
126 
127 /****************************************************************/
132 /****************************************************************/
133 typedef struct {
135  uint32_t max_width;
136  uint32_t max_height;
137  uint8_t raw_seqhdr_data[1024];
139 
140 /***************************************************************/
144 /***************************************************************/
145 typedef enum {
150  ROCDEC_PKT_NOTIFY_EOS = 0x10,
154 
155 /*****************************************************************************/
161 /*****************************************************************************/
162 typedef struct _RocdecSourceDataPacket {
163  uint32_t flags;
164  uint32_t payload_size;
165  const uint8_t *payload;
166  RocdecTimeStamp pts;
168 
169 /**********************************************************************************/
175 /**********************************************************************************/
176 typedef struct _RocdecParserDispInfo {
181  RocdecTimeStamp pts;
183 
190  rocDecVideoCodec codec;
191  union {
192  struct
193  {
194  uint8_t operating_points_cnt;
195  uint8_t reserved24_bits[3];
196  uint16_t operating_points_idc[32];
197  } av1;
198  uint8_t codec_reserved[1024];
199  };
201 
202 /**********************************************************************************/
206 /**********************************************************************************/
207 typedef struct _RocdecSeiMessage {
209  uint8_t reserved[3];
210  uint32_t sei_message_size;
212 
213 /**********************************************************************************/
217 /**********************************************************************************/
218 typedef struct _RocdecSeiMessageInfo {
219  void *sei_data;
221  uint32_t sei_message_count;
222  uint32_t picIdx;
224 
240 typedef int(ROCDECAPI *PFNVIDSEQUENCECALLBACK)(void *, RocdecVideoFormat *);
241 typedef int(ROCDECAPI *PFNVIDDECODECALLBACK)(void *, RocdecPicParams *);
242 typedef int(ROCDECAPI *PFNVIDDISPLAYCALLBACK)(void *, RocdecParserDispInfo *);
243 // typedef int (ROCDECAPI *PFNVIDOPPOINTCALLBACK)(void *, RocdecOperatingPointInfo*); // reserved for future (AV1 specific)
244 typedef int(ROCDECAPI *PFNVIDSEIMSGCALLBACK)(void *, RocdecSeiMessageInfo *);
245 
251 typedef struct _RocdecParserParams {
252  rocDecVideoCodec codec_type;
254  uint32_t clock_rate;
255  uint32_t error_threshold;
256  uint32_t max_display_delay;
257  uint32_t annex_b : 1;
258  uint32_t reserved : 31;
259  uint32_t reserved_1[4];
260  void *user_data;
262  PFNVIDDECODECALLBACK pfn_decode_picture;
263  PFNVIDDISPLAYCALLBACK pfn_display_picture;
264  PFNVIDSEIMSGCALLBACK pfn_get_sei_msg;
265  void *reserved_2[5];
268 
269 /************************************************************************************************/
273 /************************************************************************************************/
274 extern rocDecStatus ROCDECAPI rocDecCreateVideoParser(RocdecVideoParser *parser_handle, RocdecParserParams *params);
275 
276 /************************************************************************************************/
285 /************************************************************************************************/
286 extern rocDecStatus ROCDECAPI rocDecParseVideoData(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet);
287 
288 /************************************************************************************************/
292 /************************************************************************************************/
293 extern rocDecStatus ROCDECAPI rocDecDestroyVideoParser(RocdecVideoParser parser_handle);
294 
295 #if defined(__cplusplus)
296 }
297 #endif /* __cplusplus */
struct _RocdecParserParams RocdecParserParams
The AMD rocDecode library.\Used in rocDecCreateVideoParser API.
struct _RocdecOperatingPointInfo RocdecOperatingPointInfo
RocdecOperatingPointInfo structOperating point information of scalable bitstream.
rocDecStatus ROCDECAPI rocDecCreateVideoParser(RocdecVideoParser *parser_handle, RocdecParserParams *params)
rocDecStatus ROCDECAPI rocDecParseVideoData(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet)
rocDecStatus ROCDECAPI rocDecDestroyVideoParser(RocdecVideoParser parser_handle)
The AMD rocDecode Library.
RocdecVideoPacketFlags
Definition: rocparser.h:145
@ ROCDEC_PKT_TIMESTAMP
Definition: rocparser.h:147
@ ROCDEC_PKT_ENDOFPICTURE
Definition: rocparser.h:149
@ ROCDEC_PKT_DISCONTINUITY
Definition: rocparser.h:148
@ ROCDEC_PKT_NOTIFY_EOS
Definition: rocparser.h:150
@ ROCDEC_PKT_ENDOFSTREAM
Definition: rocparser.h:146
void * RocdecVideoParser
Definition: rocparser.h:46
RocdecReconfigOptions
Definition: rocparser.h:54
@ ROCDEC_RECONFIG_KEEP_SURFACES
Definition: rocparser.h:56
@ ROCDEC_RECONFIG_NEW_SURFACES
Definition: rocparser.h:55
int(ROCDECAPI * PFNVIDSEQUENCECALLBACK)(void *, RocdecVideoFormat *)
Parser callbacks \ The parser will call these synchronously from within rocDecParseVideoData(),...
Definition: rocparser.h:240
Timing Info struct\Used in rocdecParseVideoData API with PFNVIDDISPLAYCALLBACK pfn_display_picture.
Definition: rocparser.h:133
RocdecVideoFormat format
Definition: rocparser.h:134
ROCDEC_VIDEO_FORMAT structUsed in Parser callback API.
Definition: rocparser.h:64
uint32_t coded_height
Definition: rocparser.h:89
rocDecVideoChromaFormat chroma_format
Definition: rocparser.h:102
uint8_t bit_depth_luma_minus8
Definition: rocparser.h:76
int left
Definition: rocparser.h:97
uint32_t numerator
Definition: rocparser.h:71
uint32_t seqhdr_data_length
Definition: rocparser.h:123
uint32_t reconfig_options
Definition: rocparser.h:124
uint8_t reserved_zero_bits
Definition: rocparser.h:118
uint32_t coded_width
Definition: rocparser.h:88
int top
Definition: rocparser.h:98
uint8_t transfer_characteristics
Definition: rocparser.h:120
uint32_t bitrate
Definition: rocparser.h:103
int bottom
Definition: rocparser.h:100
uint8_t bit_depth_chroma_minus8
Definition: rocparser.h:77
uint8_t color_primaries
Definition: rocparser.h:119
uint8_t min_num_decode_surfaces
Definition: rocparser.h:78
int right
Definition: rocparser.h:99
uint8_t matrix_coefficients
Definition: rocparser.h:121
uint8_t video_format
Definition: rocparser.h:116
rocDecVideoCodec codec
Definition: rocparser.h:65
uint8_t video_full_range_flag
Definition: rocparser.h:117
uint8_t progressive_sequence
Definition: rocparser.h:75
RocdecOperatingPointInfo structOperating point information of scalable bitstream.
Definition: rocparser.h:189
Definition: rocparser.h:176
int repeat_first_field
Definition: rocparser.h:180
int progressive_frame
Definition: rocparser.h:178
int picture_index
Definition: rocparser.h:177
RocdecTimeStamp pts
Definition: rocparser.h:181
int top_field_first
Definition: rocparser.h:179
The AMD rocDecode library.\Used in rocDecCreateVideoParser API.
Definition: rocparser.h:251
uint32_t max_num_decode_surfaces
Definition: rocparser.h:253
uint32_t reserved
Definition: rocparser.h:258
PFNVIDSEQUENCECALLBACK pfn_sequence_callback
Definition: rocparser.h:261
uint32_t error_threshold
Definition: rocparser.h:255
void * user_data
Definition: rocparser.h:260
PFNVIDSEIMSGCALLBACK pfn_get_sei_msg
Definition: rocparser.h:264
uint32_t clock_rate
Definition: rocparser.h:254
RocdecVideoFormatEx * ext_video_info
Definition: rocparser.h:266
PFNVIDDECODECALLBACK pfn_decode_picture
Definition: rocparser.h:262
uint32_t reserved_1[4]
Definition: rocparser.h:259
PFNVIDDISPLAYCALLBACK pfn_display_picture
Definition: rocparser.h:263
uint32_t annex_b
Definition: rocparser.h:257
rocDecVideoCodec codec_type
Definition: rocparser.h:252
uint32_t max_display_delay
Definition: rocparser.h:256
void * reserved_2[5]
Definition: rocparser.h:265
Definition: rocdecode.h:1619
Definition: rocparser.h:218
void * sei_data
Definition: rocparser.h:219
RocdecSeiMessage * sei_message
Definition: rocparser.h:220
uint32_t sei_message_count
Definition: rocparser.h:221
uint32_t picIdx
Definition: rocparser.h:222
Definition: rocparser.h:207
uint32_t sei_message_size
Definition: rocparser.h:210
uint8_t sei_message_type
Definition: rocparser.h:208
Definition: rocparser.h:162
RocdecTimeStamp pts
Definition: rocparser.h:166
const uint8_t * payload
Definition: rocparser.h:165
uint32_t payload_size
Definition: rocparser.h:164
uint32_t flags
Definition: rocparser.h:163