Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QVideoFrame + OpenGL, which is the best way?

QVideoFrame + OpenGL, which is the best way?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • napajejenunedk0N Offline
    napajejenunedk0N Offline
    napajejenunedk0
    wrote on last edited by
    #1

    I am currently making a video player where the video display would be OpenGL drawn.

    Currently, I will transfer the QVideoFrame to a PBO, but what I want to evade is unnecessary copying of the frame's pixels from VRAM to RAM and vice versa.
    Saw the QAbstractVideoBuffer::GLTextureHandle handle type and was wondering what should be the scenario where the decoder, or whatever decodes and couples up the video frame, would create the frame in this format (as an OpenGL texture or something in the video memory), so that the frame could be directly used by the OpenGL shaders.
    How the functionality that creates the frames could be made to upload decoded frames directly to the video memory (as textures, for instance - QAbstractVideoBuffer::GLTextureHandle)?
    Otherwise the decoded frame data would be first mapped (copied to somewhere as Qt documentation states), then one should copy it to a PBO. This way two unnecessary copies of the frame data could be triggered:

    1. QVideoFrame::map:
      "Maps the contents of a video frame to system (CPU addressable) memory.

    In some cases the video frame data might be stored in video memory or otherwise inaccessible memory, so it is necessary to map a frame before accessing the pixel data. This may involve copying the contents around, so avoid mapping and unmapping unless required." (sorry for using quotes, the bq. doesn't work)

    1. From VRAM / RAM to VRAM - the PBO.

    Also, as "nVidia's documentation":http://http.download.nvidia.com/developer/Papers/2005/Fast_Texture_Transfers/Fast_Texture_Transfers.pdf states:
    "Storing 8-bit textures in a BGRA layout in system memory and use the
    GL_BGRA as the external format for textures to avoid swizzling"

    ... it is best to provide the pixel data to the video memory in the BGRA pixel format.

    Is possible to make the decoder pass the QVideoFrame directly to the video memory and provide the data in the BGRA format?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved