MTK MFNR 学习笔记

和你一起终身学 习,这里是程序员Android

经典好文推荐,通过阅读本文,您将收获以下知识点:

一、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

go 复制代码
0: 关 MFLL 
 1:开 MFLL
 2:开 AIS 
 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
MFNRPlugin MFNR
origin_iso 838 当前预览iso
mfll_iso_th:100 多帧 iso 决策 ,
enableMfb:1 开启 mfll
frameCapture:4 多帧拍照张数4张
evaluateCaptureSetting 拍照决策 mainFrame:1 subFrames:3
BSS output BSS 选帧
BSS: skip frame 过BSS 算法 skip的张数
allocate memory 分配内存
collected request(0/4) MFNR 收到帧的张数
doMsBlending 多帧融合
callback request 依次 callback 每一帧
go 复制代码
// 水印相机
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
// capture req#:92  capture intent: 2  第 92 帧 请求拍照
04-10 16:41:09.544396  1478  9201 D mtkcam_hal_android.device: [capture intent: 2] +  ULog#158932
04-10 16:41:09.544453  1478  9201 D mtkcam_hal_android.device: [ASettingRuleHelper::updateLogicalSetting] capture intent: 2
04-10 16:41:09.544487  1478  9201 D mtkcam_hal_android.device: [capture intent: 2] -  ULog#158933
04-10 16:41:09.545722  1478  9201 I mtkcam-FeatureSettingPolicy: [collectCaptureInfo] (0xb400007a86f4af30) capture req#:92
04-10 16:41:09.548862  1478  9201 D MFNRPlugin: (9201)[negotiate] Collected Selection:(0/0), ISP mode: 0, sensorId:0, Req(92)

//  origin_iso:838 但前预览iso
//  mfll_iso_th:100 多帧 iso 决策 ,
//  enableMfb:1 开启 mfll 
//  frameCapture:4 多帧拍照张数4张
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)
04-10 16:41:09.550055  1478  9201 D MFNRCapability_Basic: (9201)[updateSelection] Mfll apply = 1, frames = 4
04-10 16:41:09.550410  1478  9201 D MFNRPlugin: (9201)[negotiate] Collected Selection:(1/0), ISP mode: 0, sensorId:0, Req(92)
04-10 16:41:09.550512  1478  9201 D MFNRCapability_Basic: (9201)[updateSelection] Mfll apply = 1, frames = 4
04-10 16:41:09.550784  1478  9201 D MFNRPlugin: (9201)[negotiate] Collected Selection:(2/0), ISP mode: 0, sensorId:0, Req(92)
04-10 16:41:09.550857  1478  9201 D MFNRCapability_Basic: (9201)[updateSelection] Mfll apply = 1, frames = 4
04-10 16:41:09.551145  1478  9201 D MFNRPlugin: (9201)[negotiate] Collected Selection:(3/0), ISP mode: 0, sensorId:0, Req(92)
04-10 16:41:09.551218  1478  9201 D MFNRCapability_Basic: (9201)[updateSelection] Mfll apply = 1, frames = 4

// evaluateCaptureSetting 拍照决策 mainFrame:1   subFrames:3
//BSS output  BSS 选帧
04-10 16:41:09.552314  1478  9201 D mtkcam-FeatureSettingPolicy: [evaluateCaptureSetting] capture request frames count(mainFrame:1, preCollectFrames:0, subFrames:3)
04-10 16:41:09.555439  1478  9201 D mtkcam-CaptureInFlightRequest: [insertRequest] insert capture RequestNo 92, size #:1
04-10 16:41:09.777355  1478  9373 D BssCore : (9373)[postPrepareRequests] MTK_FEATURE_BSS_PROCESS = 0, BSS output(enable bss:1) - order(0)
04-10 16:41:09.777365  1478  9373 D BssCore : (9373)[postPrepareRequests] MTK_FEATURE_BSS_PROCESS = 0, BSS output(enable bss:1) - order(3)
04-10 16:41:09.777373  1478  9373 D BssCore : (9373)[postPrepareRequests] MTK_FEATURE_BSS_PROCESS = 0, BSS output(enable bss:1) - order(1)
04-10 16:41:09.777379  1478  9373 D BssCore : (9373)[postPrepareRequests] MTK_FEATURE_BSS_PROCESS = 0, BSS output(enable bss:1) - order(2)

// BSS: skip frame  过BSS 算法 skip的张数
04-10 16:41:09.778173  1478  9373 I MtkCam/CapturePipe/RootNode: [reorder]BSS: skip frame count: 0, golden:0

// allocate memory 分配内存
04-10 16:41:09.820663  1478  9505 D MfllCore: {Mfll}[operator()] future allocate memory +

// collected request(0/4) MFNR 收到帧的张数
04-10 16:41:09.821332  1478  9379 D MFNRPlugin: (9379)[process] collected request(0/4)
04-10 16:41:09.821347  1478  9508 D MfllCore: {Mfll}[operator()] times to blend(3), MEMC instanceNum(1), threadsNum(1)
04-10 16:41:09.821375  1478  9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(0) +
04-10 16:41:09.841445  1478  9379 D MFNRPlugin: (9379)[process] collected request(1/4)
04-10 16:41:09.847348  1478  9505 D MfllCore: {Mfll}[operator()] future allocate memory -
04-10 16:41:09.863183  1478  9379 D MFNRPlugin: (9379)[process] collected request(2/4)
04-10 16:41:09.886023  1478  9379 D MFNRPlugin: (9379)[process] collected request(3/4)

// memc 过完
04-10 16:41:09.913152  1478  9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(0) -
04-10 16:41:09.913241  1478  9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(1) +
04-10 16:41:09.920605  1478  9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(1) -
04-10 16:41:09.920615  1478  9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(2) +
04-10 16:41:09.927396  1478  9508 D MfllCore: {Mfll}[operator()] funcProcessMemc(2) -

//doMsBlending 多帧融合
04-10 16:41:09.950564  1478  9510 D MfllCore: {Mfll}[doMsBlending] blending (0) ok
04-10 16:41:09.950575  1478  9510 D MfllCore: {Mfll}[doMsBlending] re-use input base buffer for 2nd blend
04-10 16:41:09.975629  1478  9510 D MfllCore: {Mfll}[doMsBlending] blending (1) ok
04-10 16:41:10.008877  1478  9510 D MfllCore: {Mfll}[doMsBlending] use working buffer as output
04-10 16:41:10.053627  1478  9510 D MfllCore: {Mfll}[doMsBlending] blending (2) ok
04-10 17:19:21.915968 13594 15334 D MfllCore: {Mfll}[doMsBlending] blending (4) ok

// callback request 依次 callback 每一帧
04-10 16:41:10.053840  1478  9379 D MFNRPlugin: (9379)[process] callback request(0/4) 0xb4000079471651a8
04-10 16:41:10.054679  1478  9379 D MFNRPlugin: (9379)[process] callback request(1/4) 0xb4000079471651a8
04-10 16:41:10.055064  1478  9379 D MFNRPlugin: (9379)[process] callback request(2/4) 0xb4000079471651a8
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

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

点击阅读原文,为大佬点赞!

相关推荐
Duck Bro36 分钟前
MySQL:表的增删改查(CRUD)
android·java·数据库·c++·mysql
BAGAE2 小时前
tomcat,appche,nginix,jboss区别
java·linux·数据库·ubuntu·tomcat
終不似少年遊*2 小时前
图论1基础内容
数据结构·python·学习·算法·图论
木市门2 小时前
【GAMES101笔记速查——Lecture 21 Animation】
笔记
孤邑2 小时前
【Linux】select,poll和epoll
linux·网络·笔记·学习
小登ai学习2 小时前
框架学习07 - SpringMVC 其他功能实现
java·学习·spring·mvc
web130933203982 小时前
RabbitMQ 篇-深入了解延迟消息、MQ 可靠性(生产者可靠性、MQ 可靠性、消费者可靠性)
数据库·分布式·rabbitmq
Layue000003 小时前
学习HTML第三十三天
java·前端·笔记·学习·html
一二小选手3 小时前
【Mybatis】动态SQL详解
数据库·sql·mybatis
三月七(爱看动漫的程序员)3 小时前
Exploring Prompt Engineering: A Systematic Review with SWOT Analysis
人工智能·gpt·学习·语言模型·自然语言处理·chatgpt·prompt