docs-6.2.0/api/rocparser.h Source File

docs-6.2.0/api/rocparser.h Source File#

rocDecode: docs-6.2.0/api/rocparser.h Source File
rocparser.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2023 - 2024 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.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 
54 typedef struct {
55  rocDecVideoCodec codec;
59  struct {
61  uint32_t numerator;
63  uint32_t denominator;
64  } frame_rate;
78  uint32_t coded_width;
79  uint32_t coded_height;
86  struct {
87  int left;
88  int top;
89  int right;
90  int bottom;
91  } display_area;
92 
93  rocDecVideoChromaFormat chroma_format;
94  uint32_t bitrate;
98  struct {
99  int x;
100  int y;
101  } display_aspect_ratio;
106  struct {
107  uint8_t video_format : 3;
108  uint8_t video_full_range_flag : 1;
109  uint8_t reserved_zero_bits : 4;
110  uint8_t color_primaries;
113  } video_signal_description;
116 
117 /****************************************************************/
122 /****************************************************************/
123 typedef struct {
125  uint32_t max_width;
126  uint32_t max_height;
127  uint8_t raw_seqhdr_data[1024];
129 
130 /***************************************************************/
134 /***************************************************************/
135 typedef enum {
140  ROCDEC_PKT_NOTIFY_EOS = 0x10,
144 
145 /*****************************************************************************/
151 /*****************************************************************************/
152 typedef struct _RocdecSourceDataPacket {
153  uint32_t flags;
154  uint32_t payload_size;
155  const uint8_t *payload;
156  RocdecTimeStamp pts;
158 
159 /**********************************************************************************/
165 /**********************************************************************************/
166 typedef struct _RocdecParserDispInfo {
171  RocdecTimeStamp pts;
173 
180  rocDecVideoCodec codec;
181  union {
182  struct
183  {
184  uint8_t operating_points_cnt;
185  uint8_t reserved24_bits[3];
186  uint16_t operating_points_idc[32];
187  } av1;
188  uint8_t codec_reserved[1024];
189  };
191 
192 /**********************************************************************************/
196 /**********************************************************************************/
197 typedef struct _RocdecSeiMessage {
199  uint8_t reserved[3];
200  uint32_t sei_message_size;
202 
203 /**********************************************************************************/
207 /**********************************************************************************/
208 typedef struct _RocdecSeiMessageInfo {
209  void *sei_data;
211  uint32_t sei_message_count;
212  uint32_t picIdx;
214 
230 typedef int(ROCDECAPI *PFNVIDSEQUENCECALLBACK)(void *, RocdecVideoFormat *);
231 typedef int(ROCDECAPI *PFNVIDDECODECALLBACK)(void *, RocdecPicParams *);
232 typedef int(ROCDECAPI *PFNVIDDISPLAYCALLBACK)(void *, RocdecParserDispInfo *);
233 // typedef int (ROCDECAPI *PFNVIDOPPOINTCALLBACK)(void *, RocdecOperatingPointInfo*); // reserved for future (AV1 specific)
234 typedef int(ROCDECAPI *PFNVIDSEIMSGCALLBACK)(void *, RocdecSeiMessageInfo *);
235 
241 typedef struct _RocdecParserParams {
242  rocDecVideoCodec codec_type;
244  uint32_t clock_rate;
245  uint32_t error_threshold;
246  uint32_t max_display_delay;
247  uint32_t annex_b : 1;
248  uint32_t reserved : 31;
249  uint32_t reserved_1[4];
250  void *user_data;
252  PFNVIDDECODECALLBACK pfn_decode_picture;
253  PFNVIDDISPLAYCALLBACK pfn_display_picture;
254  PFNVIDSEIMSGCALLBACK pfn_get_sei_msg;
255  void *reserved_2[5];
258 
259 /************************************************************************************************/
263 /************************************************************************************************/
264 extern rocDecStatus ROCDECAPI rocDecCreateVideoParser(RocdecVideoParser *parser_handle, RocdecParserParams *params);
265 
266 /************************************************************************************************/
275 /************************************************************************************************/
276 extern rocDecStatus ROCDECAPI rocDecParseVideoData(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet);
277 
278 /************************************************************************************************/
282 /************************************************************************************************/
283 extern rocDecStatus ROCDECAPI rocDecDestroyVideoParser(RocdecVideoParser parser_handle);
284 
285 #if defined(__cplusplus)
286 }
287 #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:135
@ ROCDEC_PKT_TIMESTAMP
Definition: rocparser.h:137
@ ROCDEC_PKT_ENDOFPICTURE
Definition: rocparser.h:139
@ ROCDEC_PKT_DISCONTINUITY
Definition: rocparser.h:138
@ ROCDEC_PKT_NOTIFY_EOS
Definition: rocparser.h:140
@ ROCDEC_PKT_ENDOFSTREAM
Definition: rocparser.h:136
void * RocdecVideoParser
Definition: rocparser.h:46
int(ROCDECAPI * PFNVIDSEQUENCECALLBACK)(void *, RocdecVideoFormat *)
Parser callbacks \ The parser will call these synchronously from within rocDecParseVideoData(),...
Definition: rocparser.h:230
Timing Info struct\Used in rocdecParseVideoData API with PFNVIDDISPLAYCALLBACK pfn_display_picture.
Definition: rocparser.h:123
RocdecVideoFormat format
Definition: rocparser.h:124
ROCDEC_VIDEO_FORMAT structUsed in Parser callback API.
Definition: rocparser.h:54
uint32_t coded_height
Definition: rocparser.h:79
rocDecVideoChromaFormat chroma_format
Definition: rocparser.h:93
uint8_t bit_depth_luma_minus8
Definition: rocparser.h:66
int left
Definition: rocparser.h:87
uint32_t numerator
Definition: rocparser.h:61
uint32_t seqhdr_data_length
Definition: rocparser.h:114
uint8_t reserved_zero_bits
Definition: rocparser.h:109
uint32_t coded_width
Definition: rocparser.h:78
int top
Definition: rocparser.h:88
uint8_t transfer_characteristics
Definition: rocparser.h:111
uint32_t bitrate
Definition: rocparser.h:94
int bottom
Definition: rocparser.h:90
uint8_t bit_depth_chroma_minus8
Definition: rocparser.h:67
uint8_t color_primaries
Definition: rocparser.h:110
uint8_t min_num_decode_surfaces
Definition: rocparser.h:68
int right
Definition: rocparser.h:89
uint8_t matrix_coefficients
Definition: rocparser.h:112
uint8_t video_format
Definition: rocparser.h:107
rocDecVideoCodec codec
Definition: rocparser.h:55
uint8_t video_full_range_flag
Definition: rocparser.h:108
uint8_t progressive_sequence
Definition: rocparser.h:65
RocdecOperatingPointInfo structOperating point information of scalable bitstream.
Definition: rocparser.h:179
Definition: rocparser.h:166
int repeat_first_field
Definition: rocparser.h:170
int progressive_frame
Definition: rocparser.h:168
int picture_index
Definition: rocparser.h:167
RocdecTimeStamp pts
Definition: rocparser.h:171
int top_field_first
Definition: rocparser.h:169
The AMD rocDecode library.\Used in rocDecCreateVideoParser API.
Definition: rocparser.h:241
uint32_t max_num_decode_surfaces
Definition: rocparser.h:243
uint32_t reserved
Definition: rocparser.h:248
PFNVIDSEQUENCECALLBACK pfn_sequence_callback
Definition: rocparser.h:251
uint32_t error_threshold
Definition: rocparser.h:245
void * user_data
Definition: rocparser.h:250
PFNVIDSEIMSGCALLBACK pfn_get_sei_msg
Definition: rocparser.h:254
uint32_t clock_rate
Definition: rocparser.h:244
RocdecVideoFormatEx * ext_video_info
Definition: rocparser.h:256
PFNVIDDECODECALLBACK pfn_decode_picture
Definition: rocparser.h:252
uint32_t reserved_1[4]
Definition: rocparser.h:249
PFNVIDDISPLAYCALLBACK pfn_display_picture
Definition: rocparser.h:253
uint32_t annex_b
Definition: rocparser.h:247
rocDecVideoCodec codec_type
Definition: rocparser.h:242
uint32_t max_display_delay
Definition: rocparser.h:246
void * reserved_2[5]
Definition: rocparser.h:255
Definition: rocdecode.h:1374
Definition: rocparser.h:208
void * sei_data
Definition: rocparser.h:209
RocdecSeiMessage * sei_message
Definition: rocparser.h:210
uint32_t sei_message_count
Definition: rocparser.h:211
uint32_t picIdx
Definition: rocparser.h:212
Definition: rocparser.h:197
uint32_t sei_message_size
Definition: rocparser.h:200
uint8_t sei_message_type
Definition: rocparser.h:198
Definition: rocparser.h:152
RocdecTimeStamp pts
Definition: rocparser.h:156
const uint8_t * payload
Definition: rocparser.h:155
uint32_t payload_size
Definition: rocparser.h:154
uint32_t flags
Definition: rocparser.h:153