quantize_pvt.h

Go to the documentation of this file.
00001 /*
00002  *      quantize_pvt include file
00003  *
00004  *      Copyright (c) 1999 Takehiro TOMINAGA
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the
00018  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019  * Boston, MA 02111-1307, USA.
00020  */
00021 
00022 #ifndef LAME_QUANTIZE_PVT_H
00023 #define LAME_QUANTIZE_PVT_H
00024 
00025 #define IXMAX_VAL 8206  /* ix always <= 8191+15.    see count_bits() */
00026 
00027 /* buggy Winamp decoder cannot handle values > 8191 */
00028 /* #define IXMAX_VAL 8191 */
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      /* minimum possible number of
00049                            -cod_info->global_gain
00050                            + ((scalefac[] + (cod_info->preflag ? pretab[sfb] : 0))
00051                            << (cod_info->scalefac_scale + 1))
00052                            + cod_info->subblock_gain[cod_info->window[sfb]] * 8;
00053 
00054                            for long block, 0+((15+3)<<2) = 18*4 = 72
00055                            for short block, 0+(15<<2)+7*8 = 15*4+56 = 116
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;      /* sum of quantization noise > masking */
00064     FLOAT   tot_noise;       /* sum of all quantization noise */
00065     FLOAT   max_noise;       /* max quantization noise */
00066     int     over_count;      /* number of quantization noise > masking */
00067     int     over_SSD;        /* SSD-like cost of distorted bands */
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 /* takehiro.c */
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 /* LAME_QUANTIZE_PVT_H */

Generated on Sun Dec 2 11:34:20 2007 for LAME by  doxygen 1.5.2