You (?) wrote at http://www.sulaco.org/mp3/gpsycho/outer_loop.html:

--------------------------------------------------------------------
compute initial q = quantization step size  (bin_search_stepsize) 
    divide & conquer algorithm to find approximate value of q 

outer_loop: 
do { 

   compute quantization with given scalefactors and not too many bits 
   (call inner_loop) 

   calc_noise(): 
      compute distortion within each scalefactor band 
      compare distortion to allowed distortion (from psy-model) 
      over = number of scalefactor bands where distortion > allowed_distortion 

   if this quantization is the best one found so far, save it 
   if over=0 we are done, exit. 

   otherwise do ONE of the following (not both) 
      turn pre-emphasis on 
      amplify scalefactors for bands with distortion 

} while over<>0 or !(all scalefactors set to their max) 

Restore BEST quantization 

...

If you have ideas for a better way to define the BEST quantization, let me know! 

...

-----------------------------------------------------------------------

I should not use a simple binary logic to count the scalefactor band with
distortions.

Often it is better to count more fuzzy. Example:

You count in the following way:

        float noise [32];
        float allow [32];
        int errors = 0;

        for (i=0; i<32; i++)
            if ( noise[i] > allow[i] )
                errors++;
        return errors;

often it is better to do it in this way (example):

        float noise [32];
        float allow [32];
        float errors = 0;
        float tmp;

        for (i=0; i<32; i++) {
            tmp     = noise[i] / allow[i];
            tmp    *= tmp;
            errors += tmp*tmp;
        }
        return errors;

The error evaluation function (here a simple x^4) can be estimated from the
shape of the indistinguishable probability function. Functions as x^2 and
x^4 are very easy to calculate and often a good hint.

May be FhG works in this way.

Concerning speed these solutions often faster than the "if ()" versions
by preventing unforeseeable jumps in the code. Floating point becomes fast and
unforeseeable jumps slow on modern computers.

-- 
Frank Klemm

--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to