[Vorbis-dev] Another question, about the CRC computing

Ralph Giles giles at xiph.org
Sat Jul 30 10:19:25 PDT 2005


On Sat, Jul 30, 2005 at 12:30:15PM +0200, Simon OUALID wrote:

> Should I compute it over the bytes between the two "OggS" sequences ? 
> First "OggS" included ? I also thought it was something with the way I 
> compute the CRC, so I putted here the code I use to calculate it... :)

Yes, it's computed over all the data, starting at the beginning of the 
first "OggS" and ending with the last of the body data, i.e. right 
before the next "OggS", with the CRC value in the header itself set
to 0x00000000.

> I also tried with the JDK's api CRC32 class. But I think it doesn't use 
> the right polynom (must be a "zip" one ?).

IIRC it's different from the commonly implemented CRC's. The spec says:

"32 bit CRC value (direct algorithm, initial val and final XOR = 0, 
generator polynomial=0x04c11db7). The value is computed over the entire 
header (with the CRC field in the header set to zero) and then continued 
over the page. The CRC field is then filled with the computed value."

You can compare with the reference implementation in the first few pages 
of http://svn.xiph.org/trunk/ogg/src/framing.c if that helps.

Good luck!

 -r


More information about the Vorbis-dev mailing list