[vlc-commits] lpcm: fix BD decoding broken by 45c7b7c8764

Rafaël Carré git at videolan.org
Mon Jul 22 17:03:55 CEST 2013


vlc/vlc-2.1 | branch: master | Rafaël Carré <funman at videolan.org> | Mon Jul 22 16:57:42 2013 +0200| [bcfbaaad5fe59d6158cbc5250b373735da4dbbd9] | committer: Jean-Baptiste Kempf

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
(cherry picked from commit 792e9059f154d452f6d614b5d8c9ee93499a306d)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=bcfbaaad5fe59d6158cbc5250b373735da4dbbd9
---

 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