vdec_create_chn

Applicable Products

Product

Supported (√/x)

Ascend 950PR / Ascend 950DT

√

Atlas A3 training products / Atlas A3 inference products

√

Atlas A2 training products / Atlas A2 inference products

√

Atlas training products

x

Atlas inference products

√

Atlas 200I/500 A2 inference products

√

Description

Creates a decoding channel based on the configured channel attributes.

Prototype

  • C Prototype
    1
    hi_s32hi_mpi_vdec_create_chn(hi_vdec_chnchn,consthi_vdec_chn_attr*attr);
    
  • Python Function
    1
    ret=acl.himpi.vdec_create_chn(chn,attr)
    

Parameters

Parameter

Description

chn

Int, decoding channel ID.
  • Ascend 950PR / Ascend 950DT : The value range of this parameter is [0, 256). The maximum number of channels is 256 for the JPEGD function.
  • Atlas inference products : The value range of this parameter is [0, 256). The JPEGD and VDEC functions share the same channels, and the maximum number of channels is 256.
  • Atlas A2 training products / Atlas A2 inference products : The value range of this parameter is [0, 256). The JPEGD and VDEC functions share the same channels, and the maximum number of channels is 256. Among them, a maximum of 256 JPEGD decoding channels and 32 VDEC decoding channels are supported.
  • Atlas 200I/500 A2 inference products : The value range of this parameter is [0, 128). The JPEGD and VDEC functions share the same channels, and the maximum number of channels is 128.
  • Atlas A3 training products / Atlas A3 inference products : The value range of this parameter is [0, 256). The JPEGD and VDEC functions share the same channels, and the maximum number of channels is 256. Among them, a maximum of 256 JPEGD decoding channels and 32 VDEC decoding channels are supported.
NOTE:

For Ascend virtual instances on Atlas inference products : Total number of VDEC and JPEGD channels = (Total number of allocated VDEC and JPEGD hardware units/Total number of VDEC and JPEGD hardware units) x 256. If the total number of channels is not an integer, round down the value.

For Ascend virtual instances on Atlas A2 training products / Atlas A2 inference products , number of VDEC channels = (Number of allocated VDEC hardware units/Total number of VDEC hardware units) x 32. If the total number of channels is not an integer, round down the value. The number of JPEGD channels is independent of the computing power, but the maximum number of JPEGD and VDEC channels is 256.

For Ascend virtual instances on Atlas 200I/500 A2 inference products : The number of VDEC channels = (Allocated VDEC hardware units/VDEC hardware units) x 128. If the total number of channels is not an integer, round down the value. The number of JPEGD channels is independent of the computing power, but the maximum number of JPEGD and VDEC channels is 128.

The compute power specifications of the Ascend virtual instance (AVI) in each scenario can be queried by running the npu-smi info -t template-info command on the server where the AI processor is installed.

attr

dict, decoding channel attribute dictionary. For details, see hi_vdec_chn_attr.
  • If attr is left empty, the error code HI_ERR_VDEC_NULL_PTR is returned.
  • When a setting in the channel attributes pointed by attr exceeds the decoding capability set, the error code HI_ERR_VDEC_ILLEGAL_PARAM is returned.

Return Values

Return Value

Description

ret

Int, error code.

Restrictions

  • The channel ID of a single device must not be greater than the maximum channel ID.
  • Before this API call, ensure that a decoding channel has not been created yet or has been destroyed. Otherwise, a failure is returned.
  • If the OS memory is insufficient, the error code HI_ERR_VDEC_NO_MEM is returned. In this case, you can expand the OS memory as needed.
  • If the H.264 stream to be decoded has B-frames or the H.265 stream to be decoded supports temporal motion vector prediction (MVP) (sps_temporal_mvp_enabled_flag = 1), set temporal_mvp_en to 1 for the created channel and allocate video buffers (VBs) for the TMV output of each frame to avoid artifacts. The requested VB count of TMV output equals RefFrameNum plus 1. The TMV buffer size is much smaller than the image VB size, and can be queried by using the acl.himpi.vdec_get_tmv_buf_size call.
  • For H.264 and H.265 decoding, the minimum VB allocation per decoding channel is the sum of the number of reference frames and the number of display frames plus 1. For JPEG decoding, the minimum VB allocation per decoding channel is the number of display frames plus 1. The requested VB allocation varies according to the decode protocol and can be queried by using the acl.himpi.vdec_get_pic_buf_size call.
  • To skip decoding B-frames in H.264 streams or skip decoding H.265 streams with temporal MVP support (sps_temporal_mvp_enabled_flag = 1), set temporal_mvp_en to 0 for the created channel. In this case, no TMV information is output, and therefore you do not need to allocate a TMV VB pool, which saves memory.
  • Set the requested frame VB size (frame_buf_size) and count (frame_buf_cnt) as well as the requested TMV VB size (tmv_buf_size) based on the stream to be decoded. The decoder allocates private VB pools based on these configurations.
  • As long as the allocated frame buffer and TMV buffer are large enough, the decoding channel can decode a stream with any resolution in the valid range. The channel width and height are related only to the size of the stream buffer and SCD buffer.

Reference

For the API call sequence, see JPEGE and VENC.