Mercurial > libavcodec.hg
comparison mlp_parser.c @ 5980:3055403f0e57 libavcodec
cosmetics: spelling fixes
| author | diego |
|---|---|
| date | Mon, 03 Dec 2007 11:03:16 +0000 |
| parents | aafe67fa196f |
| children | f7cbb7733146 |
comparison
equal
deleted
inserted
replaced
| 5979:fd27370e7dbf | 5980:3055403f0e57 |
|---|---|
| 64 | 64 |
| 65 static int crc_init = 0; | 65 static int crc_init = 0; |
| 66 static AVCRC crc_2D[1024]; | 66 static AVCRC crc_2D[1024]; |
| 67 | 67 |
| 68 /** MLP uses checksums that seem to be based on the standard CRC algorithm, | 68 /** MLP uses checksums that seem to be based on the standard CRC algorithm, |
| 69 * but not (in implementation terms, the table lookup and XOR are reversedi). | 69 * but not (in implementation terms, the table lookup and XOR are reversed). |
| 70 * We can implement this behaviour using a standard av_crc on all but the | 70 * We can implement this behavior using a standard av_crc on all but the |
| 71 * last element, then XOR that with the last element. | 71 * last element, then XOR that with the last element. |
| 72 */ | 72 */ |
| 73 | 73 |
| 74 static uint16_t mlp_checksum16(const uint8_t *buf, unsigned int buf_size) | 74 static uint16_t mlp_checksum16(const uint8_t *buf, unsigned int buf_size) |
| 75 { | 75 { |
| 237 mp->bytes_left = 0; | 237 mp->bytes_left = 0; |
| 238 | 238 |
| 239 sync_present = (AV_RB32(buf + 4) & 0xfffffffe) == 0xf8726fba; | 239 sync_present = (AV_RB32(buf + 4) & 0xfffffffe) == 0xf8726fba; |
| 240 | 240 |
| 241 if (!sync_present) { | 241 if (!sync_present) { |
| 242 // First nibble of a frame is a parity check of the first few nibbles | 242 // First nibble of a frame is a parity check of the first few nibbles. |
| 243 // Only check when this isn't a sync frame - syncs have a checksum | 243 // Only check when this isn't a sync frame - syncs have a checksum. |
| 244 | 244 |
| 245 parity_bits = 0; | 245 parity_bits = 0; |
| 246 for (i = 0; i <= mp->num_substreams; i++) { | 246 for (i = 0; i <= mp->num_substreams; i++) { |
| 247 parity_bits ^= buf[p++]; | 247 parity_bits ^= buf[p++]; |
| 248 parity_bits ^= buf[p++]; | 248 parity_bits ^= buf[p++]; |
| 252 parity_bits ^= buf[p++]; | 252 parity_bits ^= buf[p++]; |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) { | 256 if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) { |
| 257 av_log(avctx, AV_LOG_INFO, "mlpparse: parity check failed\n"); | 257 av_log(avctx, AV_LOG_INFO, "mlpparse: Parity check failed.\n"); |
| 258 goto lost_sync; | 258 goto lost_sync; |
| 259 } | 259 } |
| 260 } else { | 260 } else { |
| 261 MLPHeaderInfo mh; | 261 MLPHeaderInfo mh; |
| 262 | 262 |
