For the Ascend 310 AI Processor, this function is not supported in the current version.
For the Ascend 910 AI Processor, this function is not supported in the current version.
If a YUV image needs to be encoded into a JPEG image during app development, ensure that your app contains the code logic for such image encoding. For details about the API call sequence, see API Call Sequence. For details about the JPEGE functions, see JPEGE Functions and Restrictions.
After creating a channel, you can set advanced encoding parameters such as the scene mode and stream controller as required. For details, see hi_mpi_venc_set_jpeg_param to hi_mpi_venc_compact_jpeg_tables.
Skip this step if the select or poll function is used.
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.