fix crashes reported by Debian Cylab Mayhem Team
[swftools.git] / lib / bladeenc / loop-pvt.h
blobcc8e2e0a80bb93716559c92faac995c163322bd2
1 /*
2 (c) Copyright 1998-2000 - Tord Jansson
3 ======================================
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.
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.
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.
21 ------------ Changes ------------
23 2000-02-15 Pirandot
25 - reformatted, used 'static', less parameters
27 2000-12-03 ap
28 - adapted according to changes to "loop.h"
31 #ifndef __LOOP_PVT__
32 #define __LOOP_PVT__
38 static int outer_loop
40 int max_bits,
41 frame_params *fr_ps
44 static int needed_bits_for_storing_scalefactors
46 frame_params *fr_ps
49 static void calc_noise (void);
51 static int loop_break (void);
53 static int amplify
55 int iteration
58 static int INLINE cutting_crew (FLOAT in);
60 static void quantize (void);
62 static void partial_quantize (void);
64 static int bin_search_StepSize
66 int desired_rate,
67 double start
72 /* ------------ bit counting -------------------------------------------------------- */
76 static int count_bits (void);
78 static int count_bits_short (void);
80 static int count_bits_long (void);
82 static void choose_table_long
84 unsigned start,
85 unsigned end,
86 unsigned max,
87 unsigned *table,
88 unsigned *bit_sum
91 static void choose_table_short
93 unsigned start_sfb,
94 unsigned end_sfb,
95 unsigned max,
96 unsigned *table,
97 unsigned *bit_sum
102 /* ------------ Huffmania ----------------------------------------------------------- */
106 static void single_Huffman
108 unsigned start,
109 unsigned end,
110 /* unsigned table0, == 1 */
111 unsigned *choice,
112 unsigned *sum
115 static void double_Huffman
117 unsigned start,
118 unsigned end,
119 unsigned table0, /* 2, 5, 13 */
120 unsigned table1, /* 3, 6, 15 */
121 unsigned *choice,
122 unsigned *sum
125 static void triple_Huffman
127 unsigned start,
128 unsigned end,
129 unsigned table0, /* 7, 10 */
130 unsigned table1, /* 8, 11 */
131 unsigned table2, /* 9, 12 */
132 unsigned *choice,
133 unsigned *sum
136 static void triple_Huffman_2
138 unsigned start,
139 unsigned end,
140 /* unsigned table0, == 13 */
141 /* unsigned table1, == 15 */
142 /* unsigned table2, == 24 */
143 unsigned *choice,
144 unsigned *sum
147 static void double_Huffman_2 /* Escape tables */
149 unsigned start,
150 unsigned end,
151 unsigned table0, /* 16... */
152 unsigned table1, /* 24... */
153 unsigned *choice,
154 unsigned *sum
159 /* ------------ the struggle continues ---------------------------------------------- */
163 static void tiny_single_Huffman
165 unsigned start,
166 unsigned end,
167 #if ORG_HUFFMAN_CODING
168 unsigned table0,
169 #else
170 /* unsigned table0, == 1 */
171 #endif
172 unsigned *choice,
173 unsigned *sum
176 static void tiny_double_Huffman
178 unsigned start,
179 unsigned end,
180 unsigned table0, /* 2, 5, 13 */
181 unsigned table1, /* 3, 6, 15 */
182 unsigned *choice,
183 unsigned *sum
186 static void tiny_triple_Huffman
188 unsigned start,
189 unsigned end,
190 unsigned table0, /* 7, 10 */
191 unsigned table1, /* 8, 11 */
192 unsigned table2, /* 9, 12 */
193 unsigned *choice,
194 unsigned *sum
197 static void tiny_triple_Huffman_2
199 unsigned start,
200 unsigned end,
201 /* unsigned table0, == 13 */
202 /* unsigned table1, == 15 */
203 /* unsigned table2, == 24 */
204 unsigned *choice,
205 unsigned *sum
208 static void tiny_double_Huffman_2 /* Escape tables */
210 unsigned start,
211 unsigned end,
212 unsigned table0, /* 16... */
213 unsigned table1, /* 24... */
214 unsigned *choice,
215 unsigned *sum
222 #endif /* __LOOP_PVT__ */