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
13 # define DllPort __declspec( dllexport )
15 # define DllPort __declspec( dllimport )
22 extern "C" { // only need to import/export C interface if used by C++ source code
25 /************************/
26 /*** General settings ***/
27 /************************/
28 /* Initialization error code */
29 enum INIT_ERROR_CODE
{
30 TVQ_NO_ERROR
= 0, // no error
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
40 #define TVQ_UNKNOWN_VERSION -1
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.
69 /* maximum number of channels */
72 /* type definition of code information interface */
79 int *segment_sw
[ N_CH_MAX
];
80 int *band_sw
[ N_CH_MAX
];
81 int *fg_intensity
[ N_CH_MAX
];
99 int pgain
[ N_CH_MAX
];
107 /***********************************************/
108 /*** Definitions about program configuration ***/
109 /***********************************************/
110 /* type definition of tvqConfInfoSubBlock */
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
;
129 /* type definition of tvqConfInfo */
131 /* frame configuration */
133 /* window type coding */
140 /* Bark-scale envelope coding */
145 /* pitch excitation */
150 /* block type dependent parameters */
151 tvqConfInfoSubBlock cfg
[N_BTYPE
];
156 /*************************************************/
157 /*** Definitions about TwinVQ bitstream header ***/
158 /*************************************************/
159 //#include "declib_src/tvq_hdr.h"
161 //#define BUFSIZ 1024
164 #define KEYWORD_BYTES 4
165 #define VERSION_BYTES 8
166 #define ELEM_BYTES sizeof(unsigned long)
172 char ID
[KEYWORD_BYTES
+VERSION_BYTES
+1];
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) */
185 char Extr
[BUFSIZ
]; // add by OKAMOTO 99.12.21
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();
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 );
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 );
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