Updated on 2022-03-13 GMT+08:00

Structures and Classes in vdec_in_msg

The structures are defined in the ddk/include/inc/dvpp/Vdec.h file in the DDK installation directory.

  • FRAME structure

Member Variable

Description

int height

Height of the output image after alignment. For the H.264 format, the value is 16-pixel aligned. For the H.265 format, the value is 64-pixel aligned.

int width

Width of the output image after alignment. For the H.264 format, the value is 16-pixel aligned. For the H.265 format, the value is 64-pixel aligned.

int realHeight

Actual image height

int realWidth

Actual image width

unsigned char* buffer

Buffer address of the output image

int buffer_size

Buffer size of the output image

unsigned int offset_payload_y

Y component offset of the output image payload. Y component address of the payload = Buffer + offset_payload_y

unsigned int offset_payload_c

C component offset of the output image payload. C component address of the payload = Buffer + offset_payload_c

unsigned int offset_head_y

Y component offset of the output image header. Y component address of the header = Buffer + offset_head_y

unsigned int offset_head_c

C component offset of the output image header. C component address of the header = Buffer + offset_head_c

unsigned int stride_payload

Payload stride of the output image

unsigned int stride_head

Header stride of the output image

unsigned short bitdepth

Bit depth of the output image

char video_format[10]

Video format. The format can be h264 or h265.

char image_format[10]

Output image format. The format can be nv12 or nv21.

  • HIAI_DATA_SP class

Member Variable or Function

Description

unsigned long long frameIndex

Frame sequence number

void * frameBuffer

Buffer for storing output frames

unsigned int frameSize

Size of the buffer for storing output frames

void setFrameIndex(unsigned long long index)

Function for configuring the frame sequence number

unsigned long long getFrameIndex()

Function for obtaining the frame sequence number

void setFrameBuffer(void * frameBuff)

Function for setting the frame buffer address

void * getFrameBuffer()

Function for obtaining the frame buffer address

void setFrameSize(unsigned int size)

Function for setting the frame size

unsigned int getFrameSize()

Function for obtaining the frame size

  • VDECERR structure

Member Variable

Description

ERRTYPE errType

Error type

enum ERRTYPE{

// An error occurs when the VDEC state is abnormal. You need to destroy the VDEC instance and then create a new one.

ERR_INVALID_STATE = 0x10001,

// A hardware error occurs. For example, the VDEC is started, executed, or stopped abnormally. You need to destroy the VDEC instance and then create a new one.

ERR_HARDWARE,

// An error occurs when the video stream is divided into multiple frames of images. You need to check whether the input video stream data is correct.

ERR_SCD_CUT_FAIL,

// An error occurs when a frame is decoded. You need to check whether the input video stream data is correct.

ERR_VDM_DECODE_FAIL,

// Reserved

ERR_ALLOC_MEM_FAIL,

// An error occurs when the input video resolution exceeds the range or the internal dynamic memory allocation fails. You need to check the resolution of the input video or available memory of the system as required.

ERR_ALLOC_DYNAMIC_MEM_FAIL,

// An error occurs when the input and output buffers of the VDEC are allocated. You need to check whether the system has available memory.

ERR_ALLOC_IN_OR_OUT_PORT_MEM_FAIL,

// A stream error occurs. This structure is reserved.

ERR_BITSTREAM,

// A video format error occurs. This structure is reserved.

ERR_VIDEO_FORMAT,

// An error occurs in the output format configuration. This structure is reserved.

ERR_IMAGE_FORMAT,

// A null error occurs in the callback function. This structure is reserved.

ERR_CALLBACK,

// A null error occurs in the input buffer. This structure is reserved.

ERR_INPUT_BUFFER,

// An error occurs when the size of the input buffer is less than or equal to 0. This structure is reserved.

ERR_INBUF_SIZE,

// A thread error occurs when the system returns the decoding result through the callback function. You need to check whether the resources (such as threads and memory) in the system are available.

ERR_THREAD_CREATE_FBD_FAIL,

// An error occurs when the VDEC instance fails to be created. You need to create a VDEC instance again.

ERR_CREATE_INSTANCE_FAIL,

// An error occurs when the VDEC fails to be initialized. For example, the number of VDEC instances exceeds 16, which is the upper limit. In this case, you need to release some VDEC instances and create new ones.

ERR_INIT_DECODER_FAIL,

// An error occurs when the VDEC handle to a video stream fails to be obtained. You need to create a VDEC instance again.

ERR_GET_CHANNEL_HANDLE_FAIL,

// An error occurs when a VENC instance is set abnormally in the system. You need to check whether the input parameter values of the VENC are correct, such as the input video format (video_format) and output frame format (image_format).

ERR_COMPONENT_SET_FAIL,

// An error occurs when a VENC instance name is set abnormally in the system. You need to check whether the input parameter values of the VENC are correct, such as the input video format (video_format) and output frame format (image_format).

ERR_COMPARE_NAME_FAIL,

// Other errors occur.

ERR_OTHER

};

unsigned short channelId

Channel for a decoding error