Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8352605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:00:36+00:00 2026-06-09T09:00:36+00:00

In my native thread I have FFMpeg getting and decoding frames then putting them

  • 0

In my native thread I have FFMpeg getting and decoding frames then putting them in a queue.

On Java side I have a GLSurfaceView and from Renderer.onDrawFrame I’m calling into the native code passing a bitmap (that bitmap I create only once, then pass it every time).

In the native code I get the head of the queue, copy data to the java bitmap using AndroidBitmap_xxx functions, then render that Bitmap on Java side as a texture.

I wonder is there a faster way to render video? Shall I do it entirely in the native code, if yes, why it will be faster?

Edit: I now don’t copy RGB frame pixels to the locked bitmap pixels, rather I decode YUV frame directly into the locked bitmap pixels. This makes rendering significantly faster (because no unneeded memcpy anymore) still the question remains.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:00:37+00:00Added an answer on June 9, 2026 at 9:00 am

    The most effective technique to change the pixels in the texture is called Render-to-Texture and can be done in OpenGL/OpenGL ES via FBOs. On desktop OpenGL you can use pixel buffer objects (PBOs) to manipulate pixel data directly on GPU (but OpenGL ES does not support this yet).

    On unextended OpenGL you can change the pixels in system memory and then update texture with glTexImage2D/glTexSubImage2D – but this is inefficient last resort solution and should be avoided if possible. glTexSubImage2D is usually much faster since it only updates pixel inside the existing texture, while glTexImage2D creates entirely new texture (as a benefit you can change the size and pixel format of the texture). On the other side, glTexSubImage2D allows to update only parts of the texture.

    You say that you want it to work with OpenGL ES, so I would propose to do the following steps:

    • replace glTexImage2D() with glTexSubImage2D() – if you gain enough performance that’s it, just let it be;
    • implement render-to-texture with FBOs and shaders – it will require
      far more work to rewrite your code, but will give even better
      performance.

    For FBOs the code can look like this:

    // setup FBO
    glGenFramebuffers( 1, &FFrameBuffer );
    glBindFramebuffer( GL_FRAMEBUFFER, FFrameBuffer );
    glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, YourTextureID, 0 );
    glBindFramebuffer( GL_FRAMEBUFFER, 0 );
    
    // render to FBO
    glBindFramebuffer( GL_FRAMEBUFFER, FFrameBuffer );
    glViewport( 0, 0, YourTextureWidth, YourTextureHeight );
    your rendering code goes here - it will draw directly into the texture
    glBindFramebuffer( GL_FRAMEBUFFER, 0 );
    
    // cleanup
    glBindFramebuffer( GL_FRAMEBUFFER, 0 );
    glDeleteFramebuffers( 1, &FFrameBuffer );
    

    Keep in mind that not all pixel formats can be rendered to. RGB/RGBA are usually fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have thread in onCreate which is getting content from web. While the content
In one of my Java 6 applications I have a thread that feeds the
I have spent some time learning what are Java Native methods and that they
I have called a native program which creates another thread, which attaches itself to
I have native function takes 2 arguments , i want to create managed thread
after export from eclipse i have error: C:\Program Files\Java\jre6\bin>java C:\wamp\www\JOGL\test.jar Exception in thread main
I have created one thread for calling native function which are calling the MPEG2
I need a solution to properly stop the thread in Java. I have IndexProcessor
I have the following Exception: Exception in thread main java.lang.SecurityException: no manifiest section for
Can I create a native thread on Windows running MRI, using the CreateThread API

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.