[FFmpeg-devel] [RFC] AAC Encoder
Jason Garrett-Glaser
darkshikari
Sat Aug 16 23:18:04 CEST 2008
>>
>> > [...]
>> > > /**
>> > > * Quantize one coefficient.
>> > > * @return absolute value of the quantized coefficient
>> > > * @see 3GPP TS26.403 5.6.2 "Scalefactor determination"
>> > > */
>> > > static av_always_inline int quant(float coef, const float Q)
>> > > {
>> > > return av_clip((int)(pow(fabsf(coef) * Q, 0.75) + 0.4054), 0, 8191);
>> > > }
>> >
>> > converting float to int by casting is rather slow on x86
>> > also i do not see why the cliping against 0 is done
>> >
>> > and where does the 0.4054 come from? How has this value been selected?
>>
>> ask 3GPP folks, in their spec (there's a reference in the comment above)
>> it's also called MAGIC_NUMBER.
>
> ideg
> morons
> anyway, its
> 1.0 - 0.5^0.75
>
> and i seriously doubt this is optimal in the psychoacoustic sense or any
> rate distortion sense.
> It IS optimal in the "least squares distortion but i dont care about the bits"
> sense
> please add a note that this constant needs to be finetuned with listening
> tests or some more solid math!
Yes, it looks like is a reference quantizer, the simplest form of
quantizer (equivalent to a deadzone value of zero). I highly doubt
that a deadzone of zero is optimal in any sense, and given how
important a step quantization is, I suspect a lot better can be done
(perhaps, ideally, some sort of trellis-like quantization algorithm).
Dark Shikari
More information about the ffmpeg-devel
mailing list