VIVO 相机HDR拍照流程拆解

科技   2024-08-30 07:33   上海  

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

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

  1. HDR 场景下发 3 帧拍照请求
  2. HDR 3帧拍照请求帧(478,479 480)
  3. HDR 3帧 result callback帧
  4. HDR 算法处理
    5.算法编解码处理
  5. HDR 拍照log关键字

HDR : 高动态范围成像(英语:High Dynamic Range Imaging,简称HDRI或HDR),在计算机图形学电影摄影术中,是用来实现比普通数位图像技术更大曝光动态范围(即更大的明暗差别)的一组技术。高动态范围成像的目的就是要正确地表示真实世界中从太阳光直射到最暗的阴影这样大的范围亮度.

HDR即指高动态光照渲染,HDR是一种提高影像亮度和对比度的处理技术,与普通图像相比,HDR可以提供更多的动态范围和图像细节,利用每个曝光时间相对应最佳细节的LDR图像来合成最终HDR图像,能够更好地反映出真实环境中的视觉效果。[

1. HDR 场景下发 3 帧拍照请求

HDR 场景下,点击拍照按钮,提交拍照请求,拍照请求帧为3,5帧(trace 中submitRequestList
下可以看到 3 个 createCaptureRequest
)。

点击拍照按钮提交拍照请求

2. HDR 3帧拍照请求帧(478,479 480)

3帧拍照请求帧

3. HDR 3帧 result callback帧

HDR 3帧 result callback帧

4. HDR 算法处理

HDR 算法处理

5.算法编解码处理

算法编解码处理

6. HDR 拍照log关键字

部分log关键字如下:

onShutterButtonFocus|connect call|Creating new stream|AlgoNativeInterface: HDR|AlgoNativeInterface: pAlgoParams|AlgoNativeInterface: algo process|IMG_20240829_195647.jpg|ACTION_UP|CAMAP_MAIN

部分log分析如下

   onShutterButtonFocus|connect call|Creating new stream|AlgoNativeInterface: HDR|AlgoNativeInterface: pAlgoParams|AlgoNativeInterface: algo process|IMG_20240829_195647.jpg|ACTION_UP|CAMAP_MAIN

// 启动 cameraactivity
205615: 08-29 19:56:29.548 10140 30284 30284 D _V_CAM_CameraActivity: CAMAP_MAIN: [Thread:main] CameraActivity---onStart, ActivityCode: 81415032
205620: 08-29 19:56:29.551 10140 30284 30284 D _V_CAM_CameraActivity: CAMAP_MAIN: [Thread:main] CameraActivity---onNewIntent, ActivityCode: 81415032
205755: 08-29 19:56:29.589 10140 30284 30284 V CAMAP_MAIN:: IS_LOG_CTRL_OPEN = true
205756: 08-29 19:56:29.589 10140 30284 30284 D _V_CAM_CameraActivity: CAMAP_MAIN: [Thread:main] CameraActivity---onResumeTask, ActivityCode: 81415032 version: 12.1.78.8
// 下发open camera
205856: 08-29 19:56:29.632 10140 30284 19959 D _V_CAM_CameraModeProxyIml: CAMAP_MAIN: [Thread:camera_task] task thread---open camera E, CameraParam [ facing : FACING_BACK, modeName : Normal, cameraType : Master, mVModeInfo :
205863: 08-29 19:56:29.634 10140 30284 19959 D _V_CAM_CameraModeProxyIml: CAMAP_MAIN: [Thread:camera_task] task thread---open camera X
// 连接cameraservice connect call
205884: 08-29 19:56:29.646 1047 1557 3193 I CameraService: CameraService::connect call (PID 30284 "com.android.camera", camera ID 0) and Camera API version 2
205956: 08-29 19:56:29.660 10140 30284 30284 D _V_CAM_StateMachine: CAMAP_MAIN: [Thread:main] change state --- photo : [ StateDestroy -> StateInit ]
// 配3路流 Creating new stream
206304: 08-29 19:56:29.769 1047 1557 3193 I Camera3-Device: Camera 0: Creating new stream 0: 1080 x 1080, format 34, dataspace 0 rotation 0 consumer usage 0, isShared 0, physicalCameraId , isMultiResolution 0 dynamicRangeProfile 0x1, streamUseCase 0, timestampBase 0, mirrorMode 0, colorSpace -1, useReadoutTimestamp 0
206330: 08-29 19:56:29.775 1047 1557 3193 I Camera3-Device: Camera 0: Creating new stream 1: 1080 x 1080, format 35, dataspace 146931712 rotation 0 consumer usage 0, isShared 0, physicalCameraId , isMultiResolution 0 dynamicRangeProfile 0x1, streamUseCase 0, timestampBase 0, mirrorMode 0, colorSpace -1, useReadoutTimestamp 0
206349: 08-29 19:56:29.787 1047 1557 3193 I Camera3-Device: Camera 0: Creating new stream 2: 3060 x 3060, format 35, dataspace 146931712 rotation 0 consumer usage 0, isShared 0, physicalCameraId , isMultiResolution 0 dynamicRangeProfile 0x1, streamUseCase 0, timestampBase 0, mirrorMode 0, colorSpace -1, useReadoutTimestamp 0
207156: 08-29 19:56:30.141 10140 30284 19992 D _V_CAM_CameraModeProxyIml: CAMAP_MAIN: [Thread:camera_callback] onConfigured mode = BackNormalMainMode
207163: 08-29 19:56:30.141 10140 30284 30284 D _V_CAM_StateMachine: CAMAP_MAIN: [Thread:main] change state --- photo : [ StateCameraOpened -> StateSessionCreated ]
// 开始起预览请求 startPreview
207247: 08-29 19:56:30.168 10140 30284 19959 D _V_CAM_CameraModeProxyIml: CAMAP_MAIN: [Thread:camera_task] ---startPreview PreviewParam { [previewdetect = 140821240225795], [eyeDetect = -1], [previewAiDetect = [-1, -1]], [vivo.control.ois = true], [relight = 0], [vivo.control.face.detect = true], [vcamsdk.repeating.VideoStabilization = true], [vivo.control.singleBlur_level = 0], [vivo.control.portrait.effect = 0], [vivo.record.eis.mode.enable = false], [vivo.control.motionVersion=17], [android.control.videoStabilizationMode=1], [vivo.control.sod.state=0], [vivo.parameter.temperature=43], [vivo.control.captureStateForDetect=0], [android.jpeg.orientation=90], [vivo.parameter.cameraColdStart=false], [custom.zoom=1.0], [custom.flash_mode=0], [custom.exposure_value=0], }
207407: 08-29 19:56:30.259 10140 30284 30284 D _V_CAM_ThumbnailAddition: CAMAP_MAIN: [Thread:main] updateThumbnailView
// 首帧可用callback onFirstFrameAvailableCallback onFirstFrameAvailable
207867: 08-29 19:56:30.431 10140 30284 19501 D _V_CAM_CameraActivity: CAMAP_MAIN: [Thread:VIEngine-Main] onFirstFrameAvailableCallback
207887: 08-29 19:56:30.437 10140 30284 30284 D _V_CAM_CameraActivity: CAMAP_MAIN: [Thread:main] onFirstFrameAvailable
// HDR 场景下点击拍照 ACTION_UP onShutterButtonFocus
211606: 08-29 19:56:32.015 10069 3054 3054 D _V_InputEventReceiver: dispatchInputEvent ,vLog[a2c672 StatusBar (client)] ,event=MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=524.0, y[0]=420.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=76500757, downTime=76500650, deviceId=5, source=0x1002, displayId=0, eventId=17122441 }
215088: 08-29 19:56:33.250 10069 3054 3054 D _V_InputEventReceiver: dispatchInputEvent ,vLog[375f109 NotificationShade (client)] ,event=MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=313.0, y[0]=651.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=76502116, downTime=76502045, deviceId=5, source=0x1002, displayId=0, eventId=980268846 }
222254: 08-29 19:56:37.928 10069 3054 3054 D _V_InputEventReceiver: dispatchInputEvent ,vLog[375f109 NotificationShade (client)] ,event=MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=686.0, y[0]=2186.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=76506799, downTime=76505392, deviceId=5, source=0x1002, displayId=0, eventId=840324513 }
235965: 08-29 19:56:47.169 10140 30284 30284 D _V_CAM_BaseBottomBar: CAMAP_MAIN: [Thread:main] onShutterButtonFocus pressed = true
237770: 08-29 19:56:48.077 10122 10844 4581 D AlgoNativeInterface: algo process E
// HDR 算法处理
237774: 08-29 19:56:48.077 10122 10844 4581 D AlgoNativeInterface: algo process img[0] fd 109 width 3060 height 3060 stride 3072 scanline 3072 size 14155776 numFds 2 numInts 23 version 12
237775: 08-29 19:56:48.077 10122 10844 4581 D AlgoNativeInterface: algo process img[1] fd 111 width 3060 height 3060 stride 3072 scanline 3072 size 14155776 numFds 2 numInts 23 version 12
237776: 08-29 19:56:48.078 10122 10844 4581 D AlgoNativeInterface: algo process img[2] fd 113 width 3060 height 3060 stride 3072 scanline 3072 size 14155776 numFds 2 numInts 23 version 12
237779: 08-29 19:56:48.078 10122 10844 4581 D AlgoNativeInterface: algo process imageFormat: 0x23 requestId: 8
237814: 08-29 19:56:48.080 10122 10844 4581 D AlgoNativeInterface: HDR 3-frames version
237872: 08-29 19:56:48.090 10122 10844 4581 D AlgoNativeInterface: pAlgoParams->frameFlag: 1724932607175 localtime:20240829195647
// HDR 算法选帧 478 479 480 3帧
237889: 08-29 19:56:48.090 10122 10844 4581 D AlgoNativeInterface: pAlgoParams->frameId[0]: 478
237890: 08-29 19:56:48.090 10122 10844 4581 D AlgoNativeInterface: pAlgoParams->frameId[1]: 479
237891: 08-29 19:56:48.090 10122 10844 4581 D AlgoNativeInterface: pAlgoParams->frameId[2]: 480
237985: 08-29 19:56:48.095 10122 10844 4581 D AlgoNativeInterface: hdrGains[0]: 6.733059, hdrShutters[0]: 30.000000, hdrFrameIndex:0
237986: 08-29 19:56:48.095 10122 10844 4581 D AlgoNativeInterface: hdrGains[1]: 10.965449, hdrShutters[1]: 30.000000, hdrFrameIndex:1
237987: 08-29 19:56:48.095 10122 10844 4581 D AlgoNativeInterface: hdrGains[2]: 1.454850, hdrShutters[2]: 10.000000, hdrFrameIndex:2
238000: 08-29 19:56:48.096 10122 10844 4581 D AlgoNativeInterface: pAlgoParams->shotAeRegions left:0 top:0 right:0 bottom:0
238009: 08-29 19:56:48.098 10122 10844 4581 D AlgoNativeInterface: algo process: pAlgoParams->satCropRegions ltwh 0 0 0

参考文献:

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

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

点个在看,为大佬点赞!

程序员Android
这是一个专注提供 Java Android 知识体系服务的公众号。 和你一起终身学习,小安愿做你成长道路上的垫脚石,不断垫高你的高度,衬托你的威仪。 风里雨里,我们一直在 Java Android 学习的路上支持你!
 最新文章