CRI Sofdec2
Last Updated: 2022-11-21 16:25 p
|
This section explains how to get and draw video frames using Sofdec2.
The Sofdec2 library does not perform any video frame drawing whatsoever.
It only decodes video frames that should be displayed and sends it to the main memory.
This allows the application to draw freely, such as by displaying movies in full screen and mapping texture.
In order to play the movie back smoothly, the application will need to regularly (once every Vsync interval) get a video frame from the main loop and immediately display the video frames on time for display.
As long as the main loop is regularly working, there is no need for the application to adjust the drawing timing due to differences in PAL/NTSC screen refresh cycles or movie frame rates.
Perform the following steps to get a video frame using Sofdec2.
Step | Description |
---|---|
(1) Decode Results Ref. criManaPlayer_ReferFrame | It will successfully reference the frame independently of the display time if there are new decoding results. |
(2) Determining Time for Display criManaPlayer_IsFrameOnTime | Specify the frame information that was successfully referenced and confirm whether that frame is on time for display. If it is on time for display, immediately display it. |
(3) Copy/Convert Decoding Results criManaPlayer_CopyFrame***** | Convert the decoding results into the format you wish to draw in. When using a pixel shader, the results will be copied to the various YUV texture regions. Hold these conversion results so that you can continue drawing until the next frame can be gotten. |
(4) Discard Converted Video Frames criManaPlayer_DiscardFrame | Discard the frame that was converted for drawing. You cannot get the next new frame until the frame is discarded. |
If the application is controlling display timing then there is no need to call for (2) determination.
If for some reason you want to discard the gotten frame without displaying it, then omit (3) and immediately discard the frame.
The Sofdec2 library decoding results are held in a unique YUV420 format.
In order to draw the decoding results, you will need to convert or copy them into a texture format or an ideal format for shader input.
The output formats that are supported vary by platform.
The following are main examples.
Refer to the specific platform manual for more information on output formats that can actually be used.