Function: dvpp_jpeg_decode_async

Applicability

Product

Supported (√/x)

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Decodes a .jpg, .jpeg, .JPG, or .JPEG image. This API is asynchronous.

Prototype

  • C Prototype
    1
    aclError acldvppJpegDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size, acldvppPicDesc *outputDesc, aclrtStream stream)
    
  • Python Function
    1
    ret = acl.media.dvpp_jpeg_decode_async(dvpp_channel_desc, data, size, output_dvpp_pic_desc, stream)
    

Parameter Description

Parameter

Description

dvpp_channel_desc

Int, pointer address of the channel description. It must be the same as dvpp_channel_desc passed to the acl.media.dvpp_create_channel call.

data

Int, pointer address of the memory address of the input image.

size

Int, actual size of the input image, in bytes.

output_dvpp_pic_desc

Int, pointer address of the output image information.

When it is used as an output, the user can obtain the decoding output from the buffer address and call the acl.media.dvpp_get_pic_desc APIs to obtain the width and height of the output image.

NOTE:

Atlas inference products : If the decoding output will be further processed (for example, cropped and resized by VPC), use the acl.media.dvpp_get_pic_desc calls to obtain the width and height of the output image, in case that the image width and height have been adjusted due to alignment requirements.

For example, for JPEG (444) to YUV420SP decoding, if the input width and height are odd numbers, the output width and height are theoretically odd numbers. However, JPEGD will round down the output width and height to multiples of 2, as required by the YUV420SP format.

Atlas 200I/500 A2 inference products : If the decoding output will be further processed (for example, cropped and resized by VPC), use the acl.media.dvpp_get_pic_desc calls to obtain the width and height of the output image, in case that the image width and height have been adjusted due to alignment requirements.

For example, for JPEG (444) to YUV420SP decoding, if the input width and height are odd numbers, the output width and height are theoretically odd numbers. However, JPEGD will round down the output width and height to multiples of 2, as required by the YUV420SP format.

Atlas A2 training products / Atlas A2 inference products : If the decoding output will be further processed (for example, cropped and resized by VPC), use the acl.media.dvpp_get_pic_desc calls to obtain the width and height of the output image, in case that the image width and height have been adjusted due to alignment requirements.

For example, for JPEG (444) to YUV420SP decoding, if the input width and height are odd numbers, the output width and height are theoretically odd numbers. However, JPEGD will round down the output width and height to multiples of 2, as required by the YUV420SP format.

Atlas A3 training products / Atlas A3 inference products : If the decoding output will be further processed (for example, cropped and resized by VPC), use the acl.media.dvpp_get_pic_desc calls to obtain the width and height of the output image, in case that the image width and height have been adjusted due to alignment requirements.

For example, for JPEG (444) to YUV420SP decoding, if the input width and height are odd numbers, the output width and height are theoretically odd numbers. However, JPEGD will round down the output width and height to multiples of 2, as required by the YUV420SP format.

stream

Int, stream object.

Return Value Description

Return Value

Description

ret

Int, error code: 0 on success; else, failure.

Restrictions

This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, call the synchronization API (for example, acl.rt.synchronize_stream) to ensure that the task is complete.

Reference

For details about the API call sequence and example, see JPEGD.