#include <revolution/thp.h>
s32 THPVideoDecode(void *file,
void *tileY,
void *tileU,
void *tileV,
void *work);
file |
Pointer to 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 area to use. |
Returns one of the following codes.
| Code | Value | Description |
| THP_OK | 0 | The function ended normally. |
|---|---|---|
| THP_BAD_SYNTAX | 3 | The specification of the THP video data marker is invalid. |
| THP_UNSUPPORTED_QUANTIZATION | 9 | The specification for the THP video data quantization table count is invalid. |
| THP_UNSUPPORTED_PRECISION | 10 | The specification for the 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 specification for the number of components in the THP video data is invalid. |
| THP_UNSUPPORTED_NUM_HUFF | 13 | The specification for the number of huffman tables in the THP video data is invalid. |
| THP_BAD_SCAN_HEADER | 14 | THP video data scan header is invalid. |
| THP_INVALID_HUFFTAB | 15 | The specification for the THP video data huffman table is invalid. |
| THP_UNSUPPORTED_COMPS | 19 | The specification for the THP video data component is invalid. |
| THP_NO_INPUT_FILE | 25 | No input data (THP video data) was specified. |
| THP_NO_WORK_AREA | 26 | No work area was specified. |
| THP_NO_OUTPUT_BUFFER | 27 | No extracted data output destination was specified. |
| THP_LC_NOT_ENABLED | 28 | 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 fifth argument specifies the work area used by the THPVideoDecode function. The size of this work area is defined in the thp.h file as THP_WORK_SIZE.
Please call the THPVideoDecode function when locked cache is enabled.
The error codes that are returned can be divided into three types: 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 the function was not used correctly, correct the error and call THPVideoDecode again. If the THP video data cannot be extracted, the data specified by the first argument may not be THP video data. Please check the specified address to see if it is correct.
The THPVideoDecode function outputs the extracted data as I8 textures for each component. Sizes of the component buffers specified for the THPVideoDecode function are as follows. The first address in each buffer must be 32-byte aligned.
| Component | The size (in bytes) |
| Y | Num of pixels in the horizontal direction x Num of pixels in the vertical direction |
| U | Num of pixels in the horizontal direction x Num of pixels in the vertical direction ÷ 4 |
| V | Num of pixels in the horizontal direction x Num of pixels in the vertical direction ÷ 4 |
Note: The THPVideoDecode function uses locked cache when extracting THP video data. For example, if while running THPVideoDecode in a thread and a locked cache is used, even by a thread with a higher priority, the calculation results of THPVideoDecode could be corrupted. Keep this in mind and use the THPVideoDecode function carefully.
2006/03/01 Initial version.
CONFIDENTIAL