1 /* -----------------------------------------------------------------------------
2 The copyright in this software is being made available under the BSD
3 License, included below. No patent rights, trademark rights and/or
4 other Intellectual Property Rights other than the copyrights concerning
5 the Software are granted under this license.
6 
7 For any license concerning other Intellectual Property rights than the software,
8 especially patent licenses, a separate Agreement needs to be closed.
9 For more information please contact:
10 
11 Fraunhofer Heinrich Hertz Institute
12 Einsteinufer 37
13 10587 Berlin, Germany
14 www.hhi.fraunhofer.de/vvc
15 vvc@hhi.fraunhofer.de
16 
17 Copyright (c) 2018-2021, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
18 All rights reserved.
19 
20 Redistribution and use in source and binary forms, with or without
21 modification, are permitted provided that the following conditions are met:
22 
23  * Redistributions of source code must retain the above copyright notice,
24    this list of conditions and the following disclaimer.
25  * Redistributions in binary form must reproduce the above copyright notice,
26    this list of conditions and the following disclaimer in the documentation
27    and/or other materials provided with the distribution.
28  * Neither the name of Fraunhofer nor the names of its contributors may
29    be used to endorse or promote products derived from this software without
30    specific prior written permission.
31 
32 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
36 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
42 THE POSSIBILITY OF SUCH DAMAGE.
43 
44 
45 ------------------------------------------------------------------------------------------- */
46 
47 #ifndef _VVDEC_H_
48 #define _VVDEC_H_
49 
50 #include "vvdec/vvdecDecl.h"
51 
52 #include <stdio.h>
53 #include <stdint.h>
54 #include <stdbool.h>
55 
56 #include "vvdec/sei.h"
57 
58 #define VVDEC_NAMESPACE_BEGIN
59 #define VVDEC_NAMESPACE_END
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 VVDEC_NAMESPACE_BEGIN
66 
67 
68 /* vvdecDecoder:
69  * opaque handler for the decoder */
70 typedef struct vvdecDecoder vvdecDecoder;
71 
72 /* vvdecLoggingCallback:
73    callback function to receive messages of the decoder library
74 */
75 typedef void (*vvdecLoggingCallback)(void*, int, const char*, va_list);
76 
77 /*
78   \enum ErrorCodes
79   The enum ErrorCodes enumerates error codes returned by the decoder.
80 */
81 typedef enum
82 {
83   VVDEC_OK                    = 0,     // success
84   VVDEC_ERR_UNSPECIFIED       = -1,    // unspecified malfunction
85   VVDEC_ERR_INITIALIZE        = -2,    // decoder not initialized or tried to initialize multiple times
86   VVDEC_ERR_ALLOCATE          = -3,    // internal allocation error
87   VVDEC_ERR_DEC_INPUT         = -4,    // decoder input error, decoder input data error
88   VVDEC_NOT_ENOUGH_MEM        = -5,    // allocated memory to small to receive decoded data. After allocating sufficient memory the failed call can be repeated.
89   VVDEC_ERR_PARAMETER         = -7,    // inconsistent or invalid parameters
90   VVDEC_ERR_NOT_SUPPORTED     = -10,   // unsupported request
91   VVDEC_ERR_RESTART_REQUIRED  = -11,   // decoder requires restart
92   VVDEC_ERR_CPU               = -30,   // unsupported CPU SSE 4.1 needed
93   VVDEC_TRY_AGAIN             = -40,   // decoder needs more input and cannot return a picture
94   VVDEC_EOF                   = -50    // end of file
95 }vvdecErrorCodes;
96 
97 /*
98   \enum LogLevel
99   The enum LogLevel enumerates supported log levels/verbosity.
100 */
101 typedef enum
102 {
103   VVDEC_SILENT  = 0,
104   VVDEC_ERROR   = 1,
105   VVDEC_WARNING = 2,
106   VVDEC_INFO    = 3,
107   VVDEC_NOTICE  = 4,
108   VVDEC_VERBOSE = 5,
109   VVDEC_DETAILS = 6
110 }vvdecLogLevel;
111 
112 /*
113   \enum SIMD_Extension
114   The enum SIMD_Extension enumerates the supported simd optimizations.
115 */
116 typedef enum
117 {
118   VVDEC_SIMD_DEFAULT  = 0,
119   VVDEC_SIMD_SCALAR   = 1,
120   VVDEC_SIMD_SSE41    = 2,
121   VVDEC_SIMD_SSE42    = 3,
122   VVDEC_SIMD_AVX      = 4,
123   VVDEC_SIMD_AVX2     = 5,
124   VVDEC_SIMD_AVX512   = 6
125 }vvdecSIMD_Extension;
126 
127 /*
128   \enum vvdecRPRUpscaling
129   The enum vvdecRPRUpscaling enumerates supported RPR upscaling handling
130 */
131 typedef enum
132 {
133   VVDEC_UPSCALING_OFF       = 0,     // no RPR scaling
134   VVDEC_UPSCALING_COPY_ONLY = 1,     // copy picture into target resolution only
135   VVDEC_UPSCALING_RESCALE   = 2      // auto rescale RPR pictures into target resolution
136 }vvdecRPRUpscaling;
137 
138 /*
139   \enum ColorFormat
140   The enum ColorFormat enumerates supported input color formats.
141 */
142 typedef enum
143 {
144   VVDEC_CF_INVALID       = -1,         // invalid color format
145   VVDEC_CF_YUV400_PLANAR =  0,         // YUV400 planar color format
146   VVDEC_CF_YUV420_PLANAR =  1,         // YUV420 planar color format
147   VVDEC_CF_YUV422_PLANAR =  2,         // YUV422 planar color format
148   VVDEC_CF_YUV444_PLANAR =  3          // YUV444 planar color format
149 }vvdecColorFormat;
150 
151 /*
152   The class InterlaceFormat enumerates several supported picture formats.
153   The enumeration InterlaceFormat is following the definition of the syntax element pic_struct defined in HEVC standard.
154 */
155 typedef enum
156 {
157   VVDEC_FF_INVALID     = -1,           // invalid interlace format
158   VVDEC_FF_PROGRESSIVE = 0,            // progressive coding picture format
159   VVDEC_FF_TOP_FIELD   = 1,            // top field picture
160   VVDEC_FF_BOT_FIELD   = 2,            // bottom field picture
161   VVDEC_FF_TOP_BOT     = 3,            // interlaced frame (top field first in display order)
162   VVDEC_FF_BOT_TOP     = 4,            // interlaced frame (bottom field first in display order)
163   VVDEC_FF_TOP_BOT_TOP = 5,            // NOT SUPPORTED (top field, bottom field, top field repeated)
164   VVDEC_FF_BOT_TOP_BOT = 6,            // NOT SUPPORTED (bottom field, top field, bottom field repeated)
165   VVDEC_FF_FRAME_DOUB  = 7,            // NOT SUPPORTED (frame doubling)
166   VVDEC_FF_FRAME_TRIP  = 8,            // NOT SUPPORTED (frame tripling)
167   VVDEC_FF_TOP_PW_PREV = 9,            // top field    (is paired with previous bottom field)
168   VVDEC_FF_BOT_PW_PREV = 10,           // bottom field (is paired with previous top field)
169   VVDEC_FF_TOP_PW_NEXT = 11,           // top field    (is paired with next bottom field)
170   VVDEC_FF_BOT_PW_NEXT = 12,           // bottom field (is paired with next top field)
171 }vvdecFrameFormat;
172 
173 /*
174   The class SliceType enumerates several supported slice types.
175 */
176 typedef enum
177 {
178   VVDEC_SLICETYPE_I = 0,
179   VVDEC_SLICETYPE_P,
180   VVDEC_SLICETYPE_B,
181   VVDEC_SLICETYPE_UNKNOWN
182 }vvdecSliceType;
183 
184 typedef enum
185 {
186   VVC_NAL_UNIT_CODED_SLICE_TRAIL = 0,  // 0
187   VVC_NAL_UNIT_CODED_SLICE_STSA,       // 1
188   VVC_NAL_UNIT_CODED_SLICE_RADL,       // 2
189   VVC_NAL_UNIT_CODED_SLICE_RASL,       // 3
190 
191   VVC_NAL_UNIT_RESERVED_VCL_4,
192   VVC_NAL_UNIT_RESERVED_VCL_5,
193   VVC_NAL_UNIT_RESERVED_VCL_6,
194 
195   VVC_NAL_UNIT_CODED_SLICE_IDR_W_RADL, // 7
196   VVC_NAL_UNIT_CODED_SLICE_IDR_N_LP,   // 8
197   VVC_NAL_UNIT_CODED_SLICE_CRA,        // 9
198   VVC_NAL_UNIT_CODED_SLICE_GDR,        // 10
199 
200   VVC_NAL_UNIT_RESERVED_IRAP_VCL_11,
201   VVC_NAL_UNIT_RESERVED_IRAP_VCL_12,
202 
203   VVC_NAL_UNIT_DCI,                    // 13
204   VVC_NAL_UNIT_VPS,                    // 14
205   VVC_NAL_UNIT_SPS,                    // 15
206   VVC_NAL_UNIT_PPS,                    // 16
207   VVC_NAL_UNIT_PREFIX_APS,             // 17
208   VVC_NAL_UNIT_SUFFIX_APS,             // 18
209   VVC_NAL_UNIT_PH,                     // 19
210   VVC_NAL_UNIT_ACCESS_UNIT_DELIMITER,  // 20
211   VVC_NAL_UNIT_EOS,                    // 21
212   VVC_NAL_UNIT_EOB,                    // 22
213   VVC_NAL_UNIT_PREFIX_SEI,             // 23
214   VVC_NAL_UNIT_SUFFIX_SEI,             // 24
215   VVC_NAL_UNIT_FD,                     // 25
216 
217   VVC_NAL_UNIT_RESERVED_NVCL_26,
218   VVC_NAL_UNIT_RESERVED_NVCL_27,
219 
220   VVC_NAL_UNIT_UNSPECIFIED_28,
221   VVC_NAL_UNIT_UNSPECIFIED_29,
222   VVC_NAL_UNIT_UNSPECIFIED_30,
223   VVC_NAL_UNIT_UNSPECIFIED_31,
224   VVC_NAL_UNIT_INVALID
225 }vvdecNalType;
226 
227 
228 typedef enum
229 {
230   VVDEC_CT_Y = 0,                      // Y component
231   VVDEC_CT_U = 1,                      // U component
232   VVDEC_CT_V = 2                       // V component
233 }vvdecComponentType;
234 
235 
236 /* vvdecAccessUnit
237   The struct vvdecAccessUnit contains attributes that are assigned to the compressed output of the decoder for a specific input picture.
238   The structure contains buffer and size information of the compressed payload as well as timing and access information.
239   The smallest output unit of VVC decoders are NalUnits. A set of NalUnits that belong to the same access unit are delivered in a continuous bitstream,
240   where the NalUnits are separated by three byte start codes.
241   The Buffer to retrieve the compressed video chunks has to be allocated by the caller.
242   The related attribute payloadSize defines the size of allocated memory whereas payloadUsedSize only defines the size of valid bytes in the bitstream.
243 */
244 typedef struct vvdecAccessUnit
245 {
246   unsigned char*  payload;             // pointer to buffer that retrieves the coded data,
247   int             payloadSize;         // size of the allocated buffer in bytes
248   int             payloadUsedSize;     // length of the coded data in bytes
249   uint64_t        cts;                 // composition time stamp in TicksPerSecond (see VVCDecoderParameter)
250   uint64_t        dts;                 // decoding time stamp in TicksPerSecond (see VVCDecoderParameter)
251   bool            ctsValid;            // composition time stamp valid flag (true: valid, false: CTS not set)
252   bool            dtsValid;            // decoding time stamp valid flag (true: valid, false: DTS not set)
253   bool            rap;                 // random access point flag (true: AU is random access point, false: sequential access)
254 } vvdecAccessUnit;
255 
256 /* vvdec_accessUnit_alloc:
257    Allocates an vvdecAccessUnit instance.
258    The returned accessUnit is set to default values.
259    The payload memory must be allocated seperately by using vvdec_accessUnit_alloc_payload.
260    To free the memory use vvdecAccessUnit_free.
261 */
262 VVDEC_DECL vvdecAccessUnit* vvdec_accessUnit_alloc( void );
263 
264 /* vvdec_accessUnit_free:
265    release storage of an vvdecAccessUnit instance.
266    The payload memory is also released if not done yet.
267 */
268 VVDEC_DECL void vvdec_accessUnit_free(vvdecAccessUnit *accessUnit );
269 
270 /* vvdec_accessUnit_alloc_payload:
271    Allocates the memory for an accessUnit payload.
272    To free the memory use vvdecAccessUnit_free_payload.
273    When the vvdecAccessUnit memory is released the payload memory is also released.
274 */
275 VVDEC_DECL void vvdec_accessUnit_alloc_payload(vvdecAccessUnit *accessUnit, int payload_size );
276 
277 /* vvdec_accessUnit_free_payload:
278    release storage of the payload in an vvdecAccessUnit instance.
279 */
280 VVDEC_DECL void vvdec_accessUnit_free_payload(vvdecAccessUnit *accessUnit );
281 
282 /* vvdec_accessUnit_default:
283   Initialize vvdecAccessUnit structure to default values
284 */
285 VVDEC_DECL void vvdec_accessUnit_default(vvdecAccessUnit *accessUnit );
286 
287 /*
288   The struct vvdecVui contains Video Usage Inforamtion
289 */
290 typedef struct vvdecVui
291 {
292   bool       aspectRatioInfoPresentFlag;
293   bool       aspectRatioConstantFlag;
294   bool       nonPackedFlag;
295   bool       nonProjectedFlag;
296   int        aspectRatioIdc;
297   int        sarWidth;
298   int        sarHeight;
299   bool       colourDescriptionPresentFlag;
300   int        colourPrimaries;
301   int        transferCharacteristics;
302   int        matrixCoefficients;
303   bool       progressiveSourceFlag;
304   bool       interlacedSourceFlag;
305   bool       chromaLocInfoPresentFlag;
306   int        chromaSampleLocTypeTopField;
307   int        chromaSampleLocTypeBottomField;
308   int        chromaSampleLocType;
309   bool       overscanInfoPresentFlag;
310   bool       overscanAppropriateFlag;
311   bool       videoSignalTypePresentFlag;
312   bool       videoFullRangeFlag;
313 }vvdecVui;
314 
315 /*
316   The struct vvdecHrd contains information about the Hypothetical Reference Decoder
317 */
318 typedef struct vvdecHrd
319 {
320   uint32_t   numUnitsInTick;
321   uint32_t   timeScale;
322   bool       generalNalHrdParamsPresentFlag;
323   bool       generalVclHrdParamsPresentFlag;
324   bool       generalSamePicTimingInAllOlsFlag;
325   uint32_t   tickDivisor;
326   bool       generalDecodingUnitHrdParamsPresentFlag;
327   uint32_t   bitRateScale;
328   uint32_t   cpbSizeScale;
329   uint32_t   cpbSizeDuScale;
330   uint32_t   hrdCpbCnt;
331 }vvdecHrd;
332 
333 
334 /*
335   The struct vvdecPicAttributes contains additional picture side information
336 */
337 typedef struct vvdecPicAttributes
338 {
339   vvdecNalType    nalType;             // nal unit type
340   vvdecSliceType  sliceType;           // slice type (I/P/B) */
341   bool            isRefPic;            // reference picture
342   uint32_t        temporalLayer;       // temporal layer
343   uint64_t        poc;                 // picture order count
344   uint32_t        bits;                // bits of the compr. image packet
345   vvdecVui       *vui;                 // if available, pointer to VUI (Video Usability Information)
346   vvdecHrd       *hrd;                 // if available, pointer to HRD (Hypothetical Reference Decoder)
347 } vvdecPicAttributes;
348 
349 /*
350   The struct vvdecPlane contains information about a plane (component) of a frame
351   that has been return from the decoder.
352 */
353 typedef struct vvdecPlane
354 {
355   unsigned char* ptr;                  // pointer to plane buffer
356   uint32_t       width;                // width of the plane
357   uint32_t       height;               // height of the plane
358   uint32_t       stride;               // stride (width + left margin + right margins) of plane in samples
359   uint32_t       bytesPerSample;       // number of bytes per sample
360 } vvdecPlane;
361 
362 /*
363   The struct vvdecFrame contains a decoded frame and consists of the picture planes and basic picture information.
364   The vvdecPicAttributes struct holds additional picture information.
365 */
366 typedef struct vvdecFrame
367 {
368   vvdecPlane          planes[ 3 ];     // component plane for yuv
369   uint32_t            numPlanes;       // number of color components
370   uint32_t            width;           // width of the luminance plane
371   uint32_t            height;          // height of the luminance plane
372   uint32_t            bitDepth;        // bit depth of input signal (8: depth 8 bit, 10: depth 10 bit  )
373   vvdecFrameFormat    frameFormat;     // frame format (progressive/interlaced)
374   vvdecColorFormat    colorFormat;     // color format
375   uint64_t            sequenceNumber;  // sequence number of the picture
376   uint64_t            cts;             // composition time stamp in TicksPerSecond
377   bool                ctsValid;        // composition time stamp valid flag (true: valid, false: CTS not set)
378   vvdecPicAttributes *picAttributes;   // pointer to vvdecPicAttributes that might be NULL, containing decoder side information
379 }vvdecFrame;
380 
381 /*
382   The struct vvdecParams is a container for decoder configuration parameters.
383   Use vvdec_default_params() to set default values.
384 */
385 typedef struct vvdecParams
386 {
387   int                 threads;           // thread count        ( default: -1 )
388   int                 parseThreads;      // parser thread count ( default: -1 )
389   vvdecRPRUpscaling   upscaleOutput;     // do internal upscaling of rpl pictures to dest. resolution ( default: 0 )
390   vvdecLogLevel       logLevel;          // verbosity level
391   bool                verifyPictureHash; // verify picture, if digest is available, true: check hash in SEI messages if available, false: ignore SEI message
392   vvdecSIMD_Extension simd;              // set specific simd optimization (default: max. availalbe)
393 } vvdecParams;
394 
395 /* vvdec_params_default:
396   Initialize vvdec_params structure to default values
397 */
398 VVDEC_DECL void vvdec_params_default(vvdecParams *param);
399 
400 /* vvdec_params_alloc:
401    Allocates an vvdec_params_alloc instance.
402    The returned params struct is set to default values.
403 */
404 VVDEC_DECL vvdecParams* vvdec_params_alloc( void );
405 
406 /* vvdec_params_free:
407    release storage of an vvdec_params instance.
408 */
409 VVDEC_DECL void vvdec_params_free(vvdecParams *params );
410 
411 /* vvdec_get_version
412   This method returns the the decoder version as string.
413   \param[in]  none
414   \retval[ ]  const char* version number as string
415 */
416 VVDEC_DECL const char* vvdec_get_version( void );
417 
418 /* vvdec_decoder_open
419   This method initializes the decoder instance.
420   This method is used to initially set up the decoder with the assigned decoder parameter struct.
421   The method fails if the assigned parameter struct does not pass the consistency check.
422   Other possibilities for an unsuccessful memory initialization, or an machine with
423   insufficient CPU-capabilities.
424   \param[in]  vvdec_params_t pointer of vvdec_params struct that holds initial decoder parameters.
425   \retval     vvdec_params_t pointer of the decoder handler if successful, otherwise NULL
426   \pre        The decoder must not be initialized (pointer of decoder handler must be null).
427 */
428 VVDEC_DECL vvdecDecoder* vvdec_decoder_open( vvdecParams *);
429 
430 /* vvdec_decoder_close
431  This method resets the decoder instance.
432  This method clears the decoder and releases all internally allocated memory.
433  Calling uninit cancels all pending decoding calls. In order to finish pending pictures use the flush method.
434  \param[in]  vvdecDecoder pointer of decoder handler
435  \retval     int if non-zero an error occurred (see ErrorCodes), otherwise VVDEC_OK indicates success.
436  \pre        The decoder has to be initialized successfully.
437 */
438 VVDEC_DECL int vvdec_decoder_close(vvdecDecoder *);
439 
440 /* vvdec_set_logging_callback
441   Set a logging callback. To disable set callback NULL.
442   \param[in]   vvdecDecoder pointer of decoder handler
443   \param[in]   vvdecLoggingCallback implementation of the callback that is called when logging messages are written
444   \retval      int if non-zero an error occurred (see ErrorCodes), otherwise VVDEC_OK indicates success.
445   \pre         The decoder has to be initialized successfully.
446  */
447 VVDEC_DECL int vvdec_set_logging_callback(vvdecDecoder*, vvdecLoggingCallback callback );
448 
449 /* vvdec_decode
450   This method decodes a compressed image packet (bitstream).
451   Compressed image packet are passed to the decoder in decoder order. A picture is returned by filling the assigned Picture struct.
452   A picture is valid if the decoder call returns success and the Picture is not null.
453   If the AccessUnit  m_iBufSize = 0, the decoder just returns a pending pictures chunk if available.
454   \param[in]   vvdecDecoder pointer of decoder handler
455   \param[in]   vvdecAccessUnit_t pointer of AccessUnit that retrieves compressed access units and side information, data are valid if UsedSize attribute is non-zero and the call was successful.
456   \param[out]  vvdecFrame pointer to pointer of frame structure containing a uncompressed picture and meta information.
457   \retval      int if non-zero an error occurred or more data is needed, otherwise the retval indicates success VVDEC_OK
458   \pre         The decoder has to be initialized successfully.
459 */
460 VVDEC_DECL int vvdec_decode( vvdecDecoder *, vvdecAccessUnit *accessUnit, vvdecFrame **frame );
461 
462 /* vvdec_flush
463   This method flushes the decoder.
464   This call is used to get outstanding pictures after all compressed packets have been passed over into the decoder using the decode call.
465   Using the flush method the decoder is signaled that there are no further compressed packets to decode.
466   The caller should repeat the flush call until all pending pictures has been delivered to the caller, which is when the the function returns VVDEC_EOF or no picture.
467   \param[in]  vvdecDecoder pointer to decoder handler
468   \param[out] vvdecFrame pointer to pointer of frame structure containing a uncompressed picture and meta information.
469   \retval     int if non-zero an error occurred, otherwise the retval indicates success VVDEC_OK
470   \pre        The decoder has to be initialized successfully.
471 */
472 VVDEC_DECL int vvdec_flush( vvdecDecoder *, vvdecFrame **frame );
473 
474 /* vvdec_find_frame_sei
475   This method finds SEI message in a given picture.
476   To get the correct sei data for a given SEIPayloadType the payload have to be casted to the payload type.
477   \param[in]  vvdecDecoder pointer of decoder handler
478   \param[in]  SEIPayloadType payload type to search for
479   \param[in]  vvdecFrame pointer of frame to search for sei
480   \param[out] vvdecSEI pointer to found sei message, NULL if not found
481   \retval     int if non-zero an error occurred, otherwise the retval indicates success VVDEC_OK
482   \pre        The decoder has to be initialized successfully.
483 */
484 VVDEC_DECL vvdecSEI* vvdec_find_frame_sei( vvdecDecoder *, vvdecSEIPayloadType seiPayloadType, vvdecFrame *frame );
485 
486 /* vvdec_frame_unref
487   This method unreference an picture and frees the memory.
488   This call is used to free the memory of an picture which is not used anymore.
489   \param[in]  vvdecDecoder pointer of decoder handler
490   \param[out] vvdecFrame pointer of frame to delete
491   \retval     int if non-zero an error occurred, otherwise the retval indicates success VVDEC_OK
492   \pre        The decoder has to be initialized successfully.
493 */
494 VVDEC_DECL int vvdec_frame_unref( vvdecDecoder *, vvdecFrame *frame );
495 
496 /* vvdec_get_hash_error_count
497  This method returns the number of found errors if PictureHash SEI is enabled.
498  \param[in]  vvdecDecoder pointer of decoder handler
499  \retval     int if non-zero an error occurred, otherwise 0 indicates success.
500  \pre        The decoder has to be initialized successfully.
501 */
502 VVDEC_DECL int vvdec_get_hash_error_count( vvdecDecoder * );
503 
504 
505 /* vvdec_get_dec_information
506  This method returns general decoder information
507  \param[in]  vvdecDecoder pointer of decoder handler
508  \retval     const char* decoder information
509  \pre        The decoder has to be initialized successfully.
510 */
511 VVDEC_DECL const char* vvdec_get_dec_information( vvdecDecoder * );
512 
513 
514 /* vvdec_get_last_error
515  This method returns the last occurred error as a string.
516  \param[in]  vvdecDecoder pointer of decoder handler
517  \retval     const char* empty string for no error assigned
518  \pre        The decoder has to be initialized successfully.
519 */
520 VVDEC_DECL const char* vvdec_get_last_error( vvdecDecoder * );
521 
522 /* vvdec_get_last_additional_error
523  This method returns additional information about the last occurred error as a string (if availalbe).
524  \param[in]  vvdecDecoder pointer of decoder handler
525  \retval     const char* empty string for no error assigned
526  \pre        The decoder has to be initialized successfully.
527 */
528 VVDEC_DECL const char* vvdec_get_last_additional_error( vvdecDecoder * );
529 
530 /* vvdec_get_error_msg
531  This function returns a string according to the passed parameter nRet.
532  \param[in]  nRet return value code (see ErrorCodes) to translate
533  \retval[ ]  const char* empty string for no error
534 */
535 VVDEC_DECL const char* vvdec_get_error_msg( int nRet );
536 
537 /* vvdec_get_nal_unit_type
538  This function returns the NalType of a given AccessUnit.
539  \param[in]  vvdecAccessUnit_t pointer of accessUnit that retrieves compressed access units and
540              side information, data are valid if UsedSize attribute is non-zero and the call was successful.
541  \retval[ ]  NalType found Nal Unit type
542 */
543 VVDEC_DECL vvdecNalType vvdec_get_nal_unit_type ( vvdecAccessUnit *accessUnit );
544 
545 /* vvdec_get_nal_unit_type_name
546  This function returns the name of a given NalType
547  \param[in]  NalType value of enum NalType
548  \retval[ ]  const char* NalType as string
549 */
550 VVDEC_DECL const char* vvdec_get_nal_unit_type_name( vvdecNalType t );
551 
552 /* vvdec_is_nal_unit_slice
553  This function returns true if a given NalType is of type picture or slice
554  \param[in]  NalType value of enum NalType
555  \retval[ ]  bool true if slice/picture, else false
556 */
557 VVDEC_DECL bool vvdec_is_nal_unit_slice ( vvdecNalType t );
558 
559 VVDEC_NAMESPACE_END
560 
561 #ifdef __cplusplus
562 }
563 #endif /*__cplusplus */
564 
565 #endif /*_VVDEC_H_*/
566