Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: In Vorbis 1 specification (Read 4314 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

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" ?

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)

 

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.