|
firefly-rk3288采用OV13850摄像头java应用调用相机预览底层报错问题
发表于 2017-5-14 15:11:29
浏览:9514
|
回复:2
打印
只看该作者
[复制链接]
楼主
本帖最后由 as12312a 于 2017-5-14 15:15 编辑
采用firefly-rk3288-reload板搭配firefly官方的OV13850模块,
上层调用getSupportedPreviewSizes 获取到支持预览的分辨率列表如下:
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 176 height = 144
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 320 height = 240
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 352 height = 288
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 640 height = 480
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 720 height = 480
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 800 height = 600
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 4224 height = 3136
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 4224 height = 3136
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 1280 height = 720
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 1920 height = 1080
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
01-01 14:04:49.520: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
01-01 14:04:49.520: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
01-01 14:04:49.520: I/HJSoft(5806): previewSizes:width = 2064 height = 1548
设置setPreviewSize设置预览大小为最大分辨率4224*3126
setPreviewCallback设置preview回调函数,供底层回传数据
setPreviewDisplay(SurfaceHolder holder)设置供预览显示的控件(实际我只是想通过回调获取数据,但是该控件不设置的话,底层没有数据上来)
startPreview开始预览,底层报了如下错误。且进入PreviewCallback函数的时间激增到了5-8秒
E/preview(5806): Time 8005
01-01 14:04:57.016: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
01-01 14:05:01.677: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
01-01 14:05:02.536: E/preview(5806): Time 5522
这边估计5-8秒的时间是由于该rga_nv12_scale_crop异常引起的
查了一下,该函数是rk的一个2D硬件单元,用于转换数据的,在CameraHal.h中找到了
RGA_VIRTUAL_W 和RGA_VIRTUAL_H的最大宽高为4096*4096
#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
很明显,4224超出了rga支持的大小,导致底层报了异常,由于项目需求,我们需要camera底层回传一个4000*3000以上分辨率的图像,且获取时间尽量减小,需要1秒内可以取5-10帧图像用于使用,getSupportedPreviewSizes提供的4000*3000以上分辨率只有4224*3136,是否有办法修改getSupportedPreviewSizes回传的参数,让系统支持4000*3000分辨率或者相近分辨率(好像底层要求分辨率需要按16字节对齐),且满足宽高均小于4096,这样底层就不会报异常。
另外,是否有不在UI控件上显示预览,直接获取底层camera预览数据的办法,由于预览控件很小,不排除是4224*3136大小的数据在400*300大小控件上显示导致的时间损耗。
附件是异常的完整log
该异常较为特殊,请大家帮忙看看,提供一下想法和建议,万分感谢!~~~
完整log贴在这里:
- 01-01 14:04:49.434: E/CameraHal_Marvin(165): HAL-MOCKUP: PHY ADDR (0x10000000),iommu addr (0x10000000)
- 01-01 14:04:49.437: E/CameraHal_Marvin(165): HAL-MOCKUP: PHY ADDR (0x112f5000),iommu addr (0x112f5000)
- 01-01 14:04:49.441: E/CameraHal_Marvin(165): HAL-MOCKUP: PHY ADDR (0x125ea000),iommu addr (0x125ea000)
- 01-01 14:04:49.448: E/CameraHal_Marvin(165): HAL-MOCKUP: PHY ADDR (0x138df000),iommu addr (0x138df000)
- 01-01 14:04:49.514: D/CameraHal(165): initDefaultParameters(914): ------mHardInfo.mVcmInfo.mVcmDrvName in not NC-----
- 01-01 14:04:49.515: D/CameraHal(165): enableSensor(213): orientation = 0xb71aa118 (MPL accel)
- 01-01 14:04:49.515: V/Sensors(507): int poll__setDelay(sensors_poll_device_t*, int, int64_t)
- 01-01 14:04:49.515: V/Sensors(507): int sensors_poll_context_t::setDelay(int, int64_t)
- 01-01 14:04:49.515: V/Sensors(507): setDelay - sensor Accelerometer (handle 4), rate 20 ms (50.00 Hz)
- 01-01 14:04:49.516: E/Sensors(507): MPU is not available
- 01-01 14:04:49.516: V/Sensors(507): int poll__setDelay(sensors_poll_device_t*, int, int64_t)
- 01-01 14:04:49.516: V/Sensors(507): int sensors_poll_context_t::setDelay(int, int64_t)
- 01-01 14:04:49.516: V/Sensors(507): setDelay - sensor Accelerometer (handle 4), rate 66 ms (15.00 Hz)
- 01-01 14:04:49.516: E/Sensors(507): MPU is not available
- 01-01 14:04:49.516: W/CameraService(165): CameraService::connect X (id 0, this pid is 165, name com.hjkj.hjobj)
- 01-01 14:04:49.516: I/HJSoft(5806): surfaceChanged...
- 01-01 14:04:49.516: I/HJSoft(5806): doStartPreview...
- 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 4224 height = 3136
- 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 4128 height = 3096
- 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 3264 height = 2448
- 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 2592 height = 1944
- 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 1600 height = 1200
- 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 640 height = 480
- 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 352 height = 288
- 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 320 height = 240
- 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 176 height = 144
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 176 height = 144
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 320 height = 240
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 352 height = 288
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 640 height = 480
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 720 height = 480
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 800 height = 600
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 4224 height = 3136
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 4224 height = 3136
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 1280 height = 720
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 1920 height = 1080
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
- 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
- 01-01 14:04:49.520: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
- 01-01 14:04:49.520: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
- 01-01 14:04:49.520: I/HJSoft(5806): previewSizes:width = 2064 height = 1548
- 01-01 14:04:49.520: I/HJSoft(5806): focusModes--fixed
- 01-01 14:04:49.520: I/HJSoft(5806): focusModes--auto
- 01-01 14:04:49.520: I/HJSoft(5806): focusModes--continuous-picture
- 01-01 14:04:49.524: D/CameraHal(165): commandThread(937): commandThread(937):receive CMD_SET_PREVIEW_WINDOW
- 01-01 14:04:49.524: D/CameraHal(165): commandThread(953): commandThread(953): CMD_SET_PREVIEW_WINDOW out
- 01-01 14:04:49.524: D/CameraHal(165): commandThread(832): commandThread(832):receive CMD_PREVIEW_START
- 01-01 14:04:49.525: E/CameraHal_Marvin(165): CAM_API_CAMENGINE: getPreferedSensorRes failed! best_res: 0xffffffff max_res: 0xf080c40
- 01-01 14:04:49.525: D/CameraHal(165): stop(1792): m_camDevice->stopPreview success!
- 01-01 14:04:49.526: E/CameraHal_Marvin(165): OV13850: STREAM OFF ++++++++++++++
- 01-01 14:04:49.526: E/CameraHal_Marvin(165): CAM_API_CAMENGINE: changeResolution (can't change resolution of sensor)
- 01-01 14:04:49.526: I/HJSoft(5806): 最终设置:PreviewSize--With = 4224Height = 3136
- 01-01 14:04:49.526: I/HJSoft(5806): 最终设置:PictureSize--With = 4224Height = 3136
- 01-01 14:04:49.532: D/ViewRootImpl(5806): 1920<<<<<< BACK FROM relayoutnull
- 01-01 14:04:49.535: D/ViewRootImpl(5806): 1920<<<<<< BACK FROM relayoutWM.LayoutParams{(0,0)(fillxfill)mPosX=0mPosY=0mHScale=1.0mVScale=1.0 align=UNDEFINE taskId=445 sim=#120 ty=1 fl=#1810100 fmt=-3 wanim=0x1030001 surfaceInsets=Rect(0, 0 - 0, 0) needsMenuKey=2packageName=com.hjkj.hjobjtoken=android.os.BinderProxy@1032ae10}
- 01-01 14:04:49.593: D/CameraHal(165): setupPreview(248): isp out put format is YUV420SP.
- 01-01 14:04:49.597: D/CameraHal(165): start(1747): m_camDevice->startPreview success
- 01-01 14:04:49.609: I/ActivityManagerService(507): Displayed com.hjkj.hjobj/.CameraActivity: +536ms (total +31m28s978ms)
- 01-01 14:04:49.611: D/ViewRootImpl(507): onDetachedFromWindow ungister contentObserver
- 01-01 14:04:49.661: D/CameraHal(165): displayThread(596): displayThread(596): receive CMD_DISPLAY_START
- 01-01 14:04:49.661: D/CameraHal(165): cameraDisplayBufferDestory(399): cameraDisplayBufferDestory(399): mANativeWindow is NULL, destory is ignore
- 01-01 14:04:49.662: W/gralloc(158): Debugmem The fd=99, in vmalloc !!!! Ishwc=0
- 01-01 14:04:49.684: W/gralloc(158): Debugmem The fd=94, in vmalloc !!!! Ishwc=0
- 01-01 14:04:49.709: W/gralloc(158): Debugmem The fd=98, in vmalloc !!!! Ishwc=0
- 01-01 14:04:49.727: D/CameraHal_Marvin(165): c: AfpsCurrResolution(0x3c840620 2112x1568@30fps) -> (idx:3 0x1e840620 2112x1568@15fps)
- 01-01 14:04:49.750: W/gralloc(158): Debugmem The fd=102, in vmalloc !!!! Ishwc=0
- 01-01 14:04:49.752: D/CameraHal(165): commandThread(905): commandThread(905): CMD_PREVIEW_START out
- 01-01 14:04:49.860: D/CameraHal_Marvin(165): ECM: AfpsCurrResolution(0x1e840620 2112x1568@15fps) -> (idx:4 0x14840620 2112x1568@10fps)
- 01-01 14:04:50.378: D/TaskPersister(507): removeObsoleteFile: deleting file=442_task.xml
- 01-01 14:04:50.379: D/TaskPersister(507): removeObsoleteFile: deleting file=442_task_thumbnail.png
- 01-01 14:04:50.826: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:04:50.826: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:04:51.924: D/CameraHal_Marvin(165): ECM: AfpsCurrResolution(0x14840620 2112x1568@10fps) -> (idx:3 0x1e840620 2112x1568@15fps)
- 01-01 14:04:56.225: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:04:56.893: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:66672
- 01-01 14:04:57.014: E/preview(5806): Time 8005
- 01-01 14:04:57.016: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:04:57.041: I/System.out(5806): java.io.DataOutputStream@25c07441
- 01-01 14:05:01.677: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:02.472: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:456335
- 01-01 14:05:02.536: E/preview(5806): Time 5522
- 01-01 14:05:02.539: I/System.out(5806): java.io.DataOutputStream@21a37de6
- 01-01 14:05:02.540: D/CameraHal_Marvin(165): ECM: AfpsCurrResolution(0x1e840620 2112x1568@15fps) -> (idx:4 0x14840620 2112x1568@10fps)
- 01-01 14:05:06.608: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:06.800: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:11.772: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:11.914: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:113500
- 01-01 14:05:11.972: E/preview(5806): Time 9437
- 01-01 14:05:11.975: I/System.out(5806): java.io.DataOutputStream@28dcdf27
- 01-01 14:05:16.652: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:16.784: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:21.426: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:21.507: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:-276821
- 01-01 14:05:21.560: E/preview(5806): Time 9588
- 01-01 14:05:21.563: I/System.out(5806): java.io.DataOutputStream@313315d4
- 01-01 14:05:21.576: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:26.083: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:-493365
- 01-01 14:05:26.134: E/preview(5806): Time 4574
- 01-01 14:05:26.136: I/System.out(5806): java.io.DataOutputStream@395f137d
- 01-01 14:05:26.823: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:26.968: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:31.466: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:31.592: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:-375571
- 01-01 14:05:31.646: E/preview(5806): Time 5512
- 01-01 14:05:31.648: I/System.out(5806): java.io.DataOutputStream@35199272
- 01-01 14:05:31.660: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:36.190: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:36.343: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:-317672
- 01-01 14:05:36.395: E/preview(5806): Time 4749
- 01-01 14:05:36.433: I/System.out(5806): java.io.DataOutputStream@1cae46c3
- 01-01 14:05:40.735: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:40.846: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:45.324: E/CameraHal(165): rga_nv12_scale_crop(426):(dst_width > RGA_VIRTUAL_W) || (dst_height > RGA_VIRTUAL_H), switch to arm
- 01-01 14:05:46.109: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:-736340
- 01-01 14:05:46.170: E/preview(5806): Time 9775
- 01-01 14:05:46.172: I/System.out(5806): java.io.DataOutputStream@d95bb40
复制代码
|
|