This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM68A: Request an example to use an AF feature

Part Number: PROCESSOR-SDK-AM68A
Other Parts Discussed in Thread: AM68A

Hello,


As I know, TI H3A system supports an AF feature. But I couldn't find proper information to set the AF.
Would you provide an information to use AF feature?
Why I am asking, our system has a MFZ(Motorized Focus and Zoom) lens to support an auto focus function. And it should be worked in real time.

Belows are what I tried to set AF. But It seems that the ROI for AF was not set. Please check whether I tried to setup properly. 

What I tried : 

1. configured the ROI for AF/AEWB in "imx415_h3a_aewb_dcc.xml"

   <h3a_aewb_dcc type="iss_h3a_grid_size">
                {
                       1,     // enable:   u8
                       2,     // mode:     u8

                    920,     // v_start:  u16
                    1600,     // h_start:  u16

                      32,     // v_size:   u8
                      64,     // h_size:   u8

                      10,     // v_count:  u8
                      10,     // h_count:  u8

                       2,     // v_skip:   u8
                       2,     // h_skip:   u8

                    1000,     // saturation_limit: u16

                       2,     // blk_win_numlines: u16
                    2158,     // blk_row_vpos:     u16

                       2,     // Sum Shift:   u8

                       0,     // ALaw_En:     u8
                       0,     // MedFilt_En:  u8
                }

2. changed the "h3a_aewb_af_mode" to  "TIVX_VPAC_VISS_H3A_MODE_AF" in "/edgeai-tiovx-modules/src/tiovx_viss_module.c"

static vx_status tiovx_viss_module_configure_params(vx_context context, TIOVXVISSModuleObj *obj)
{                                                                                         
    vx_status status = VX_SUCCESS;                                                              
                                                                                        
    SensorObj *sensorObj = obj->sensorObj;                                            
                                                                                     
    obj->params.sensor_dcc_id       = sensorObj->sensorParams.dccId;  

..........................
                                                                       
    //obj->params.h3a_aewb_af_mode = TIVX_VPAC_VISS_H3A_MODE_AEWB;             
    obj->params.h3a_aewb_af_mode = TIVX_VPAC_VISS_H3A_MODE_AF;      
..........................

3. added print out to check the ROI in "/edgeai-gst-plugins/ext/tiovx/gsttiovxisp.c"

static gboolean                                                          
gst_tiovx_isp_postprocess (GstTIOVXMiso * miso)                          
{                                                                           
  GstTIOVXISP *self = NULL;                                                     
  GList *sink_pads_list = NULL;                                                 
  GList *l = NULL;                                                              
  gboolean ret = FALSE;                                                  
  struct v4l2_control control;                                        
  gchar *video_dev = NULL;                                                  
  vx_map_id h3a_buf_map_id;                                                  
  vx_map_id aewb_buf_map_id;                      
  gint i = 0;      

..........................  
  ti_2a_wrapper_ret = TI_2A_wrapper_process (&sink_pad->ti_2a_wrapper, &sink_pad->aewb_config, h3a_data, &sink_pad->sensor_in_data, ae_awb_result, &sink_pad->sensor_out_data);
  if (ti_2a_wrapper_ret) {
    GST_ERROR_OBJECT (self, "Unable to process TI 2A wrapper: %d",
    ti_2a_wrapper_ret);
    goto out;
  }
  GST_LOG_OBJECT (sink_pad, "Exposure time output from TI 2A library: %d",
    sink_pad->sensor_out_data.aePrms.exposureTime[0]);
  GST_LOG_OBJECT (sink_pad, "Analog gain output from TI 2A library: %d",
    sink_pad->sensor_out_data.aePrms.analogGain[0]);


  printf("H3A aewwin1_WINH:%d aewwin1_WINW:%d aewwin1_WINVC:%d, aewwin1_WINHC:%d\n", h3a_data->aew_config.aewwin1_WINH , h3a_data->aew_config.aewwin1_WINW , h3a_data->aew_config.aewwin1_WINVC , h3a_d
  printf("H3A aew_af_mode:%d channel_id:%d cpu_id:%d, size:%d\n", h3a_data->aew_af_mode, h3a_data->channel_id, h3a_data->cpu_id, h3a_data->size);
    
..........................  

Print Out :

H3A aewwin1_WINH:0 aewwin1_WINW:0 aewwin1_WINVC:0, aewwin1_WINHC:0      => ROI was not set
H3A aew_af_mode:1 channel_id:0 cpu_id:3, size:2112

Thanks, 

Jang.

  • Hi Jang,

    Why I am asking, our system has a MFZ(Motorized Focus and Zoom) lens to support an auto focus function. And it should be worked in real time.

    Personally, I have not used AF on TDA4/AM68A devices and I am not familiar with AF lenses or AF algorithms.

    There is a H3A H/W limitation so that H3A-AF and H3A-AEWB cannot be used at the same time.
    That is, if H3A-AF is used for a input frame, no statistics can be available for AE and AWB.

    1. configured the ROI for AF/AEWB in "imx415_h3a_aewb_dcc.xml"

    This configuration is only for AEWB.
    We don't have DCC xml support for AF. 
    To setup H3A-AF, you have to do it in the source code.
    You may refer to "6.7.3.2.4.6 RAWFE H3A" in AM62A TRM for H3A-AF details.

    Unfortunately, we don't have any reference for AF algorithm or reference AF settings as we have no AF experience at TI,

    H3A aewwin1_WINH:0 aewwin1_WINW:0 aewwin1_WINVC:0, aewwin1_WINHC:0      => ROI was not set

    Do you know from which source file this line above is printed?
    It seems an issue in driver because when H3A-AF is enabled, H3A-AEWB shall not matter.

  • Hi Gang, 

    I thought, AF and AEWB share same ROI in "imx415_h3a_aewb_dcc.xml". 

    Regarding below your comment, 

    Do you know from which source file this line above is printed?

    [Jang]

    I changed the "obj->params.h3a_aewb_af_mode" from "TIVX_VPAC_VISS_H3A_MODE_AEWB" to "TIVX_VPAC_VISS_H3A_MODE_AF" in "/edgeai-tiovx-modules/src/tiovx_viss_module.c".

    And I added "printf" in "/edgeai-gst-plugins/ext/tiovx/gsttiovxisp.c" to see ROI setting.

    Thanks, 

    Jang. 

  • I thought, AF and AEWB share same ROI in "imx415_h3a_aewb_dcc.xml". 

    H3A-AF and H3A-AEWB are separate.

    And I added "printf" in "/edgeai-gst-plugins/ext/tiovx/gsttiovxisp.c" to see ROI setting.

    Ok, thanks!

    I did not realize that you use gstreamer.
    It looks like when you enables H3A-AF, H3A-AEWB parameters are not programmed.

  • Thanks for your quick reply.

    I am looking for "6.7.3.2.4.6 RAWFE H3A" in AM62A TRM for H3A-AF. But not easy to find.

    Would let me know where can I get an information(code, document) of "6.7.3.2.4.6 RAWFE H3A" in AM62A TRM for H3A-AF?

    Thanks,

    Jang.

  • I have a typo there.
    I mean "6.7.3.2.4.6 RAWFE H3A" in AM68A TRM.
    In the TRM version I have, "6.7" is "Vision Pre-processing Accelerator (VPAC)".

    You may search the section name "RAWFE H3A" in the TRM.

  • HI:Gang

    YOU:There is a H3A H/W limitation so that H3A-AF and H3A-AEWB cannot be used at the same time.

    ASK:what is H3A H/W limitation?

    YOU:You may refer to "6.7.3.2.4.6 RAWFE H3A" in AM62A TRM for H3A-AF details.

    ASK:I took a look at RAWFE H3A,which is a description of how to calculate AF data. Do we need to implement all the AF-related codes by ourselves? Will it be supported in subsequent SDK versions?

    thanks~

  • Hi Quan,

    ASK:what is H3A H/W limitation?

    It is a H/W limitation that H3A-AE and H3A-AF cannot be enabled for the same VISS input image frame.

    Do we need to implement all the AF-related codes by ourselves? Will it be supported in subsequent SDK versions?

    As far as I know, TI has no prior experience with AF algorithms previously and has no plan for that.
    You will have to do it on your own or get it from a 3rd party.

  • If I just want to get AF statistics, use to detect the fog sense of the current screen.

    Can I set frame N to output H3A-AE, frame N+1 to output H3A-AF, and so on

  • Hi Quan,

    Yes, that is possible from the H/W perspective because you may reprogram VISS frame by frame.

    to detect the fog sense of the current screen.

    Do you mean detecting foggy scenes or dirty/blocked lenses?

    Please note that H3A's input bit depth is limited to 10-bit.