hi_vdec_chn_attr

Description

Defines the VDEC channel attributes.

Prototype

hi_vdec_chn_attr= {"type": hi_payload_type, # RW; video type to be decoded
                    "mode": hi_vdec_send_mode, # RW; send by stream or by frame
                    "pic_width": pic_width, # RW; max pic width
                    "pic_height": pic_height, # RW; max pic height
                    "stream_buf_size": stream_buf_size, # stream buf size(Byte)
                    "frame_buf_size": frame_buf_size, # RW; frame buf size(Byte)
                    "frame_buf_cnt": frame_buf_cnt, # RW; frame buf num
                    "video_attr": hi_vdec_video_attr} # RW; structure with video

Members

Member

Description

type

Int, decoding protocol type, which is a static attribute.

mode

Int, stream sending mode, which is a static attribute.

pic_width

Int, maximum width of the image to be decoded (in pixels), which is a static attribute.

pic_height

Int, maximum height of the image to be decoded (in pixels), which is a static attribute.

stream_buf_size

Int, size of the stream buffer, which is a static attribute.

The value (in bytes) must be greater than or equal to 3/4 of the decoding channel size (Width x Height), that is, half of the YUV420 image size (Width x Height x 3/2 x 1/2), and smaller than or equal to 1024 x 1024 x 1024 (bytes).

You are advised to set the buffer size to the size of a decoded YUV420 picture, that is, width x height x 1.5.

frame_buf_size

Int, size of the buffer for storing decoded image frames, in bytes. Invalid for JPEGD.

Value range: ≥ 0.

  • When this parameter is set to 0, the VDEC automatically allocates an appropriate frame buffer size based on the actual stream information.
  • If the value is greater than 0, ensure that the following condition is met: Frame buffer size x Number of reference frames) ≥ Required minimum frame buffer size x Required minimum number of reference frames). Otherwise, decoding fails.

The required minimum frame buffer size can be obtained by the acl.himpi.vdec_get_pic_buf_size call, which takes arguments including the width, height, and bit width of the input stream as specified in the sequence parameter set (SPS) of the stream.

frame_buf_cnt

Int, number of decoded image frame buffers. Invalid for JPEGD.

Value range: ≥ 0.

  • Generally, if this parameter is set to 0, VDEC automatically allocates an appropriate number of frame buffers based on the actual stream information.
  • If you want to limit the frame buffer size for VDEC decoding, set this parameter to a value greater than 0. Ensure that Frame buffer size x Number of reference framesRequired minimum frame buffer size x Required minimum number of reference frames. Otherwise, decoding fails.

The number of reference frames is specified in the SPS of the stream. Number of required minimum reference frames for H.264/H.265 decoding = Number of reference frames + Number of display frames + 1.

video_attr

Dictionary, video (H.264/H.265) decoding channel attributes.

Precautions

Set the channel width and height to the actual values if possible. If the stream width and height are unknown, set them to the maximum, which is 4096 x 4096.