[vorbis-dev] OGG header

Erik Stenborg d99papa at dtek.chalmers.se
Fri Aug 30 02:16:56 PDT 2002



Thank you. I have no idea on whether the algorithm in framing.c is a
proper CRC algo (I hope it is), but now at least my code workes after
copying the table and algo straight off.

/Erik

On Thu, 29 Aug 2002, Keith Wright wrote:

> 
> Err.  Except I begin to doubt my own words.  The algorithm
> I described above would be
> 
> for(i=0;i<og->header_len;i++)
>   crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)]^og->header[i];
> 
> whereas in framing.c we find
>   crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
> 
> (note change in position of left bracket of subscript.)
> 
> That is, if you have a 32-bit shift register shifting in one bit at
> a time into the low order, then the new bits shifted in do not
> affect the addition of the generator "polynomial" until they
> have been shifted through the intervening 24 bits, while the 
> Ogg algorithm makes the new data byte affect the XORed generator
> immediately.
> 
> I do not know if this difference is deliberate, or whether it
> affects the error checking properties of the algorithm.  You might
> just say the algorithm is what it is (the Popeye defense) and
> it doesn't matter so long as it is the same every time, but
> this might piss off somebody who is trying to do the checksum
> in hardware with a real shift register.
> 
> Or is it so late at night that I am hallucinating without drugs?
> 
> -- 
>      -- 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.
> 

--- >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