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