Android相机框架渲染 [英] Android Camera Frame Rendering

查看:155
本文介绍了Android相机框架渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Android中渲染我的相机框架,并利用canvas,bitmap,onDraw()在我的Surfaceview上显示这些框架.但是,在本机端进行渲染的代码性能占用了我的CPU的70%.渲染速度不错但是CPU消耗不好.问题是我在渲染和捕获相机时还有另一个叠加的surfaceview(surfaceview2)可以显示其他内容.我想知道如何减少cpu的消耗并更多地使用gpu等.到目前为止,可能的解决方案是: a)使用opengl在Surfaceview上绘制我的框架,但是资源和示例代码有限 b)使用本机面绘制框架,但资源也有限

I am trying to render my camera frames in Android and make use of canvas,bitmap,onDraw() to display the frames on my Surfaceview. However my code performance which does the rendering on the Native side is taking up to 70% of my cpu. The rendering speed is good but CPU consumption is bad.The problem is that I have another overlaying surfaceview(surfaceview2) to display something else while I am rendering and capturing camera. I was wondering how may I reduce the cpu consumption and make use of gpu more or etc. The possible solutions so far are : a) using opengl to draw my frames on surfaceview but limited resources and sample codes b) using native side to draw my frames but limited resources as well

有人知道如何使用上述技术对rbg执行YV12吗?

Does anyone know how can I perform YV12 to rbg using above techniques?

推荐答案

许多现代GPU都可以对YUV进行本地解码.问题是如何将YUV表面放入OpenGL ES,因为这通常不是Open GL ES要做的事情...

A lot of the modern GPUs can decode YUV natively; the issue is how to get the YUV surface into OpenGL ES as this is not normally something which Open GL ES does ...

大多数操作系统(包括Android)可让您通过EGL_image_external扩展将外部表面导入OpenGL ES,并且可以将这些外部表面标记为YUV.

Most operating systems (Android included) let you import external surfaces into OpenGL ES via the EGL_image_external extension, and these external surfaces can be marked up a being YUV.

唯一的问题是,我不确定这在Android方面的工作原理(抱歉),因此其他人将不得不回答.我只知道图形驱动程序方面-只知道在大多数现代移动GPU上都有可能.

The only problem is that I'm not entirely sure how this works on the Android side (sorry) - so someone else will have to answer that. I only know the graphics driver side - just know that it is possible on most modern mobile GPUs.

这篇关于Android相机框架渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆