Git Product home page Git Product logo

Comments (3)

fadden avatar fadden commented on May 5, 2024

The performance of glReadPixels() seems to vary widely between different devices and different driver releases. This is why I added a trivial benchmark to Grafika. (What values do you get?)

http://bigflake.com/mediacodec/#ExtractMpegFrames shows some timing values for extracting video frames with glReadPixels(); on a Nexus 5 the function ran quickly, and most of the time was spent elsewhere (primarily PNG compression in that case).

(The convertToBitmap() function you reference could be sped up by inverting the Y axis in the GL rendering, rather than the bitmap copy, and it'd annoy the GC less if the pixel buffers were allocated once and re-used. But if that's not the bottleneck then there's no reason to mess with it.)

One partially-completed attempt to use non-public APIs from the NDK can be found at http://stackoverflow.com/questions/21151259/replacing-glreadpixels-with-egl-khr-image-base-for-faster-pixel-copy/21199078#21199078 ; I think with the final "edit" it would actually work, but I never got around to trying it out (and at this point it's unlikely I ever will).

The fastest way to get images to disk is to use the MP4 video encoder, but that's usually not appropriate unless your input is video.

from grafika.

gaurav-fueled avatar gaurav-fueled commented on May 5, 2024

Hey @fadden,

The time glReadPixels in convertToBitmap() method takes on Nexus 5 (Android L) for 3264 X 2448 size image comes out to be 689 milli seconds.

In grafika 3264 X 2448 size image takes 51.416 milli seconds on Nexus 5 with on Android L.

from grafika.

fadden avatar fadden commented on May 5, 2024

That's a lot of pixels. Even so, I suspect you may be hitting a slow path in the driver to get performance that bad.

In any event, this is a bit out of scope for Grafika, since there isn't yet a public Java-language API that will make this faster.

from grafika.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.