hi_mpi_venc_set_roi_attr
The
The Ascend 910 AI Processor does not support this API.
Description
Sets the ROI attributes of an H.264/H.265 channel. This is used to limit the QP value of the ROI so that it is different from that of other ROIs. For details about the ROI encoding function, see ROI Encoding Function.
Restrictions
- This API is used to set the ROI attributes of an H.264/H.265 channel.
- This API must be called after an encoding channel is created and before the channel is destroyed. If this API is called during encoding, the configuration takes effect only after the next frame is encoded.
- It is recommended that this API be called after an encoding channel is created and before encoding is started, to reduce the number of the API calls during encoding.
- It is recommended that hi_mpi_venc_get_roi_attr be called before this API to obtain the ROI configurations of the current encoding channel.
- After this API is called to set the ROI attributes, if the system logic determines that the current frame is encoded as a P-Skip frame, the effect of the P-Skip frame takes priority.
Prototype
hi_s32 hi_mpi_venc_set_roi_attr(hi_venc_chn chn, const hi_venc_roi_attr *roi_attr)
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
chn |
Input |
Encoding channel ID. |
|
roi_attr |
Input |
Pointer to the ROI parameters. |
Returns
- 0: success
- Other values: failure. For details, see VENC/JPEGE Return Codes.
ROI Encoding Function
ROI encoding is used to encode a region of interest (ROI).
You can configure an ROI to limit its QP value. This can limit the QP value of the ROI so that it is different from that of other ROIs. Currently, only H.264 and H.265 channels support ROI settings. Eight ROIs are provided for users at the same time.
The eight regions can be overlaid with each other and the overlay priority ranges from 0 to 7. The overlay priority indicates the final QP value of image regions when the regions are overlaid. The final QP value is set according to the region with the highest priority. ROIs can be configured in absolute or relative QP mode.
- Absolute QP: The QP value of an ROI is the user-defined QP value.
- Relative QP: The QP value of an ROI is the sum of the QP value generated during bit rate control and the user-defined QP offset.
The following figure is used as an example, where the QP values of all macroblocks in the image are 25. ROI 0 is set to the absolute QP mode, with the QP value of 10 and the index of 0. ROI 1 is set to the relative QP mode, with the QP value of –10 and the index of 1. When the two regions are overlaid, the QP is set according to the region with the highest priority (ROI 1). The QP value of ROI 0 except the overlapping part is 10. The QP value of ROI 1 is 15 (25 – 10).
