Help - Search - Members - Calendar
Full Version: In Vorbis 1 specification
Hydrogenaudio Forums > Lossy Audio Compression > Ogg Vorbis > Ogg Vorbis - Tech
yesjoon
I don't understand below explanation.


In Vorbis 1 specification, 3.2.1. codebook decode
===================================

If the [ordered] flag is unset, the codeword list is not length ordered and the decoder needs to read each codeword length one-by-one.

The decoder first reads one additional bit flag, the [sparse] flag. This flag determines whether or not the codebook contains unused entries that are not to be included in the codeword decode tree:

byte 8: [ X 1 ] [sparse] flag (1 bit)

The decoder now performs for each of the [codebook_entries] codebook entries:


1) if([sparse] is set){

2) [flag] = read one bit;
3) if([flag] is set){

4) [length] = read a five bit unsigned integer;
5) codeword length for this entry is [length]+1;

} else {

6) this entry is unused. mark it as such.

}

} else the sparse flag is not set {

7) [length] = read a five bit unsigned integer;
8) the codeword length for this entry is [length]+1;

}


==============================================

byte 8: [ X 1 ] [sparse] flag (1 bit)

==> '1' is [ordered] bit and 'X' is [sparse] bit. Is it right?

What is a difference between "1) [sparse] is set" and " 3) [flag] is set" ?
kjoonlee
CODE
byte 8: [               X ] [ordered] (1 bit)
byte 8: [             X 0 ] [sparse] flag (1 bit)
byte 8: [           X 1 0 ] [flag] flag (1 bit)
kjoonlee
I got some big help from Xiph.org (Michael Smith in particular) in writing that answer, but I still might be wrong.

If you want a definitive, accurate answer, then please email vorbis-dev@xiph.org with your question. smile.gif
kjoonlee
An unchained Vorbis stream has one (1) codebook header packet, which contains all the codebooks that are used in that stream.

For each codebook, [sparse] is always read.

if [sparse] is 1, then [flag] is read for each and every "codebook entry"/"codeword."

Thanks go to Michael Smith. smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.