豪车网站建设背景,销售型企业网站有哪些,wordpress server error,网站功能性介绍平台 RK3566 Android 11
概述 UVC#xff1a; USB video class#xff08;又称为USB video device class or UVC#xff09;就是USB device class视频产品在不需要安装任何的驱动程序下即插即用#xff0c;包括摄像头、数字摄影机、模拟视频转换器、电视卡及静态视频相机…平台 RK3566 Android 11
概述 UVC USB video class又称为USB video device class or UVC就是USB device class视频产品在不需要安装任何的驱动程序下即插即用包括摄像头、数字摄影机、模拟视频转换器、电视卡及静态视频相机。
测试代码 Camera cam Camera.open(CAMERA_ID);Camera.Parameters param cam.getParameters();ListCamera.Size sizes param.getSupportedPreviewSizes();打印出来后显示支持的预览分辨率如下
D startPreview support preview 640x360
D startPreview support preview 640x480
D startPreview support preview 960x540
D startPreview support preview 800x600
D startPreview support preview 1280x720
D startPreview support preview 1280x960
D startPreview support preview 1920x1080
D startPreview support preview 1600x1200然而把摄像头接入到PC上不管是LINUX还是WINDOWS会发现实际支持的最大预览分辨率是3840x2160 缺少的分辨率哪去了
分析 摄像头部分的架构比较复杂整理几个相关的源码目录 # SDK 接口frameworks/base/core/java/android/hardware/Camera.javaframeworks/base/core/jni/android_hardware_Camera.cpp# 上层 Camera 服务frameworks/av/camera/# HAL层hardware/rockchip/camerahardware/interfaces/camera/# 配置文件对应USB和CSI之类的摄像头配置
# 包含了支持分辨率闪光灯等等的一些特性。device/rockchip/common/external_camera_config.xmlhardware/rockchip/camera/etc/camera/烧录到主板后相关的一些文件目录 rk3568_r:/ # ll /vendor/etc/camera/
total 948
-rw-r--r-- 1 root root 3044 2023-04-18 09:55 README.txt
-rw-r--r-- 1 root root 152818 2023-04-18 09:55 camera3_profiles.xml
-rw-r--r-- 1 root root 166244 2023-04-18 09:55 camera3_profiles_default.xml
-rw-r--r-- 1 root root 14744 2023-04-18 09:55 camera3_profiles_rk1126.xml
-rw-r--r-- 1 root root 48811 2023-04-18 09:55 camera3_profiles_rk3126c.xml
-rw-r--r-- 1 root root 64987 2023-04-18 09:55 camera3_profiles_rk3288.xml
-rw-r--r-- 1 root root 61800 2023-04-18 09:55 camera3_profiles_rk3326.xml
-rw-r--r-- 1 root root 98549 2023-04-18 09:55 camera3_profiles_rk3368.xml
-rw-r--r-- 1 root root 64766 2023-04-18 09:55 camera3_profiles_rk3399.xml
-rw-r--r-- 1 root root 26451 2023-04-18 09:55 camera3_profiles_rk3399_1608.xml
-rw-r--r-- 1 root root 77820 2023-04-18 09:55 camera3_profiles_rk3399pro.xml
-rw-r--r-- 1 root root 152818 2023-04-18 09:55 camera3_profiles_rk356x.xml
-rw-r--r-- 1 root root 2875 2023-04-18 09:55 graph_descriptor.xml
-rw-r--r-- 1 root root 145 2023-04-18 09:55 reset_camera.sh
drwxr-xr-x 2 root shell 4096 2023-04-18 09:55 rkisp1
drwxr-xr-x 2 root shell 4096 2023-04-18 09:55 rkisp2# UVC 的配置/vendor/etc/external_camera_config.xml先用v4l2 工具看下基本信息
## 当前的设备列表
rk3566:/ # ll /dev/video*
crw-rw---- 1 media camera 81, 0 2023-04-14 09:44 /dev/video0
crw-rw---- 1 media camera 81, 1 2023-04-14 09:44 /dev/video1
crw-rw---- 1 media camera 81, 10 2023-04-14 09:44 /dev/video10
crw-rw---- 1 media camera 81, 11 2023-04-14 09:44 /dev/video11
crw-rw---- 1 media camera 81, 12 2023-04-14 09:44 /dev/video12
crw-rw---- 1 media camera 81, 13 2023-04-14 09:44 /dev/video13
crw-rw---- 1 media camera 81, 14 2023-04-14 09:44 /dev/video14
crw-rw---- 1 media camera 81, 15 2023-04-14 09:44 /dev/video15
crw-rw---- 1 media camera 81, 2 2023-04-14 09:44 /dev/video2
crw-rw---- 1 media camera 81, 3 2023-04-14 09:44 /dev/video3
crw-rw---- 1 media camera 81, 4 2023-04-14 09:44 /dev/video4
crw-rw---- 1 media camera 81, 5 2023-04-14 09:44 /dev/video5
crw-rw---- 1 media camera 81, 6 2023-04-14 09:44 /dev/video6
crw-rw---- 1 media camera 81, 7 2023-04-14 09:44 /dev/video7
crw-rw---- 1 media camera 81, 8 2023-04-14 09:44 /dev/video8
crw-rw---- 1 media camera 81, 9 2023-04-14 09:44 /dev/video9# 设备信息
rk3566_r:/ # v4l2-ctl --list-devices
rkisp-statistics (platform: rkisp):/dev/video12/dev/video13rkcif (platform:rkcif_mipi_lvds):/dev/video0/dev/video1/dev/video2/dev/video3/dev/video4rkisp_mainpath (platform:rkisp-vir0):/dev/video5/dev/video6/dev/video7/dev/video8/dev/video9/dev/video10/dev/video11UC40A Audio: UC40A Video (usb-xhci-hcd.1.auto-1.3):/dev/video14/dev/video15# 查看指定设备信息
rk3566_r:/ # v4l2-ctl -D -d /dev/video15
Driver Info:Driver name : uvcvideoCard type : UC40A Audio: UC40A VideoBus info : usb-xhci-hcd.1.auto-1.3Driver version : 4.19.193Capabilities : 0x84a00001Video CaptureMetadata CaptureStreamingExtended Pix FormatDevice CapabilitiesDevice Caps : 0x04a00000Metadata CaptureStreamingExtended Pix Format
Media Driver Info:Driver name : uvcvideoModel : UC40A Audio: UC40A VideoSerial : 01.00.00Bus info : usb-xhci-hcd.1.auto-1.3Media version : 4.19.193Hardware revision: 0x00000902 (2306)Driver version : 4.19.193
Interface Info:ID : 0x03000005Type : V4L Video
Entity Info:ID : 0x00000004 (4)Name : UC40A Audio: UC40A VideoFunction : V4L2 I/O# 设备支持格式
rk3566_r:/ # v4l2-ctl -d /dev/video14 --list-formats
ioctl: VIDIOC_ENUM_FMTIndex : 0Type : Video CapturePixel Format: MJPG (compressed)Name : Motion-JPEGIndex : 1Type : Video CapturePixel Format: YUYVName : YUYV 4:2:2# 设备支持分辨率
rk3566_r:/ # v4l2-ctl -d /dev/video14 --list-framesizesYUYV
ioctl: VIDIOC_ENUM_FRAMESIZESSize: Discrete 2048x1536Size: Discrete 640x480Size: Discrete 3840x2160Size: Discrete 2592x1944Size: Discrete 2688x1512Size: Discrete 1920x1080Size: Discrete 1600x1200Size: Discrete 1280x960Size: Discrete 1280x720Size: Discrete 960x540Size: Discrete 800x600Size: Discrete 640x360结论硬件及驱动到HAL都是正常 忽略中间漫长的排查过程, 直奔主题: 预览的限制主要存在于HAL和framework层 至少RK的SDK是这样的其他平台请勿对号入座。
HAL /vendor/etc/external_camera_config.xml 中的 FpsList 注释List of maximum fps for various output sizes 解决的方法是增加对应缺少的分辨率如Limit width“3840” height“2160” fpsBound“30.0” / ExternalCameraProviderignore !-- Internal video devices to be ignored by external camera HAL --!-- id0/id -- !-- No leading/trailing spaces --/ignore/Provider!-- See ExternalCameraUtils.cpp for default values of Device configurations below--Device!-- Max JPEG buffer size in bytes--MaxJpegBufferSize bytes24883200/ !-- 3MB (~ 1080p YUV420) --!-- Size of v4l2 buffer queue when streaming 30fps --!-- Larger value: more request can be cached pipeline (less janky) --!-- Smaller value: use less memory --NumVideoBuffers count4/!-- Size of v4l2 buffer queue when streaming 30fps --NumStillBuffers count2/!-- List of maximum fps for various output sizes --!-- Any image size smaller than the size listed in Limit row will reportfps (as minimum frame duration) up to the fpsBound value. --FpsList!-- width/height must be increasing, fpsBound must be decreasing--Limit width176 height144 fpsBound60.0 /Limit width176 height144 fpsBound30.0 /Limit width176 height144 fpsBound20.0 /Limit width176 height144 fpsBound15.0 /Limit width320 height240 fpsBound60.0 /Limit width320 height240 fpsBound30.0 /Limit width320 height240 fpsBound20.0 /Limit width320 height240 fpsBound15.0 /Limit width352 height288 fpsBound30.0 /Limit width352 height288 fpsBound20.0 /Limit width352 height288 fpsBound15.0 /Limit width640 height480 fpsBound60.0 /Limit width640 height480 fpsBound30.0 /Limit width640 height480 fpsBound20.0 /Limit width640 height480 fpsBound15.0 /Limit width640 height480 fpsBound10.0 /Limit width800 height600 fpsBound30.0 /Limit width800 height600 fpsBound20.0 /Limit width800 height600 fpsBound15.0 /Limit width1024 height768 fpsBound30.0 /Limit width1024 height768 fpsBound20.0 /Limit width1024 height768 fpsBound15.0 /Limit width1024 height768 fpsBound10.0 /Limit width1280 height720 fpsBound60.0 /Limit width1280 height720 fpsBound30.0 /Limit width1280 height720 fpsBound20.0 /Limit width1280 height720 fpsBound15.0 /Limit width1280 height720 fpsBound10.0 /Limit width1280 height800 fpsBound30.0 /Limit width1280 height800 fpsBound20.0 /Limit width1280 height800 fpsBound15.0 /Limit width1280 height960 fpsBound30.0 /Limit width1280 height960 fpsBound20.0 /Limit width1280 height960 fpsBound15.0 /Limit width1280 height1024 fpsBound30.0 /Limit width1280 height1024 fpsBound20.0 /Limit width1280 height1024 fpsBound15.0 /Limit width1600 height1200 fpsBound30.0 /Limit width1600 height1200 fpsBound15.0 /Limit width1920 height1080 fpsBound30.0 /Limit width1920 height1080 fpsBound15.0 /Limit width2048 height1536 fpsBound30.0 /Limit width2592 height1944 fpsBound30.0 /Limit width2592 height1944 fpsBound15.0 /Limit width2592 height1944 fpsBound10.0 /Limit width2592 height1944 fpsBound5.0 /Limit width2688 height1512 fpsBound30.0 /Limit width3840 height2160 fpsBound30.0 /!-- image size larger than the last entry will not be supported--/FpsList!-- orientation --Orientation degree90//Device
/ExternalCamerahardware/interfaces/camera/device/3.4/default/RgaCropScale.cpp diff --git a/hardware/interfaces/camera/device/3.4/default/RgaCropScale.cpp b/hardware/interfaces/camera/device/3.4/default/RgaCropScale.cpp
index 23d018fb6d..4829d1d664 100644
--- a/hardware/interfaces/camera/device/3.4/default/RgaCropScale.cppb/hardware/interfaces/camera/device/3.4/default/RgaCropScale.cpp-21,21 21,21 namespace android {namespace camera2 {-#if (defined(TARGET_RK32) || defined(TARGET_RK3368))
//#if (defined(TARGET_RK32) || defined(TARGET_RK3368))#define RGA_VER (2.0)#define RGA_ACTIVE_W (4096)#define RGA_VIRTUAL_W (4096)#define RGA_ACTIVE_H (4096)#define RGA_VIRTUAL_H (4096)-#else
-#define RGA_VER (1.0)
-#define RGA_ACTIVE_W (2048)
-#define RGA_VIRTUAL_W (4096)
-#define RGA_ACTIVE_H (2048)
-#define RGA_VIRTUAL_H (2048)
//#else
//#define RGA_VER (1.0)
//#define RGA_ACTIVE_W (2048)
//#define RGA_VIRTUAL_W (4096)
//#define RGA_ACTIVE_H (2048)
//#define RGA_VIRTUAL_H (2048)-#endif
//#endif
这部分不修改会导致以下问题
and...ternal-service E (dst_width RGA_VIRTUAL_W) || (dst_height RGA_VIRTUAL_H), switch to arm
and...ternal-service I uid1047(cameraserver) ExtCamOut identical 2 lines
and...ternal-service E (dst_width RGA_VIRTUAL_W) || (dst_height RGA_VIRTUAL_H), switch to arm
com...d.quickpreview I Background concurrent copying GC freed 306(35KB) AllocSpace objects, 3(35MB) LOS objects, 48% free, 25MB/49MB, paused 862us total 143.804ms
and...ternal-service E (dst_width RGA_VIRTUAL_W) || (dst_height RGA_VIRTUAL_H), switch to arm
and...ternal-service E (dst_width RGA_VIRTUAL_W) || (dst_height RGA_VIRTUAL_H), switch to arm
and...er2.1-service I [File] : hardware/rockchip/libgralloc/bifrost/src/core/mali_gralloc_formats.cpp; [Line] : 1858; [Func] : rk_gralloc_select_format;AFBC IS disabled for fb_target_layer.
and...ternal-service E (dst_width RGA_VIRTUAL_W) || (dst_height RGA_VIRTUAL_H), switch to arm
and...ternal-service I uid1047(cameraserver) ExtCamOut identical 2 lines
and...ternal-service E (dst_width RGA_VIRTUAL_W) || (dst_height RGA_VIRTUAL_H), switch to arm
and...ternal-service D debugShowFPS(1171): Camera 2176 Frames, 30.105 FPS
and...ternal-service E (dst_width RGA_VIRTUAL_W) || (dst_height RGA_VIRTUAL_H), switch to arm
and...ternal-service I uid1047(cameraserver) ExtCamOut identical 2 lines
and...ternal-service E (dst_width RGA_VIRTUAL_W) || (dst_height RGA_VIRTUAL_H), switch to arm
and...er2.1-service I [File] : hardware/rockchip/libgralloc/bifrost/src/core/mali_gralloc_formats.cpp; [Line] : 1858; [Func] : rk_gralloc_select_format;AFBC IS disabled for fb_target_layer.
and...ternal-service E (dst_width RGA_VIRTUAL_W) || (dst_height RGA_VIRTUAL_H), switch to arm
and...ternal-service I uid1047(cameraserver) ExtCamOut identical 4 lines
and...ternal-service E (dst_width RGA_VIRTUAL_W) || (dst_height RGA_VIRTUAL_H), switch to arm
and...er2.1-service I [File] : hardware/rockchip/libgralloc/bifrost/src/core/mali_gralloc_formats.cpp; [Line] : 1858; [Func] : rk_gralloc_select_format;AFBC IS disabled for fb_target_layer.Framework frameworks/av/services/camera/libcameraservice/api1/client2/Parameters.h 上层接口解除1080P的限制. diff --git a/frameworks/av/services/camera/libcameraservice/api1/client2/Parameters.h b/frameworks/av/services/camera/libcameraservice/api1/client2/Parameters.h
index 3a709c9791..2ee332a8c8 100644
--- a/frameworks/av/services/camera/libcameraservice/api1/client2/Parameters.hb/frameworks/av/services/camera/libcameraservice/api1/client2/Parameters.h-199,11 199,11 struct Parameters {// Max preview size allowed// This is set to a 1:1 value to allow for any aspect ratio that has// a max long side of 1920 pixels
- static const unsigned int MAX_PREVIEW_WIDTH 1920;
- static const unsigned int MAX_PREVIEW_HEIGHT 1920;static const unsigned int MAX_PREVIEW_WIDTH 3840;static const unsigned int MAX_PREVIEW_HEIGHT 2160;// Initial max preview/recording size bound
- static const int MAX_INITIAL_PREVIEW_WIDTH 1920;
- static const int MAX_INITIAL_PREVIEW_HEIGHT 1080;static const int MAX_INITIAL_PREVIEW_WIDTH 3840;static const int MAX_INITIAL_PREVIEW_HEIGHT 2160;// Aspect ratio tolerancestatic const CONSTEXPR float ASPECT_RATIO_TOLERANCE 0.001;// Threshold for slow jpeg mode 编译验证
# 编译
mmm hardware/interfaces/camera/device/3.4/default/
# push 到主板
#adb push out/target/product/rk3566_r/vendor/lib64/hw/camera.rk30board.so /vendor/lib64/hw/
#adb push out/target/product/rk3566_r/vendor/lib/hw/camera.rk30board.so /vendor/lib/hw/
adb push out/target/product/rk3566_r/vendor/lib/camera.device3.4-external-impl.so /vendor/lib/
adb push out/target/product/rk3566_r/vendor/lib64/camera.device3.4-external-impl.so /vendor/lib64/# 编译
mmm /disk4/anson/rk3568_a11/frameworks/av/services/camera/libcameraservice/:libcameraservice
adb push out/target/product/rk3566_r/system/lib/libcameraservice.so /system/lib/
adb push out/target/product/rk3566_r/system/lib64/libcameraservice.so /system/lib64/小插曲 RK的Linux 烧录工具 # 低版本可以烧录 system.img
# -s system.img
# 新版本的SDK中烧录super.img
Linux_Upgrade_Tool_v1.65/upgrade_tool DI -super super.img# 烧录完整固件
Linux_Upgrade_Tool_v1.65/upgrade_tool UF update.img参考
Ubuntu下查看usb摄像头不同压缩格式支持的分辨率