docs-6.1.1/api/rocparser.h Source File

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

rocDecode: docs-6.1.1/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  uint8_t operating_points_cnt;
184  uint8_t reserved24_bits[3];
185  uint16_t operating_points_idc[32];
186  } av1;
187  uint8_t codec_reserved[1024];
188  };
190 
191 /**********************************************************************************/
195 /**********************************************************************************/
196 typedef struct _RocdecSeiMessage {
198  uint8_t reserved[3];
199  uint32_t sei_message_size;
201 
202 /**********************************************************************************/
206 /**********************************************************************************/
207 typedef struct _RocdecSeiMessageInfo {
208  void *sei_data;
210  uint32_t sei_message_count;
211  uint32_t picIdx;
213 
229 typedef int (ROCDECAPI *PFNVIDSEQUENCECALLBACK)(void *, RocdecVideoFormat *);
230 typedef int (ROCDECAPI *PFNVIDDECODECALLBACK)(void *, RocdecPicParams *);
231 typedef int (ROCDECAPI *PFNVIDDISPLAYCALLBACK)(void *, RocdecParserDispInfo *);
232 //typedef int (ROCDECAPI *PFNVIDOPPOINTCALLBACK)(void *, RocdecOperatingPointInfo*); // reserved for future (AV1 specific)
233 typedef int (ROCDECAPI *PFNVIDSEIMSGCALLBACK) (void *, RocdecSeiMessageInfo *);
234 
240 typedef struct _RocdecParserParams {
241  rocDecVideoCodec codec_type;
243  uint32_t clock_rate;
244  uint32_t error_threshold;
245  uint32_t max_display_delay;
246  uint32_t annex_b : 1;
247  uint32_t reserved : 31;
248  uint32_t reserved_1[4];
249  void *user_data;
251  PFNVIDDECODECALLBACK pfn_decode_picture;
252  PFNVIDDISPLAYCALLBACK pfn_display_picture;
253  PFNVIDSEIMSGCALLBACK pfn_get_sei_msg;
254  void *reserved_2[5];
257 
258 /************************************************************************************************/
262 /************************************************************************************************/
263 extern rocDecStatus ROCDECAPI rocDecCreateVideoParser(RocdecVideoParser *parser_handle, RocdecParserParams *params);
264 
265 /************************************************************************************************/
274 /************************************************************************************************/
275 extern rocDecStatus ROCDECAPI rocDecParseVideoData(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet);
276 
277 /************************************************************************************************/
281 /************************************************************************************************/
282 extern rocDecStatus ROCDECAPI rocDecDestroyVideoParser(RocdecVideoParser parser_handle);
283 
284 #if defined(__cplusplus)
285 }
286 #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:229
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:240
uint32_t max_num_decode_surfaces
Definition: rocparser.h:242
uint32_t reserved
Definition: rocparser.h:247
PFNVIDSEQUENCECALLBACK pfn_sequence_callback
Definition: rocparser.h:250
uint32_t error_threshold
Definition: rocparser.h:244
void * user_data
Definition: rocparser.h:249
PFNVIDSEIMSGCALLBACK pfn_get_sei_msg
Definition: rocparser.h:253
uint32_t clock_rate
Definition: rocparser.h:243
RocdecVideoFormatEx * ext_video_info
Definition: rocparser.h:255
PFNVIDDECODECALLBACK pfn_decode_picture
Definition: rocparser.h:251
uint32_t reserved_1[4]
Definition: rocparser.h:248
PFNVIDDISPLAYCALLBACK pfn_display_picture
Definition: rocparser.h:252
uint32_t annex_b
Definition: rocparser.h:246
rocDecVideoCodec codec_type
Definition: rocparser.h:241
uint32_t max_display_delay
Definition: rocparser.h:245
void * reserved_2[5]
Definition: rocparser.h:254
Definition: rocdecode.h:792
Definition: rocparser.h:207
void * sei_data
Definition: rocparser.h:208
RocdecSeiMessage * sei_message
Definition: rocparser.h:209
uint32_t sei_message_count
Definition: rocparser.h:210
uint32_t picIdx
Definition: rocparser.h:211
Definition: rocparser.h:196
uint32_t sei_message_size
Definition: rocparser.h:199
uint8_t sei_message_type
Definition: rocparser.h:197
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