AF 監(jiān)控狀態(tài)的主要功能是場景切換檢測。直觀地看,場景切換意味著當(dāng)前場景沒有對焦,導(dǎo)致算法觸發(fā)搜索以找到準(zhǔn)焦的最佳位置。
每種算法有其自己的場景切換檢測標(biāo)準(zhǔn)。例如, CAF 依賴于陀螺儀參數(shù)、絕對誤差和 (SAD)參數(shù)以及 SAD 相關(guān)參考幀 (SADR) 參數(shù)以檢測場景切換。相比之下, PDAF 依賴于當(dāng)前幀散焦值的組合、算法的可信度以及場景的穩(wěn)定性。
AF 監(jiān)控也負(fù)責(zé)場景平移檢測。為避免不必要的搜索,算法區(qū)分了場景切換和場景平移。搜索算法直到場景穩(wěn)定(即,不平移)時,才開始搜索。總而言之,場景切換和場景平移檢測是AF 監(jiān)控狀態(tài)中的兩種基本功能。
CAF 依賴于陀螺儀參數(shù)、SAD(sum of absolute differences)、SADR 參數(shù)以檢測場景切換。 PDAF依賴于當(dāng)前幀defocus value、算法的confidence 和 場景的穩(wěn)定性(stability of the scene)。
SAD 是統(tǒng)計當(dāng)前畫面的平均亮度值和上一幀的亮度之間的差異得到。 亮度的絕對誤差和 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 //獲取當(dāng)前的SAD 值 af_cont_detect_scene_change //判斷當(dāng)前場景是否改變
(3)場景沒用pdaf,啟用CAF 對焦原因 focus_converge_done=true的條件 a. 場景穩(wěn)定stable b.PD Preprocessing -> PD Max Limit Do Not Use Defocus Sample > defocus
場景不穩(wěn)定
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.
場景穩(wěn)定. 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)收斂完成進(jìn)入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:
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)狀態(tài)查詢
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
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 設(shè)置的無效沒有對應(yīng)的log
HAF_MSG_LOW("setting %s sensitivity to %d from %d", p_VM->name, sens, prev_sens);