Sending Images to Be Encoded

Ascend 310 acldvpp API

Ascend 310P hi_mpi API

What You Need to Do

Configure the input image information:

acldvppCreatePicDesc

acldvppSetPicDescData

acldvppSetPicDescSize

acldvppSetPicDescFormat

acldvppSetPicDescWidth

acldvppSetPicDescHeight

acldvppSetPicDescWidthStride

acldvppSetPicDescHeightStride

No corresponding API. When configuring the input images, directly assign values to the members of the hi_video_frame_info struct:

hi_video_frame_info.v_frame.virt_addr

hi_video_frame_info.v_frame.pixel_format

hi_video_frame_info.v_frame.width

hi_video_frame_info.v_frame.height

hi_video_frame_info.v_frame.width_stride

hi_video_frame_info.v_frame.height_stride

Modify your code to configure the parameters of the input images by assigning values to the members of the hi_video_frame_info struct.

You do not need to set the size of the input data when using hi_mpi APIs as the system automatically calculates the size of the input data based on the image resolution and format.

Configure the quality of image encoding:

acldvppCreateJpegeConfig

acldvppSetJpegeConfigLevel

Configure the image encoding quality by changing the value of hi_venc_jpeg_param.qfactor:

hi_mpi_venc_set_jpeg_param

Modify your code to use hi_mpi_venc_set_jpeg_param to configure the JPEGE image encoding quality.

No corresponding API. The encoder does not need to be instructed to start receiving images to be encoded.

Notify the encoder of starting receiving input data (the API needs to be called only once per channel):

hi_mpi_venc_start_chn

Add the hi_mpi_venc_start_chn API call in your code.

Send an image to be encoded for each frame using the API and pass the address of output buffer allocated before:

acldvppJpegEncodeAsync

When the output buffer is managed by the system, hi_mpi_venc_send_frame needs to be called for each frame to send encoded images.

When the output buffer is managed by the system, hi_mpi_venc_send_jpege_frame needs to be called for each frame to send encoded images.

Modify your code to send the image to be encoded by using hi_mpi_venc_send_frame or hi_mpi_venc_send_jpege_frame and pass the channel ID.