[PATCH] psuedocode error for Floor1 description in the vorbis docs
Location
The Floor1 description in the vorbis docs, found here:
http://www.xiph.org/ogg/vorbis/doc/vorbis-spec-floor1.html
Contains a bug in the pseudocode rendering of reading out the header (section header decode).
Fragment
18) iterate [i] over the range 0 ... [floor1_partitions]-1 {
19) [current_class_number] = vector [floor1_partition_class_list] element [i]
20) iterate [j] over the range 0 ... ([floor1_class_dimensions] element [current_class_number])-1 {
21) vector [floor1_X_list] element ([j] + [floor1_values]) =
read [rangebits] bits as unsigned integer
}
22) [floor1_values] = [floor1_values] + [floor1_class_dimensions] element [i]
}
Problem
Line 22 is wrong I think. The intent is to fill the floor1_X_List array with the correct number of 4-bit values. This entails increasing the value of 'floor1_values' with exactly as many values as we just read. However, the increment is: floor1_class_dimensions(i) whereas the number of 4-bit values read is equal to floor1_class_dimensions(floor1_partition_class_list(i)) aka floor1_class_dimensions(current_class_number).
Background
I'm re-implementing vorbis, just a decoder, from scratch, in java, using just the docs. Whenever I find inconsistencies or confusion I 'cheat' and take a quick peek at the C sources. In this case, the C sources seem to suggest the documentation is wrong.
Fix
Change line 22 in the pseudocode to:
22) [floor1_values] = [floor1_values] + [floor1_class_dimensions] element [current_class_number]
No further changes neccessary.
Priority and Severity
As it's documentation, you can intrinsically work around any problems by just implementing it right. Assuming for a moment I'm the only one currently trying to hack out a new vorbis decoder from scratch, there's no rush whatsoever. Severity is medium; it's fairly easy to catch, and the free C sources available make it fairly easy to confirm the nature of this documentation bug.