acl.himpi.venc_set_roi_attr
C Prototype |
hi_s32 hi_mpi_venc_set_roi_attr(hi_venc_chn chn, const hi_venc_roi_attr *roi_attr) |
|---|---|
Python Function |
ret = acl.himpi.venc_set_roi_attr(chn, roi_attr) |
Function Usage |
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. The Atlas 200/300/500 Inference Product does not support this API. The Atlas Training Series Product does not support this API. |
Input Description |
chn: int, encoding channel ID. roi_attr: dict, ROI parameter dictionary. For details, see hi_venc_roi_attr. |
Return Value |
ret: int, error code.
|
Restrictions |
|
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).
