>>>>> "S" == Segher Boessenkool <[EMAIL PROTECTED]> writes:
>> AFAIK, x and i are energy terms, in which case the first
>> formula gives error in (energy^2); the second gives (error in
>> energy)^2, which is I think a more useful value.
S> x and i are amplitude terms; energy ~ amplitude squared times
S> frequency.
I think so too. x and i are amplitude.
this could be tested by like this.
make enough big "all 1" pcm file and "all 32767" pcm file. like this.
% od ../test1.pcm
0000000 000400 000400 000400 000400 000400 000400 000400 000400
*
0200000
% od ../test32k.pcm
0000000 177577 177577 177577 177577 177577 177577 177577 177577
*
0200000
and patch lame.c little bit, to print out "xr" value.
% diff -c lame.c lame.c.orig
:
mdct_sub48(mfbuf[0], mfbuf[1], xr, stereo, &l3_side, mode_gr);
+ printf("%e\n", xr[0][0][0]);
:
and make and run the lame with these two files.
% lame ../test1.pcm
:
-4.315976e-05
-4.315976e-05
-4.315976e-05
-4.315976e-05
-4.315976e-05
^C
% lame ../test32k.pcm
:
-1.414216e+00
-1.414216e+00
-1.414216e+00
-1.414216e+00
-1.414216e+00
^C
You can easyly find out
1.414216 / 4.315976e-05 = 32767.003338294744919
And, xr is amplitude and is proportional to the input file amplitude.
not squared(energy).
I think we should use energy difference in db, so the noise formula
should be
sum (10 log (xr^2 - ix^(8/3)))
or
10 log (sum(xr^2 - ix^(8/3)))
and I think the latest quantization method will do the best aproximation
even when we use this noise formula.
---
Takehiro TOMINAGA // may the source be with you!
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )