
和你一起终身学 习,这里是程序员Android
经典好文推荐,通过阅读本文,您将收获以下知识点:
一、长曝光是什么?
二、MTK长曝光流程
三、MTK长曝光log分析
四、Sensor长曝光添加code参考
一、长曝光是什么?
长曝光是摄影术语,指通过慢速快门实现特殊效果的拍摄技术,常用于弱光环境或捕捉动态轨迹,如车灯轨迹、星轨等场景。
其核心原理是延长快门开启时间以增加进光量,需配合三脚架、快门线避免震动,并可通过调整光圈、感光度及使用ND滤镜控制曝光效果。

二、MTK长曝光流程
1.AE 收到上层长曝光设定(AE Mode OFF)
2.AE 设置Shutter 给Sensor
3.Vsync 间隔是否与长曝光设定一致
4.MTK MW抓到的buffer 是否ok
三、MTK 长曝光log分析
1. enable debug log 脚本
go
adb wait-for-device
adb root
adb remount
::isp6s
adb shell setprop vendor.debug.aaa_sensor_mgr.enable 1
adb shell getprop vendor.debug.aaa_sensor_mgr.enable
adb shell pkill camera*
pause
2.log关键字
connect call|capture req#|frames count|MTK_SENSOR_EXPOSURE_TIME|setSensorExpTime|vsirq|AEEffectiveFrame|Hal3AFlowCtrl.*i8ExposureTime(1000000000)|setScenario
3. 1s 长曝光log分析
Android log分析:
image.png
go
09-24 14:52:05.323360 1324 11374 I CameraService: CameraService::connect call (PID 11038 "XXX", camera ID 2) and Camera API version 2
//Linetime 8500ns
09-24 14:52:05.600575 10703 11496 D ImgSensorDrv: [setScenario][setScenario]DevID = 2, m_LineTimeInus = 8500 Scenario id = 0, PixelClk = 280000000, PixelInLine = 3640, Framelength = 2548
//AEEffectiveFrame(0): 0/2: 都是 N+2 帧生效,1:是N+1 帧生效
09-24 14:52:05.634264 10703 11496 I aaa_common_custom.cpp: [cust_initSpecialLongExpOnOff] g_bIsSpecialLongExpOn(0) AEEffectiveFrame(0)
09-24 14:52:08.473743 10703 11529 D aaa_sensor_mgr: [setSensorExpTime()] i4SensorDev:4 a_u4ExpTime:100000
09-24 14:52:08.564662 10703 11482 D HwEventIRQ: [wait] VSIrq
09-24 14:52:08.572474 10703 11529 D aaa_sensor_mgr: [setSensorExpTime()] i4SensorDev:4 a_u4ExpTime:100000
09-24 14:52:08.664930 10703 11482 D HwEventIRQ: [wait] VSIrq
09-24 14:52:08.671269 10703 11529 D aaa_sensor_mgr: [setSensorExpTime()] i4SensorDev:4 a_u4ExpTime:100000
//capture req#:32 :拍照帧号以及拍照决策走单帧
09-24 14:52:08.681183 10703 11197 I mtkcam-FeatureSettingPolicy: [evaluateCaptureSetting] (0xb400007536c4f420) capture req#:32
09-24 14:52:08.697639 10703 11197 D mtkcam-FeatureSettingPolicy: [evaluateCaptureSetting] capture request frames count(mainFrame:1, subFrames:0, preDummyFrames:0, postDummyFrames:0)
09-24 14:52:08.697684 10703 11197 D mtkcam-FeatureSettingPolicy: [dumpRequestOutputParams] request frames count(mainFrame:1, subFrames:0, preDummyFrames:0, postDummyFrames:0), needUnpackRaw(0)
09-24 14:52:08.764989 10703 11482 D HwEventIRQ: [wait] VSIrq
//解析到 1s shutter 的metadata
09-24 14:52:08.765996 10703 11197 D Hal3Av3 : [parseMeta] MTK_SENSOR_EXPOSURE_TIME(100000000 -> 1000000000)
09-24 14:52:08.768091 10703 11529 D aaa_sensor_mgr: [setSensorExpTime()] i4SensorDev:4 a_u4ExpTime:100000
09-24 14:52:08.865177 10703 11482 D HwEventIRQ: [wait] VSIrq
//i8ExposureTime(1000000000): Hal3A 送1s曝光参数给AE
09-24 14:52:08.865741 10703 11482 D Hal3AFlowCtrl: m_rParam.u4AeMode(0), m_rParam.i8ExposureTime(1000000000), iValidateOpt(1)
09-24 14:52:08.866019 10703 10862 D Hal3Av3 : [parseMeta] MTK_SENSOR_EXPOSURE_TIME(1000000000 -> 100000000)
//AE 通过aaa_sensor_mgr 下1s shutter 给Sensor
09-24 14:52:08.870095 10703 11529 D aaa_sensor_mgr: [setSensorExpTime()] i4SensorDev:4 a_u4ExpTime:1000000
09-24 14:52:08.965443 10703 11482 D HwEventIRQ: [wait] VSIrq
//由于N+2 帧长曝光剩下,N+1 帧正常短曝光 100ms
09-24 14:52:08.970461 10703 11529 D aaa_sensor_mgr: [setSensorExpTime()] i4SensorDev:4 a_u4ExpTime:100000
//N+2 帧生效 跟第一个VSIrq 正好时间差别1s,如果时间不对,需要找vendor FAE 协助分析
09-24 14:52:09.965644 10703 11482 D HwEventIRQ: [wait] VSIrq
//退出长曝光...
09-24 14:52:05.758824 10703 11482 D HwEventIRQ: [wait] VSIrq
09-24 14:52:05.859109 10703 11482 D HwEventIRQ: [wait] VSIrq
09-24 14:52:05.959313 10703 11482 D HwEventIRQ: [wait] VSIrq
09-24 14:52:06.059459 10703 11482 D HwEventIRQ: [wait] VSIrq
Kernel log分析
image.png
go
09-24 14:52:08.892884 0 0 I [T410752] kworker/u16: 5: [name:camera_isp&][ISP][ISP_BH_Workqueue] [1214.449352]
CAM_A P1_DON_32(0x00008800_0x04001f1f,0x00008800_0x04001f1f)dma done(0x1f385,0x0,0x0)int(0x3c24f,0x0,0x0)exe_us:32248 ,\,
CAM_A P1_SOF_33_33(0x00008800_0x04011f20,0x00008800_0x04011f20,0xe7200000,0xfa800000,0x20/0x1f),
int_us:100203,FBC:0x0001f385,cq:0xef27f000_0xef29f000 0x00000000_0x00000000 0x00000000_0x00000000,Don(0x00120074_0x00120074 0x00000000_0x00000000,0x00000000_0x00000000 0x00000000_0x00000000),DMA(0x1f385_0x1f385,0x0_0x0,0x0_0x0,0x16f700_0x16f700,0x0_0x0,0x0_0x0),CTL_EN(0x41effef_0x
09-24 14:52:08.895948 0 0 D [T411529] 3AEventThd: xxx_camera_sensor[write_shutter] [name:imgsensor_isp6s&] shutter =76923, framelength =7708
//进入长曝光模式
09-24 14:52:08.895976 0 0 D [T411529] 3AEventThd: xxx_camera_sensor[write_shutter] [name:imgsensor_isp6s&]enter long exposure mode shutter=76923
09-24 14:52:08.897748 0 0 D [T511529] 3AEventThd: xxx_camera_sensor[write_shutter] [name:imgsensor_isp6s&]after shutter =76923, framelength =65534
09-24 14:52:08.897897 0 0 D [T511529] 3AEventThd: xxx_camera_sensor[set_gain] [name:imgsensor_isp6s&]gain = 128, reg_gain = 0x800, max_gain:0x400
//int_us:100221: P1_SOF_33_33 -->P1_DON_33 帧间隔100ms
09-24 14:52:08.995120 0 0 I [T510752] kworker/u16: 5: [name:camera_isp&][ISP][ISP_BH_Workqueue] [1214.549568]
CAM_A P1_DON_33(0x00008800_0x04002020,0x00008800_0x04002020)dma done(0x1f385,0x0,0x0)int(0x3c24f,0x0,0x0)exe_us:32242 ,\,
CAM_A P1_SOF_34_34(0x00008800_0x04012021,0x00008800_0x04012021,0xe4a00000,0xfa400000,0x21/0x20),
int_us:100221,FBC:0x0001f385,cq:0xef23f000_0xef25f000 0x00000000_0x00000000 0x00000000_0x00000000,Don(0x00120074_0x00120074 0x00000000_0x00000000,0x00000000_0x00000000 0x00000000_0x00000000),DMA(0x1f385_0x1f385,0x0_0x0,0x0_0x0,0x16f700_0x16f700,0x0_0x0,0x0_0x0),CTL_EN(0x41effef_0x
09-24 14:52:08.996053 0 0 D [T611529] 3AEventThd: xxx_camera_sensor[write_shutter] [name:imgsensor_isp6s&] shutter =7692, framelength =65534
//退出长曝光模式
09-24 14:52:08.996063 0 0 D [T611529] 3AEventThd: xxx_camera_sensor[write_shutter] [name:imgsensor_isp6s&]exit long exposure mode shutter=7692
09-24 14:52:08.998142 0 0 D [T611529] 3AEventThd: xxx_camera_sensor[write_shutter] [name:imgsensor_isp6s&]after shutter =7692, framelength =7708
09-24 14:52:08.998213 0 0 D [T611529] 3AEventThd: xxx_camera_sensor[set_gain] [name:imgsensor_isp6s&]gain = 204, reg_gain = 0xcc0, max_gain:0x400
// int_us:1000196 : P1_SOF_34_34 --> P1_DON_34 曝光耗时1s
09-24 14:52:09.993351 0 0 I [T410000] kworker/u16: 1: [name:camera_isp&][ISP][ISP_BH_Workqueue] [1215.549770]
CAM_A P1_DON_34(0x00008800_0x04002121,0x00008800_0x04002121)dma done(0x1f385,0x0,0x0)int(0x3c24f,0x0,0x0)exe_us:32223 ,\,
CAM_A P1_SOF_35_35(0x00008800_0x04012122,0x00008800_0x04012122,0xe3e00000,0xfa000000,0x22/0x21),
int_us:1000196,FBC:0x0001f385,cq:0xef2bf000_0xef2de000 0x00000000_0x00000000 0x00000000_0x00000000,Don(0x00120074_0x00120074 0x00000000_0x00000000,0x00000000_0x00000000 0x00000000_0x00000000),DMA(0x1f385_0x1f385,0x0_0x0,0x0_0x0,0x16f700_0x16f700,0x0_0x0,0x0_0x0),CTL_EN(0x41effef_0
四、Sensor 长曝光添加code参考
进入退出长曝光寄存器,需要vendor FAE 提供,大致模板如下:
Sensor 长曝光添加code参考
至此,本篇已结束。转载网络的文章,小编觉得很优秀,欢迎点击阅读原文,支持原创作者,如有侵权,恳请联系小编删除,比如:文章底部留言,12小时内必删,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!

点个在看,为大佬点赞!