和你一起终身学习,这里是程序员Android
经典好文推荐,通过阅读本文,您将收获以下知识点:
一、多帧拍照请求概览
二、多帧拍照回帧概览
一、多帧拍照请求概览
多帧拍照请求概览如下:
多帧拍照请求
1.1 APP 下发拍照请求到 Camera Framework
1.1.1 Trace关键字如下:
APP:
deliverInputEvent: app 点击事件处理
CameraUnitCamera2ImplTakePicture:app 下发拍照请求
binder transaction :通过bind 跟FWK交互
FWK:
binder reply :响应app 下发的bind
submitRequestList:Camera FWK提交拍照请求给HAL,并包含拍照帧数
captureList
submitRequestsHelper
createCaptureRequest :比如多帧会下发4 帧
queueRequestList
unpauseForNewRequests:暂停新的拍照请求
1.1.2 详细请看下面trace 截图
1.1.3 下发4帧请求createCaptureRequest
请求4帧
1.2 Camera Framework下发拍照请求到 camera HAL中
1.2.1 Trace关键字如下:
FWK:
sendRequestsBatch:Camera FWK 下发批处理请求
CameraHal::processBatchCaptureRequests:Camera FWK 每帧请求到HAL
HIDL::ICameraDeviceSession::processCaptureRequest_3_4::client:Camera 向Camera HAL请求一帧
binder transaction
CAM HAL:
binder reply
HIDL::ICameraDeviceSession::processCaptureRequest_3_4::server :Camera HAL接受处理Camera FWK 请求
processCaptureRequest_3_4
processCaptureRequest
submitOneRequest
onRequest_EvaluateRequest
evaluateRequest
FeatureSettingPolicy::evaluateRequest
evaluateCaptureSetting
negotiate
onRequest_ProcessEvaluatedFrame
processEvaluatedFrame
onProcessEvaluatedFrame
submitZslRequest:Camera HAL 提交拍照请求帧
makePipelineFrame
queue|requestNo:97 frameNo:97
onFrameUpdated
1.2.2 详细请看下面trace 截图
1.2.3 拍照log关键字:
control.captureIntent:2|capture req#
拍照log 如下:
01-02 09:05:10.695442 1161 1642 I mtkcam-PipelineModelSession: [submitRequest] <Default/1> requestNo:94 { repeating:0 control.aeTargetFpsRange:5,30 control.captureIntent:2 control.enableZsl:1 control.processRawEn:0 control.mode:1 control.sceneMode:0 control.videoStabilizationMode:0 edge.mode:2 }
01-02 09:05:10.695560 1161 1642 I mtkcam-FeatureSettingPolicy: [evaluateCaptureSetting] (0xb4000075a3a43020) capture req#:94
01-02 09:05:10.734815 1161 1642 I mtkcam-PipelineModelSession: [submitRequest] <Default/1> requestNo:95 { repeating:0 control.aeTargetFpsRange:5,30 control.captureIntent:2 control.enableZsl:1 control.processRawEn:0 control.mode:1 control.sceneMode:0 control.videoStabilizationMode:0 edge.mode:2 }
01-02 09:05:10.734937 1161 1642 I mtkcam-FeatureSettingPolicy: [evaluateCaptureSetting] (0xb4000075a3a43020) capture req#:95
01-02 09:05:10.770126 1161 1645 I mtkcam-PipelineModelSession: [submitRequest] <Default/1> requestNo:96 { repeating:0 control.aeTargetFpsRange:5,30 control.captureIntent:2 control.enableZsl:1 control.processRawEn:0 control.mode:1 control.sceneMode:0 control.videoStabilizationMode:0 edge.mode:2 }
01-02 09:05:10.770526 1161 1645 I mtkcam-FeatureSettingPolicy: [evaluateCaptureSetting] (0xb4000075a3a43020) capture req#:96
01-02 09:05:10.795720 1161 1645 I mtkcam-PipelineModelSession: [submitRequest] <Default/1> requestNo:97 { repeating:0 control.aeTargetFpsRange:5,30 control.captureIntent:2 control.enableZsl:1 control.processRawEn:0 control.mode:1 control.sceneMode:0 control.videoStabilizationMode:0 edge.mode:2 }
01-02 09:05:10.795846 1161 1645 I mtkcam-FeatureSettingPolicy: [evaluateCaptureSetting] (0xb4000075a3a43020) capture req#:97
01-02 09:05:10.958217 1161 1642 I mtkcam-FeatureSettingPolicy_ISP: [evaluateCaptureSetting] (0xb4000075a3be0c58) capture req#:94 (count:4, index:0)
01-02 09:05:13.924135 1161 1644 I mtkcam-FeatureSettingPolicy_ISP: [evaluateCaptureSetting] (0xb400007592195818) capture req#:94 (count:1, index:0)
二、多帧拍照回帧概览
2.1 多帧拍照回帧概览如下:
2.2 Camera HAL 请求返回帧处理
2.2.1 Trace 关键字如下:
CAM HAL:
onDispatchFrame|requestNo:97 frameNo:97 nodeId:1 :处理拍照请求帧97
CaptureNode::queue
P2_Capture:enque()
MWFrameRequest::createRequests->createP2ImgMap
p2a:process|r97f97s1 :RequestNo : 97 FrameNo: 97 SensorID :1 前摄
p2a:finish|r97f971)
P2_Capture:notifyRelease()
P2:ApplyRelease
P2:DispatchFrame
processCaptureResult
convertToHidlCaptureResults
HIDL::ICameraDeviceCallback::processCaptureResult_3_4::client
2.3 Camera FWK && Camera APP 请求返回帧处理
CAM FWK:
HIDL::ICameraDeviceCallback::processCaptureResult_3_4::server
queueBuffer
APP:
binder reply
queueBuffer
ImageReader :APP 接收到 Camera FWK PostView
2.4 MTK BSS效果选帧处理
效果处理:
BSS(Best Shot Selection)MTK 最佳选帧算法,拍照返回帧的效果的一些处理,主要优化图片质量效果
packIspTuningDataToHeap:4帧拍照会有5个,每帧一个,在MFNR处理后会还有一个
downSampleImageBufferHeap
doZipWithBss
2.5 app 请求返回帧处理
APP拿到请求返回帧后对图片进行处理,
比如多帧算法,人脸识别,美颜算法,滤镜,镜像等等,app 处理完之后就开始压jpeg进行图片保存。
大致流程如下:
【腾讯文档】Camera学习知识库
https://docs.qq.com/doc/DSWZ6dUlNemtUWndv
友情推荐:
Android 开发干货集锦
至此,本篇已结束。转载网络的文章,小编觉得很优秀,欢迎点击阅读原文,支持原创作者,如有侵权,恳请联系小编删除,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!
点击阅读原文,为大佬点赞!