comparison mlp_parser.c @ 7198:479fc906650f libavcodec

spelling cosmetics
author diego
date Sat, 05 Jul 2008 10:11:42 +0000
parents a82e7d9c8c34
children ae8c047d6be5
comparison
equal deleted inserted replaced
7197:54f8d960f15b 7198:479fc906650f
63 } 63 }
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, but
69 * but not (in implementation terms, the table lookup and XOR are reversed). 69 * are not (in implementation terms, the table lookup and XOR are reversed).
70 * We can implement this behavior 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)
97 uint16_t checksum; 97 uint16_t checksum;
98 98
99 assert(get_bits_count(gb) == 0); 99 assert(get_bits_count(gb) == 0);
100 100
101 if (gb->size_in_bits < 28 << 3) { 101 if (gb->size_in_bits < 28 << 3) {
102 av_log(log, AV_LOG_ERROR, "Packet too short, unable to read major sync\n"); 102 av_log(log, AV_LOG_ERROR, "packet too short, unable to read major sync\n");
103 return -1; 103 return -1;
104 } 104 }
105 105
106 checksum = mlp_checksum16(gb->buffer, 26); 106 checksum = mlp_checksum16(gb->buffer, 26);
107 if (checksum != AV_RL16(gb->buffer+26)) { 107 if (checksum != AV_RL16(gb->buffer+26)) {
108 av_log(log, AV_LOG_ERROR, "Major sync info header checksum error\n"); 108 av_log(log, AV_LOG_ERROR, "major sync info header checksum error\n");
109 return -1; 109 return -1;
110 } 110 }
111 111
112 if (get_bits_long(gb, 24) != 0xf8726f) /* Sync words */ 112 if (get_bits_long(gb, 24) != 0xf8726f) /* Sync words */
113 return -1; 113 return -1;