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