[vorbis] Problem with decoding number of codebooks

Donal Riordan riordan at dcs.kcl.ac.uk
Mon Jun 30 18:01:36 PDT 2003



Hello,

I'm trying to write a Vorbis decoder (just as a hobby) but I've got a
problem with reading the setup header. According to the Vorbis
documentation the first data that should be read after the initial
'vorbis' string is an eight bit integer which when incremented by one,
contains the number of codebooks in the header. My problem is that
whenever I read this number it seems to be wrong!
For example, I created a very small Ogg Vorbis file and in this file the
first byte of the setup header is 29 (hex). This means that 42 (dec)
codebooks should follow. However this is not the case - in the entire file
there are only 7 occurances of the 'BCV' string which identifies codebooks
so the value stored should be 06.
It could be that my encoder is faulty but I downloaded the newest copy of
CDex and the encoder on that did not resolve the problem. Interestingly
the old encoder had 11 (hex) in this field in every file it generated and
the newer encoder has 29 (hex) in all the files it generates.
Can anyone tell me what I'm doing wrong? I have included the first five
hundred bytes of the file. The whole file is just 8KB so I could email it
if neccessary.
Thanks for any help,
Donal

riordan<AT>dcs.kcl.ac.uk

<p><p>00000000 4F67 6753 0002 0000 0000 OggS......
00000010 0000 0000 4D94 0500 0000 ....M.....
00000020 0000 5484 5044 011E 0176 ..T.PD...v
00000030 6F72 6269 7300 0000 0002 orbis.....
00000040 44AC 0000 0000 0000 0371 D........q
00000050 0200 0000 0000 B801 4F67 ........Og
00000060 6753 0000 0000 0000 0000 gS........
00000070 0000 4D94 0500 0100 0000 ..M.......
00000080 3235 587D 113E FFFF FFFF 25X}.>....
00000090 FFFF FFFF FFFF FFFF FFFF ..........
00000100 FFFF 0376 6F72 6269 731D ...vorbis.
00000110 0000 0058 6970 682E 4F72 ...Xiph.Or
00000120 6720 6C69 6256 6F72 6269 g libVorbi
00000130 7320 4920 3230 3032 3037 s I 200207
00000140 3137 0100 0000 0D00 0000 17........
00000150 5452 4143 4B4E 554D 4245 TRACKNUMBE
00000160 523D 3101 0576 6F72 6269 R=1..vorbi
00000170 7329 4243 5601 0008 0000 s)BCV.....

The ')' [29h] in the line above is what I'm
reading as the number of codebooks

00000180 0031 4C28 C480 D090 5500 .1L(....U.
00000190 0010 0000 2098 3610 6BA7 .... .6.k.
00000200 B5D6 5A6B 82A4 765A 6BAA ..Zk..vZk.
00000210 B5D6 5A6B 26B5 B65A 6BAD ..Zk&..Zk.
00000220 B5D6 5A6B ADB5 D65A 6BAD ..Zk...Zk.
00000230 B5D6 5A63 2034 6415 0000 ..Zc 4d...
00000240 0400 4028 4A12 B464 524C ..@(J..dRL
00000250 4A29 6520 478E 72E4 3948 J)e G.r.9H
00000260 CA27 A528 470A 62E2 39E8 .'.(G.b.9.
00000270 3DF5 646B 4DA6 A4E4 5B4D =.dkM...[M
00000280 4A29 2508 0D59 0500 0002 J)%..Y....
00000290 0040 0821 8410 5248 2185 . at .!..RH!.
00000300 1452 4821 8514 6288 21A6 .RH!..b.!.
00000310 9862 CA29 A79C 72CA 29C7 .b.)..r.).
00000320 2083 0C32 C820 834C 32E9  ..2. .L2.
00000330 A4A3 8E3A EAAC B3CE 3A0B ...:....:.
00000340 2DB4 D042 0CB1 C412 536D -..B....Sm
00000350 35D6 DA73 10CA 28A5 9452 5..s..(..R
00000360 4A29 A594 524A 29A5 8C31 J)..RJ)..1
00000370 C608 4243 5601 0020 0000 ..BCV.. ..
00000380 0442 0619 6490 4108 2185 .B..d.A.!.
00000390 1452 8A29 A69C 720C 32E8 .R.)..r.2.
00000400 80D0 9055 0000 2000 8000 ...U.. ...
00000410 0000 00C7 9014 49B1 1CCB ......I...
00000420 D11C 4FF2 24CF 122D 5113 ..O.$..-Q.
00000430 3DD3 3345 D334 4DD3 356D =.3E.4M.5m
00000440 5577 7555 5775 D556 75D5 UwuUWu.Vu.
00000450 5665 D335 6DD3 5665 D355 Ve.5m.Ve.U
00000460 7557 9775 57B6 755D D775 uW.uW.u].u
00000470 5DD7 755D D775 5DD7 755D ].u].u].u]
00000480 D775 DDB6 6D20 3464 1500 .u..m 4d..
00000490 2001 00A0 2339 9AE2 29A2  ...#9..).

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis mailing list