2
* encoder.h include file
4
* Copyright (c) 2000 Mark Taylor
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.
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.
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 02110-1301, USA.
23
#ifndef LAME_ENCODER_H
24
#define LAME_ENCODER_H
26
/***********************************************************************
28
* encoder and decoder delays
30
***********************************************************************/
33
* layer III enc->dec delay: 1056 (1057?) (observed)
34
* layer II enc->dec delay: 480 (481?) (observed)
36
* polyphase 256-16 (dec or enc) = 240
37
* mdct 256+32 (9*32) (dec or enc) = 288
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
46
* ENCDELAY The encoder delay.
48
* Minimum allowed is MDCTDELAY (see below)
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.
54
* set to 1160 to sync with FhG.
62
* make sure there is at least one complete frame after the
63
* last frame containing real data
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
71
/*#define POSTDELAY 288*/
72
#define POSTDELAY 1152
77
* delay of the MDCT used in mdct.c
78
* original ISO routines had a delay of 528!
79
* Takehiro's routines:
83
#define FFTOFFSET (224+MDCTDELAY)
86
* Most decoders, including the one we use, have a delay of 528 samples.
92
/* number of subbands */
95
/* parition bands bands */
98
/* number of critical bands/scale factor bands where masking is computed*/
102
/* total number of scalefactor bands encoded */
112
#define HBLKSIZE (BLKSIZE/2 + 1)
113
#define BLKSIZE_s 256
114
#define HBLKSIZE_s (BLKSIZE_s/2 + 1)
117
/* #define switch_pe 1800 */
125
* When we are in stereo mode, there are 4 possible methods to store these
126
* two channels. The stereo modes -m? are using a subset of them.
129
* -mj: MPG_MD_LR_LR and MPG_MD_MS_LR
134
#define MPG_MD_LR_LR 0
135
#define MPG_MD_LR_I 1
136
#define MPG_MD_MS_LR 2
137
#define MPG_MD_MS_I 3
143
int lame_encode_mp3_frame (
144
lame_global_flags* const gfp,
147
unsigned char* mp3buf,
150
#endif /* LAME_ENCODER_H */