Registering the AE Algorithm with the ISP Library

  1. Implement the following callback functions in the customized AE algorithm library. For details about the callback functions, see hi_isp_ae_exp_func.

    Member

    Description

    pfn_ae_init

    Pointer to the callback function for initializing the AE.

    pfn_ae_init is called when hi_mpi_isp_init is called to initialize the AE algorithm library.

    pfn_ae_run

    Pointer to the callback function for running the AE

    pfn_ae_run is called when hi_mpi_isp_run is called to run the AE algorithm library and calculate the exposure time and gain of the sensor and the digital gain of the ISP.

    pfn_ae_ctrl

    Pointer to the callback function for controlling the internal status of the AE.

    pfn_ae_ctrl is called to change the internal status of the AE algorithm library. When the firmware is running, it inexplicitly calls pfn_ae_ctrl to instruct the AE algorithm library to switch the WDR or linear mode and set the FPS. For details about the cmd value in pfn_ae_ctrl, see hi_isp_ctrl_cmd.

    pfn_ae_exit

    Pointer to the callback function for destroying the AE

    pfn_ae_exit is called when hi_mpi_isp_exit is called to destroy the AE algorithm library.

  2. Implement hi_mpi_ae_register in the AE algorithm, in which hi_mpi_isp_ae_lib_reg_callback provided by the ISP is called to register the AE algorithm with the ISP library. The following is an example:
    /* Implement the registration function. */
    hi_isp_ae_register ae_register; hi_s32 ret = HI_SUCCESS;
    ae_check_pointer_return(ae_lib); ae_check_handle_id_return(ae_lib->id);
    ae_check_lib_name_return(ae_lib->lib_name);
    /* Call the callback function. */
    ae_register.ae_exp_func.pfn_ae_init  = ae_init;
    ae_register.ae_exp_func.pfn_ae_run   = ae_run;
    ae_register.ae_exp_func.pfn_ae_ctrl  = ae_ctrl;
    ae_register.ae_exp_func.pfn_ae_exit  = ae_exit;
    ret = hi_mpi_isp_ae_lib_reg_callback(vi_pipe, ae_lib, &ae_register);
    if (ret != HI_SUCCESS)
    {
    printf("Hi_ae register failed!\n");
    }