cats-oss / android-gpuimage

Android filters based on OpenGL (idea from GPUImage for iOS)
9k stars 2.27k forks source link

glReadPixels in PixelBuffer Class #129

Open vashisthg opened 10 years ago

vashisthg commented 10 years ago

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

JesseScott commented 10 years ago

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

gaurav-fueled commented 10 years ago

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

JesseScott commented 10 years ago

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

vashisthg commented 10 years ago

@JesseScott Got any solution?

JesseScott commented 10 years ago

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

JesseScott commented 9 years ago

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

vashisthg commented 9 years ago

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

JesseScott commented 9 years ago

@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 ;-)

JuannyWang commented 9 years ago

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

flyuuo9 commented 8 years ago

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

JesseScott commented 8 years ago

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

JuannyWang commented 8 years ago

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

flyuuo9 commented 8 years ago

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