14276
|
1 /* (c)Copyright 1996-2000 NTT Cyber Space Laboratories */
|
|
2 /* Released on 2000.05.22 by N. Iwakami */
|
|
3 /* Modified on 2000.05.25 by N. Iwakami */
|
|
4 /* Released on 2000.09.06 by N. Iwakami */
|
|
5
|
|
6 // Modified for MPlayer on 2004.12.29
|
|
7
|
|
8 #ifndef tvqdec_h
|
|
9 #define tvqdec_h
|
|
10
|
|
11 #ifdef _MSC_VER
|
|
12 # ifdef DLL_MODULE
|
|
13 # define DllPort __declspec( dllexport )
|
|
14 # else
|
|
15 # define DllPort __declspec( dllimport )
|
|
16 # endif
|
|
17 #else
|
|
18 # define DllPort
|
|
19 #endif
|
|
20
|
|
21 #ifdef __cplusplus
|
|
22 extern "C" { // only need to import/export C interface if used by C++ source code
|
|
23 #endif
|
|
24
|
|
25 /************************/
|
|
26 /*** General settings ***/
|
|
27 /************************/
|
|
28 /* Initialization error code */
|
|
29 enum INIT_ERROR_CODE {
|
|
30 TVQ_NO_ERROR = 0, // no error
|
|
31 TVQ_ERROR, // general
|
|
32 TVQ_ERROR_VERSION, // wrong version
|
|
33 TVQ_ERROR_CHANNEL, // channel setting error
|
|
34 TVQ_ERROR_MODE, // wrong coding mode
|
|
35 TVQ_ERROR_PARAM, // inner parameter setting error
|
|
36 TVQ_ERROR_N_CAN, // wrong number of VQ pre-selection candidates, used only in encoder
|
|
37 };
|
|
38
|
|
39 /* version ID */
|
|
40 #define TVQ_UNKNOWN_VERSION -1
|
|
41 #define V2 0
|
|
42 #define V2PP 1
|
|
43
|
|
44 #define N_VERSIONS 2
|
|
45
|
|
46 /* window types */
|
|
47 enum WINDOW_TYPE {
|
|
48 ONLY_LONG_WINDOW = 0,
|
|
49 LONG_SHORT_WINDOW,
|
|
50 ONLY_SHORT_WINDOW,
|
|
51 SHORT_LONG_WINDOW,
|
|
52 SHORT_MEDIUM_WINDOW,
|
|
53 MEDIUM_LONG_WINDOW,
|
|
54 LONG_MEDIUM_WINDOW,
|
|
55 MEDIUM_SHORT_WINDOW,
|
|
56 ONLY_MEDIUM_WINDOW,
|
|
57 };
|
|
58
|
|
59 /* block types */
|
|
60 enum BLOCK_TYPE {
|
|
61 BLK_SHORT = 0,
|
|
62 BLK_MEDIUM,
|
|
63 BLK_LONG,
|
|
64 BLK_PPC,
|
|
65 };
|
|
66 #define N_BTYPE 3 // number of block types
|
|
67 #define N_INTR_TYPE 4 // number of interleave types, enum BLOCK_TYPE is commonly used for detecting interleave types.
|
|
68
|
|
69 /* maximum number of channels */
|
|
70 #define N_CH_MAX 2
|
|
71
|
|
72 /* type definition of code information interface */
|
|
73 typedef struct {
|
|
74 /* block type */
|
|
75 int w_type;
|
|
76 int btype;
|
|
77
|
|
78 /* FBC info */
|
|
79 int *segment_sw[ N_CH_MAX ];
|
|
80 int *band_sw[ N_CH_MAX ];
|
|
81 int *fg_intensity[ N_CH_MAX ];
|
|
82
|
|
83 /* VQ info */
|
|
84 int *wvq;
|
|
85
|
|
86 /* BSE info */
|
|
87 int *fw;
|
|
88 int *fw_alf;
|
|
89
|
|
90 /* gain info */
|
|
91 int *pow;
|
|
92
|
|
93 /* LSP info */
|
|
94 int *lsp[ N_CH_MAX ];
|
|
95
|
|
96 /* PPC info */
|
|
97 int pit[ N_CH_MAX ];
|
|
98 int *pls;
|
|
99 int pgain[ N_CH_MAX ];
|
|
100
|
|
101 /* EBC info */
|
|
102 int *bc[ N_CH_MAX ];
|
|
103
|
|
104 void *manager;
|
|
105 } INDEX;
|
|
106
|
|
107 /***********************************************/
|
|
108 /*** Definitions about program configuration ***/
|
|
109 /***********************************************/
|
|
110 /* type definition of tvqConfInfoSubBlock */
|
|
111 typedef struct {
|
|
112 int sf_sz; // subframe size
|
|
113 int nsf; // number of subframes
|
|
114 int ndiv; // number of division of weighted interleave vector quantization
|
|
115 int ncrb; // number of Bark-scale subbands
|
|
116 int fw_ndiv; // number of division of BSE VQ
|
|
117 int fw_nbit; // number of bits for BSE VQ
|
|
118 int nsubg; // number of sub-blocks for gain coding
|
|
119 int ppc_enable; // PPC switch
|
|
120 int ebc_enable; // EBC switch
|
|
121 int ebc_crb_base; // EBC base band
|
|
122 int ebc_bits; // EBC bits
|
|
123 int fbc_enable; // FBC switch
|
|
124 int fbc_n_segment; // FBC number of segments
|
|
125 int fbc_nband; // FBC number of subbands
|
|
126 int *fbc_crb_tbl; // FBC subband table
|
|
127 } tvqConfInfoSubBlock;
|
|
128
|
|
129 /* type definition of tvqConfInfo */
|
|
130 typedef struct {
|
|
131 /* frame configuration */
|
|
132 int N_CH;
|
|
133 /* window type coding */
|
|
134 int BITS_WTYPE;
|
|
135 /* LSP coding */
|
|
136 int LSP_BIT0;
|
|
137 int LSP_BIT1;
|
|
138 int LSP_BIT2;
|
|
139 int LSP_SPLIT;
|
|
140 /* Bark-scale envelope coding */
|
|
141 int FW_ARSW_BITS;
|
|
142 /* gain coding */
|
|
143 int GAIN_BITS;
|
|
144 int SUB_GAIN_BITS;
|
|
145 /* pitch excitation */
|
|
146 int N_DIV_P;
|
|
147 int BASF_BIT;
|
|
148 int PGAIN_BIT;
|
|
149
|
|
150 /* block type dependent parameters */
|
|
151 tvqConfInfoSubBlock cfg[N_BTYPE];
|
|
152
|
|
153 } tvqConfInfo;
|
|
154
|
|
155
|
|
156 /*************************************************/
|
|
157 /*** Definitions about TwinVQ bitstream header ***/
|
|
158 /*************************************************/
|
17012
|
159 //#include "declib_src/tvq_hdr.h"
|
14276
|
160 //#ifndef BUFSIZ
|
|
161 //#define BUFSIZ 1024
|
|
162 //#endif
|
|
163
|
|
164 #define KEYWORD_BYTES 4
|
|
165 #define VERSION_BYTES 8
|
|
166 #define ELEM_BYTES sizeof(unsigned long)
|
|
167
|
|
168
|
|
169 /*
|
|
170 */
|
|
171 typedef struct {
|
|
172 char ID[KEYWORD_BYTES+VERSION_BYTES+1];
|
|
173 int size;
|
|
174 /* Common Chunk */
|
|
175 int channelMode; /* channel mode (mono:0/stereo:1) */
|
|
176 int bitRate; /* bit rate (kbit/s) */
|
|
177 int samplingRate; /* sampling rate (44.1 kHz -> 44) */
|
|
178 int securityLevel; /* security level (always 0) */
|
|
179 /* Text Chunk */
|
|
180 char Name[BUFSIZ];
|
|
181 char Comt[BUFSIZ];
|
|
182 char Auth[BUFSIZ];
|
|
183 char Cpyr[BUFSIZ];
|
|
184 char File[BUFSIZ];
|
|
185 char Extr[BUFSIZ]; // add by OKAMOTO 99.12.21
|
|
186 /* Data size chunk*/
|
|
187 int Dsiz;
|
|
188 } headerInfo;
|
|
189
|
|
190 // TwinVQ decoder initialization/termination functions
|
|
191 //DllPort int TvqInitialize( headerInfo *setupInfo, INDEX *index, int dispErrorMessageBox );
|
|
192 //DllPort void TvqTerminate( INDEX *index );
|
|
193 //DllPort void TvqGetVectorInfo(int *bits0[], int *bits1[]);
|
|
194 //DllPort void TvqResetFrameCounter();
|
|
195
|
|
196 // TwinVQ decoder function
|
|
197 //DllPort void TvqDecodeFrame(INDEX *indexp, float out[]);
|
|
198 //DllPort int TvqWtypeToBtype( int w_type, int *btype );
|
|
199 //DllPort void TvqUpdateVectorInfo(int varbits, int *ndiv, int bits0[], int bits1[]);
|
|
200 //DllPort void TvqSetFrameCounter( int position );
|
|
201
|
|
202 // TwinVQ query functions
|
|
203 //DllPort int TvqCheckVersion(char *versionID);
|
|
204 //DllPort void TvqGetSetupInfo(headerInfo *setupInfo); // setup information
|
|
205 //DllPort void TvqGetConfInfo(tvqConfInfo *cf); // configuration information
|
|
206 //DllPort int TvqGetFrameSize(); // frame size
|
|
207 //DllPort int TvqGetNumChannels(); // number of channels
|
|
208 //DllPort int TvqGetBitRate(); // total bitrate
|
|
209 //DllPort float TvqGetSamplingRate(); // sampling rate
|
|
210 //DllPort int TvqGetNumFixedBitsPerFrame(); // number of fixed bits per frame
|
|
211 //DllPort int TvqGetNumFrames(); // number of decoded frame
|
|
212 //DllPort int TvqGetModuleVersion( char* versionString );
|
|
213
|
|
214 #ifdef V2PLUS_SUPPORT
|
|
215 // TwinVQ FB coding tool control
|
|
216 DllPort void TvqFbCountUsedBits(int nbit); // count number of used bits
|
|
217 DllPort float TvqGetFbCurrentBitrate(); // query average bitrate for the tool
|
|
218 DllPort int TvqGetFbTotalBits(); // query total number of used bits
|
|
219 #endif
|
|
220
|
|
221 #ifdef __cplusplus
|
|
222 }
|
|
223 #endif
|
|
224
|
|
225
|
|
226 #endif
|