acl.himpi.sys_set_chn_csc_matrix

C Prototype

hi_s32 hi_mpi_sys_set_chn_csc_matrix(hi_mod_id mode, hi_s32 chn, hi_csc_matrix csc_matrix, hi_csc_coefficient *csc_coefficient);

Python Function

ret = acl.himpi.sys_set_chn_csc_matrix(mode, chn, csc_matrix, csc_coefficient)

Function Usage

Sets the CSC parameters after the corresponding image or video processing channel is created if the CSC parameters need to be adjusted in the conversion between YUV and RGB before images or videos are processed.

The Atlas 200/300/500 Inference Product does not support this API in the current version.

The Atlas Training Series Product does not support this API in the current version.

Input Description

mode: int, module ID, either HI_ID_VDEC or HI_ID_VPC.

chn: int, channel ID.

  • When mode is set to HI_ID_VDEC, check the value range of the chn parameter in acl.himpi.vdec_create_chn for the channel ID range.
  • When mode is set to HI_ID_VPC, check the value range of the chn parameter in acl.himpi.vpc_create_chn for the channel ID range.

csc_matrix: int, data standard of the CSC matrix. For details, see hi_csc_matrix.

csc_coefficient: dict, CSC matrix parameter value dictionary. For details, see hi_csc_coefficient.

Use csc_coefficient to set the CSC matrix parameters when csc_matrix is set to HI_CSC_MATRIX_USER. Otherwise, pass a random value to this parameter.

Return Value

ret: int, error code.

Restrictions

  • If this API is not called to set CSC parameters, the CSC matrix parameters following the BT.601 Wide standard are used by default.
  • If the default CSC parameters are not applicable, they need to be modified only once for all other tasks in the channel. You can call this API to set CSC parameters after the corresponding image or video processing channel is created. After that, call the specific image or video processing API, and then call the API that obtains the image or video processing result.
  • If the default CSC parameters are not applicable and different CSC parameters are used for different tasks, modify the parameters for multiple times after the corresponding image or video processing channel is created, after the previous task is complete, and before the next task is executed. (If this API is called again before the previous task is complete, the task processing result may be incorrect.) After that, call the specific image or video processing API, and then call the API that obtains the image or video processing result.

    The call sequence is as follows:

    1. acl.himpi.sys_set_chn_csc_matrix (first CSC parameter modification)
    2. acl.himpi.vpc_crop (crop)
    3. acl.himpi.vpc_get_process_result (waiting for the cropping task to complete)
    4. acl.himpi.sys_set_chn_csc_matrix (second CSC parameter modification)
    5. acl.himpi.vpc_resize (resize)
    6. acl.himpi.vpc_get_process_result (waiting for the resizing task to complete)