# [vorbis-dev] Codebook Questions

Monty xiphmont at xiph.org
Tue Nov 25 16:49:21 PST 2003

```
> 2.  What exactly is being quantized during "Vector quantization"?
> My understanding of this process is as follows: for each frame of 2n
> samples (per channel), MDCT yields n values.  The floor is calculated
> and subtracted for these N values leaving the residue "vector."  This
> vector is divided into chunks, and then each chunk is encoded/quantized
> using a particular codebook.  If we have c chunks, this yields N/c
> values per chunk.  Are these n scalars the "vectors" (1-dimensional)
> that are being quantized?

Your terminology is still a bit ambiguous, but yes; a vector is a
group of scalars.

> 3.  How is a particular codebook selected for each "chunk"?

"Any way that makes sense".

> I assume
> this selection is made to minimize error but is also contingent on a
> particular bitrate or quality setting.

All of the above.

>  Is there some sort of algorithm
> to determine which codebook to use

Yes; right now, codebooks are chosen by frequency, representation
range and base quality setting.

>, or does the encoder sample a set of
> codebooks and pick the best one?

No.  There's no trial-and-error process in encoding like there is in mp3.

> 4.  What are classification codewords, and why are they used?

These encode the meta-information of which codebooks were used to
encode any given chunk of data.

> 5.  I'm also confused about the following multiple-pass encoding of the
> residue vectors.  The excerpt from the documentation below states that
> there is a different codebook used in each pass, but the classification
> number is constant.  How does this work?  Isn't the classification
> number related to the codebook used?

Yes, but the classification selects a set of codebooks; each pass uses
one codebook in order from this set; the encoded value is pass 0 +
pass 1 + pass 2 + ... + pass N.

Different texts have different names for this; some call it
'joint-codebook' encoding, some call it 'cascaded encoding'.

subject.  I almost missed your message entirely becaue it was a reply
to an unrelated subject I had marked for hiding.

Monty

<p><p><p><p><p>--- >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.

```