]> git.sesse.net Git - vlc/commitdiff
* Fix bug in ac3dec for mono streams
authorRenaud Dartus <reno@videolan.org>
Thu, 22 Feb 2001 05:31:55 +0000 (05:31 +0000)
committerRenaud Dartus <reno@videolan.org>
Thu, 22 Feb 2001 05:31:55 +0000 (05:31 +0000)
src/ac3_decoder/ac3_bit_stream.h
src/ac3_decoder/ac3_decoder.c
src/ac3_decoder/ac3_decoder_thread.c
src/ac3_decoder/ac3_downmix.c
src/ac3_decoder/ac3_downmix_c.c
src/ac3_decoder/ac3_exponent.c
src/ac3_decoder/ac3_imdct.c
src/ac3_decoder/ac3_mantissa.c
src/ac3_decoder/ac3_parse.c

index 7572b722cf48c213c2241343c99bfaf4773ea928..7c96f32e8cd892aa7a4ef682373ab50b64178cad 100644 (file)
@@ -30,8 +30,11 @@ static __inline__ u32 bitstream_get (ac3_bit_stream_t * p_bit_stream,
     {
         if (p_bit_stream->byte_stream.p_byte >= p_bit_stream->byte_stream.p_end)
         {
+            ac3dec_thread_t * p_ac3dec = p_bit_stream->byte_stream.info;
+            
             /* no, switch to next buffer */
-            ac3_byte_stream_next (&p_bit_stream->byte_stream);
+            if(!p_ac3dec->p_fifo->b_die)
+                ac3_byte_stream_next (&p_bit_stream->byte_stream);
         }
         p_bit_stream->buffer |=((u32) *(p_bit_stream->byte_stream.p_byte++)) 
             << (24 - p_bit_stream->i_available);
index 8472f9aed0038e90dfd310aa5e14dea6c370d999..1740771fea4d40ca976d4ae79333175c09fe2195 100644 (file)
@@ -45,7 +45,7 @@ int ac3_init (ac3dec_t * p_ac3dec)
 int ac3_decode_frame (ac3dec_t * p_ac3dec, s16 * buffer)
 {
     int i;
-
+    
     if (parse_bsi (p_ac3dec))
         return 1;
     
index e92332a6a106068686e9cff7e44896ada7e93d50..4850a4bf61cdfb8b2ad275360815e5c1b672b0b0 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_decoder_thread.c: ac3 decoder thread
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_decoder_thread.c,v 1.25 2001/02/20 12:06:28 reno Exp $
+ * $Id: ac3_decoder_thread.c,v 1.26 2001/02/22 05:31:55 reno Exp $
  *
  * Authors: Michel Lespinasse <walken@zoy.org>
  *
@@ -231,7 +231,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec)
         {
             p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = LAST_MDATE;
         }
-
+        
         if (ac3_sync_frame (&p_ac3dec->ac3_decoder, &sync_info))
         {
             sync = 0;
index 4ea8ce0096d6830e07f8cc8de4fc1cac835841e3..d238b629de684adf2ce74fd651b8ce93c164f96b 100644 (file)
@@ -41,7 +41,6 @@ int __inline__ downmix (ac3dec_t * p_ac3dec, s16 * out_buf)
 {
 
     dm_par_t    dm_par;
-    float       * center = 0;
     
     dm_par.clev = 0.0;
     dm_par.slev = 0.0;
@@ -83,12 +82,11 @@ int __inline__ downmix (ac3dec_t * p_ac3dec, s16 * out_buf)
                case 2:
                        break;
                default:        // 1/0
+            /* FIXME
                        if (p_ac3dec->bsi.acmod == 1)
                                center = p_ac3dec->samples.channel[0];
                        else if (p_ac3dec->bsi.acmod == 0)
-                               center = p_ac3dec->samples.channel[0]; /* FIXME */
-                       
-            stream_sample_1ch_to_s16_c (out_buf, center);
+                               center = p_ac3dec->samples.channel[0]; */
             return 1;
        }
     return 0;
index dc16cfa0006de9e0ec652433eff89d9ae2a80ecb..6afbf848a8a307866e9e7d5261e30b0ca35583bc 100644 (file)
 
 #include "ac3_decoder.h"
 #include "ac3_internal.h"
-#include "ac3_bit_stream.h"
 
 #include "ac3_downmix.h"
-
 void __inline__ downmix_3f_2r_to_2ch_c (float *samples, dm_par_t *dm_par)
 {
        int i;
@@ -145,6 +143,6 @@ void __inline__ stream_sample_1ch_to_s16_c (s16 *out_buf, float *center)
 
        for (i=0; i < 256; i++) {
                *out_buf++ = tmp = (s16) (0.7071f * *center++ * NORM);
-               *out_buf++ = tmp * NORM;
+               *out_buf++ = tmp;
        }
 }
index 1f6cd05f2afe4b3eed25f537ad8ad5ec8b316dc8..f71d7ea97e48ac309df7692e9f30cf1dc1a60832 100644 (file)
  *****************************************************************************/
 #include "defs.h"
 
-#include <stdio.h>                                           /* "intf_msg.h" */
-
 #include "config.h"
 #include "common.h"
 #include "threads.h"
 #include "mtime.h"
 
-#include "intf_msg.h"
+#include "stream_control.h"
+#include "input_ext-dec.h"
+
+#include "audio_output.h"
 
 #include "ac3_decoder.h"
+#include "ac3_decoder_thread.h"
+
+#include "intf_msg.h"
+
 #include "ac3_bit_stream.h"
 #include "ac3_internal.h"
 
index c2afd5dc6e8c94e6dbee42d25ee09c06b9f3451a..a566e90faaf35654dacb597e4eacbcacb2a08648 100644 (file)
@@ -201,6 +201,8 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer)
     {
         stream_sample_2ch_to_s16_c(buffer, p_ac3dec->samples.channel[0],
                 p_ac3dec->samples.channel[1]);
+    } else {
+        stream_sample_1ch_to_s16_c(buffer, p_ac3dec->samples.channel[0]);
     }
 
     /* XXX?? We don't bother with the IMDCT for the LFE as it's currently
index 5c5afdb5d786a65c08327bc861aa7d0221c242dc..f59adfa61d82da1bc80fe3eb5ea6251d21f1bc14 100644 (file)
 
 #include "defs.h"
 
-#include <stdio.h>                                           /* "intf_msg.h" */
-
+#include "config.h"
 #include "common.h"
+#include "threads.h"
+#include "mtime.h"
+
+#include "stream_control.h"
+#include "input_ext-dec.h"
+
+#include "audio_output.h"
 
 #include "ac3_decoder.h"
+#include "ac3_decoder_thread.h"
+
 #include "ac3_internal.h"
 #include "ac3_bit_stream.h"
 
index 6a070b869334fa3e110174c1e14d0cbfda7569cc..4c0bbaee103264d165ec364b04e27d71bbbefed0 100644 (file)
 
 #include "defs.h"
 
+#include "config.h"
 #include "common.h"
-#include "intf_msg.h"
 
+#include "threads.h"
+#include "mtime.h"
+
+#include "stream_control.h"
+#include "input_ext-dec.h"
+
+#include "audio_output.h"
+
+#include "intf_msg.h"
 #include "ac3_decoder.h"
+#include "ac3_decoder_thread.h"
+
 #include "ac3_internal.h"
 #include "ac3_bit_stream.h"
 
@@ -94,10 +105,9 @@ int ac3_sync_frame (ac3dec_t * p_ac3dec, ac3_sync_info_t * p_sync_info)
     
     p_ac3dec->bit_stream.total_bits_read = 0;
     p_ac3dec->bit_stream.i_available = 0;
-
+    
     /* sync word - should be 0x0b77 */
-    buf =  bitstream_get(&(p_ac3dec->bit_stream),16);
-    if (buf != 0x0b77)
+    if( (buf =  bitstream_get(&(p_ac3dec->bit_stream),16)) != 0x0b77)
     {
         return 1;
     }