From the bladeenc package.
[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 2002/01/10 17:30:00 kramm Exp $
44  *
45
46  * $Log: l3psy.h,v $
47  * Revision 1.1  2002/01/10 17:30:00  kramm
48  * Version 0.94.1 of the bladeenc mp3 encoder
49  *
50  * Revision 1.1  1996/02/14 04:04:23  rowlands
51  * Initial revision
52  *
53  * Received from Mike Coleman
54  **********************************************************************/
55
56 #ifndef         __L3PSY__
57 #define         __L3PSY__
58
59
60
61 #include        "encoder.h"
62
63
64
65
66
67 /*  ========================================================================================  */
68 /*              keeping backward compatability                                                */
69 /*  ========================================================================================  */
70
71 #define         ORG_NUMLINES_NORM               0   /* 0 = don't overwrite long numline entries with short numline entries */
72 #define         ORG_BLOCK_SELECT                0   /* 0 = ISO draft paper states slightly different block selection */
73 #define         ORG_SHORT_CW_LIMIT              0   /* 0 = ISO draft paper says first element starts at 6/4 = 1 (not 2) */
74
75
76
77
78
79 /*      #define         CBANDS                                    63 */
80 #define         CBANDS_s                                42
81 #define         BLKSIZE_s                               256
82 #define         HBLKSIZE_s                              129
83 #define         TCBMAX_l                                63
84 #define         TCBMAX_s                                42
85 #define         SBMAX_l                                 21
86 #define         SBMAX_s                                 12
87
88
89
90 /*      #define         switch_pe                               1800 */
91 #define         NORM_TYPE                               0
92 #define         START_TYPE                              1
93 #define         SHORT_TYPE                              2
94 #define         STOP_TYPE                               3
95
96
97
98
99
100 void                                    psycho_anal
101 (
102 #if ORG_BUFFERS
103         short int                               *buffer,
104         short int                               savebuf[2048],
105 #else
106         FLOAT                                   *buffer,
107         int                                             buffer_idx,
108 #endif
109         int                                             ch,
110         int                                             lay,
111 /*      FLOAT                                   snr32[32], */
112         double                                  ratio_d[SBMAX_l],
113         double                                  ratio_ds[SBMAX_s][3],
114         double                                  *pe,
115         gr_info                                 *cod_info
116 );
117
118 void                                    psycho_anal_init (double sfreq);
119
120 void                                    psycho_anal_exit (void);
121
122
123
124
125
126 void                                    fft (FLOAT[], FLOAT[], FLOAT[], FLOAT[], int);
127
128
129
130 /*
131         Switches for configuring the fft in "subs.c"
132 */
133
134 /* Do we want to reorder the data? */
135 #define         REORDER_DATA        0   /* no need to do that */
136
137 /* To get the inverse fft, set NORMAL_FFT to 0 */
138 #define         NORMAL_FFT                      1   /* si */
139
140 /* Try this to speed up the fft when using non-complex sequences */
141 #define         REAL_SEQUENCE           1   /* no complex values needed */
142
143 /* We assume, the real data gets prepacked externally */
144 #define         PREPACKED                       1   /* yes */
145
146 /* No one needs all the phi values in layer 3 !!! */
147 #define         USED_VALUES_ONLY        1
148 #define         LONG_FFT_MIN_IDX        0
149 #define         LONG_FFT_MAX_IDX        5
150 #if ORG_SHORT_CW_LIMIT
151 #define         SHORT_FFT_MIN_IDX       2    /* (  6+2)/4     */
152 #define         SHORT_FFT_MAX_IDX       51   /* (206+2)/4 - 1 */
153 #else   /* according to ISO */
154 #define         SHORT_FFT_MIN_IDX       1    /*   6/4     */
155 #define         SHORT_FFT_MAX_IDX       50   /* 206/4 - 1 */
156 #endif
157
158
159
160
161
162 #endif          /* __L3PSY__ */