Commit a1b8de5c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Clean up L20 decoding

parent 236a2766
...@@ -424,15 +424,17 @@ static void DecodeS20B( void *outp, const uint8_t *in, unsigned samples ) ...@@ -424,15 +424,17 @@ static void DecodeS20B( void *outp, const uint8_t *in, unsigned samples )
while( samples >= 2 ) while( samples >= 2 )
{ {
*(out++) = U32_AT(in) & ~0xFFF; uint32_t dw = U32_AT(in);
*(out++) = U32_AT(in + 1) << 12; in += 4;
in += 5; *(out++) = dw & ~0xFFF;
*(out++) = (dw << 20) | (*in << 12);
in++;
samples -= 2; samples -= 2;
} }
/* No U32_AT() for the last odd sample: avoid off-by-one overflow! */ /* No U32_AT() for the last odd sample: avoid off-by-one overflow! */
if( samples ) if( samples )
*(out++) = ((U16_AT(in) << 16) | (in[2] << 8)) & ~0xFFF; *(out++) = (U16_AT(in) << 16) | ((in[2] & 0xF0) << 8);
} }
static int16_t dat12tos16( uint16_t y ) static int16_t dat12tos16( uint16_t y )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment