Creating a Channel

Ascend 310 aclvdec API

Ascend 310P hi_mpi API

What You Need to Do

Create the struct of the channel description:

aclvdecCreateChannelDesc

No corresponding API. Use the hi_vdec_chn_attr struct directly.

Declare the variables of the hi_vdec_chn_attr struct in your code.

Set the parameters of the channel description:

aclvdecSetChannelDescEnType

aclvdecSetChannelDescOutPicWidth

aclvdecSetChannelDescOutPicHeight

aclvdecSetChannelDescRefFrameNum

aclvdecSetChannelDescChannelId (specific to acl APIs)

aclvdecSetChannelDescThreadId (specific to acl APIs)

aclvdecSetChannelDescCallback (specific to acl APIs)

aclvdecSetChannelDescOutPicFormat (specific to acl APIs)

aclvdecSetChannelDescOutMode (specific to acl APIs)

No corresponding API. Assign values to the members of hi_vdec_chn_attr struct:

hi_vdec_chn_attr.type

hi_vdec_chn_attr.pic_width

hi_vdec_chn_attr.pic_height

hi_vdec_chn_attr.video_attr.ref_frame_num

hi_vdec_chn_attr.mode (specific to hi_mpi APIs)

hi_vdec_chn_attr.stream_buf_size (specific to hi_mpi APIs)

hi_vdec_chn_attr.frame_buf_cnt (specific to hi_mpi APIs)

hi_vdec_chn_attr.frame_buf_size (specific to hi_mpi APIs)

hi_vdec_chn_attr.video_attr.temporal_mvp_en (specific to hi_mpi APIs)

hi_vdec_chn_attr.video_attr.tmv_buf_size (specific to hi_mpi APIs)

Modify your code to configure the parameters of the channel description by assigning values to the members of the hi_vdec_chn_attr struct.

Note that for the parameters specific to acl APIs, there are corresponding hi_mpi APIs.

  • The channel ID is not specified in the hi_vdec_chn_attr struct. Pass the channel ID to the hi_mpi_vdec_create_chn API when creating the channel.
  • The thread ID and callback (related to the callback function) are not specified in the hi_vdec_chn_attr struct, because no callback function needs to be set when hi_mpi APIs are used. In this case, start another thread and call hi_mpi_vdec_get_frame to obtain the decoding result.
  • The output image format parameter (outPicFormat) is not specified in the hi_vdec_chn_attr struct and is specified by the hi_vdec_pic_info.pixel_format parameter by using the hi_mpi_vdec_send_stream API to send stream data.
  • The outMode parameter that specifies whether to output a frame in real time (that is, decode a frame as soon as the frame is sent, without depending on the input of subsequent frames) is not specified in the hi_vdec_chn_attr struct. It is specified by the hi_vdec_chn_param.hi_vdec_video_param.hi_video_out_order parameter when the channel attributes are set by using hi_mpi_vdec_set_chn_param. The decoding sequence indicates that frames are output quickly.

No corresponding API.

Set channel attributes:

hi_mpi_vdec_set_chn_param

Set the output mode of the decoded frames using the hi_mpi_vdec_set_chn_param API.

Create a channel:

aclvdecCreateChannel

Create a channel:

hi_mpi_vdec_create_chn

Modify your code to create a channel using the hi_mpi_vdec_create_chn API.