> From: "Gabriel Bouvigne" <[EMAIL PROTECTED]>
> Date: Sat, 27 Nov 1999 14:03:02 +0100
> 
> > The midpoint (in terms of the error) is:  .5 * (1 + 2.52) = 1.76.
> > So if x<1.76, we should take i=1 and if x>1.76 we take i=2.
> 
> I think that for this kind of test, something like:
> i=(int)(x^.75+.5)
> would be faster than a comparison, and produces the same output.
> 
> Btw do you have any explanation about how .4054 could be optimal for any
> value?
> 

.4054 is optimal when choosing between i=0 and i=1.

0^4/3 = 0
1^4/3 = 1

So x<.5 should quanitze to 0, and x>.5 should quantize to 1.

Let x = .5000.  The code actually quantizes x^3/4

x^3/4 = .5946

So we want:   x^3/4  >  .5946    then   i=1
              x^3/4  <  .5946    then   i=0

And in this case the ISO formula is correct:  i=floor( x^3/4 + .4054 )
Taking i=floor(x^.75+.5) would be suboptimal.  

The problem with the ISO formula is that it is only optimal when
choosing between i=0 and i=1.  When choosing between i=1 and i=2,
the number should be .4720.  As i increases, this number approaches
.5, so for large values of i, the nearest int is about right.  

This number is given by Takehiro's formula for adj45[].
Segher had the same formula, but I think he had a typo and was
using 3/8 instead of 3/4?

Mark





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

Reply via email to