日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

AF monitor tuning <2>

發布時間:2024/3/7 编程问答 52 豆豆
生活随笔 收集整理的這篇文章主要介紹了 AF monitor tuning <2> 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. af monitor concept

AF 監控狀態的主要功能是場景切換檢測。直觀地看,場景切換意味著當前場景沒有對焦,導致算法觸發搜索以找到準焦的最佳位置。

每種算法有其自己的場景切換檢測標準。例如, CAF 依賴于陀螺儀參數、絕對誤差和 (SAD)參數以及 SAD 相關參考幀 (SADR) 參數以檢測場景切換。相比之下, PDAF 依賴于當前幀散焦值的組合、算法的可信度以及場景的穩定性。

AF 監控也負責場景平移檢測。為避免不必要的搜索,算法區分了場景切換和場景平移。搜索算法直到場景穩定(即,不平移)時,才開始搜索。總而言之,場景切換和場景平移檢測是AF 監控狀態中的兩種基本功能。

  • CAF 依賴于陀螺儀參數、SAD(sum of absolute differences)、SADR 參數以檢測場景切換。 PDAF依賴于當前幀defocus value、算法的confidence 和 場景的穩定性(stability of the scene)。
  • SADR 是統計 當前畫面的平均亮度值和上次對焦完成的亮度之間的差異得到的。
  • SAD 是統計當前畫面的平均亮度值和上一幀的亮度之間的差異得到。
    亮度的絕對誤差和
    SAD compares frame by frame, which is less sensitive to slow scene changes
    SADR compares to a reference that is established when the scene is stable after a scene change (which is after focus is finished and both SAD and SADR are not stable).

SAD keywords:
af_cont_detect_scene_change_sad //獲取當前的SAD 值
af_cont_detect_scene_change //判斷當前場景是否改變

2. value monitor bank and algo configure

數值監控實例化了每個監控算法的配置和決策邏輯。盡管監控邏輯與之前的 3A 版本類似,但是數值監控的結構、配置和操作是該邏輯的全新實施。數值監控的主要優點在于配置靈活、調試簡便。下圖顯示了數值監控的兩種主要結構.

  • 監控算法配置 – 包含在 CAF、 PDAF、 TOF 和 DCIAF 監控算法中使用的各狀態類型的靈敏
    度設置。
  • 數值監控庫 – 包含各狀態類型各種參數。

Monitor Algo Config 對應 algo configure

  • 在本示例中,陀螺儀靈敏度值為 50。這是所有靈敏度參數的默認值。所有靈敏度參數的范圍在 1 至 100(0 表示關閉)。在 1-100 之間的所有靈敏度值都是有效的,并預計會導致合理的監控行為。
  • 因為靈敏度是 50,所以選擇中靈敏度參數。如果靈敏度是 1,則選擇低靈敏度參數。如果靈敏度是 100,則選擇高靈敏度參數。如果靈敏度在 1 至 50 或 50 至 100 之間,則分別在低和中或中和高之間使用線性插值。每個配置文件(低、中、高)中的參數完全相同。然而,其值經過了預配置,可根據監控算法配置中的靈敏度參數提供不同級別的靈敏度。
  • 根據作為 1 和 2 的結果產生的配置, CAF 和任何其他配置了陀螺儀數值監控設置類型的監控算法都可實例化。
  • 如果調試工程師想要使陀螺儀靈敏度比中靈敏度配置更加敏感,最簡單的方法是將陀螺儀靈敏度修改為 50 以上。如果調試工程師想要使陀螺儀靈敏度與中靈敏度配置相比更為不敏感,則將靈敏度修改為 50 以下。
    注: 當在調試過程中使用邏輯靈敏度參數時,數值監控庫中的參數不會發生變化。

    a. algo configure

    算法的優先級別

    注: 將靈敏度參數設置為 0,可禁用相應數值監控庫中的參數。例如,將 SADR 設置為 0,可禁用 SADR VM 設置類型中的參數。在這種情況下,輸出決策為 0。

    Topo CAF 中的邏輯靈敏度參數字面意思的靈敏度。

    b. value monitor bank

    Trigger Threshold :確定信號是否穩定的閾值。它被定義為元濾波器輸出和基準之間的絕對誤差。 Consecutive Count Threshold :用于檢測器檢測信號穩定/不穩定的連續計數的計數閾值。如果達到閾值,則數值監控為VM_DETECTOR_UNSTABLE 模式輸出 1,為VM_DETECTOR_STABLE 模式輸出 0。 Frame To Armed: 強制數值監控開始檢測流程的數字。例如,如果frame2armed=2,則數值監控在場景對焦后 2 幀開始檢測流程(調用變基)。 Median Filter Config Enable: 用于啟用中值濾波器的標記。 Num of Samples: 中值濾波器的長度。 Mvavg Fltr Cf Enable 用于在元濾波器模塊中啟用移動平均濾波器的標記。 Num of Samples: 元濾波器模塊中移動平均濾波器的待濾波樣本數。 IIR Fltr Cfg Enable: 用于在元濾波器模塊中啟用 IIR 濾波器的標記。 Num of Samples IIR:濾波器的緩沖區大小(在當前版本中,值限制為 2)。 Coeff Numerator:分子中的系數(需要調試工程師來檢查濾波器穩定性) Coeff Denominator:分母中的系數(需要調試工程師來檢查濾波器穩定性)。 Detection Type:數值監控的檢測類型的標記。 如果選擇不穩定,則指定的數值監控會判斷信號是否變得不穩定。如果信號不穩定,數值監控輸出為 1;如果信號穩定,數值監控輸出為 0。 如果選擇穩定,則指定的數值監控會判斷信號是否變得穩定。如果信號不穩定,數值監控輸出為 0;如果信號穩定,數值監控輸出為 1。 在穩定/不穩定檢測期間,通常考慮連續計數。因此,這兩種配置有不同的檢測邏輯。 Absolute Mode Cfg:用于確定基準的模式選擇的標記。如果啟用絕對模式 (==1),則指定的數值監控在檢測過程中使用 absolute_mode_cfg.baseline 參數作為固定基準。如果禁用絕對模式 (==0),則指定的數值監控會自適應地配置基準。當達到 frame2armed 值時,基準為元濾波器輸出。

    3. AF調試步驟

    caf的monitor key log根本不是af_cont_state_monitor/ af_cont_detect_scene_change/ af_cont_detect_panning。沒有更多的詳細數據日志。
    CAF只需查看這個函數af_caf_process_monitor,并檢查狀態結果[0或1]來微調sad/gyro場景變化和平移。

    Trigger refocus condition:
    is_scene_change = sad->is_change | gyro->is_change;
    is_scene_panning =sad->is_panning | gyro->is_panning;
    is_trig_refocus = is_scene_change && is_scene_stable

    (1)亮度變化引起的monitor

    (2)場景變化引起的monitor

    調試monitor algo config Topo CAF

  • 只打開CAF algorithm
  • 調試SADR(scene change) 設置GYRO/GYRO_PANNING/SAD_PANNING sensitivities to 0
  • 調整SADR 靈敏度范圍1-100. 值越大越容易觸發scene change
  • SADR sensitivity 調整好,開始調試SAD_Panning sensitivity value。
  • 調整SAD_Panning 靈敏度1-100. 數值越大,越容易獲得場景穩定
  • SADR SAD_Panning 場景變化和場景穩定 ,調試GYRO
  • 調試GYRO(scene change) 設置SADR/GYRO_Panning/SAD_Panning sensitivities to 0
  • 調整GYRO靈敏度范圍1-100. 值越大越容易觸發scene change
  • GYRO sensitivity 調整好,開始調試GYRO_Panning sensitivity value。
  • 調整GYRO_Panning靈敏度1-100. 數值越大,越容易獲得場景穩定
  • 更新所有調試好的sensitivities ,查看性能。
  • 依據testing cases,fine tuned 每個sensitivity 到可以接受。
  • 03-31 16:02:08.051 888 1189 V CamX : [ VERB][STATS_AF ] af_haf_caf.cpp:999: af_caf_process_monitor Caf topology index 1 03-31 16:02:08.051 888 1189 V CamX : [ VERB][STATS_AF ] af_value_monitor.cpp:634: af_value_monitor_get_trigger CAF_SADR VM GET TRIGGER detection mode 2, abs mode 1, baseline 0, input 14.577575, metafilter 13.794128, decision 1 03-31 16:02:08.051 888 1189 V CamX : [ VERB][STATS_AF ] af_value_monitor.cpp:634: af_value_monitor_get_trigger CAF_GYRO VM GET TRIGGER detection mode 1, abs mode 1, baseline 0, input 0.000000, metafilter 0.000000, decision 0 03-31 16:02:08.051 888 1189 V CamX : [ VERB][STATS_AF ] af_value_monitor.cpp:634: af_value_monitor_get_trigger CAF_SAD_PANNING VM GET TRIGGER detection mode 1, abs mode 1, baseline 0, input 1.103057, metafilter 1.103027, decision 0 03-31 16:02:08.051 888 1189 V CamX : [ VERB][STATS_AF ] af_value_monitor.cpp:634: af_value_monitor_get_trigger CAF_GYRO_PANNING VM GET TRIGGER detection mode 1, abs mode 1, baseline 0, input 0.000000, metafilter 0.000000, decision 0 03-31 16:02:08.052 888 1189 V CamX : [ VERB][STATS_AF ] af_value_monitor.cpp:634: af_value_monitor_get_trigger CAF_FACE_SCENE_CHANGE_HOLD VM GET TRIGGER detection mode 1, abs mode 1, baseline 0, input 0.000000, metafilter 0.000000, decision 0 03-31 16:02:08.052 888 1189 V CamX : [ VERB][STATS_AF ] af_haf_caf.cpp:1030: af_caf_process_monitor setting face value monitor to 0 03-31 16:02:08.052 888 1189 V CamX : [ VERB][STATS_AF ] af_haf_caf.cpp:1075: af_caf_process_monitor Scene change sad 1 gyro 0 face 0 scene panning sad 0 gyro 0 03-31 16:02:08.052 888 1189 V CamX : [ VERB][STATS_AF ] af_value_monitor.cpp:634: af_value_monitor_get_trigger CAF_CAF_SCENE_CHANGE_HOLD VM GET TRIGGER detection mode 1, abs mode 1, baseline 0, input 0.000000, metafilter 0.000000, decision 0 03-31 16:02:08.052 888 1189 V CamX : [ VERB][STATS_AF ] af_haf_caf.cpp:1097: af_caf_process_monitor CAF caf_sc_extension 0 is scene changed 1 is_scene_panning 0 03-31 16:02:08.052 888 1189 V CamX : [ VERB][STATS_AF ] af_haf_caf.cpp:1099: af_caf_process_monitor CAF_is_scene_changed:1 panning 0 stable 1! 03-31 16:02:08.052 888 1189 V CamX : [ VERB][STATS_AF ] af_haf_caf.cpp:1138: af_caf_process_monitor is_face_af: 0 is_caf_af 1 cur_pos 311 03-31 16:02:08.052 888 1189 V CamX : [ VERB][STATS_AF ] af_haf_caf.cpp:1139: af_caf_process_monitor CAF_is_scene_changed: sadr 1 gyro 0! 03-31 16:02:08.052 888 1189 V CamX : [ VERB][STATS_AF ] af_haf_caf.cpp:1140: af_caf_process_monitor CAF_is_panning: sad 0 gyro 0! 03-31 16:02:08.052 888 1189 V CamX : [ VERB][STATS_AF ] af_haf_caf.cpp:1145: af_caf_process_monitor CAF monitor output : 100 0 100 1 !*Caf topology index 1 means used CAF_TOPO_PROFILE_ADVANCED* is_scene_change = sad->is_change | gyro->is_change; is_scene_panning =sad->is_panning | gyro->is_panning; is_trig_refocus = is_scene_change && is_scene_stable please notice this log af_caf_process_monitor: CAF monitor output : 100 0 100 1 confidence/focus_level/stability/is_trig_refocusThe values respectively is confidence/focus_level/stability/is_trig_refocus. And will affect different monitor status. Focus level and Stability only have two values [100 or 0]. is_scene_change == 0? focus_level=100: focuc_level=0 is_scene_stable==1? stability=100: stability=0 Confidence generally only have two values [100/0], but when used multi-window will generateone special value 50 and if enabled PDAF_TOPO_PROFILE_ADVANCED will also finally has chance to re-write confidence to value 50 Topo Default Mixer 這里面參數不知道什么意思。后面在看下。 secondary scene change cnt > 0 穩定就會從新觸發對焦 03-31 16:02:00.717 888 1190 V CamX : [ VERB][STATS_AF ] af_haf_default_mixer.cpp:791: af_default_mixer_process_monitor secondary scene change cnt: 5 03-31 16:02:00.717 888 1190 V CamX : [ VERB][STATS_AF ] af_haf_default_mixer.cpp:831: af_default_mixer_process_monitor primary monitor has low confidence. is trig_refocus: 1

    4. PDAF調試monitor

    PDAF只需查看這個函數af_pdaf_monitor
    pdaf monitor:defocus,confident,stable
    通常,PDAF監控場景的變化,并在滿足以下條件時觸發搜索:

    • 當前幀defocus 值大于 defocus threshold
    • 算法可信度ok
    • 場景穩定。
  • defcous
    正離焦值意味著運動是從近到遠。負離焦值意味著運動是從遠到近。當離焦值接近零時,表示目標有焦。

  • confident
    置信度是用于相位差估計的場景中線索數量(例如,垂直邊緣,場景亮度)的函數。高置信度意味著ROI中的PD具有較小的方差和較高的邊緣強度。置信表用于定義相對于傳感器增益的最小置信閾值。
    high confidence:亮環境和多個垂直邊緣。
    lower confidence 亮度低的環境和少的vertical edges。

  • 3.Stable
    穩定性是通過評估離焦值歷史來計算的。如果值在可調閾值內,則認為場景是穩定的。

    confidence table 如何工作
    高置信度意味著該 ROI 中 PD 的偏差較小并且可能具有更高的邊緣密度。 置信度表用于定義相對于傳感器增益的最小置信度閾值.
    噪點增益小于或等于某個參數noise gain時,對應Minimum Confidence。

    4. PDAF不觸發的 log 分析

    (1)PDAF 觸發
    Trigger refocus condition : is_conf && is_defocused && is_stabl

    Line 16022: 03-31 16:07:14.492 892 1185 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:2040: af_pdaf_monitor is_conf 1, is_defocused 0, is_stable 1, is_trig_refocus 0Line 16426: 03-31 16:07:14.533 892 1189 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:1897: af_pdaf_monitor monitors: defocus_low 0, defocus_high 0 sad_panning 0, gyro_panning 0Line 16817: 03-31 16:07:14.575 892 1188 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:1897: af_pdaf_monitor monitors: defocus_low 1, defocus_high 0 sad_panning 0, gyro_panning 0Line 16821: 03-31 16:07:14.575 892 1188 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:1925: af_pdaf_monitor decisions of value monitors: defocus_low 1, defocus_high 0 sad_panning 0, gyro_panning 0 caf_face_is_stable 0 caf_track_is_stable 0Line 16822: 03-31 16:07:14.575 892 1188 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:1947: af_pdaf_monitor Spotlight flag 0,conf 1Line 16823: 03-31 16:07:14.576 892 1188 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:2040: af_pdaf_monitor is_conf 1, is_defocused 1, is_stable 1, is_trig_refocus 1Line 17204: 03-31 16:07:14.622 892 1189 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:1897: af_pdaf_monitor monitors: defocus_low 1, defocus_high 0 sad_panning 0, gyro_panning 0Line 17209: 03-31 16:07:14.622 892 1189 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:1925: af_pdaf_monitor decisions of value monitors: defocus_low 1, defocus_high 0 sad_panning 0, gyro_panning 0 caf_face_is_stable 0 caf_track_is_stable 0Line 17212: 03-31 16:07:14.622 892 1189 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:1947: af_pdaf_monitor Spotlight flag 0,conf 1

    (2)is_defocused=FALSE 啟用pd 對焦失敗。
    should be trigger refocus but it didn’t trigger again?

    Line 10866: 03-31 16:07:13.923 892 1186 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:5161: af_pdaf_proc_defocused roi(0) defocus=29, dof_mult=1.0, defocus_thres=26.5, defocus_cnt=6, min_defocus_cnt=1, is_defocused=TRUELine 11444: 03-31 16:07:13.985 892 1187 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:5161: af_pdaf_proc_defocused roi(0) defocus=25, dof_mult=1.0, defocus_thres=26.5, defocus_cnt=0, min_defocus_cnt=1, is_defocused=FALSE And please remember defocused condition: defocus_cnt >= min_defocus_cnt
  • adjust Scene Monitor
  • adjust Stable Table
  • (3)場景沒用pdaf,啟用CAF 對焦原因
    focus_converge_done=true的條件
    a. 場景穩定stable
    b.PD Preprocessing -> PD Max Limit Do Not Use Defocus Sample > defocus

    場景不穩定 03-31 16:07:17.438 892 1189 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3828: af_pdaf_is_focus_converge_done defocus=22, focus_converge_done_thres=20, focus_converge_done=FALSE 03-31 16:07:17.438 892 1189 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3445: af_pdaf_focus_converge Scene is panning. No action until stable. 場景穩定. 32 >26Line 8566: 03-31 16:07:13.591 892 1185 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3828: af_pdaf_is_focus_converge_done defocus=26, focus_converge_done_thres=19, focus_converge_done=TRUELine 44940: 03-31 16:07:17.484 892 1188 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3828: af_pdaf_is_focus_converge_done defocus=6, focus_converge_done_thres=20, focus_converge_done=TRUEfind the biggers dac and set the pd_max_limit_do_not_use_defocus_sample over this dac.If no, it means af_pdaf_is_focus_converge_done failed, return -1 and fallback to contrast af

    (4)收斂完成進入finesearch

    • af_pdaf_focus_converge condition : need meet is_caf_stable and thenaf_pdaf_is_focus_converge_done return 1.

    • af_pdaf_is_focus_converge_done condition : abs(defocus)-abs(next_move) less thanfocus_done_thresh

    • next_move is returned by af_pdaf_get_focus_move_steps:

    • 03-31 16:07:17.438 892 1189 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:4255: af_pdaf_get_focus_move_steps defocus=22.00, focus_pcnt=1.00, move_steps=22

    • focus_done_thresh equal focus_scan.focus_done_threshold * dof_multiplier * noise_multiplier

    Line 7461: 03-31 16:07:13.461 892 1189 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3381: af_pdaf_focus_converge Adjust wait_conf_recover_cnt for focus convergence in first run = 4Line 7480: 03-31 16:07:13.462 892 1189 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3445: af_pdaf_focus_converge Scene is panning. No action until stable.Line 7899: 03-31 16:07:13.503 892 1184 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3381: af_pdaf_focus_converge Adjust wait_conf_recover_cnt for focus convergence in first run = 4Line 8197: 03-31 16:07:13.541 892 1187 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3381: af_pdaf_focus_converge Adjust wait_conf_recover_cnt for focus convergence in first run = 4Line 8546: 03-31 16:07:13.590 892 1185 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3381: af_pdaf_focus_converge Adjust wait_conf_recover_cnt for focus convergence in first run = 4Line 8569: 03-31 16:07:13.592 892 1185 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3434: af_pdaf_focus_converge Converge done. Go to fine scanLine 44512: 03-31 16:07:17.438 892 1189 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3445: af_pdaf_focus_converge Scene is panning. No action until stable.Line 44941: 03-31 16:07:17.484 892 1188 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:3434: af_pdaf_focus_converge Converge done. Go to fine scan

    (5)狀態查詢

    Line 15400: 03-31 16:07:14.402 892 1185 V CamX : [ VERB][STATS_AF ] af_haf.cpp:152: af_haf_util_change_state HAF_STATE_CHANGE to SEARCHLine 15405: 03-31 16:07:14.403 892 1185 V CamX : [ VERB][STATS_AF ] af_haf.cpp:159: af_haf_util_change_state HAF_STATE_CHANGE to MONITORLine 47337: 03-31 16:07:17.731 892 1187 V CamX : [ VERB][STATS_AF ] af_haf.cpp:165: af_haf_util_change_state HAF_STATE_CHANGE to GO_TO_DEST

    5. 注意

    紅框的內容會覆蓋黑框的值。
    AF算法已經支持使用不同的值監視器對不同光照條件的靈敏度。該算法采用AEC實數增益作為觸發輸入,在數值監測庫中采用不同的靈敏度剖面。該功能默認關閉。

    Sensitivity Trigger Arr 參數對應的xml 紅框。
    對于黑框矩形中的參數是每個值監視的默認靈敏度值,紅色矩形中的參數默認不存在,它們是每個值監視的靈敏度觸發器數組。算法會檢查靈敏度觸發器數組是否存在。如果觸發器數組存在,它將使用它們而不是黑框矩形中的默認值。

    算法將檢查通過實增益是落在哪個區域。我們將比較傳入的增益值和gain_start,所以請將gain_start和gain_end設置為相同的值

    set_sensitivity_triggerLine 2962: 03-31 16:43:02.200 879 1179 V CamX : [ VERB][STATS_AF ] af_haf_pdaf.cpp:5573: af_pdaf_set_sensitivity_trigger sensor gain changed :3.960967, check for VM sens updateLine 2963: 03-31 16:43:02.200 879 1179 V CamX : [ VERB][STATS_AF ] af_haf_caf.cpp:1328: af_caf_set_sensitivity_trigger sensor gain changed :3.960967, check for VM sens update sensitivity_trigger_vm vm 設置的無效沒有對應的log HAF_MSG_LOW("setting %s sensitivity to %d from %d", p_VM->name, sens, prev_sens);

    參考:KBA-170501033706

    總結

    以上是生活随笔為你收集整理的AF monitor tuning <2>的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。