• MTK MFNR


    一、MFNR 简介
    二、MFNR 开关与决策
    三、MFNR 相关的adb 命令
    四、MFNR log 分析
    五 参考文献

    一、MFNR 简介

    MFNR : Multiple Frame Noise Reduction
    MFLL : Multiple Frame Low Light
    BSS : Best Select Shot

    MFNR 跟 MFLL 是两个功能一致,名称不同的简称,是MTK 推出的YUV domain 多帧降噪的算法。

    MFNR 是在 P2_CaputureNode 中 CaptureFeaturePipe 的路径,多帧的raw 首先在rootnode 中做 bss,同时会做 recorder 动作,然后依次进入到 P2ANode 做 raw2yuv ,产生的yuv等image,送到 MultiFrameNode(挂载 MFNR 算法)中进行多帧降噪处理,产生一张降噪后的YUV;如果还挂在其他的单帧YUV算法,则送YUVNode 处理,最终送到MDPNode 做crop ,resize处理.

    大致流程如下:
    Raws--> RootNode(BSS)-->Raws-->P2A(Raw2Yuv)-->YUVs-->MultiFrameNode(MFNR)-->YUV-->YUVNode-->YUV-->MDPNode-->Yuv

    二、MFNR 开关与决策

    2.1 MFNR 开关设置

    开关控制在:MTK_CAM_MFB_SUPPORT
    代码路径:
    /device/*/ProjectConfig.mk
    如果支持,默认建议设置为 3
    MTK_CAM_MFB_SUPPORT =3

    1. 0: 关 MFLL
    2. 1:开 MFLL
    3. 2:开 AIS
    4. 3:开 MFLL 和AIS
    • 1.不支持MFNR时,请在 app 中设置

    MTK_MFNR_FEATURE_MFB_MODE 为 MTK_MFNR_FEATURE_MFB_OFF

    • 2.支持MFNR 时,请在 app 中设置

    MTK_MFNR_FEATURE_MFB_MODE 为 MTK_MFNR_FEATURE_MFB_AUTO,由 CUST_MFLL_AUTO_MODE 决策走哪个模式

    • 3.当支持AIS时,可以使用下面二者任一种

    1.MTK_MFNR_FEATURE_AIS_MODE = MTK_MFNR_FEATURE_AIS_ON
    2.MTK_MFNR_FEATURE_MFB_MODE = MTK_MFNR_FEATURE_MFB_AIS

    • 4.当前面的meta确认为非 OFF 状态,则去判断tuning设置的threshold 是否满足,(mfll_iso_th 决策是否走MFNR)。

    三、MFNR 相关的adb 命令

    1.强制开、关 MFNR

    adb shell setprop vendor.mfll.force 1 // 开 :1 、 关:0

    2. dump MFNR 各阶段的图片

    adb shell setprop vendor.mfll.dump.all 1
    路径:/data/vendor/camera_dump

    3.开MFNR 的log

    adb shell setprop vendor.mfll.log_level 3

    4.dump MFNR 需要的RaW 跟YUV 图

    adb shell setprop vendor.debug.camera.p2.dump 1

    5.dump bss 之前的RAW和RRZO

    adb shell setprop vendor.debug.camera.bss.dump 1

    四、MFNR log 分析

    Log 关键字

    log关键字:
    MFNRPlugin|capture req|capture intent: 2|connect call|MfllCore

    connect call|capture req|capture intent: 2|mfll_iso_th.*enablemfb|Mfll apply.*frames|Collected Selection|capture request frames count|BSS output|skip frame count|allocate memory|times to blend|funcprocessMemc|process.*collected request|doMsBlending|process.*callback request

    关键字解释
    connect call调用cameraservice的app 以及使用的api
    capture req capture intent: 2拍照请求帧以及intent
    MFNRPluginMFNR
    origin_iso838 当前预览iso
    mfll_iso_th:100多帧 iso 决策 ,
    enableMfb:1开启 mfll
    frameCapture:4多帧拍照张数4张
    evaluateCaptureSetting拍照决策 mainFrame:1 subFrames:3
    BSS outputBSS 选帧
    BSS: skip frame过BSS 算法 skip的张数
    allocate memory分配内存
    collected request(0/4)MFNR 收到帧的张数
    doMsBlending多帧融合
    callback request依次 callback 每一帧
    1. // 水印相机
    2. 04-10 16:41:04.080150 1422 8639 I CameraService: CameraService::connect call (PID 8414 "com.tencent.zebra", camera ID 0) and Camera API version 1
    3. // capture req#:92 capture intent: 292 帧 请求拍照
    4. 04-10 16:41:09.544396 1478 9201 D mtkcam_hal_android.device: [capture intent: 2] + ULog#158932
    5. 04-10 16:41:09.544453 1478 9201 D mtkcam_hal_android.device: [ASettingRuleHelper::updateLogicalSetting] capture intent: 2
    6. 04-10 16:41:09.544487 1478 9201 D mtkcam_hal_android.device: [capture intent: 2] - ULog#158933
    7. 04-10 16:41:09.545722 1478 9201 I mtkcam-FeatureSettingPolicy: [collectCaptureInfo] (0xb400007a86f4af30) capture req#:92
    8. 04-10 16:41:09.548862 1478 9201 D MFNRPlugin: (9201)[negotiate] Collected Selection:(0/0), ISP mode: 0, sensorId:0, Req(92)
    9. // origin_iso:838 但前预览iso
    10. // mfll_iso_th:100 多帧 iso 决策 ,
    11. // enableMfb:1 开启 mfll
    12. // frameCapture:4 多帧拍照张数4
    13. 04-10 16:41:09.549907 1478 9201 I MfllCore/Strategy: {Mfll}[queryStrategy] iso:838, origin_iso:838, mfll_iso_th:100, downscale(enabled:0, ratio:0, 16/16), finalCfg(enableMfb:1, frameCapture:4), postrefine(nr:1, mfb:1), aevc(ae:0, lcso:0)
    14. 04-10 16:41:09.550055 1478 9201 D MFNRCapability_Basic: (9201)[updateSelection] Mfll apply = 1, frames = 4
    15. 04-10 16:41:09.550410 1478 9201 D MFNRPlugin: (9201)[negotiate] Collected Selection:(1/0), ISP mode: 0, sensorId:0, Req(92)
    16. 04-10 16:41:09.550512 1478 9201 D MFNRCapability_Basic: (9201)[updateSelection] Mfll apply = 1, frames = 4
    17. 04-10 16:41:09.550784 1478 9201 D MFNRPlugin: (9201)[negotiate] Collected Selection:(2/0), ISP mode: 0, sensorId:0, Req(92)
    18. 04-10 16:41:09.550857 1478 9201 D MFNRCapability_Basic: (9201)[updateSelection] Mfll apply = 1, frames = 4
    19. 04-10 16:41:09.551145 1478 9201 D MFNRPlugin: (9201)[negotiate] Collected Selection:(3/0), ISP mode: 0, sensorId:0, Req(92)
    20. 04-10 16:41:09.551218 1478 9201 D MFNRCapability_Basic: (9201)[updateSelection] Mfll apply = 1, frames = 4
    21. // evaluateCaptureSetting 拍照决策 mainFrame:1 subFrames:3
    22. //BSS output BSS 选帧
    23. 04-10 16:41:09.552314 1478 9201 D mtkcam-FeatureSettingPolicy: [evaluateCaptureSetting] capture request frames count(mainFrame:1, preCollectFrames:0, subFrames:3)
    24. 04-10 16:41:09.555439 1478 9201 D mtkcam-CaptureInFlightRequest: [insertRequest] insert capture RequestNo 92, size #:1
    25. 04-10 16:41:09.777355 1478 9373 D BssCore : (9373)[postPrepareRequests] MTK_FEATURE_BSS_PROCESS = 0, BSS output(enable bss:1) - order(0)
    26. 04-10 16:41:09.777365 1478 9373 D BssCore : (9373)[postPrepareRequests] MTK_FEATURE_BSS_PROCESS = 0, BSS output(enable bss:1) - order(3)
    27. 04-10 16:41:09.777373 1478 9373 D BssCore : (9373)[postPrepareRequests] MTK_FEATURE_BSS_PROCESS = 0, BSS output(enable bss:1) - order(1)
    28. 04-10 16:41:09.777379 1478 9373 D BssCore : (9373)[postPrepareRequests] MTK_FEATURE_BSS_PROCESS = 0, BSS output(enable bss:1) - order(2)
    29. // BSS: skip frame 过BSS 算法 skip的张数
    30. 04-10 16:41:09.778173 1478 9373 I MtkCam/CapturePipe/RootNode: [reorder]BSS: skip frame count: 0, golden:0
    31. // allocate memory 分配内存
    32. 04-10 16:41:09.820663 1478 9505 D MfllCore: {Mfll}[operator()] future allocate memory +
    33. // collected request(0/4) MFNR 收到帧的张数
    34. 04-10 16:41:09.821332 1478 9379 D MFNRPlugin: (9379)[process] collected request(0/4)
    35. 04-10 16:41:09.821347 1478 9508 D MfllCore: {Mfll}[operator()] times to blend(3), MEMC instanceNum(1), threadsNum(1)
    36. 04-10 16:41:09.821375 1478 9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(0) +
    37. 04-10 16:41:09.841445 1478 9379 D MFNRPlugin: (9379)[process] collected request(1/4)
    38. 04-10 16:41:09.847348 1478 9505 D MfllCore: {Mfll}[operator()] future allocate memory -
    39. 04-10 16:41:09.863183 1478 9379 D MFNRPlugin: (9379)[process] collected request(2/4)
    40. 04-10 16:41:09.886023 1478 9379 D MFNRPlugin: (9379)[process] collected request(3/4)
    41. // memc 过完
    42. 04-10 16:41:09.913152 1478 9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(0) -
    43. 04-10 16:41:09.913241 1478 9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(1) +
    44. 04-10 16:41:09.920605 1478 9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(1) -
    45. 04-10 16:41:09.920615 1478 9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(2) +
    46. 04-10 16:41:09.927396 1478 9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(2) -
    47. //doMsBlending 多帧融合
    48. 04-10 16:41:09.950564 1478 9510 D MfllCore: {Mfll}[doMsBlending] blending (0) ok
    49. 04-10 16:41:09.950575 1478 9510 D MfllCore: {Mfll}[doMsBlending] re-use input base buffer for 2nd blend
    50. 04-10 16:41:09.975629 1478 9510 D MfllCore: {Mfll}[doMsBlending] blending (1) ok
    51. 04-10 16:41:10.008877 1478 9510 D MfllCore: {Mfll}[doMsBlending] use working buffer as output
    52. 04-10 16:41:10.053627 1478 9510 D MfllCore: {Mfll}[doMsBlending] blending (2) ok
    53. 04-10 17:19:21.915968 13594 15334 D MfllCore: {Mfll}[doMsBlending] blending (4) ok
    54. // callback request 依次 callback 每一帧
    55. 04-10 16:41:10.053840 1478 9379 D MFNRPlugin: (9379)[process] callback request(0/4) 0xb4000079471651a8
    56. 04-10 16:41:10.054679 1478 9379 D MFNRPlugin: (9379)[process] callback request(1/4) 0xb4000079471651a8
    57. 04-10 16:41:10.055064 1478 9379 D MFNRPlugin: (9379)[process] callback request(2/4) 0xb4000079471651a8
    58. 04-10 16:41:10.055407 1478 9379 D MFNRPlugin: (9379)[process] callback request(3/4) 0xb4000079471651a8

    五 参考文献

    MTK文档

    参考文献:

    【腾讯文档】Camera学习知识库
    https://docs.qq.com/doc/DSWZ6dUlNemtUWndv

    至此,本篇已结束。转载网络的文章,小编觉得很优秀,欢迎点击阅读原文,支持原创作者,如有侵权,恳请联系小编删除,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!

  • 相关阅读:
    ununtu中vim的使用
    MATLAB算法实战应用案例精讲-【目标检测】单目3D目标检测
    【笔试题】【day23】
    Transformers库总体介绍
    Boundary (topology)
    手写节流和防抖
    软件测试之集成测试
    win7升级到win10系统后,node13升级为node16,node版本node-sass版本与不匹配,导致出现npm ERR! ERESOLVE could not resolve
    Qt实现单例模式:Q_GLOBAL_STATIC和Q_GLOBAL_STATIC_WITH_ARGS
    机器学习笔记 - 图解对象检测任务(1)
  • 原文地址:https://blog.csdn.net/m0_72053187/article/details/137914698