Firefly开源社区

打印 上一主题 下一主题

firefly-rk3288采用OV13850摄像头java应用调用相机预览底层报错问题

31

积分

0

威望

0

贡献

技术小白

积分
31

firefly-rk3288采用OV13850摄像头java应用调用相机预览底层报错问题

发表于 2017-5-14 15:11:29      浏览:9549 | 回复: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贴在这里:

  1. 01-01 14:04:49.434: E/CameraHal_Marvin(165): HAL-MOCKUP: PHY ADDR (0x10000000),iommu addr (0x10000000)
  2. 01-01 14:04:49.437: E/CameraHal_Marvin(165): HAL-MOCKUP: PHY ADDR (0x112f5000),iommu addr (0x112f5000)
  3. 01-01 14:04:49.441: E/CameraHal_Marvin(165): HAL-MOCKUP: PHY ADDR (0x125ea000),iommu addr (0x125ea000)
  4. 01-01 14:04:49.448: E/CameraHal_Marvin(165): HAL-MOCKUP: PHY ADDR (0x138df000),iommu addr (0x138df000)
  5. 01-01 14:04:49.514: D/CameraHal(165): initDefaultParameters(914): ------mHardInfo.mVcmInfo.mVcmDrvName in not NC-----
  6. 01-01 14:04:49.515: D/CameraHal(165): enableSensor(213): orientation = 0xb71aa118 (MPL accel)
  7. 01-01 14:04:49.515: V/Sensors(507): int poll__setDelay(sensors_poll_device_t*, int, int64_t)
  8. 01-01 14:04:49.515: V/Sensors(507): int sensors_poll_context_t::setDelay(int, int64_t)
  9. 01-01 14:04:49.515: V/Sensors(507): setDelay - sensor Accelerometer (handle 4), rate 20 ms (50.00 Hz)
  10. 01-01 14:04:49.516: E/Sensors(507): MPU is not available
  11. 01-01 14:04:49.516: V/Sensors(507): int poll__setDelay(sensors_poll_device_t*, int, int64_t)
  12. 01-01 14:04:49.516: V/Sensors(507): int sensors_poll_context_t::setDelay(int, int64_t)
  13. 01-01 14:04:49.516: V/Sensors(507): setDelay - sensor Accelerometer (handle 4), rate 66 ms (15.00 Hz)
  14. 01-01 14:04:49.516: E/Sensors(507): MPU is not available
  15. 01-01 14:04:49.516: W/CameraService(165): CameraService::connect X (id 0, this pid is 165, name com.hjkj.hjobj)
  16. 01-01 14:04:49.516: I/HJSoft(5806): surfaceChanged...
  17. 01-01 14:04:49.516: I/HJSoft(5806): doStartPreview...
  18. 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 4224 height = 3136
  19. 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 4128 height = 3096
  20. 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 3264 height = 2448
  21. 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 2592 height = 1944
  22. 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 1600 height = 1200
  23. 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 640 height = 480
  24. 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 352 height = 288
  25. 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 320 height = 240
  26. 01-01 14:04:49.519: I/HJSoft(5806): pictureSizes:width = 176 height = 144
  27. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 176 height = 144
  28. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 320 height = 240
  29. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 352 height = 288
  30. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 640 height = 480
  31. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 720 height = 480
  32. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 800 height = 600
  33. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 4224 height = 3136
  34. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 4224 height = 3136
  35. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 1280 height = 720
  36. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 1920 height = 1080
  37. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
  38. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
  39. 01-01 14:04:49.519: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
  40. 01-01 14:04:49.520: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
  41. 01-01 14:04:49.520: I/HJSoft(5806): previewSizes:width = 2112 height = 1568
  42. 01-01 14:04:49.520: I/HJSoft(5806): previewSizes:width = 2064 height = 1548
  43. 01-01 14:04:49.520: I/HJSoft(5806): focusModes--fixed
  44. 01-01 14:04:49.520: I/HJSoft(5806): focusModes--auto
  45. 01-01 14:04:49.520: I/HJSoft(5806): focusModes--continuous-picture
  46. 01-01 14:04:49.524: D/CameraHal(165): commandThread(937): commandThread(937):receive CMD_SET_PREVIEW_WINDOW
  47. 01-01 14:04:49.524: D/CameraHal(165): commandThread(953): commandThread(953): CMD_SET_PREVIEW_WINDOW out
  48. 01-01 14:04:49.524: D/CameraHal(165): commandThread(832): commandThread(832):receive CMD_PREVIEW_START
  49. 01-01 14:04:49.525: E/CameraHal_Marvin(165): CAM_API_CAMENGINE: getPreferedSensorRes failed! best_res: 0xffffffff max_res: 0xf080c40
  50. 01-01 14:04:49.525: D/CameraHal(165): stop(1792): m_camDevice->stopPreview success!
  51. 01-01 14:04:49.526: E/CameraHal_Marvin(165): OV13850: STREAM OFF ++++++++++++++
  52. 01-01 14:04:49.526: E/CameraHal_Marvin(165): CAM_API_CAMENGINE: changeResolution (can't change resolution of sensor)
  53. 01-01 14:04:49.526: I/HJSoft(5806): 最终设置:PreviewSize--With = 4224Height = 3136
  54. 01-01 14:04:49.526: I/HJSoft(5806): 最终设置:PictureSize--With = 4224Height = 3136
  55. 01-01 14:04:49.532: D/ViewRootImpl(5806): 1920<<<<<< BACK FROM relayoutnull
  56. 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}
  57. 01-01 14:04:49.593: D/CameraHal(165): setupPreview(248): isp out put format is YUV420SP.
  58. 01-01 14:04:49.597: D/CameraHal(165): start(1747): m_camDevice->startPreview success
  59. 01-01 14:04:49.609: I/ActivityManagerService(507): Displayed com.hjkj.hjobj/.CameraActivity: +536ms (total +31m28s978ms)
  60. 01-01 14:04:49.611: D/ViewRootImpl(507): onDetachedFromWindow ungister contentObserver
  61. 01-01 14:04:49.661: D/CameraHal(165): displayThread(596): displayThread(596): receive CMD_DISPLAY_START
  62. 01-01 14:04:49.661: D/CameraHal(165): cameraDisplayBufferDestory(399): cameraDisplayBufferDestory(399): mANativeWindow is NULL, destory is ignore
  63. 01-01 14:04:49.662: W/gralloc(158): Debugmem The fd=99, in vmalloc !!!! Ishwc=0
  64. 01-01 14:04:49.684: W/gralloc(158): Debugmem The fd=94, in vmalloc !!!! Ishwc=0
  65. 01-01 14:04:49.709: W/gralloc(158): Debugmem The fd=98, in vmalloc !!!! Ishwc=0
  66. 01-01 14:04:49.727: D/CameraHal_Marvin(165): c: AfpsCurrResolution(0x3c840620 2112x1568@30fps) -> (idx:3 0x1e840620 2112x1568@15fps)
  67. 01-01 14:04:49.750: W/gralloc(158): Debugmem The fd=102, in vmalloc !!!! Ishwc=0
  68. 01-01 14:04:49.752: D/CameraHal(165): commandThread(905): commandThread(905): CMD_PREVIEW_START out
  69. 01-01 14:04:49.860: D/CameraHal_Marvin(165): ECM: AfpsCurrResolution(0x1e840620 2112x1568@15fps) -> (idx:4 0x14840620 2112x1568@10fps)
  70. 01-01 14:04:50.378: D/TaskPersister(507): removeObsoleteFile: deleting file=442_task.xml
  71. 01-01 14:04:50.379: D/TaskPersister(507): removeObsoleteFile: deleting file=442_task_thumbnail.png
  72. 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
  73. 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
  74. 01-01 14:04:51.924: D/CameraHal_Marvin(165): ECM: AfpsCurrResolution(0x14840620 2112x1568@10fps) -> (idx:3 0x1e840620 2112x1568@15fps)
  75. 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
  76. 01-01 14:04:56.893: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:66672
  77. 01-01 14:04:57.014: E/preview(5806): Time 8005
  78. 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
  79. 01-01 14:04:57.041: I/System.out(5806): java.io.DataOutputStream@25c07441
  80. 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
  81. 01-01 14:05:02.472: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:456335
  82. 01-01 14:05:02.536: E/preview(5806): Time 5522
  83. 01-01 14:05:02.539: I/System.out(5806): java.io.DataOutputStream@21a37de6
  84. 01-01 14:05:02.540: D/CameraHal_Marvin(165): ECM: AfpsCurrResolution(0x1e840620 2112x1568@15fps) -> (idx:4 0x14840620 2112x1568@10fps)
  85. 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
  86. 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
  87. 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
  88. 01-01 14:05:11.914: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:113500
  89. 01-01 14:05:11.972: E/preview(5806): Time 9437
  90. 01-01 14:05:11.975: I/System.out(5806): java.io.DataOutputStream@28dcdf27
  91. 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
  92. 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
  93. 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
  94. 01-01 14:05:21.507: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:-276821
  95. 01-01 14:05:21.560: E/preview(5806): Time 9588
  96. 01-01 14:05:21.563: I/System.out(5806): java.io.DataOutputStream@313315d4
  97. 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
  98. 01-01 14:05:26.083: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:-493365
  99. 01-01 14:05:26.134: E/preview(5806): Time 4574
  100. 01-01 14:05:26.136: I/System.out(5806): java.io.DataOutputStream@395f137d
  101. 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
  102. 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
  103. 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
  104. 01-01 14:05:31.592: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:-375571
  105. 01-01 14:05:31.646: E/preview(5806): Time 5512
  106. 01-01 14:05:31.648: I/System.out(5806): java.io.DataOutputStream@35199272
  107. 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
  108. 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
  109. 01-01 14:05:36.343: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:-317672
  110. 01-01 14:05:36.395: E/preview(5806): Time 4749
  111. 01-01 14:05:36.433: I/System.out(5806): java.io.DataOutputStream@1cae46c3
  112. 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
  113. 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
  114. 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
  115. 01-01 14:05:46.109: E/CameraHal(165): processPreviewDataCb(1369): processPreviewDataCb(1369): jxw test time:-736340
  116. 01-01 14:05:46.170: E/preview(5806): Time 9775
  117. 01-01 14:05:46.172: I/System.out(5806): java.io.DataOutputStream@d95bb40
复制代码







回复

使用道具 举报

59

积分

0

威望

0

贡献

技术小白

积分
59
发表于 2017-11-1 14:33:00        只看该作者  沙发
同样的问题,楼主是否解决?
回复

使用道具 举报

72

积分

0

威望

0

贡献

技术小白

积分
72
发表于 2017-11-10 11:00:22        只看该作者  板凳
有没有碰到这类问题,预览Y方向畸变 右测出现绿色条纹。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

友情链接 : 爱板网 电子发烧友论坛 云汉电子社区 粤ICP备14022046号-2
快速回复 返回顶部 返回列表