1 /*---------------------------------------------------------------------------*
2   Project:  THP - fast picture and motion-picture decoding for Revolution
3   File:     thp.h
4 
5   Copyright (C)2002-2006 Nintendo  All Rights Reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: thp.h,v $
14   Revision 1.3  2008/02/27 23:53:40  aka
15   Added THP_AUDIO_MONO.
16 
17   Revision 1.2  2006/02/09 04:50:20  aka
18   Changed copyright.
19 
20   Revision 1.1.1.1  2005/05/12 02:41:07  yasuh-to
21   Imported from Dolphin tree.
22 
23     2     03/09/15 9:38a Akagi
24 
25     1     02/01/16 12:02p Akagi
26     moved from tests. cleanup.
27 
28     3     8/14/01 5:28p Tian
29     Support for any multiple-of-16 resolution
30 
31     2     4/16/01 4:03p Tian
32     Added support for both 640x480 and 512x448 decoding in library via
33     separate APIs.  NOTE: THPSimple is only compiled for 512x448.  "#define
34     DOING640480" to make THPSimple work for 640x480.  Updated MHTP APIs.
35 
36     2     4/13/01 4:25p Tian
37     All copying eliminated, with locked cache for IDCT output, outer loop
38     optimizations, even more huffman decoding optimizations.
39 
40     1     4/12/01 11:01p Tian
41     Move to THP tree.  Massive optimizations : Hirose-san's new IDCT with
42     swizzle, table-driven huffman decoding, speculative execution of common
43     case code, etc.
44 
45     5     4/10/01 2:58p Tian
46     Locked cache Y-I8 texture output optimizations.
47 
48     4     4/09/01 11:22a Tian
49     Huffman optimizations.  Integrated Hirose-san's IDCT.
50 
51     3     3/30/01 2:21a Tian
52     Major optimizations for TEV-based YUV conversion (code ported from hvqm
53     tree), 640x480 decode in one pass for all render modes, TEV konstant
54     calibration, zoom/pan controls tweaked.
55 
56     2     3/29/01 4:44p Tian
57     Cleanup.  Optimizations.  More stats.
58 
59     1     3/28/01 12:16a Tian
60     Initial checkin.
61   $NoKeywords: $
62 
63  *---------------------------------------------------------------------------*/
64 
65 #ifndef __THP_H__
66 #define __THP_H__
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
71 /*---------------------------------------------------------------------------*
72     Public Constants...
73  *---------------------------------------------------------------------------*/
74 
75 // work size for THPVideoDecode()
76 #define THP_WORK_SIZE              0x1000
77 
78 // this enum describes the used errorcodes...
79 enum
80 {
81     THP_OK = 0,                                   //  0
82 
83     THP_RESOURCE_NOT_FOUND,                       //  1
84     THP_GET_DATA_ERROR,                           //  2
85     THP_BAD_SYNTAX,                               //  3
86     THP_BAD_VERSION,                              //  4
87     THP_UNSUPPORTED_FORMAT,                       //  5
88     THP_NO_MEMORY,                                //  6
89     THP_HAS_THUMBNAIL,                            //  7
90     THP_CORRUPT_HEADER,                           //  8
91     THP_UNSUPPORTED_QUANTIZATION,                 //  9
92     THP_UNSUPPORTED_PRECISION,                    // 10
93     THP_UNSUPPORTED_MARKER,                       // 11
94     THP_UNSUPPORTED_NUM_COMP,                     // 12
95     THP_UNSUPPORTED_NUM_HUFF,                     // 13
96     THP_BAD_SCAN_HEADER,                          // 14
97     THP_INVALID_HUFFTAB,                          // 15
98     THP_BAD_HUFFTAB,                              // 16
99     THP_BAD_MCU_SIZE,                             // 17
100     THP_OPTIONS_NOT_SUPPORTED,                    // 18
101     THP_UNSUPPORTED_COMPS,                        // 19
102     THP_UNSUPPORTED_IMAGESIZE,                    // 20
103     THP_IMAGE_VS_TILE_MISMATCH,                   // 21
104     THP_UNSUPPORTED_OUTPUTMODE,                   // 22
105     THP_UNSUPPORTED_SAMPLING_FACTORS,             // 23
106     THP_NUMCOMP_VS_OUTPUTMODE_MISMATCH,           // 24
107 
108     THP_NO_INPUT_FILE,                            // 25
109     THP_NO_WORK_AREA,                             // 26
110 
111     THP_NO_OUTPUT_BUFFER,                         // 27
112     THP_LC_NOT_ENABLED,                           // 28
113     THP_NOT_INITIALIZED,                          // 29
114 
115     THP_NUM_ERRORS
116 };
117 
118 // flag value of THPAudioDecode()
119 #define THP_AUDIO_INTERLEAVE    0x00
120 #define THP_AUDIO_NO_INTERLEAVE 0x01
121 #define THP_AUDIO_MONO          0x02
122 
123 /*---------------------------------------------------------------------------*
124     Public Prototypes...
125  *---------------------------------------------------------------------------*/
126 
127 // graphics stuff
128 BOOL   THPInit        (void);
129 s32    THPVideoDecode (void *file, void *tileY, void *tileU, void *tileV, void *work);
130 
131 // sound stuff
132 u32    THPAudioDecode (s16 *buffer, u8 *audioFrame, s32 flag);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif
139