[vlc-commits] AES3: decode to S32N rather than S24 and simplify a little
Rémi Denis-Courmont
git at videolan.org
Wed Dec 19 22:20:00 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Dec 19 23:19:03 2012 +0200| [e0f38966c474b9e34045db263a1711d4d7cd30f2] | committer: Rémi Denis-Courmont
AES3: decode to S32N rather than S24 and simplify a little
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e0f38966c474b9e34045db263a1711d4d7cd30f2
---
modules/codec/aes3.c | 73 ++++++++++++++++----------------------------------
1 file changed, 23 insertions(+), 50 deletions(-)
diff --git a/modules/codec/aes3.c b/modules/codec/aes3.c
index d59ba48..61feef4 100644
--- a/modules/codec/aes3.c
+++ b/modules/codec/aes3.c
@@ -157,32 +157,19 @@ static block_t *Decode( decoder_t *p_dec, block_t **pp_block )
p_block->i_buffer -= AES3_HEADER_LEN;
p_block->p_buffer += AES3_HEADER_LEN;
-#ifdef WORDS_BIGENGIAN
-# define LOB 2
-# define HIB 0
-#else
-# define LOB 0
-# define HIB 2
-#endif
-#define MIB 1
if( i_bits == 24 )
{
- uint8_t *p_out = p_aout_buffer->p_buffer;
+ uint32_t *p_out = (uint32_t *)p_aout_buffer->p_buffer;
while( p_block->i_buffer / 7 )
{
- p_out[LOB] = reverse[p_block->p_buffer[0]];
- p_out[MIB] = reverse[p_block->p_buffer[1]];
- p_out[HIB] = reverse[p_block->p_buffer[2]];
- p_out += 3;
-
- p_out[LOB] = (reverse[p_block->p_buffer[3]] >> 4)
- | ((reverse[p_block->p_buffer[4]] << 4) & 0xf0);
- p_out[MIB] = (reverse[p_block->p_buffer[4]] >> 4)
- | ((reverse[p_block->p_buffer[5]] << 4) & 0xf0);
- p_out[HIB] = (reverse[p_block->p_buffer[5]] >> 4)
- | ((reverse[p_block->p_buffer[6]] << 4) & 0xf0);
- p_out += 3;
+ *(p_out++) = (reverse[p_block->p_buffer[0]] << 8)
+ | (reverse[p_block->p_buffer[1]] << 16)
+ | (reverse[p_block->p_buffer[2]] << 24);
+ *(p_out++) = ((reverse[p_block->p_buffer[3]] << 4)
+ | (reverse[p_block->p_buffer[4]] << 12)
+ | (reverse[p_block->p_buffer[5]] << 20)
+ | (reverse[p_block->p_buffer[6]] << 28)) & 0xFFFFFF00;
p_block->i_buffer -= 7;
p_block->p_buffer += 7;
@@ -191,47 +178,34 @@ static block_t *Decode( decoder_t *p_dec, block_t **pp_block )
}
else if( i_bits == 20 )
{
- uint8_t *p_out = p_aout_buffer->p_buffer;
+ uint32_t *p_out = (uint32_t *)p_aout_buffer->p_buffer;
while( p_block->i_buffer / 6 )
{
- p_out[LOB] = ((reverse[p_block->p_buffer[0]] << 4) & 0xf0);
- p_out[MIB] = (reverse[p_block->p_buffer[0]] >> 4)
- | ((reverse[p_block->p_buffer[1]] << 4) & 0xf0);
- p_out[HIB] = (reverse[p_block->p_buffer[1]] >> 4)
- | ((reverse[p_block->p_buffer[2]] << 4) & 0xf0);
- p_out += 3;
-
- p_out[LOB] = ((reverse[p_block->p_buffer[3]] << 4) & 0xf0);
- p_out[MIB] = (reverse[p_block->p_buffer[3]] >> 4)
- | ((reverse[p_block->p_buffer[4]] << 4) & 0xf0);
- p_out[HIB] = (reverse[p_block->p_buffer[4]] >> 4)
- | ((reverse[p_block->p_buffer[5]] << 4) & 0xf0);
- p_out += 3;
+ *(p_out++) = (reverse[p_block->p_buffer[0]] << 12)
+ | (reverse[p_block->p_buffer[1]] << 20)
+ | (reverse[p_block->p_buffer[2]] << 28);
+ *(p_out++) = (reverse[p_block->p_buffer[3]] << 12)
+ | (reverse[p_block->p_buffer[4]] << 20)
+ | (reverse[p_block->p_buffer[5]] << 28);
p_block->i_buffer -= 6;
p_block->p_buffer += 6;
}
}
-#undef HIB
-#define HIB (!(LOB))
else
{
- uint8_t *p_out = p_aout_buffer->p_buffer;
+ uint16_t *p_out = (uint16_t *)p_aout_buffer->p_buffer;
assert( i_bits == 16 );
while( p_block->i_buffer / 5 )
{
- p_out[LOB] = reverse[p_block->p_buffer[0]];
- p_out[HIB] = reverse[p_block->p_buffer[1]];
- p_out += 2;
-
- p_out[LOB] = (reverse[p_block->p_buffer[2]] >> 4)
- | ((reverse[p_block->p_buffer[3]] << 4) & 0xf0);
- p_out[HIB] = (reverse[p_block->p_buffer[3]] >> 4)
- | ((reverse[p_block->p_buffer[4]] << 4) & 0xf0);
- p_out += 2;
+ *(p_out++) = reverse[p_block->p_buffer[0]]
+ | reverse[p_block->p_buffer[1]];
+ *(p_out++) = (reverse[p_block->p_buffer[2]] >> 4)
+ | (reverse[p_block->p_buffer[3]] << 4)
+ | (reverse[p_block->p_buffer[4]] << 12);
p_block->i_buffer -= 5;
p_block->p_buffer += 5;
@@ -385,9 +359,8 @@ static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
}
else
{
- p_dec->fmt_out.i_codec = i_bits == 16 ? VLC_CODEC_S16N
- : VLC_CODEC_S24N;
- p_dec->fmt_out.audio.i_bitspersample = i_bits == 16 ? 16 : 24;
+ p_dec->fmt_out.i_codec = i_bits == 16 ? VLC_CODEC_S16N : VLC_CODEC_S32N;
+ p_dec->fmt_out.audio.i_bitspersample = i_bits == 16 ? 16 : 32;
}
p_dec->fmt_out.audio.i_channels = i_channels;
More information about the vlc-commits
mailing list