[vorbis-dev] bitrate scaling by freq / quality bug ? / comments

Attila Padar galileog at externet.hu
Wed Jan 17 12:44:41 PST 2001



Hi again!
I have some other suggestions/modifications.

1. Bitrate scaling by frequency in vorbis_encode_init:
bpch=(long)((float)nominal_bitrate/(float)channels*44100.0f/(float)rate);
With this modification, if we use -b128 at 22khz files, the OGG file
will be 128kbit/s, not 64kbit/s ...

2. Probable quality bug:
I tested some floating point constants (recalculated them (see below)
and encoded some songs with 'longer' (more precise) numbers)
in the SCALES.H, at it seems the fromdB is a little bit wrong...
So, the original line is:
#define fromdB(x) (exp((x)*.11512925f))
Corrected line is:
#define fromdB(x) (exp((x)*.115129255f))
(there is an extra '5' digit at the end)
(more precise number is 0.115129254649702278f)

But I think so you have to recalculate the encoding tables too,
else we get extra (too much) high sounds in the ogg file!
(What does the LATTICEHINT.C do? There is a fromdB in it...)
Please check this!

3. Again about the floating point constants:
You should add some comments to these values, becasue in a few
years nobody will know how did you get (calculate) these numbers...
(in scales.h, mdct.h, smallft.c)
Examples:
// 8.68588963806503678   = 20*log10(2.0)/log(2.0)
// 0.115129254649702278 = 1.0/8.68588963806503678
#define todB(x) (((x)==0.)? -9e20:log(fabs(x))*8.68588963806503678f)
#define todB_nn(x) (((x)==0.)?  -400:log(x)*8.68588963806503678f)
#define fromdB(x)  (exp((x)*0.115129254649702278f))

// 0.69314718055994529 = log(2.0)
// 1.44269504088896339 = 1.0/log(2.0)
// 6.96578428466208699 = log(125.0)*1.0/log(2.0)
#define toOC(f) (log(f)*1.44269504088896339F-6.96578428466208699F)
#define fromOC(o) (exp(((o)+6.96578428466208699F)*0.69314718055994529F))

that's all
regards
Attila Padar

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list