8.4. Data Types

The data types and data structures related to video decoding are defined as follows:

8.4.1. VDEC_CHN_ATTR_S

【Description】

Define the decoding channel attribute structure.

【Syntax】

typedef struct _VDEC_CHN_ATTR_S {
  PAYLOAD_TYPE_E enType; /* RW; video type to be decoded   */
  VIDEO_MODE_E enMode; /* RW; send by stream or by frame */
  CVI_U32 u32PicWidth; /* RW; max pic width */
  CVI_U32 u32PicHeight; /* RW; max pic height */
  CVI_U32 u32StreamBufSize; /* RW; stream buffer size(Byte) */
  CVI_U32 u32FrameBufSize; /* RW; frame buffer size(Byte) */
  CVI_U32 u32FrameBufCnt;
  union {
    VDEC_ATTR_VIDEO_S
    stVdecVideoAttr; /* structure with video ( h264/h265) */
  };
} VDEC_CHN_ATTR_S;

【Member】

Member

Description

enType

Decode protocol type enumeration. Video Codec common enumeration: PT_JPEG/ PT_H264/ PT_H265/ PT_MJPEG

enMode

Bitstream delievry mode. Currently only support VIDEO_MODE_FRAME

u32PicWidth

Maximum width of decoded image supported by channel (in pixels)

u32PicHeight

Maximum height of decoded image supported by channel (in pixels)

u32StreamBufSize

The size of the bitstream buffer.

(u32StreamBufSize = u32Width * u32Height)

u32FrameBufSize

Size of buffer for storing decoded image frames (varies depending on enType).

u32FrameBufCnt

The number of decoded image frames.

stVdecVideoAttr

Video (H.264/H.265) decoding channel properties.

【Note】

CV181x VDEC module only supports PT_JPEG/PT_MJPEG/PT_H264,CV180x only supports PT_JPEG/PT_MJPEG.

【Related Data Type and Interface】

None.

8.4.2. VDEC_ATTR_VIDEO_S

【Description】

Define the video decoding video channel attributes.

【Syntax】

typedef struct _VDEC_ATTR_VIDEO_S {
  CVI_U32 u32RefFrameNum;
  CVI_BOOL bTemporalMvpEnable;
  CVI_U32 u32TmvBufSize;
} VDEC_ATTR_VIDEO_S;

【Member】

Member

Description

u32RefFrameNum

The number of reference frames.

(currently not supported)

bTemporalMvpEnable

Whether time domain motion vector prediction is supported.

(currently not supported)

u32TmvBufSize

The size of Tmv Buffer of video decoded image.

(currently not supported)

【Note】

None.

【Related Data Type and Interface】

None.

8.4.3. VIDEO_MODE_E

【Description】

Define the bitstream delievry mode.

【Syntax】

 typedef enum _VIDEO_MODE_E {
  VIDEO_MODE_STREAM = 0, /* send by stream */
  VIDEO_MODE_FRAME, /* send by frame  */
  VIDEO_MODE_COMPAT, /* One frame supports multiple packets sending. */
  /* The current frame is considered to end when bEndOfFrame is equal to HI_TRUE */
  VIDEO_MODE_BUTT
} VIDEO_MODE_E;

【Member】

Member

Description

VIDEO_MODE_STREAM

Send the bitstream as a stream. This mode is not supported for JPEG/MJPEG decoding

(currently not supported)

VIDEO_MODE_FRAME

The bitstream is sent in frame mode.

VIDEO_MODE_COMPAT

Sending bitstream in compatibility mode.

(Currently not supported)

【Note】

None.

【Related Data Type and Interface】

None.

8.4.4. VDEC_CHN_STATUS_S

【Description】

Define the channel state structure.

【Syntax】

 typedef struct _VDEC_CHN_STATUS_S {
  PAYLOAD_TYPE_E enType;
  CVI_S32 u32LeftStreamBytes;
  CVI_S32 u32LeftStreamFrames;
  CVI_S32 u32LeftPics;
  CVI_BOOL bStartRecvStream;
  CVI_U32 u32RecvStreamFrames;
  CVI_U32 u32DecodeStreamFrames;
  VDEC_DECODE_ERROR_S stVdecDecErr;
  CVI_U32 u32Width;
  CVI_U32 u32Height;
} VDEC_CHN_STATUS_S;

【Member】

Member

Description

enType

Decoding protocol type enumeration. Video Codec common enumeration: PT_JPEG/ PT_H264/ PT_H265/ PT_MJPEG

u32LeftStreamBytes

The number of bytes to be decoded in the bitstream buffer, including the number of undeciphered bytes in the current frame being decoded.

u32LeftStreamFrames

The number of frames to be decoded in the bitstream buffer, excluding the current frame being decoded.

1 means invalid.

u32LeftPics

The number of pic remaining in the image buffer.

bStartRecvStream

Whether the decoder has started receiving the bitstream.

u32RecvStreamFrames

The number of received frames in the bitstream buffer. - 1 means invalid.

u32DecodeStreamFrames

The number of decoded frames in the bitstream buffer.

stVdecDecErr

Decoding error message.

u32Width

image width

u32Height

image height.

【Note】

CV181x VDEC module only supports PT_JPEG/PT_MJPEG/PT_H264,CV180x only supports PT_JPEG/PT_MJPEG.

【Related Data Type and Interface】

None.

8.4.5. VDEC_DECODE_ERROR_S

【Description】

Define the decoding error information structure.

【Syntax】

 typedef struct _VDEC_DECODE_ERROR_S {
  CVI_S32 s32FormatErr;
  CVI_S32 s32PicSizeErrSet;
  CVI_S32 s32StreamUnsprt;
  CVI_S32 s32PackErr;
  CVI_S32 s32PrtclNumErrSet;
  CVI_S32 s32RefErrSet;
  CVI_S32 s32PicBufSizeErrSet;
  CVI_S32 s32StreamSizeOver;
  CVI_S32 s32VdecStreamNotRelease;
} VDEC_DECODE_ERROR_S;

【Member】

Member

Description

s32FormatErr

Unsupported format.

s32PicSizeErrSet

The width (or height) of the image is larger than that of the channel.

s32StreamUnsprt

Unsupported specification (the code stream specification is inconsistent with the specification claimed by the processor).

s32PackErr

There is an error in the bit stream.

s32PrtclNumErrSet

The number of protocol parameters set is insufficient. For example, the number of Slice, Pps and Sps.

s32RefErrSet

The number of reference frames set is insufficient.

s32PicBufSizeErrSet

The memory size of image buffer is insufficient.

s32StreamSizeOver

One frame code stream is too large. When the whole SCDbuffer can not hold the next frame code stream, the SCDbuffer is forced to be cleared.

s32VdecStreamNotRelease

VFMW internal management stream error. The bitstream is held for a long time without being released.

【Note】

None.

【Related Data Type and Interface】

None.

8.4.6. VDEC_CHN_PARAM_S

【Description】

Define advanced parameters of decoding channel.

【Syntax】

 typedef struct _VDEC_CHN_PARAM_S {
  PAYLOAD_TYPE_E enType;
  CVI_U32 u32DisplayFrameNum;
  union {
    VDEC_PARAM_VIDEO_S
    stVdecVideoParam;
    VDEC_PARAM_PICTURE_S
    stVdecPictureParam;
  };
} VDEC_CHN_PARAM_S;

【Member】

Member

Description

enType

Common enumeration: PT_JPEG/ PT_H264/ PT_H265/ PT_MJPEG

u32DisplayFrameNum

The minimum number of frames to decode the cached image.

stVdecVideoParam

Video (H.264 / H.265) decoding advanced parameters.

stVdecPictureParam

Picture (JPEG/MJPEG) decoding advanced parameters

【Note】

None.

【Related Data Type and Interface】

  • CVI_VDEC_GetChnParam

  • CVI_VDEC_SetChnParam

8.4.7. VDEC_PARAM_VIDEO_S

【Description】

Define advanced parameters of video decoding.

【Syntax】

 typedef struct _VDEC_PARAM_VIDEO_S {
  CVI_S32 s32ErrThreshold;
  VIDEO_DEC_MODE_E enDecMode;
  VIDEO_OUTPUT_ORDER_E enOutputOrder;
  COMPRESS_MODE_E enCompressMode;
  VIDEO_FORMAT_E enVideoFormat;
} VDEC_PARAM_VIDEO_S;

【Member】

Member

Description

s32ErrThreshold

Error threshold.

Value range: [0, 100]. 0 stands for losing when there is an error, 100 stands for none.

enDecMode

Decoding mode:

enOutputOrder

Decoding image output order.

enCompressMode

Decoding image compression mode. COMPRESS_MODE_NONE = 0, COMPRESS_MODE_TILE, COMPRESS_MODE_LINE, COMPRESS_MODE_FRAME,

enVideoFormat

Decoding image data format.

【Note】

None.

【Related Data Type and Interface】

This parameter setting is related to VI module.

8.4.8. VDEC_PARAM_PICTURE_S

【Description】

Define advanced parameters of graphics decoding.

【Syntax】

 typedef struct _VDEC_PARAM_PICTURE_S {
  PIXEL_FORMAT_E enPixelFormat;
  CVI_U32 u32Alpha;
} VDEC_PARAM_PICTURE_S;

【Member】

Member

Description

enPixelFormat

JPEG (MJPEG) decoding output format. Please refer to: typedef enum _PIXEL_FORMAT_E in cvi_comm_video.h

u32Alpha

Global alpha when outputting in ARGB format, only valid when outputting in ARGB

(currently not supported).

【Note】

None.

【Related Data Type and Interface】

None.

8.4.9. VIDEO_DEC_MODE_E

【Description】

Define the video decoding mode enumeration.

【Syntax】

 typedef enum _VIDEO_DEC_MODE_E {
  VIDEO_DEC_MODE_IPB = 0,
  VIDEO_DEC_MODE_IP,
  VIDEO_DEC_MODE_I,
  VIDEO_DEC_MODE_BUTT
} VIDEO_DEC_MODE_E;

【Member】

Member

Description

VIDEO_DEC_MODE_IPB

In IPB mode, i.e. I, P and B frames are all decoded.

VIDEO_DEC_MODE_IP

IP mode. Only I frames and P frames are decoded.

VIDEO_DEC_MODE_I

I mode. Only I frames are decoded.

【Note】

None.

【Related Data Type and Interface】

None.

8.4.10. VIDEO_OUTPUT_ORDER_E

【Description】

Define the video decoding output order enumeration.

【Syntax】

 typedef enum _VIDEO_OUTPUT_ORDER_E {
  VIDEO_OUTPUT_ORDER_DISP = 0,
  VIDEO_OUTPUT_ORDER_DEC,
  VIDEO_OUTPUT_ORDER_BUTT
} VIDEO_OUTPUT_ORDER_E;

【Member】

Member

Description

VIDEO_OUTPUT_ORDER_DISP

Display order output.

VIDEO_OUTPUT_ORDER_DEC

Decoding order output.

【Note】

The decoded bitstream with B frame should be set to display order output.

【Related Data Type and Interface】

None.

8.4.11. COMPRESS_MODE_E

【Description】

Define an enumeration of decoding image compression modes.

【Syntax】

 typedef enum _COMPRESS_MODE_E {
  COMPRESS_MODE_NONE = 0,
  COMPRESS_MODE_TILE,
  COMPRESS_MODE_LINE,
  COMPRESS_MODE_FRAME,
  COMPRESS_MODE_BUTT
} COMPRESS_MODE_E;

【Member】

Member

Description

COMPRESS_MODE_NONE

No compression.

COMPRESS_MODE_TILE

Reserved

COMPRESS_MODE_LINE

Reserved

COMPRESS_MODE_FRAME

Reserved

【Note】

None.

【Related Data Type and Interface】

None.

8.4.12. H264_PRTCL_PARAM_S

【Description】

Memory allocation parameters related to H.264 protocol.

【Syntax】

 typedef struct _H264_PRTCL_PARAM_S {
  CVI_S32 s32MaxSliceNum; /* RW; max slice num support */
  CVI_S32 s32MaxSpsNum; /* RW; max sps num support */
  CVI_S32 s32MaxPpsNum; /* RW; max pps num support */
} H264_PRTCL_PARAM_S;

【Member】

Member

Description

s32MaxSliceNum

The maximum number of Slice supported by the channel decoding.

s32MaxSpsNum

The maximum number of SPS supported by the channel decoding.

s32MaxPpsNum

The maximum number of PPS supported by the channel decoding.

【Note】

None.

【Related Data Type and Interface】

8.4.13. H265_PRTCL_PARAM_S

【Description】

Memory allocation parameters related to H.265 protocol.

【Syntax】

 typedef struct _H265_PRTCL_PARAM_S {
  CVI_S32 s32MaxSliceSegmentNum; /* RW; max slice segmnet num support */
  CVI_S32 s32MaxVpsNum; /* RW; max vps num support */
  CVI_S32 s32MaxSpsNum; /* RW; max sps num support */
  CVI_S32 s32MaxPpsNum; /* RW; max pps num support */
} H265_PRTCL_PARAM_S;

【Member】

Member

Description

s32MaxSliceSegmentNum

The maximum number of SliceSegment supported by the channel decoding.

s32MaxVpsNum

The maximum number of VPS supported by the channel decoding.

s32MaxSpsNum

The maximum number of SPS supported by the channel decoding.

s32MaxPpsNum

The maximum number of PPS supported by the channel decoding.

【Note】

None.

【Related Data Type and Interface】

8.4.14. VDEC_PRTCL_PARAM_S

【Description】

Memory allocation parameters related to protocol.

【Syntax】

 typedef struct _VDEC_PRTCL_PARAM_S {
  PAYLOAD_TYPE_E
  enType;
  union {
  H264_PRTCL_PARAM_S
  stH264PrtclParam;
  H265_PRTCL_PARAM_S
  stH265PrtclParam;
  };
} VDEC_PRTCL_PARAM_S;

【Member】

Member

Description

enType

Decoding protocol supported by channel.

stH264PrtclParam

H.264 protocol parameter

stH265PrtclParam

H.265 protocol parameter

【Note】

CV181x VDEC module only supports PT_JPEG/PT_MJPEG/PT_H264,CV180x only supports PT_JPEG/PT_MJPEG.

【Related Data Type and Interface】

None.

8.4.15. VDEC_STREAM_S

【Description】

Define the bitstream structure of video decoding.

【Syntax】

 typedef struct _VDEC_STREAM_S {
  CVI_U32 u32Len;
  CVI_U64 u64PTS;
  CVI_BOOL bEndOfFrame;
  CVI_BOOL bEndOfStream;
  CVI_BOOL bDisplay;
  CVI_U8 *pu8Addr;
} VDEC_STREAM_S;

【Member】

Member

Description

u32Len

The length of the stream packet.

u64PTS

The timestamp of the stream packet.

bEndOfFrame

Whether the current frame ends.

bEndOfStream

Whether all the bitstream has been sent.

pu8Addr

The address of the stream packet.

bDisplay

Whether the current frame is output for display.

【Note】

None.

【Related Data Type and Interface】

None.

8.4.16. VDEC_USERDATA_S

【Description】

Define the user data structure.

【Syntax】

 typedef struct _VDEC_USERDATA_S {
  CVI_U64 u64PhyAddr;
  CVI_U32 u32Len;
  CVI_BOOL bValid;
  CVI_U8 *pu8Addr;
} VDEC_USERDATA_S;

【Member】

Member

Description

u32PhyAddr

The physical address of the user data

u32Len

The length of user data.

bValid

Valid identifier of the current data.

pu8Addr

The virtual address of the user data.

【Note】

None.

【Related Data Type and Interface】

None.

8.4.17. VIDEO_DISPLAY_MODE_E

【Description】

Defines the display mode enumeration.

【Syntax】

 typedef enum _VIDEO_DISPLAY_MODE_E {
  VIDEO_DISPLAY_MODE_PREVIEW = 0x0,
  VIDEO_DISPLAY_MODE_PLAYBACK = 0x1,
  VIDEO_DISPLAY_MODE_MAX
} VIDEO_DISPLAY_MODE_E;

【Member】

Member

Description

VIDEO_DISPLAY_MODE_PREVIEW

Preview mode.

VIDEO_DISPLAY_MODE_PLAYBACK

Playback mode.

【Note】

None.

【Related Data Type and Interface】

None.

8.4.18. VDEC_PARAM_MOD_S

【Description】

Parameters related to decoding modules.

【Syntax】

 typedef struct _VDEC_MOD_PARAM_S {
  VB_SOURCE_E enVdecVBSource;
  CVI_U32 u32MiniBufMode;
  CVI_U32 u32ParallelMode;
  VDEC_VIDEO_MOD_PARAM_S stVideoModParam;
  VDEC_PICTURE_MOD_PARAM_S stPictureModParam;
} VDEC_MOD_PARAM_S;

【Member】

Member

Description

enVdecVBSource

Source of decoding frame buffer (VB).

Value range: only supported VB_SOURCE_COMMON, VB_SOURCE_USER

u32MiniBufMode

Stream buffer configuration mode

u32ParallelMode

VDH decoding mode

stVideoModParam

Parameters of video decoding module. Invalid for JPEG / MJPEG.

stPictureModParam

Picture decoding module parameters. Invalid for H264/H265.

【Note】

None.

【Related Data Type and Interface】

  • CVI_VDEC_SetModParam

  • CVI_VDEC_GetModParam

8.4.19. VDEC_VIDEO_MOD_PARAM_S

【Description】

Define the parameter structure of video decoding module

【Syntax】

typedef struct _VDEC_VIDEO_MOD_PARAM_S {
   CVI_U32 u32MaxPicWidth;
   CVI_U32 u32MaxPicHeight;
   CVI_U32 u32MaxSliceNum;
   CVI_U32 u32VdhMsgNum;
   CVI_U32 u32VdhBinSize;
   CVI_U32 u32VdhExtMemLevel;
 } VDEC_VIDEO_MOD_PARAM_S;

【Member】

Member

Description

u32MaxPicWidth

Maximum width supported by video decoding.

Value range: See Table 7-1, the minimum value is the minimum width of the resolution supported by H.264/H.265 decoding.

The maximum value is the maximum width of the resolution supported by H.264/H.265 decoding.

The default value is the maximum value.

u32MaxPicHeight

Maximum height supported by video decoding.

Value range: See Table 7-1, the minimum value is the minimum width of the resolution supported by H.264/H.265 decoding.

The maximum value is the maximum width of the resolution supported by H.264/H.265 decoding.

The default value is the maximum value.

u32MaxSliceNum

Maximum number of slice supported by H.264/H.265 decoding.

Value range: the minimum value is 1, and the maximum value is the maximum number of slice supported by H.264/H.265 decoding.

The default value is the maximum value.

u32VdhMsgNum

The number of VDH decoded message pools.

u32VdhBinSize

Size of the buffer used to cache bin data for VDH decoding.

u32VdhExtMemLevel

Level of external memory allocation for VDH decoding.

【Note】

CV812x only supports H264 decoding.

【Related Data Type and Interface】

  • CVI_VDEC_SetModParam

  • CVI_VDEC_GetModParam

8.4.20. VDEC_PICTURE_MOD_PARAM_S

【Description】

Define the parameter structure of picture decoding module.

【Syntax】

 typedef struct _VDEC_PICTURE_MOD_PARAM_S {
    CVI_U32 u32MaxPicWidth;
    CVI_U32 u32MaxPicHeight;
    CVI_BOOL bSupportProgressive;
    CVI_BOOL bDynamicAllocate;
    VDEC_CAPACITY_STRATEGY_E enCapStrategy;
} VDEC_PICTURE_MOD_PARAM_S;

【Member】

Member

Description

u32MaxPicWidth

The maximum width supported by image decoding, with a default value of the maximum width supported by the current processor.

Value range: the minimum value is the minimum width supported by JPEG/MJPEG decoding, and the maximum value is the maximum width supported by JPEG/MJPEG decoding.

The default value is the maximum value.

u32MaxPicHeight

The maximum height supported by the image decoding, with a default value of the maximum height supported by the current processor.

The value range is from the minimum width of the supported resolution for JPEG/MJPEG decoding to the maximum width of the supported resolution for JPEG/MJPEG decoding, with a default value of the maximum width.

bSupportProgressive

Whether JPEG / MJPEG decoding supports progressive format.

bDynamicAllocate

When JPEG / MJPEG decoding supports progressive format, the required buf allocation method is 0 by default.

enCapStrategy

The maximum width and height capability set strategy of decoding image.

【Note】

None.

【Related Data Type and Interface】

  • CVI_VDEC_SetModParam

  • CVI_VDEC_GetModParam

8.4.21. VDEC_CHN_POOL_S

【Description】

Define the VB pool structure bound to the decoding channel.

【Syntax】

 typedef struct _VDEC_CHN_POOL_S {
    VB_POOL hPicVbPool; /* RW;  vb pool id for pic buffer */
    VB_POOL hTmvVbPool; /* RW;  vb pool id for tmv buffer */
} VDEC_CHN_POOL_S;

【Member】

Member

Description

hPicVbPool

VB pool Poold for storing picture

hTmvVbPool

VB pool Poolld used to store TMV.

【Note】

None.

【Related Data Type and Interface】

  • CVI_VDEC_AttachVbPool