android-gpuimage icon indicating copy to clipboard operation
android-gpuimage copied to clipboard

glReadPixels in PixelBuffer Class

Open vashisthg opened this issue 12 years ago • 13 comments

With 8 mega pixel images the glReadPixels method being called in PixelBuffer.convertToBitmap() takes 700 - 1000 milli seconds. I have read that that glReadPixels is slow and can be replaced by Pixel buffer objects. I don't have any experience with OPENGL, can someone come up with a faster solution.

Line: https://github.com/CyberAgent/android-gpuimage/blob/febdf4900b437b2069661fd371d5469196e26f18/library/src/jp/co/cyberagent/android/gpuimage/PixelBuffer.java#L194

vashisthg avatar Sep 26 '14 10:09 vashisthg

Been running into the same problem here. Look at this post: https://vec.io/posts/faster-alternatives-to-glreadpixels-and-glteximage2d-in-opengl-es

JesseScott avatar Oct 17 '14 18:10 JesseScott

@JesseScott Were you able to port this library to that implementation

gaurav-fueled avatar Oct 20 '14 06:10 gaurav-fueled

@gvv-fueled working on it, along with a video implementation. Almost done, will post here (and issue a pull request) when it's done.

JesseScott avatar Oct 20 '14 16:10 JesseScott

@JesseScott Got any solution?

vashisthg avatar Oct 24 '14 11:10 vashisthg

@vashisthg soon. project has had a few different priorities, so have ahd to shift gears this week. Will be revisiting next week.

JesseScott avatar Oct 24 '14 16:10 JesseScott

Currently working on adapting the FBO/PBO activity from Grafika into GPUImageRenderer, but its proving tricky because of the GLContext...

For refernce: https://github.com/google/grafika/blob/f3c8c3dee60153f471312e21acac8b3a3cddd7dc/src/com/android/grafika/RecordFBOActivity.java

JesseScott avatar Nov 20 '14 18:11 JesseScott

@JesseScott Had opened a issue on Grafika some time ago https://github.com/google/grafika/issues/10

vashisthg avatar Nov 24 '14 12:11 vashisthg

@vashisthg yeah, I've seen that actually. Maybe we should just chip in and buy Fadden a nice bottle of scotch to fix this for us ;-)

JesseScott avatar Nov 24 '14 17:11 JesseScott

@JesseScott did you accomplish the FBO solution? glReadPixels() is very very slow and can't apply in real time video application.

JuannyWang avatar Sep 01 '15 05:09 JuannyWang

I have the same question as JuannyWang, is anywhere can find a demo about copy from PBO

flyuuo9 avatar Dec 18 '15 08:12 flyuuo9

We haven't released our code yet - I'll ping my boss about it. But a hint, we ended up utilizing several of the examples/functionality from Grafika https://github.com/google/grafika

JesseScott avatar Dec 18 '15 16:12 JesseScott

@JesseScott We're looking forward to your release. ^_^

JuannyWang avatar Dec 21 '15 06:12 JuannyWang

I have done the PBO copy in my own project, but the bitmap decode from the buffer, is not I need, it seems like width and height exchanged, may need do some transform action.(no problem in grafika) http://stackoverflow.com/questions/34347835/how-can-i-implement-pbopixel-buffer-object-in-android-grafika-project

flyuuo9 avatar Dec 22 '15 02:12 flyuuo9