polygon intersector: added horizontal line reconstruction
[swftools.git] / lib / lame / encoder.h
1 /*
2  *      encoder.h include file
3  *
4  *      Copyright (c) 2000 Mark Taylor
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22
23 #ifndef LAME_ENCODER_H
24 #define LAME_ENCODER_H
25
26 /***********************************************************************
27 *
28 *  encoder and decoder delays
29 *
30 ***********************************************************************/
31
32 /* 
33  * layer III enc->dec delay:  1056 (1057?)   (observed)
34  * layer  II enc->dec delay:   480  (481?)   (observed)
35  *
36  * polyphase 256-16             (dec or enc)        = 240
37  * mdct      256+32  (9*32)     (dec or enc)        = 288
38  * total:    512+16
39  *
40  * My guess is that delay of polyphase filterbank is actualy 240.5
41  * (there are technical reasons for this, see postings in mp3encoder).
42  * So total Encode+Decode delay = ENCDELAY + 528 + 1
43  */
44
45 /* 
46  * ENCDELAY  The encoder delay.  
47  *
48  * Minimum allowed is MDCTDELAY (see below)
49  *  
50  * The first 96 samples will be attenuated, so using a value less than 96
51  * will result in corrupt data for the first 96-ENCDELAY samples.
52  *
53  * suggested: 576
54  * set to 1160 to sync with FhG.
55  */
56  
57 #define ENCDELAY      576
58
59
60
61 /*
62  * make sure there is at least one complete frame after the
63  * last frame containing real data
64  *
65  * Using a value of 288 would be sufficient for a 
66  * a very sophisticated decoder that can decode granule-by-granule instead
67  * of frame by frame.  But lets not assume this, and assume the decoder  
68  * will not decode frame N unless it also has data for frame N+1
69  *
70  */
71 /*#define POSTDELAY   288*/
72 #define POSTDELAY   1152
73
74
75
76 /* 
77  * delay of the MDCT used in mdct.c
78  * original ISO routines had a delay of 528!  
79  * Takehiro's routines: 
80  */
81
82 #define MDCTDELAY     48  
83 #define FFTOFFSET     (224+MDCTDELAY)
84
85 /*
86  * Most decoders, including the one we use, have a delay of 528 samples.  
87  */
88  
89 #define DECDELAY      528
90
91
92 /* number of subbands */
93 #define SBLIMIT       32
94
95 /* parition bands bands */
96 #define CBANDS        64
97
98 /* number of critical bands/scale factor bands where masking is computed*/
99 #define SBPSY_l       21
100 #define SBPSY_s       12
101
102 /* total number of scalefactor bands encoded */
103 #define SBMAX_l       22
104 #define SBMAX_s       13
105
106
107
108 /* FFT sizes */
109 #define BLKSIZE       1024
110 #define HBLKSIZE      (BLKSIZE/2 + 1)
111 #define BLKSIZE_s     256
112 #define HBLKSIZE_s    (BLKSIZE_s/2 + 1)
113
114
115 /* #define switch_pe        1800 */
116 #define NORM_TYPE     0
117 #define START_TYPE    1
118 #define SHORT_TYPE    2
119 #define STOP_TYPE     3
120
121 /* 
122  * Mode Extention:
123  * When we are in stereo mode, there are 4 possible methods to store these
124  * two channels. The stereo modes -m? are using a subset of them.
125  *
126  *  -ms: MPG_MD_LR_LR
127  *  -mj: MPG_MD_LR_LR and MPG_MD_MS_LR
128  *  -mf: MPG_MD_MS_LR
129  *  -mi: all
130  */
131  
132 #define MPG_MD_LR_LR  0
133 #define MPG_MD_LR_I   1
134 #define MPG_MD_MS_LR  2
135 #define MPG_MD_MS_I   3
136
137
138 #include "machine.h"
139 #include "lame.h"
140
141 int  lame_encode_mp3_frame (
142         lame_global_flags*  const gfp,
143         sample_t*           inbuf_l,
144         sample_t*           inbuf_r,
145         unsigned char*      mp3buf, 
146         int                 mp3buf_size );
147
148 #endif /* LAME_ENCODER_H */