Commit 4b1da9cc authored by Renaud Dartus's avatar Renaud Dartus

* Fix bug in ac3dec for mono streams

parent 9067002c
...@@ -30,8 +30,11 @@ static __inline__ u32 bitstream_get (ac3_bit_stream_t * p_bit_stream, ...@@ -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) 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 */ /* 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++)) p_bit_stream->buffer |=((u32) *(p_bit_stream->byte_stream.p_byte++))
<< (24 - p_bit_stream->i_available); << (24 - p_bit_stream->i_available);
......
...@@ -45,7 +45,7 @@ int ac3_init (ac3dec_t * p_ac3dec) ...@@ -45,7 +45,7 @@ int ac3_init (ac3dec_t * p_ac3dec)
int ac3_decode_frame (ac3dec_t * p_ac3dec, s16 * buffer) int ac3_decode_frame (ac3dec_t * p_ac3dec, s16 * buffer)
{ {
int i; int i;
if (parse_bsi (p_ac3dec)) if (parse_bsi (p_ac3dec))
return 1; return 1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ac3_decoder_thread.c: ac3 decoder thread * ac3_decoder_thread.c: ac3 decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Michel Lespinasse <walken@zoy.org>
* *
...@@ -231,7 +231,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec) ...@@ -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; 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)) if (ac3_sync_frame (&p_ac3dec->ac3_decoder, &sync_info))
{ {
sync = 0; sync = 0;
......
...@@ -41,7 +41,6 @@ int __inline__ downmix (ac3dec_t * p_ac3dec, s16 * out_buf) ...@@ -41,7 +41,6 @@ int __inline__ downmix (ac3dec_t * p_ac3dec, s16 * out_buf)
{ {
dm_par_t dm_par; dm_par_t dm_par;
float * center = 0;
dm_par.clev = 0.0; dm_par.clev = 0.0;
dm_par.slev = 0.0; dm_par.slev = 0.0;
...@@ -83,12 +82,11 @@ int __inline__ downmix (ac3dec_t * p_ac3dec, s16 * out_buf) ...@@ -83,12 +82,11 @@ int __inline__ downmix (ac3dec_t * p_ac3dec, s16 * out_buf)
case 2: case 2:
break; break;
default: // 1/0 default: // 1/0
/* FIXME
if (p_ac3dec->bsi.acmod == 1) if (p_ac3dec->bsi.acmod == 1)
center = p_ac3dec->samples.channel[0]; center = p_ac3dec->samples.channel[0];
else if (p_ac3dec->bsi.acmod == 0) else if (p_ac3dec->bsi.acmod == 0)
center = p_ac3dec->samples.channel[0]; /* FIXME */ center = p_ac3dec->samples.channel[0]; */
stream_sample_1ch_to_s16_c (out_buf, center);
return 1; return 1;
} }
return 0; return 0;
......
...@@ -27,10 +27,8 @@ ...@@ -27,10 +27,8 @@
#include "ac3_decoder.h" #include "ac3_decoder.h"
#include "ac3_internal.h" #include "ac3_internal.h"
#include "ac3_bit_stream.h"
#include "ac3_downmix.h" #include "ac3_downmix.h"
void __inline__ downmix_3f_2r_to_2ch_c (float *samples, dm_par_t *dm_par) void __inline__ downmix_3f_2r_to_2ch_c (float *samples, dm_par_t *dm_par)
{ {
int i; int i;
...@@ -145,6 +143,6 @@ void __inline__ stream_sample_1ch_to_s16_c (s16 *out_buf, float *center) ...@@ -145,6 +143,6 @@ void __inline__ stream_sample_1ch_to_s16_c (s16 *out_buf, float *center)
for (i=0; i < 256; i++) { for (i=0; i < 256; i++) {
*out_buf++ = tmp = (s16) (0.7071f * *center++ * NORM); *out_buf++ = tmp = (s16) (0.7071f * *center++ * NORM);
*out_buf++ = tmp * NORM; *out_buf++ = tmp;
} }
} }
...@@ -23,16 +23,21 @@ ...@@ -23,16 +23,21 @@
*****************************************************************************/ *****************************************************************************/
#include "defs.h" #include "defs.h"
#include <stdio.h> /* "intf_msg.h" */
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "threads.h" #include "threads.h"
#include "mtime.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.h"
#include "ac3_decoder_thread.h"
#include "intf_msg.h"
#include "ac3_bit_stream.h" #include "ac3_bit_stream.h"
#include "ac3_internal.h" #include "ac3_internal.h"
......
...@@ -201,6 +201,8 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer) ...@@ -201,6 +201,8 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer)
{ {
stream_sample_2ch_to_s16_c(buffer, p_ac3dec->samples.channel[0], stream_sample_2ch_to_s16_c(buffer, p_ac3dec->samples.channel[0],
p_ac3dec->samples.channel[1]); 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 /* XXX?? We don't bother with the IMDCT for the LFE as it's currently
......
...@@ -24,11 +24,19 @@ ...@@ -24,11 +24,19 @@
#include "defs.h" #include "defs.h"
#include <stdio.h> /* "intf_msg.h" */ #include "config.h"
#include "common.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.h"
#include "ac3_decoder_thread.h"
#include "ac3_internal.h" #include "ac3_internal.h"
#include "ac3_bit_stream.h" #include "ac3_bit_stream.h"
......
...@@ -24,10 +24,21 @@ ...@@ -24,10 +24,21 @@
#include "defs.h" #include "defs.h"
#include "config.h"
#include "common.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.h"
#include "ac3_decoder_thread.h"
#include "ac3_internal.h" #include "ac3_internal.h"
#include "ac3_bit_stream.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) ...@@ -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.total_bits_read = 0;
p_ac3dec->bit_stream.i_available = 0; p_ac3dec->bit_stream.i_available = 0;
/* sync word - should be 0x0b77 */ /* sync word - should be 0x0b77 */
buf = bitstream_get(&(p_ac3dec->bit_stream),16); if( (buf = bitstream_get(&(p_ac3dec->bit_stream),16)) != 0x0b77)
if (buf != 0x0b77)
{ {
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment