vb.net - How to calculate crc32 in psi/si packet -
we working on sending udp packets psi si. developing psi si generator. stuck on checksum crc32 - not able find check sum. tried on few code internet . comes checksum checksum doesnt match wireshark check sum .
we have wireshark dump of psisi packets working correct checksum .
can anyoone me in calculating checksum psi si ?
regards, vipul
i developing dvb-s head station , manipulating si-data ran same problem. solution read iso/iec 13818-1 , use right algorithm.
iso/iec 13818-1 describes beginning of section of psi-table indicated pointer field in same transport stream packet payload. means, there pointer field in front of section data , pointer field must not put in checksum calculation. first byte of pointer field length of field data. in cases there no field data , find simple 0 in front of section data starts table id of section. don´t take 0 checksum calculation.
mpeg´s crc 32 cyclic unreflected redundancy check starts 0xffffffff , takes highest bits first. magic value 0x04c11db7 can derived polynom specified in iso/iec 13818-1 annex b assigning each bit polynomial exponent.
putting have simple code calculate checksum:
uint calccrc32(byte[] sectiondata, int sectiondatalength) { uint crc32 = 0xffffffff; (int = 1 + sectiondata[0]; < sectiondatalength; i++) { byte b = sectiondata[i]; (int bit = 0; bit < 8; bit++) { if ((crc32 >= 0x80000000) != (b >= 0x80)) crc32 = (crc32 << 1) ^ 0x04c11db7; else crc32 = (crc32 << 1); b <<= 1; } } return crc32; }
Comments
Post a Comment