Skip to main content

Topic: CRC alogrithism for AC3 (Read 1739 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • kevin.wang
  • [*]
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?