[Vorbis-dev] newbie questions about VQ

Keenan Pepper cherylgpepper
Fri Jun 25 13:28:57 PDT 2004

Hi, I've been using the Vorbis codec for a while and recently I got the source code and had a look at the spec (great job on the doc BTW). I don't have any former experience with audio compression, but I do know what a DCT does and I totally grok Huffman coding (so I guess I'm not that much of a newbie, am I?).

Anyway I just had some questions about how VQ works on the encoding side. (I realize the spec doesn't say anything about the process of encoding, I'm just asking about how the reference encoder (the only encoder?) works.) My understanding of vector quantization is that vectors of length n can be interpreted as points in n-dimensional space, and to quantize them you carefully choose a set of code vectors to minimize the average distance from each code vector to each vector in the group of input vectors it approximates. Then you make a codebook of all the code vectors and encode each input vector by the closest codeword to it.

I had thought this all occurred at encoding time, and the code vectors would be specifically chosen for each audio file, but after looking closer at the source it seems like there are static codebooks that are set at compile time. This confuses me because I thought one of the strengths of Vorbis was its flexibility, how it wasn't confined to one probability model or whatnot. Also, if the codebooks are set at compile-time then why are they in the header of every Ogg Vorbis file? Is it just to ensure compatibility with future encoders that use different VQ techniques?

Also I have no idea what most of the code in the /vq subdirectory does, and I am confused about these mysterious ".vqh" and ".vqd" files they talk about.

The reason I ask about VQ encoding (besides the simple reason that I don't understand it yet) is that I think the obvious way to implement the long-awaited feature of bitrate peeling is to reencode the vectors using a smaller and coarser set of codewords. Is this just stupid or am I on to something here?

P.S. If this email appears as a few annoyingly long lines, please tell me and I can have my mail client insert newlines.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://westfish.xiph.org/pipermail/vorbis-dev/attachments/20040625/fbb5cbeb/attachment.pgp

More information about the Vorbis-dev mailing list