[Vorbis-dev] Error in floor0 decode specification
Роман Донченко
DXDragon at yandex.ru
Mon Apr 18 09:37:23 PDT 2011
Hello,
It seems there is an error in the algorithm for floor0 decode in section
6.2.2 of the Vorbis specification.
Here's the relevant part:
3 3) [coefficients] is an empty, zero length vector
4 4) [booknumber] = read an unsigned integer of ilog(
[floor0_number_of_books] ) bits
5 5) if ( [booknumber] is greater than the highest number decode
codebook ) then packet is undecodable
6 6) [last] = zero;
7 7) vector [temp_vector] = read vector from bitstream using
codebook number [floor0_book_list] element [booknumber] in VQ context.
8 8) add the scalar value [last] to each scalar in vector
[temp_vector]
9 9) [last] = the value of the last scalar in vector [temp_vector]
10 10) concatenate [temp_vector] onto the end of the [coefficients]
vector
11 11) if (length of vector [coefficients] is less than
[floor0_order], continue at step 6
If implemented as written, it would mean that [last] does nothing, since
the only time it is used it always equals to zero. I've looked at the
corresponding code in libvorbis (which seems to be floor0_inverse1 in
floor0.c), and it does this:
float last=0.f;
/* ... */
for(j=0;j<look->m;){
for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
last=lsp[j-1];
}
which suggests that step 11 in the algorithm should say "continue at step
7" (skipping the initialization of [last]).
Coincidentally, there's also a cosmetic error in the same algorithm - step
7 is too long and is truncated in the PDF version.
Roman.
More information about the Vorbis-dev
mailing list