Skip to main content

Topic: In Vorbis 1 specification (Read 3464 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • yesjoon
  • [*]
In Vorbis 1 specification
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
  • [*][*][*][*][*]
In Vorbis 1 specification
Reply #1
Code: [Select]
byte 8: [               X ] [ordered] (1 bit)
byte 8: [             X 0 ] [sparse] flag (1 bit)
byte 8: [           X 1 0 ] [flag] flag (1 bit)
  • Last Edit: 26 May, 2004, 10:54:33 PM by kjoonlee

  • kjoonlee
  • [*][*][*][*][*]
In Vorbis 1 specification
Reply #2
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.

  • kjoonlee
  • [*][*][*][*][*]
In Vorbis 1 specification
Reply #3
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.