Re: CRC 32 information for MPEG checksum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 14, 2007 at 12:37:15PM +0100, Paolo Pasquali wrote:
> Hi to all,
> I'm doing an application to off-line analyze and edit a generic DVB TS.  I
> have a lot og problems with CRC32 calculation on PSI/SI tables.
> I'm using a fast calculation CRC32:
> 
> poly: 0x04c11db7
> 
> table:  0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc,
> 0x17c56b6b, etc.............
> 
> algorithm:
> 
> public long CRC(byte[] by)
>        {
>            ulong ulCRC = 0xFFFFFFFF;
>            long len;
>            len = by.Length;
>            for(long i = 0; i < len; i++)
>            {
> 
> 
>                ulCRC = (ulCRC >> 8) ^ crcLookup[by[i]  ^ (ulCRC & 0xFF) ];
>                }
>            return Convert.ToInt64( ulCRC ^ 0xFFFFFFFF);
>        }
> 
Try this:

for (i = 0; i < len; ++i)
        CRC = (CRC<<8) ^ crc_tab[((CRC>>24)^*p++) &0xff];

Wolfgang

_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux