[FFmpeg-devel] [RFC] AAC Encoder

Michael Niedermayer michaelni
Sat Aug 16 23:49:25 CEST 2008


On Sat, Aug 16, 2008 at 03:18:04PM -0600, Jason Garrett-Glaser wrote:
> >>
> >> > [...]
> >> > > /**
> >> > >  * 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).

AAC is simpler than mpeg each band uses one of 12 code books, each band
is then split in element pairs or quads (depending on the code book) and
each of these is independant.These codebooks are just arrays of
small integer pairs or quads, the index into that is stored as simple vlc.
so no trellis is needed at the coeff quantization level because there is
no dependance between elements ...
just a "try all 12 codebooks" and try all quads/pairs between the best and 0,0

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080816/b3fe3b28/attachment.pgp>



More information about the ffmpeg-devel mailing list