diff options
Diffstat (limited to 'drivers/isdn/mISDN/l1oip_codec.c')
-rw-r--r-- | drivers/isdn/mISDN/l1oip_codec.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/isdn/mISDN/l1oip_codec.c b/drivers/isdn/mISDN/l1oip_codec.c index 5a89972..a601c84 100644 --- a/drivers/isdn/mISDN/l1oip_codec.c +++ b/drivers/isdn/mISDN/l1oip_codec.c @@ -27,22 +27,22 @@ /* -How the codec works: --------------------- + How the codec works: + -------------------- -The volume is increased to increase the dynamic range of the audio signal. -Each sample is converted to a-LAW with only 16 steps of level resolution. -A pair of two samples are stored in one byte. + The volume is increased to increase the dynamic range of the audio signal. + Each sample is converted to a-LAW with only 16 steps of level resolution. + A pair of two samples are stored in one byte. -The first byte is stored in the upper bits, the second byte is stored in the -lower bits. + The first byte is stored in the upper bits, the second byte is stored in the + lower bits. -To speed up compression and decompression, two lookup tables are formed: + To speed up compression and decompression, two lookup tables are formed: -- 16 bits index for two samples (law encoded) with 8 bit compressed result. -- 8 bits index for one compressed data with 16 bits decompressed result. + - 16 bits index for two samples (law encoded) with 8 bit compressed result. + - 8 bits index for one compressed data with 16 bits decompressed result. -NOTE: The bytes are handled as they are law-encoded. + NOTE: The bytes are handled as they are law-encoded. */ @@ -232,7 +232,7 @@ l1oip_law_to_4bit(u8 *data, int len, u8 *result, u32 *state) /* send saved byte and first input byte */ if (*state) { - *result++ = table_com[(((*state)<<8)&0xff00) | (*data++)]; + *result++ = table_com[(((*state) << 8) & 0xff00) | (*data++)]; len--; o++; } @@ -267,7 +267,7 @@ l1oip_4bit_to_law(u8 *data, int len, u8 *result) while (i < len) { r = table_dec[*data++]; - *result++ = r>>8; + *result++ = r >> 8; *result++ = r; i++; } @@ -345,8 +345,8 @@ l1oip_4bit_alloc(int ulaw) c = alaw_to_4bit[i1]; i2 = 0; while (i2 < 256) { - table_com[(i1<<8) | i2] |= (c<<4); - table_com[(i2<<8) | i1] |= c; + table_com[(i1 << 8) | i2] |= (c << 4); + table_com[(i2 << 8) | i1] |= c; i2++; } i1++; @@ -361,8 +361,8 @@ l1oip_4bit_alloc(int ulaw) sample = _4bit_to_alaw[i1]; i2 = 0; while (i2 < 16) { - table_dec[(i1<<4) | i2] |= (sample<<8); - table_dec[(i2<<4) | i1] |= sample; + table_dec[(i1 << 4) | i2] |= (sample << 8); + table_dec[(i2 << 4) | i1] |= sample; i2++; } i1++; @@ -370,5 +370,3 @@ l1oip_4bit_alloc(int ulaw) return 0; } - - |