[vlc-commits] Clean up L20 decoding
Rémi Denis-Courmont
git at videolan.org
Thu Aug 18 17:37:15 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug 18 18:35:36 2011 +0300| [a1b8de5c83f04e6d2917dd60b1075129b6d604d4] | committer: Rémi Denis-Courmont
Clean up L20 decoding
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a1b8de5c83f04e6d2917dd60b1075129b6d604d4
---
modules/codec/araw.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index 9c2410c..30c7d15 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -424,15 +424,17 @@ static void DecodeS20B( void *outp, const uint8_t *in, unsigned samples )
while( samples >= 2 )
{
- *(out++) = U32_AT(in) & ~0xFFF;
- *(out++) = U32_AT(in + 1) << 12;
- in += 5;
+ uint32_t dw = U32_AT(in);
+ in += 4;
+ *(out++) = dw & ~0xFFF;
+ *(out++) = (dw << 20) | (*in << 12);
+ in++;
samples -= 2;
}
/* No U32_AT() for the last odd sample: avoid off-by-one overflow! */
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 )
More information about the vlc-commits
mailing list