[vlc-commits] lpcm: fix BD decoding broken by 45c7b7c8764
Rafaël Carré
git at videolan.org
Mon Jul 22 17:00:30 CEST 2013
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Jul 22 16:57:42 2013 +0200| [792e9059f154d452f6d614b5d8c9ee93499a306d] | committer: Rafaël Carré
lpcm: fix BD decoding broken by 45c7b7c8764
We now output 20 and 24 bits PCM into S32N
Don't use swab, as it is forbidden for an odd number of channels
Fixes: #8982
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=792e9059f154d452f6d614b5d8c9ee93499a306d
---
modules/codec/lpcm.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index 402cd73..7bc4787 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -1052,15 +1052,24 @@ static void BdExtract( block_t *p_aout_buffer, block_t *p_block,
{
uint8_t *p_src = p_block->p_buffer;
uint8_t *p_dst = p_aout_buffer->p_buffer;
+ int dst_inc = ((i_bits == 16) ? 2 : 4) * i_channels;
+
while( i_frame_length > 0 )
{
#ifdef WORDS_BIGENDIAN
memcpy( p_dst, p_src, i_channels * i_bits / 8 );
#else
- swab( p_dst, p_src, i_channels * i_bits / 8 );
+ if (i_bits == 16) {
+ swab( p_dst, p_src, (i_channels + i_channels_padding) * i_bits / 8 );
+ } else {
+ p_dst[0] = 0;
+ p_dst[1] = p_src[2];
+ p_dst[2] = p_src[1];
+ p_dst[3] = p_src[0];
+ }
#endif
p_src += (i_channels + i_channels_padding) * i_bits / 8;
- p_dst += (i_channels + 0) * i_bits / 8;
+ p_dst += dst_inc;
i_frame_length--;
}
}
More information about the vlc-commits
mailing list