[vlc-devel] [PATCH] lpcm bd: fix 24 bit stereo decoding

Tristan Matthews le.businessman at gmail.com
Tue Mar 25 06:14:21 CET 2014


Fixes #10265
---
 modules/codec/lpcm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index eb9793f..24c8555 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -1117,10 +1117,12 @@ static void BdExtract( block_t *p_aout_buffer, block_t *p_block,
             if (i_bits == 16) {
                 swab( p_src, p_dst, (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];
+                for (unsigned i = 0; i < i_channels; ++i) {
+                    p_dst[i * 4] = 0;
+                    p_dst[1 + (i * 4)] = p_src[2 + (i * 3)];
+                    p_dst[2 + (i * 4)] = p_src[1 + (i * 3)];
+                    p_dst[3 + (i * 4)] = p_src[i * 3];
+                }
             }
 #endif
             p_src += (i_channels + i_channels_padding) * i_bits / 8;
-- 
1.9.1




More information about the vlc-devel mailing list