[vorbis-dev] OGG header

Keith Wright kwright at gis.net
Wed Aug 28 21:55:45 PDT 2002



> From: Erik Stenborg <d99papa at dtek.chalmers.se>
> Cc: Bogdan Giusca <bogdang at hotpop.com>
> 
> Some time ago I tried to do the same but got stuck on the CRC
> calculation.  I would be grateful if I could get some more details
> on how to calculate it. The link from the spec is dead and the
> source uses a look-up-table which I have no idea how it is
> constructed or even how to use properly.

Do you have the latest version?  In libogg-1.0/src/framing.c
the code to compute the |crc_lookup| table is right above
the table in #if 0...#endif brackets.  The CRC algorithm
is shift left, if a one comes out XOR with a magic number.
The code is made more efficient by building a table with
the result of doing this to each possible byte.  The choice
of magic number is a black art, do not approach it unless
you love finding irreducible polynomials over a Galois field.
But you don't need to do that, a magic number has been
chosen and is written in the code.

The secret is 0x04c11db7.  The algorithm is two lines.
You do it to the data block and hope the answer matches.
Where do you get stuck?


-- 
     -- Keith Wright  <kwright at free-comp-shop.com>

Programmer in Chief, Free Computer Shop <http://www.free-comp-shop.com>
         ---  Food, Shelter, Source code.  ---
--- >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-dev-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-dev mailing list