Quelltext /~heha/hs/puh.zip/quantize_pvt.h

/*	quantize_pvt include file
 *	Copyright (c) 1999 Takehiro TOMINAGA
 */

#pragma once

#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 int pretab[SBMAX_l];
extern const int slen1_tab[16];
extern const int slen2_tab[16];

extern const scalefac_struct sfBandIndex[9];

extern FLOAT pow43[PRECALC_SIZE];
#ifdef TAKEHIRO_IEEE754_HACK
extern FLOAT adj43asm[PRECALC_SIZE];
#else
extern FLOAT adj43[PRECALC_SIZE];
#endif

#define Q_MAX (256+1)
#define Q_MAX2 116      /* minimum possible number of
                           -cod_info->global_gain
                           + ((scalefac[] + (cod_info->preflag ? pretab[sfb] : 0))
                           << (cod_info->scalefac_scale + 1))
                           + cod_info->subblock_gain[cod_info->window[sfb]] * 8;

                           for long block, 0+((15+3)<<2) = 18*4 = 72
                           for short block, 0+(15<<2)+7*8 = 15*4+56 = 116
                         */

extern FLOAT pow20[Q_MAX + Q_MAX2 + 1];
extern FLOAT ipow20[Q_MAX];

typedef struct calc_noise_result_t {
    FLOAT   over_noise;      /* sum of quantization noise > masking */
    FLOAT   tot_noise;       /* sum of all quantization noise */
    FLOAT   max_noise;       /* max quantization noise */
    int     over_count;      /* number of quantization noise > masking */
    int     over_SSD;        /* SSD-like cost of distorted bands */
    int     bits;
} calc_noise_result;


/**
* allows re-use of previously
* computed noise values
*/
typedef struct calc_noise_data_t {
    int     global_gain;
    int     sfb_count1;
    int     step[39];
    FLOAT   noise[39];
    FLOAT   noise_log[39];
} calc_noise_data;


//int  on_pe(lame_internal_flags&, const FLOAT pe[2][2], int targ_bits[2], int mean_bits, int gr, int cbr);
void reduce_side(int targ_bits[2], FLOAT ms_ener_ratio, int mean_bits, int max_bits);


//void iteration_init(lame_internal_flags&);

//int  calc_xmin(lame_internal_flags const&,
//                  III_psy_ratio const *const ratio, gr_info & cod_info, FLOAT * l3_xmin);

int     calc_noise(const gr_info & cod_info,
                   const FLOAT * l3_xmin,
                   FLOAT * distort, calc_noise_result * const res, calc_noise_data * prev_noise);


FLOAT athAdjust(FLOAT a, FLOAT x, FLOAT athFloor, float ATHfixpoint);

#define LARGE_BITS 100000
Vorgefundene Kodierung: UTF-80