和你一起终身学习,这里是程序员Android
经典好文推荐,通过阅读本文,您将收获以下知识点:
一、 创建 LogicalCameraName 相关的metadata
二、 导通 LogicalCameraName Middleware 相关配置
三、认 LogicalCameraName 是否创建成功
四、双摄bringup LogicalCameraDevice 导通参考
一、 创建 LogicalCameraName 相关的metadata
1.1 LogicalCameraName 文件夹命名规则
主摄_FeatureName
例如:(主摄_bayerwide, 主摄_bayertele, 主摄_bayerbayer, 主摄_bayermono)
预设单摄对应的metadata 已经存在并导通,将主摄(比如:SENSOR_DRVNAME_S5K_MIPI_RAW)的 metadata文件夹 copy 一份;
修改主摄文件夹名为LogicalCameraName;
比如:vendor\mediatek\proprietary\custom\mt**\hal\imgsensor_metadata\S5K_mipi_raw_bayermono
修改创建 LogicalCameraName 文件夹中的metadata文件中 STATIC_METADATA2_BEGIN 后面的主摄的name 修改为LogicalCameraName;
比如:
$grep "S5K" -ri .
./config_static_metadata.lens.S5Kmipiraw.h:STATIC_METADATA2_BEGIN(PLATFORM, LENS, SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono)
./config_static_metadata.module.S5Kmipiraw.h:STATIC_METADATA2_BEGIN(PLATFORM, MODULE, SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono)
./config_static_metadata.module.S5Kmipiraw.h:STATIC_METADATA2_BEGIN(PLATFORM, MOD_OVERWRITE, SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono)
./config_static_metadata_availableKeys.h:STATIC_METADATA2_BEGIN(PLATFORM, AVAILABLE_KEYS, SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono)
./config_static_metadata_custom.h:STATIC_METADATA2_BEGIN(PLATFORM, CUSTOM, SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono)
./config_static_metadata_project.h:STATIC_METADATA2_BEGIN(PLATFORM, PROJECT, SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono)
./config_static_metadata_project.h:STATIC_METADATA2_BEGIN(PLATFORM, PRO_OVERWRITE, SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono)
./config_static_metadata_vendor.h:STATIC_METADATA2_BEGIN(PLATFORM, VENDOR, SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono)
1.2 LogicalCamera Size 修改
LogicalCamera Size相关:config_static_metadata_custom.h
后置人像尺寸:
CONFIG_METADATA_BEGIN(android_TUNNING_BACK_PORTRAIT_NORMAL_PICTURE_SIZE)
CONFIG_ENTRY_VALUE(4160, MINT32)
CONFIG_ENTRY_VALUE(3120, MINT32)
CONFIG_METADATA_END()
/主副摄照片尺寸
CONFIG_METADATA_BEGIN(android_CONTROL_BOKEH_PICTURE_SIZE)
CONFIG_ENTRY_VALUE(4160 , MINT32)
CONFIG_ENTRY_VALUE(3120 , MINT32)
CONFIG_ENTRY_VALUE(1600 , MINT32)
CONFIG_ENTRY_VALUE(1200 , MINT32)
CONFIG_METADATA_END()
二、 导通 LogicalCameraName Middleware 相关配置
Multicamra custom stereo Setting middleware 配置路径:
alps/vendor/mediatek/proprietary/custom/mt**/hal/camera/camera_custom_stereo_setting.h
主摄Name ,副摄Name ,LogicalCameraName(主摄_FeatureName)添加到camera_custom_stereo_setting.h中。
注意:主摄Name ,副摄Name ,LogicalCameraName 需要跟meatdata文件夹中的保持一致。
2.1 配置举例如下:
//主摄Name
"{"
"\"Name\": \"S5K_MIPI_RAW\","
"\"Capture Size\": {" //实际双摄图片的最终输出大小。
"\"4:3\": ["
"\"4160x3120\""
"],"
"\"16:9\": ["
"\"4160x2340\""
"]"
"},"
"\"IMGOYUV Size\": {" //在有Fov Crop 的情况下,不能配置为Sensor full size,建议比full size 小,或者配置FOV crop的值
"\"4:3\": \"4160x3120\","
"\"16:9\": \"4160x2340\""
"},"
"\"RRZOYUV Size\": {" //一般配置跟预览size 相等或者稍大,如果IMGOYUV Size的二分之一比预览size 大的话,也可以配置为IMGOYUV Size的二分之一。
"\"4:3\": \"2080x1560\","
"\"16:9\": \"2080x1170\""
"},"
"\"SensorScenarioZSD\": {" //人像对应的是VSDoF, 对应的Sensor Settings的Sensormode 是Custom1
"\"VSDoF\": \"custom1\","
"\"3rdParty\": \"custom1\","
"\"Zoom\": \"custom1\","
"\"MtkDepthmap\": \"custom1\","
"\"Multicam\": \"custom1\""
"},"
"\"SensorScenarioRecording\": {"
"\"VSDoF\": \"Video\","
"\"3rdParty\": \"custom1\","
"\"MtkDepthmap\": \"custom1\""
"},"
"\"FOV\": {"
"\"H\": 69.0,"
"\"V\": 54.4"
"},"
"\"Calibration\": {"
"\"Macro Distance\": 80,"
"\"Infinite Distance\": 5000" // 标定距离远处 50cm
"
}
//,副摄Name
"{"
"\"Name\": \"SC20_MIPI_RAW\","
"\"Capture Size\": {"
"\"4:3\": ["
... ...
}
//,LogicalCameraName
"{"
"\"Logical Device\":{"
"\"Name\": \"bayermono\","
"\"Features\": [\"VSDoF\"]"
"},"
"\"Sensors\": [ \"S5K_MIPI_RAW\", \"SC20_MIPI_RAW\"],"
"\"Depth Flow\": \"MtkDepthmap\","
"\"Module Type\": 2,"
"\"Baseline\": 1.82," //主副摄Sensor 中心距离
"\"FOV Crop\": {"
"\"Disable Crop\": 1" //如果副摄FOV可以 cover 到主摄FOV 就不需要做Crop,配置为Disable Crop,否则配置为 Center Crop
"},"
"\"Depthmap Size\": {"
"\"4:3\": \"480x360\","
"\"16:9\": \"480x272\""
"},"
"\"LDC\": [\"0\"]"
}
2.3 部分名词解释
Caputre Size:实际双摄图片的最终输出大小。
IMGOYUV Size:在有Fov Crop 的情况下,不能配置为Sensor full size,建议比full size 小,或者配置FOV crop的值。
RRZOYUV Size:一般配置跟预览size 相等或者稍大,如果IMGOYUV Size的二分之一比预览size 大的话,也可以配置为IMGOYUV Size的二分之一。
SensorScenaricZSD:人像对应的是VSDoF, 对应的Sensor Settings的Sensormode 是Custom1 ,详细请看下面举例。
FOV :市场角,规格说明书中有H/V 或者D两种表达
Calibration:标定距离远处 50cm
Baseline:主副摄Sensor 中心距离,涉及到标定。
FOV Crop:如果副摄FOV可以 cover 到主摄FOV 就不需要做Crop,配置为Disable Crop,否则配置为 Center Crop
2.4 Sensormode 客制化举例
修改S5K_mipi_raw 客制化sensormode 为custom1
比如:在下面文件中添加custom1
\kernel-4.14\drivers\misc\mediatek\imgsensor\src\mt**\camera_project\k6833v1_64\S5K_mipi_raw
.custom1 = {
.pclk = 480000000, //record different mode's pclk
.linelength = 4896, //record different mode's linelength
.framelength = 4084, //record different mode's framelength
.startx = 0, //record different mode's startx of grabwindow
.starty = 0, //record different mode's starty of grabwindow
.grabwindow_width = 4160, //record different mode's width of grabwindow
.grabwindow_height = 3120, //record different mode's height of grabwindow
/* following for MIPIDataLowPwr2HighSpeedSettleDelayCount by different scenario */
.mipi_data_lp2hs_settle_dc = 85,
/* following for GetDefaultFramerateByScenario() */
.max_framerate = 240,
.mipi_pixel_rate = 454400000,
},
三、认 LogicalCameraName 是否创建成功
抓开机Log(boot_normal的main log) 确认 LogicalCameraName 是否创建成功
3.1 打开logD命令抓取开启log方式:
adb root
adb shell setenforce 0
adb shell setprop persist.vendor.mtk.camera.log_level 3
adb shell setprop persist.vendor.debug.camera.log 3
adb shell pkill camerahalserver
adb shell pkill cameraserver
3.2 Log 关键字:
LogicalDevice|Logical Device Name|addLogicalDevice|queryDriverName
or
LogicalDevice: Sensor #|addLogicalDevice|queryDriverName] queryDriverName
// LogicalCameraName 名称 bayermono,包含的物理主副摄 Sensor 名,Feature:vsdof
01-01 04:35:58.196228 26609 26609 D MtkCam/Util/LogicalDevice: Logical Device Name: bayermono
01-01 04:35:58.196262 26609 26609 D MtkCam/Util/LogicalDevice: Sensor #0: S5K_MIPI_RAW(ID: 0)
01-01 04:35:58.196278 26609 26609 D MtkCam/Util/LogicalDevice: Sensor #1: SC20_MIPI_RAW(ID: 2)
01-01 04:35:58.196296 26609 26609 D MtkCam/Util/LogicalDevice: vsdof //对应的Feature 是vsdof 虚化
01-01 04:35:58.196312 26609 26609 D MtkCam/Util/LogicalDevice: ---------------
... ...
//成功添加 Logical camera SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono 并查询index 为3
01-01 04:35:58.198808 26609 26609 D MtkCam/Util/LogicalDevice: (26609)[addLogicalDevice] query static metadata for multi-cam (SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono)
01-01 04:35:58.226454 26609 26609 I MtkCam/Util/LogicalDevice: (26609)[addLogicalDevice] add new logic device: SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono
01-01 04:35:59.019505 26609 26609 D MtkCam/Util/LogicalDevice: (26609)[queryDriverName] queryDriverName index : 3
01-01 04:35:59.019530 26609 26609 D MtkCam/Util/LogicalDevice: (26609)[queryDriverName] queryDriverName : SENSOR_DRVNAME_S5K_MIPI_RAW_bayermono
01-01 04:45:12.691179 11172 11855 I CameraService: CameraService::connect call (PID -1 "com.android.camera", camera ID 3) and Camera API version 2
四、双摄bringup LogicalCameraDevice 导通参考
004_ISP7_Multi-Camera(SAT,VSDOF).pdf
ISP7_How_to_use_custom_setting_file.pdf
VSdof :Video Shallow Depth of Field 视频浅景深
SAT:Spatial Alignment Transform 光变切换(空间对齐变换)
PIP:Picture in Picture 画中画(双景录像)
【腾讯文档】Camera学习知识库
https://docs.qq.com/doc/DSWZ6dUlNemtUWndv
友情推荐:
Android 开发干货集锦
至此,本篇已结束。转载网络的文章,小编觉得很优秀,欢迎点击阅读原文,支持原创作者,如有侵权,恳请联系小编删除,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!
点击阅读原文,为大佬点赞!