CRI Sofdec2  Last Updated: 2022-11-21 16:25 p
Video Frame Conversion and Display

This section discusses the video output formats that can be used with the PC version of Sofdec2.

Video Frame Output Format

The decoding results from the Sofdec2 library are stored in a proprietary format.
When copying video frames to the video frame output buffer, they must be converted to the proper format for rendering.

The PC (Windows) platform supports the following two video frame output formats.

  • 32-bit ARGB texture format
  • YUV individual buffers format (for pixel shaders)

Video Frame Output Buffer Size and Pitch

The video frame output buffer for converting the decoding results must be allocated by your application.
The size of the buffer depends on the movie resolution and rendering format.
If the output destination is a texture buffer, the number of horizontal pixels in the movie and the width of the buffer (pitch) may be different.
Converting and/or copying a Sofdec2 video frame usually requires a buffer pointer, buffer size, and pitch as parameters.

Video Frame Output Format

(1) 32-bit ARGB

Get the video frame in 32-bit ARGB texture format.
Use the criManaPlayer_CopyFrameToBufferARGB32 function.
However, to get video frames in this format you must call the criMana_InitializeFrameARGB32 function immediately after the library is initialized.

The actual data structure of the 32-bit ARGB format is based on the most general purpose texture format.

On PCs, texture sizes may be restricted to a power of two depending on the video card, etc., so be careful when specifying the pitch.
Specify the actual memory width for the pitch argument to the video frame acquisition function.

(2) YUV Individual Buffers (for Pixel Shaders)

Get the video frame in three buffers: Y, U, and V.
Use the criManaPlayer_CopyFrameToBuffersYUV function. Use a CriManaTextureBuffersYUV structure as a parameter to this function.

This format is best suited for rendering while performing YUV to RGB color conversion with a pixel shader.

The pixel shader must be implemented and controlled by the application.