THP Player Constants

READ_BUFFER_NUM

READ_BUFFER_NUM is the size of the read buffer for the optical disc drive maintained in the THP player. The buffer size actually allocated is the maximum frame size in the THP movie data header (THPHeader) multiplied by READ_BUFFER_NUM. If data reading speeds cause minor slowdowns, increasing the size of READ_BUFFER_NUM might remedy this issue. READ_BUFFER_NUM is defined as follows.


#define READ_BUFFER_NUM 10

DECODE_VIDEO_BUFFER_NUM / DECODE_AUDIO_BUFFER_NUM

DECODE_VIDEO_BUFFER_NUM and DECODE_AUDIO_BUFFER_NUM indicate the number of buffers that store the decoded THP video and audio data within the THP player. The buffer sizes actually allocated are calculated as shown below:

// Y texture buffer size
( OSRoundUp32B (THP video data horizontal size × vertical size)
// U texture buffer size
+ OSRoundUp32B (THP video data horizontal size × vertical size / 4)
// V texture buffer size
+ OSRoundUp32B (THP video data horizontal size × vertical size / 4) × DECODE_VIDEO_BUFFER_NUM 
// Size of buffer for reading THP audio data 
+ OSRoundUp32B (THP audio data maximum number of samples × 4) × DECODE_AUDIO_BUFFER_NUM

If the extraction process time causes any minor slowdowns, increasing the number of these buffers could remedy this issue. DECODE_VIDEO_BUFFER_NUM and DECODE_AUDIO_BUFFER_NUM are defined as follows.


#define DECODE_VIDEO_BUFFER_NUM 3
#define DECODE_AUDIO_BUFFER_NUM 6

READ_THREAD_PRIORITY / AUDIO_THREAD_PRIORITY / VIDEO_THREAD_PRIORITY

The THP player creates a maximum of three threads. These three threads are the read threads that read from the optical disc, the video decode thread that extracts the THP video data, and the audio thread that extracts the THP audio data. The priority of each thread is indicated by READ_THREAD_PRIORITY, AUDIO_THREAD_PRIORITY and VIDEO_THREAD_PRIORITY. The priority of each thread is defined in the demo program. If you embed the THP player in a game, you need to modify the priorities for their respective environments. When modifying the priorities, preserve the following thread priority relationships.

(High) READ_THREAD_PRIORITY > AUDIO_THREAD_PRIORITY > VIDEO_THREAD_PRIORITY (Low) 

To read smoothly from the optical disc and prevent sound gaps, be sure to assign high priorities to the read and audio decode threads. READ_THREAD_PRIORITY, AUDIO_THREAD_PRIORITY and VIDEO_THREAD_PRIORITY are defined as follows.


#define READ_THREAD_PRIORITY 8
#define AUDIO_THREAD_PRIORITY 12
#define VIDEO_THREAD_PRIORITY 20

See Also

Revision History

03/01/2006 Initial version.