#include <revolution/thp.h>
s32 THPVideoDecode(void *file,
void *tileY,
void *tileU,
void *tileV,
void *work);
| file | Pointer to the THP video data. |
| tileY | Pointer to buffer that stores the Y component of the extracted data. |
| tileU | Pointer to buffer that stores the U component of the extracted data. |
| tileV | Pointer to buffer that stores the V component of the extracted data. |
| work | Work buffer used. |
Returns one of the following codes:
| Code | Value | Description |
THP_OK |
0 | The function ended normally. |
THP_BAD_SYNTAX |
3 | The specified THP video data marker is invalid. |
THP_UNSUPPORTED_QUANTIZATION |
9 | The specified THP video data quantization table count is invalid. |
THP_UNSUPPORTED_PRECISION |
10 | The specified THP video data bit precision is invalid. |
THP_UNSUPPORTED_MARKER |
11 | There is an unsupported marker in the THP video data. |
THP_UNSUPPORTED_NUM_COMP |
12 | The specified number of components in the THP video data is invalid. |
THP_UNSUPPORTED_NUM_HUFF |
13 | The specified number of Huffman tables in the THP video data is invalid. |
THP_BAD_SCAN_HEADER |
14 | The THP video data scan header is invalid. |
THP_INVALID_HUFFTAB |
15 | The specified THP video data Huffman table is invalid. |
THP_UNSUPPORTED_COMPS |
19 | The specified THP video data component is invalid. |
THP_NO_INPUT_FILE |
25 | No input (THP video) data was specified. |
THP_NO_WORK_AREA |
26 | No work buffer was specified. |
THP_NO_OUTPUT_BUFFER |
27 | No extracted data output destination was specified. |
THP_LC_NOT_ENABLED |
28 | A locked cache was not enabled. |
THP_NOT_INITIALIZED |
29 | The THPInit function was not called. |
The THPVideoDecode function extracts the THP video data specified by the first argument, writes the Y component of the extracted data to the buffer specified by the second component, writes the U component of the extracted data to the buffer specified by the third component, and writes the V component of the extracted data to the buffer specified by the fourth argument. The work buffer used is specified as the fifth argument. The size of this work buffer is defined in the thp.h file as THP_WORK_SIZE.
Call the THPVideoDecode function while a locked cache is enabled.
The error codes for the return value can be divided into three types. They are those returned when the function ends normally (THP_OK), those returned when the function was not used correctly (THP_NO_INPUT_FILE, etc.), and those returned when the THP video data cannot be extracted (THP_BAD_SYNTAX, etc.). If THPVideoDecode was not used correctly, correct the error and call it again. If the THP video data cannot be extracted, it is possible that the data specified by the first argument is not THP video data. Please check the specified address to see if it is correct.
The THPVideoDecode function outputs the extracted data as I8 textures to each component. The sizes of the component buffers specified for the function are as follows. The first address in each buffer must be 32-byte aligned.
| Component | Size (in bytes) |
| Y | (number of pixels in the horizontal direction) x (number of pixels in the vertical direction) |
| U | (number of pixels in the horizontal direction) x (number of pixels in the vertical direction) / 4 |
| V | (number of pixels in the horizontal direction) x (number of pixels in the vertical direction) / 4 |
Note: The THPVideoDecode function uses a locked cache when extracting THP video data. For example, if locked cache is used also by a thread with a higher priority while executing the THPVideoDecode function in a thread, the calculation results of the THPVideoDecode function could be corrupted. Be aware of this when using this function.
03/01/2006 Initial version.