Function: dvpp_jpeg_encode_async

Applicability

Product

Supported

Atlas 350 Accelerator Card

x

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

Description

Encodes YUV images into JPG images. This API is asynchronous.

Prototype

  • C Prototype
    1
    aclError acldvppJpegEncodeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, const void *data, uint32_t *size, acldvppJpegeConfig *config, aclrtStream stream)
    
  • Python Function
    1
    ret = acl.media.dvpp_jpeg_encode_async(dvpp_channel_desc, input_dvpp_pic_desc, data, size_ptr, dvpp_jpege_config, stream)
    

Parameters

Parameter

Description

dvpp_channel_desc

Int, pointer address of the channel description. The value must be the same as that of dvpp_channel_desc specified when a channel is created by calling acl.media.dvpp_create_channel.

input_dvpp_pic_desc

Int, pointer address of the description of input images.
  • Call the acl.media.dvpp_create_pic_desc API to create the image description.
  • Call the acl.media.dvpp_set_pic_desc APIs to set image description parameters (such as the image format, width, and height).

    For details about the requirements on the input image resolution (≤ maximum channel width x maximum channel height) and image format, see Functions and Restrictions.

data

Int, pointer address of the output buffer address for storing encoded data.

size_ptr

Int, pointer to the output buffer size, in bytes.

  • acl.media.dvpp_jpeg_predict_enc_size is called in advance to predict the output buffer size out_buffer_size.
  • np_out_size = np.array([out_buffer_size], dtype=np.int32) is called to create data of a NumPy array. Then bytes_data = np_out_size.tobytes()-> \->size_ptr = acl.util.bytes_to_ptr(bytes_data), is called to convert the data into an object as the argument.

    Note: After the function is called successfully, the data (np_out_size) converted by size_ptr changes.

dvpp_jpege_config

Int, pointer address of the image encoding configuration.

stream

Specified stream.

Return Value

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 examples, see JPEGD.