changeset 4693:86a2dfcc5eef libavcodec

Smacker Audio stereo fix
author kostya
date Wed, 21 Mar 2007 05:56:29 +0000
parents 3318e3f6470f
children f5fa13dfd3c8
files smacker.c
diffstat 1 files changed, 8 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/smacker.c	Tue Mar 20 18:08:51 2007 +0000
+++ b/smacker.c	Wed Mar 21 05:56:29 2007 +0000
@@ -620,14 +620,10 @@
         }
     }
     if(bits) { //decode 16-bit data
-        pred[0]  = get_bits(&gb, 8);
-        pred[0] |= get_bits(&gb, 8);
-        *samples++ = pred[0];
-        if(stereo) {
-            pred[1]  = get_bits(&gb, 8);
-            pred[1] |= get_bits(&gb, 8);
-            *samples++ = pred[1];
-        }
+        for(i = stereo; i >= 0; i--)
+            pred[i] = bswap_16(get_bits(&gb, 16));
+        for(i = 0; i < stereo; i++)
+            *samples++ = pred[i];
         for(i = 0; i < unp_size / 2; i++) {
             if(i & stereo) {
                 if(vlc[2].table)
@@ -658,12 +654,10 @@
             }
         }
     } else { //8-bit data
-        pred[0] = get_bits(&gb, 8);
-        *samples++ = (pred[0] - 0x80) << 8;
-        if(stereo) {
-            pred[1] = get_bits(&gb, 8);
-            *samples++ = (pred[1] - 0x80) << 8;
-        }
+        for(i = stereo; i >= 0; i--)
+            pred[i] = get_bits(&gb, 8);
+        for(i = 0; i < stereo; i++)
+            *samples++ = (pred[i] - 0x80) << 8;
         for(i = 0; i < unp_size; i++) {
             if(i & stereo){
                 if(vlc[1].table)