[英]Any other method than copying bits to an ANativeWindow buffer?
I'm using native window in android to show a video in a surface view. 我正在使用android中的本机窗口以表面视图显示视频。 Here's the part of my code.
这是我的代码的一部分。
ANativeWindow_lock(window, &windowBuffer, NULL);
memcpy(windowBuffer.bits, buffer, size);
ANativeWindow_unlockAndPost(window);
But the memcpy is taking too much time. 但是memcpy需要太多时间。 Is there any other method without memcpy so that I can directly use the buffer allocated in native code?
还有没有memcpy的其他方法,以便我可以直接使用本机代码中分配的缓冲区? I want to fill the surface view completely with data in buffer.
我想用缓冲区中的数据完全填充表面视图。
Surfaces aren't buffers, they're queues of buffers. 表面不是缓冲区,它们是缓冲区的队列。 Anything headed to the display will be double- or triple-buffered.
前往显示屏的所有内容都会被双缓冲或三缓冲。
You can generate your output directly into the buffer returned by ANativeWindow_lock()
. 您可以将输出直接生成到
ANativeWindow_lock()
返回的缓冲区中。 Because it's (at least) double-buffered, there is no penalty for locking the next buffer right after you unlock the previous one -- you won't prevent the compositor from seeing the just-finished frame by immediately calling lock. 因为它(至少)是双缓冲的,所以在解锁前一个缓冲区后立即锁定下一个缓冲区没有任何惩罚-您不会通过立即调用lock来阻止合成器看到刚完成的帧。
See the Android graphics architecture doc for more details, particularly this section . 有关更多详细信息,请参阅Android图形架构文档,尤其是本部分 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.