00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef LAME_QUANTIZE_PVT_H
00023 #define LAME_QUANTIZE_PVT_H
00024
00025 #define IXMAX_VAL 8206
00026
00027
00028
00029
00030 #define PRECALC_SIZE (IXMAX_VAL+2)
00031
00032
00033 extern const int nr_of_sfb_block[6][3][4];
00034 extern const int pretab[SBMAX_l];
00035 extern const int slen1_tab[16];
00036 extern const int slen2_tab[16];
00037
00038 extern const scalefac_struct sfBandIndex[9];
00039
00040 extern FLOAT pow43[PRECALC_SIZE];
00041 #ifdef TAKEHIRO_IEEE754_HACK
00042 extern FLOAT adj43asm[PRECALC_SIZE];
00043 #else
00044 extern FLOAT adj43[PRECALC_SIZE];
00045 #endif
00046
00047 #define Q_MAX (256+1)
00048 #define Q_MAX2 116
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 extern FLOAT pow20[Q_MAX + Q_MAX2 + 1];
00059 extern FLOAT ipow20[Q_MAX];
00060 extern FLOAT iipow20[Q_MAX2 + 1];
00061
00062 typedef struct calc_noise_result_t {
00063 FLOAT over_noise;
00064 FLOAT tot_noise;
00065 FLOAT max_noise;
00066 int over_count;
00067 int over_SSD;
00068 int bits;
00069 } calc_noise_result;
00070
00071
00076 typedef struct calc_noise_data_t {
00077 int global_gain;
00078 int sfb_count1;
00079 int step[39];
00080 FLOAT noise[39];
00081 FLOAT noise_log[39];
00082 } calc_noise_data;
00083
00084
00085 int on_pe(lame_global_flags const *gfp, FLOAT const pe[2][2], III_side_info_t const *l3_side,
00086 int targ_bits[2], int mean_bits, int gr, int cbr);
00087
00088 void reduce_side(int targ_bits[2], FLOAT ms_ener_ratio, int mean_bits, int max_bits);
00089
00090
00091 int bin_search_StepSize(lame_internal_flags * const gfc, gr_info * const cod_info,
00092 int desired_rate, const int ch, const FLOAT xrpow[576]);
00093
00094 void iteration_init(lame_global_flags * gfp);
00095
00096
00097 int calc_xmin(lame_global_flags const *gfp,
00098 III_psy_ratio const *const ratio, gr_info * const cod_info, FLOAT * l3_xmin);
00099
00100 int calc_noise(const gr_info * const cod_info,
00101 const FLOAT * l3_xmin,
00102 FLOAT * distort, calc_noise_result * const res, calc_noise_data * prev_noise);
00103
00104 void set_frame_pinfo(lame_global_flags const *gfp, III_psy_ratio const ratio[2][2]);
00105
00106
00107
00108
00109
00110
00111 int count_bits(lame_internal_flags const *const gfc, const FLOAT * const xr,
00112 gr_info * const cod_info, calc_noise_data * prev_noise);
00113 int noquant_count_bits(lame_internal_flags const *const gfc,
00114 gr_info * const cod_info, calc_noise_data * prev_noise);
00115
00116
00117 void best_huffman_divide(const lame_internal_flags * const gfc, gr_info * const cod_info);
00118
00119 void best_scalefac_store(const lame_internal_flags * gfc, const int gr, const int ch,
00120 III_side_info_t * const l3_side);
00121
00122 int scale_bitcount(gr_info * const cod_info);
00123 int scale_bitcount_lsf(const lame_internal_flags * gfp, gr_info * const cod_info);
00124
00125 void huffman_init(lame_internal_flags * const gfc);
00126
00127 void quantize_init(lame_internal_flags * const gfc);
00128
00129 void init_xrpow_core_init(lame_internal_flags * const gfc);
00130
00131 FLOAT athAdjust(FLOAT a, FLOAT x, FLOAT athFloor);
00132
00133 #define LARGE_BITS 100000
00134
00135 #endif