For the Ascend 310 AI Processor, this function is reserved and is not supported currently.
For the Ascend 910 AI Processor, this function is reserved and is not supported currently.
JPEG Encoder (JPEGE) encodes YUV images into JPEG image files, for example, .jpg files.
To implement the JPEGE function:
Call hi_mpi_dvpp_malloc and hi_mpi_dvpp_free to allocate and free the input and output buffers on the device. The buffer lifetime is managed by the user. For details about the buffer size, see the formula in the following table.
When creating a channel by calling hi_mpi_venc_create_chn, you must properly set hi_venc_chn_attr.venc_attr.buf_size. For details about the parameter description, see hi_venc_attr.
In this mode, the JPEG header of the output data does not contain the COM comment field, and the data length is smaller. However, you need to copy the output data from the buffer returned by DVPP to the specified memory.
When creating a channel by calling hi_mpi_venc_create_chn, set hi_venc_chn_attr.venc_attr.buf_size to 0 (for details about the parameter description, see hi_venc_attr). Call hi_mpi_venc_get_jpege_predicted_size to predict the output buffer size and call hi_mpi_dvpp_malloc or hi_mpi_dvpp_free to allocate or free the output buffer.
In this mode, the output buffer address is set when hi_mpi_venc_send_jpege_frame is called. The output data is directly stored in the buffer set by the user. Compared with the other mode, this mode does not require you to copy the output data from the buffer returned by DVPP to the specified memory. However, the JPEG header of the output data may contain the COM comment field (whose length ranges from 4 bytes to 19 bytes), and thus the data length is larger.
For details about the definition of the input image format, see hi_pixel_format. For details about the concepts such as width stride and height stride, see Terminology.