$Id$ changes
[swftools.git] / lib / bladeenc / l3psy.h
1 /*
2                         (c) Copyright 1998-2001 - Tord Jansson
3                         ======================================
4
5                 This file is part of the BladeEnc MP3 Encoder, based on
6                 ISO's reference code for MPEG Layer 3 compression, and might
7                 contain smaller or larger sections that are directly taken
8                 from ISO's reference code.
9
10                 All changes to the ISO reference code herein are either
11                 copyrighted by Tord Jansson (tord.jansson@swipnet.se)
12                 or sublicensed to Tord Jansson by a third party.
13
14         BladeEnc is free software; you can redistribute this file
15         and/or modify it under the terms of the GNU Lesser General Public
16         License as published by the Free Software Foundation; either
17         version 2.1 of the License, or (at your option) any later version.
18
19
20
21         ------------    Changes    ------------
22
23         2000-12-11  Andre Piotrowski
24
25         -       reformatted
26
27         2000-12-12  ap
28
29         -       removed fft() prototype from "encoder.h" to this file
30         -       removed the fft configuration switches from "subs.c" to this file
31         -       implemented ORG_SHORT_CW_LIMIT
32
33         2001-01-12  ap
34
35         -       bug fix: include encoder.h for definition of ORG_BUFFERS
36         -       clear some backward compatability flags for 0.93.10
37 */
38
39 /**********************************************************************
40  * ISO MPEG Audio Subgroup Software Simulation Group (1996)
41  * ISO 13818-3 MPEG-2 Audio Encoder - Lower Sampling Frequency Extension
42  *
43  * $Id: l3psy.h,v 1.1 2004/05/08 12:13:21 kramm Exp $
44  *
45
46  * $Log: l3psy.h,v $
47  * Revision 1.1  2004/05/08 12:13:21  kramm
48  * Version 0.94.1 of the bladeenc mp3 encoder
49  *
50  * Revision 1.1  2002/01/10 17:30:00  kramm
51  * Version 0.94.1 of the bladeenc mp3 encoder
52  *
53  * Revision 1.1  1996/02/14 04:04:23  rowlands
54  * Initial revision
55  *
56  * Received from Mike Coleman
57  **********************************************************************/
58
59 #ifndef         __L3PSY__
60 #define         __L3PSY__
61
62
63
64 #include        "encoder.h"
65
66
67
68
69
70 /*  ========================================================================================  */
71 /*              keeping backward compatability                                                */
72 /*  ========================================================================================  */
73
74 #define         ORG_NUMLINES_NORM               0   /* 0 = don't overwrite long numline entries with short numline entries */
75 #define         ORG_BLOCK_SELECT                0   /* 0 = ISO draft paper states slightly different block selection */
76 #define         ORG_SHORT_CW_LIMIT              0   /* 0 = ISO draft paper says first element starts at 6/4 = 1 (not 2) */
77
78
79
80
81
82 /*      #define         CBANDS                                    63 */
83 #define         CBANDS_s                                42
84 #define         BLKSIZE_s                               256
85 #define         HBLKSIZE_s                              129
86 #define         TCBMAX_l                                63
87 #define         TCBMAX_s                                42
88 #define         SBMAX_l                                 21
89 #define         SBMAX_s                                 12
90
91
92
93 /*      #define         switch_pe                               1800 */
94 #define         NORM_TYPE                               0
95 #define         START_TYPE                              1
96 #define         SHORT_TYPE                              2
97 #define         STOP_TYPE                               3
98
99
100
101
102
103 void                                    psycho_anal
104 (
105 #if ORG_BUFFERS
106         short int                               *buffer,
107         short int                               savebuf[2048],
108 #else
109         FLOAT                                   *buffer,
110         int                                             buffer_idx,
111 #endif
112         int                                             ch,
113         int                                             lay,
114 /*      FLOAT                                   snr32[32], */
115         double                                  ratio_d[SBMAX_l],
116         double                                  ratio_ds[SBMAX_s][3],
117         double                                  *pe,
118         gr_info                                 *cod_info
119 );
120
121 void                                    psycho_anal_init (double sfreq);
122
123 void                                    psycho_anal_exit (void);
124
125
126
127
128
129 void                                    fft (FLOAT[], FLOAT[], FLOAT[], FLOAT[], int);
130
131
132
133 /*
134         Switches for configuring the fft in "subs.c"
135 */
136
137 /* Do we want to reorder the data? */
138 #define         REORDER_DATA        0   /* no need to do that */
139
140 /* To get the inverse fft, set NORMAL_FFT to 0 */
141 #define         NORMAL_FFT                      1   /* si */
142
143 /* Try this to speed up the fft when using non-complex sequences */
144 #define         REAL_SEQUENCE           1   /* no complex values needed */
145
146 /* We assume, the real data gets prepacked externally */
147 #define         PREPACKED                       1   /* yes */
148
149 /* No one needs all the phi values in layer 3 !!! */
150 #define         USED_VALUES_ONLY        1
151 #define         LONG_FFT_MIN_IDX        0
152 #define         LONG_FFT_MAX_IDX        5
153 #if ORG_SHORT_CW_LIMIT
154 #define         SHORT_FFT_MIN_IDX       2    /* (  6+2)/4     */
155 #define         SHORT_FFT_MAX_IDX       51   /* (206+2)/4 - 1 */
156 #else   /* according to ISO */
157 #define         SHORT_FFT_MIN_IDX       1    /*   6/4     */
158 #define         SHORT_FFT_MAX_IDX       50   /* 206/4 - 1 */
159 #endif
160
161
162
163
164
165 #endif          /* __L3PSY__ */