1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/*
* quantize_pvt include file
*
* Copyright (c) 1999 Takehiro TOMINAGA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef LAME_QUANTIZE_PVT_H
#define LAME_QUANTIZE_PVT_H
#include "l3side.h"
#define IXMAX_VAL 8206 /* ix always <= 8191+15. see count_bits() */
/* buggy Winamp decoder cannot handle values > 8191 */
/* #define IXMAX_VAL 8191 */
#define PRECALC_SIZE (IXMAX_VAL+2)
extern const int nr_of_sfb_block[6][3][4];
extern const char pretab[SBMAX_l];
extern const char slen1_tab[16];
extern const char slen2_tab[16];
extern const scalefac_struct sfBandIndex[9];
extern FLOAT8 pow43[PRECALC_SIZE];
extern FLOAT8 adj43[PRECALC_SIZE];
extern FLOAT8 adj43asm[PRECALC_SIZE];
#define Q_MAX 330
extern FLOAT8 pow20[Q_MAX];
extern FLOAT8 ipow20[Q_MAX];
typedef struct calc_noise_result_t {
int over_count; /* number of quantization noise > masking */
int tot_count; /* all */
FLOAT8 over_noise; /* sum of quantization noise > masking */
FLOAT8 tot_noise; /* sum of all quantization noise */
FLOAT8 max_noise; /* max quantization noise */
float klemm_noise;
FLOAT8 dist_l[SBMAX_l];
FLOAT8 dist_s[3][SBMAX_s];
} calc_noise_result;
void compute_ath (lame_global_flags * gfp, FLOAT8 ATH_l[SBPSY_l],
FLOAT8 ATH_s[SBPSY_l]);
void ms_convert (FLOAT8 xr[2][576], FLOAT8 xr_org[2][576]);
int on_pe (lame_global_flags *gfp, FLOAT8 pe[2][2], III_side_info_t * l3_side,
int targ_bits[2], int mean_bits, int gr);
void reduce_side (int targ_bits[2], FLOAT8 ms_ener_ratio, int mean_bits,
int max_bits);
int bin_search_StepSize (lame_internal_flags * gfc, gr_info * cod_info,
int desired_rate, int start,
const FLOAT8 xrpow[576], int l3enc[576]);
int inner_loop (lame_internal_flags * gfc, gr_info * cod_info, int max_bits,
const FLOAT8 xrpow[576], int l3enc[576]);
void iteration_init (lame_global_flags *gfp);
int calc_xmin (lame_global_flags *gfp, const FLOAT8 xr[576],
const III_psy_ratio * ratio, const gr_info * cod_info,
III_psy_xmin * l3_xmin);
int calc_noise (const lame_internal_flags * gfc, const FLOAT8 xr[576],
const int ix[576], const gr_info * cod_info,
const III_psy_xmin * l3_xmin,
const III_scalefac_t * scalefac,
III_psy_xmin * distort, calc_noise_result * res);
void set_frame_pinfo (lame_global_flags *gfp, FLOAT8 xr[2][2][576],
III_psy_ratio ratio[2][2], int l3_enc[2][2][576],
III_scalefac_t scalefac[2][2]);
void quantize_xrpow (const FLOAT8 xr[576], int ix[576], FLOAT8 istep);
void quantize_xrpow_ISO (const FLOAT8 xr[576], int ix[576], FLOAT8 istep);
/* takehiro.c */
int count_bits (lame_internal_flags * gfc, int *ix, const FLOAT8 xr[576],
gr_info * cod_info);
void best_huffman_divide (const lame_internal_flags * gfc, int gr, int ch,
gr_info * cod_info, int *ix);
void best_scalefac_store (const lame_internal_flags * gfc, int gr, int ch,
int l3_enc[2][2][576], III_side_info_t * l3_side,
III_scalefac_t scalefac[2][2]);
int scale_bitcount (III_scalefac_t * scalefac, gr_info * cod_info);
int scale_bitcount_lsf (const lame_internal_flags *gfp, const III_scalefac_t * scalefac,
gr_info * cod_info);
void huffman_init (lame_internal_flags * gfc);
#define LARGE_BITS 100000
#endif /* LAME_QUANTIZE_PVT_H */
|