Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: CRC alogrithism for AC3 (Read 2989 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

CRC alogrithism for AC3

Hi all

I want to unstandard how ac3's CRC work, because it seems the CRC for AC3 is different from the generic one.

AC3 use X^16+X^15+X^2+1 as its poly (0x8005)

the generic alogrithism is:

unsigned short syndrom=0;

for(i=0;i<words; i++){
  syndrom = ((syndrom << 8) & 0xff00) ^ crctab[((syndrom>>8)&0xff)^( (data>>8)&0xff) ];
  syndrom = ((syndrom << 8) & 0xff00) ^ crctab[((syndrom>>8)&0xff)^( (data)&0xff) ];
}

for ac3:
unsigned short syndrom=0;

for(i=0;i<words; i++){
  syndrom = ((syndrom << 8) & 0xff00) ^ ((data>>8)&0xff) ^ crctab[(syndrom>>8)&0xff];
  syndrom = ((syndrom << 8) & 0xff00) ^ ((data)&0xff) ^crctab[(syndrom>>8)&0xff];
}

Who can tell me how to apply generic crc to ac3?