Commit 764fd89e authored by Laurent Aimar's avatar Laurent Aimar

* all : mpeg_audio decoder works now with aout3.

parent fd976a60
......@@ -5667,8 +5667,8 @@ BUILTINS="${BUILTINS}"
PLUGINS="${PLUGINS} misc/dummy/dummy misc/null/null"
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file access/udp access/http access/rtp misc/network/ipv4 misc/memcpy/memcpy"
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/mpeg_audio/mpeg_audio codec/a52old/a52old codec/lpcm/lpcm"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif codec/mpeg_audio/mpeg_audio"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/a52old/a52old codec/lpcm/lpcm"
PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop"
PLUGINS="${PLUGINS} audio_filter/converter/float32tos16 audio_filter/converter/float32tos8 audio_filter/converter/float32tou16 audio_filter/converter/float32tou8 audio_filter/converter/a52tospdif"
PLUGINS="${PLUGINS} audio_filter/resampler/trivial"
......
......@@ -441,8 +441,8 @@ BUILTINS="${BUILTINS}"
PLUGINS="${PLUGINS} misc/dummy/dummy misc/null/null"
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file access/udp access/http access/rtp misc/network/ipv4 misc/memcpy/memcpy"
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/mpeg_audio/mpeg_audio codec/a52old/a52old codec/lpcm/lpcm"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif codec/mpeg_audio/mpeg_audio"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/a52old/a52old codec/lpcm/lpcm"
PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop"
PLUGINS="${PLUGINS} audio_filter/converter/float32tos16 audio_filter/converter/float32tos8 audio_filter/converter/float32tou16 audio_filter/converter/float32tou8 audio_filter/converter/a52tospdif"
PLUGINS="${PLUGINS} audio_filter/resampler/trivial"
......
......@@ -2,7 +2,7 @@
* decoder.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: decoder.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: decoder.c,v 1.2 2002/08/17 15:35:10 fenrir Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -37,7 +37,7 @@
#include "generic.h"
#include "decoder.h"
#define ADEC_FRAME_SIZE (2*1152)
#define ADEC_FRAME_SIZE 1152 /* XXX Frame size for only one channel */
/*****************************************************************************
* Local Prototypes
......@@ -113,7 +113,9 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
/* We do not create the audio output fifo now, but
it will be created when the first frame is received */
p_adec->p_aout_fifo = NULL;
p_adec->p_aout = NULL;
p_adec->p_aout_input = NULL;
p_adec->i_pts = 0;
p_adec->i_sync = 0;
......@@ -144,69 +146,74 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
*****************************************************************************/
static void DecodeThread( adec_thread_t * p_adec )
{
s16 *p_buffer;
adec_sync_info_t sync_info;
mtime_t i_pts;
aout_buffer_t *p_aout_buffer;
adec_sync_info_t sync_info;
if( ! adec_SyncFrame (p_adec, &sync_info) )
{
/* TODO: check if audio type has changed */
/* Create the output fifo if it doesn't exist yet */
if( p_adec->p_aout_fifo == NULL )
if( ( p_adec->p_aout_input == NULL )||
( p_adec->output_format.i_channels != ( sync_info.b_stereo ? 2 : 1 ) )||
( p_adec->output_format.i_rate != sync_info.sample_rate ) )
{
int i_channels;
if( !config_GetInt( p_adec->p_fifo, "mono" ) )
{
msg_Dbg( p_adec->p_fifo, "setting stereo output" );
i_channels = 2;
}
else if( sync_info.b_stereo )
if( p_adec->p_aout_input )
{
i_channels = 2;
}
else
{
i_channels = 1;
}
p_adec->p_aout_fifo =
aout_CreateFifo( p_adec->p_fifo, AOUT_FIFO_PCM, i_channels,
sync_info.sample_rate, ADEC_FRAME_SIZE, NULL );
if( p_adec->p_aout_fifo == NULL)
{
msg_Err( p_adec->p_fifo, "failed to create aout fifo" );
p_adec->p_fifo->b_error = 1;
return;
/* Delete old output */
msg_Warn( p_adec->p_fifo, "opening a new aout" );
aout_InputDelete( p_adec->p_aout, p_adec->p_aout_input );
}
/* Set output configuration */
p_adec->output_format.i_format = AOUT_FMT_FLOAT32;
p_adec->output_format.i_channels = ( sync_info.b_stereo ? 2 : 1 );
p_adec->output_format.i_rate = sync_info.sample_rate;
p_adec->p_aout_input = aout_InputNew( p_adec->p_fifo,
&p_adec->p_aout,
&p_adec->output_format );
}
p_adec->i_sync = 1;
if( p_adec->p_aout_input == NULL )
{
msg_Err( p_adec->p_fifo, "failed to create aout fifo" );
p_adec->p_fifo->b_error = 1;
return;
}
p_buffer = ((s16 *)p_adec->p_aout_fifo->buffer)
+ (p_adec->p_aout_fifo->i_end_frame * ADEC_FRAME_SIZE);
p_aout_buffer = aout_BufferNew( p_adec->p_aout,
p_adec->p_aout_input,
ADEC_FRAME_SIZE );
if( !p_aout_buffer )
{
msg_Err( p_adec->p_fifo, "cannot get aout buffer" );
p_adec->p_fifo->b_error = 1;
return;
}
CurrentPTS( &p_adec->bit_stream,
&p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->i_end_frame],
NULL );
if( !p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->i_end_frame] )
p_adec->i_sync = 1;
CurrentPTS( &p_adec->bit_stream, &i_pts, NULL );
if( i_pts > 0 )
{
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->i_end_frame] =
LAST_MDATE;
p_adec->i_pts = i_pts;
}
p_aout_buffer->start_date = p_adec->i_pts;
p_adec->i_pts += (mtime_t)1000000 * (mtime_t)ADEC_FRAME_SIZE /
(mtime_t)p_adec->output_format.i_rate;
p_aout_buffer->end_date = p_adec->i_pts;
if( adec_DecodeFrame (p_adec, p_buffer) )
if( adec_DecodeFrame (p_adec, (float*)p_aout_buffer->p_buffer ) )
{
/* Ouch, failed decoding... We'll have to resync */
p_adec->i_sync = 0;
aout_BufferDelete( p_adec->p_aout, p_adec->p_aout_input, p_aout_buffer );
}
else
{
vlc_mutex_lock (&p_adec->p_aout_fifo->data_lock);
p_adec->p_aout_fifo->i_end_frame =
(p_adec->p_aout_fifo->i_end_frame + 1) & AOUT_FIFO_SIZE;
vlc_cond_signal (&p_adec->p_aout_fifo->data_wait);
vlc_mutex_unlock (&p_adec->p_aout_fifo->data_lock);
aout_BufferPlay( p_adec->p_aout, p_adec->p_aout_input, p_aout_buffer );
}
}
}
......@@ -220,15 +227,12 @@ static void DecodeThread( adec_thread_t * p_adec )
static void EndThread ( adec_thread_t *p_adec )
{
/* If the audio output fifo was created, we destroy it */
if ( p_adec->p_aout_fifo != NULL )
if( p_adec->p_aout_input )
{
aout_DestroyFifo ( p_adec->p_aout_fifo );
/* Make sure the output thread leaves the NextFrame() function */
vlc_mutex_lock (&(p_adec->p_aout_fifo->data_lock));
vlc_cond_signal (&(p_adec->p_aout_fifo->data_wait));
vlc_mutex_unlock (&(p_adec->p_aout_fifo->data_lock));
aout_InputDelete( p_adec->p_aout, p_adec->p_aout_input );
}
/* Destroy descriptor */
free( p_adec );
}
......
......@@ -2,7 +2,7 @@
* mpeg_adec.h : audio decoder thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: decoder.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: decoder.h,v 1.2 2002/08/17 15:35:10 fenrir Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
......@@ -49,8 +49,11 @@ typedef struct adec_thread_s
/*
* Output properties
*/
aout_fifo_t * p_aout_fifo; /* stores the decompressed frames */
aout_instance_t *p_aout; /* opaque */
aout_input_t *p_aout_input; /* opaque */
audio_sample_format_t output_format;
mtime_t i_pts;
} adec_thread_t;
/*****************************************************************************
......@@ -61,5 +64,5 @@ typedef struct adec_thread_s
* From adec_generic.c
*/
int adec_SyncFrame( adec_thread_t *, adec_sync_info_t * );
int adec_DecodeFrame( adec_thread_t * , s16 * );
int adec_DecodeFrame( adec_thread_t * , float * );
......@@ -2,7 +2,7 @@
* generic.c: MPEG audio decoder
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: generic.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: generic.c,v 1.2 2002/08/17 15:35:10 fenrir Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -26,6 +26,7 @@
#include <string.h> /* memcpy(), memset() */
#include <vlc/vlc.h>
#include <vlc/aout.h>
#include <vlc/decoder.h>
#include "generic.h"
......@@ -182,7 +183,7 @@ int adec_SyncFrame( adec_thread_t * p_adec, adec_sync_info_t * p_sync_info )
return 0;
}
int adec_DecodeFrame( adec_thread_t * p_adec, s16 * buffer )
int adec_DecodeFrame( adec_thread_t * p_adec, float * buffer )
{
int i_total_bytes_read;
......
......@@ -2,7 +2,7 @@
* layer1.c: MPEG Layer I audio decoder
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: layer1.c,v 1.2 2002/08/08 00:35:11 sam Exp $
* $Id: layer1.c,v 1.3 2002/08/17 15:35:10 fenrir Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -27,7 +27,7 @@
#include <vlc/vlc.h>
#include <vlc/decoder.h>
#include <vlc/aout.h>
#include "generic.h"
#include "decoder.h"
#include "math.h" /* DCT32(), PCM() */
......@@ -85,7 +85,7 @@ static u8 adec_layer1_allocation_table[15] =
static int adec_bound_table[4] = { 4, 8, 12, 16 };
int adec_layer1_mono( adec_thread_t * p_adec, s16 * buffer )
int adec_layer1_mono( adec_thread_t * p_adec, float * buffer )
{
u8 allocation[32];
float slope[32];
......@@ -178,7 +178,7 @@ int adec_layer1_mono( adec_thread_t * p_adec, s16 * buffer )
return 0;
}
int adec_layer1_stereo( adec_thread_t * p_adec, s16 * buffer )
int adec_layer1_stereo( adec_thread_t * p_adec, float * buffer )
{
u8 allocation_0[32], allocation_1[32];
float slope_0[32], slope_1[32];
......
......@@ -2,7 +2,7 @@
* adec_layer1.h: MPEG Layer I audio decoder
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: layer1.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: layer1.h,v 1.2 2002/08/17 15:35:10 fenrir Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
......@@ -21,6 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
int adec_layer1_mono( adec_thread_t * p_adec, s16 * buffer );
int adec_layer1_stereo (adec_thread_t * p_adec, s16 * buffer);
int adec_layer1_mono( adec_thread_t * p_adec, float * buffer );
int adec_layer1_stereo (adec_thread_t * p_adec, float * buffer);
......@@ -2,7 +2,7 @@
* layer2.c: MPEG Layer II audio decoder
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: layer2.c,v 1.2 2002/08/08 00:35:11 sam Exp $
* $Id: layer2.c,v 1.3 2002/08/17 15:35:10 fenrir Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -27,7 +27,7 @@
#include <vlc/vlc.h>
#include <vlc/decoder.h>
#include <vlc/aout.h>
#include "generic.h"
#include "decoder.h"
#include "math.h" /* DCT32(), PCM() */
......@@ -184,7 +184,7 @@ static void adec_layer2_get_table( u32 header, u8 freq_table[15],
*sblimit = sblimit_table[index];
}
int adec_layer2_mono( adec_thread_t * p_adec, s16 * buffer )
int adec_layer2_mono( adec_thread_t * p_adec, float * buffer )
{
static u8 freq_table[15] = {2, 1, 1, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2};
static float L3_table[3] = {-2/3.0, 0, 2/3.0};
......@@ -450,7 +450,7 @@ int adec_layer2_mono( adec_thread_t * p_adec, s16 * buffer )
return 0;
}
int adec_layer2_stereo( adec_thread_t * p_adec, s16 * buffer )
int adec_layer2_stereo( adec_thread_t * p_adec, float * buffer )
{
static u8 freq_table[15] = {3, 0, 0, 0, 1, 0, 1, 2, 2, 2, 3, 3, 3, 3, 3};
static float L3_table[3] = {-2/3.0, 0, 2/3.0};
......
......@@ -2,7 +2,7 @@
* adec_layer2.h: MPEG Layer II audio decoder
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: layer2.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: layer2.h,v 1.2 2002/08/17 15:35:10 fenrir Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
......@@ -21,6 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
int adec_layer2_mono ( adec_thread_t * p_adec, s16 * buffer );
int adec_layer2_stereo ( adec_thread_t * p_adec, s16 * buffer );
int adec_layer2_mono ( adec_thread_t * p_adec, float * buffer );
int adec_layer2_stereo ( adec_thread_t * p_adec, float * buffer );
......@@ -2,7 +2,7 @@
* math.c: Inverse Discrete Cosine Transform and Pulse Code Modulation
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: math.c,v 1.2 2002/08/08 00:35:11 sam Exp $
* $Id: math.c,v 1.3 2002/08/17 15:35:10 fenrir Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -312,10 +312,10 @@ void DCT32( adec_bank_t *b, float *x )
* Compute 32 PCM samples with a convolution product
*****************************************************************************/
void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
void PCM(adec_bank_t *b, float *p_pcm, int jump)
{
/* scale factor */
#define F -32768
#define F -1 //-32768
/* These values are not in the same order as in Annex 3-B.3 of the ISO/IEC
DIS 11172-3 */
static const float c[512] =
......@@ -478,19 +478,19 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
/* ceiling saturation */
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
/* floor saturation */
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -516,17 +516,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -552,17 +552,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -588,17 +588,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -624,17 +624,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -660,17 +660,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -696,17 +696,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -732,17 +732,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -768,17 +768,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -804,17 +804,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -840,17 +840,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -876,17 +876,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -912,17 +912,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
v += 15;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -948,17 +948,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v;
v += 15;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -984,17 +984,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v;
v += 15;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)
{
*p_pcm = 32767; /* 0x7ffff */
*p_pcm = 1.0;
}
else if (tmp < -32768)
else if (tmp < -1.0)
{
*p_pcm = -32768; /* 0x8000 */
*p_pcm = -1.0;
}
else
{
*p_pcm = (s16)tmp;
*p_pcm = tmp;
}
p_pcm += jump;
v += 15;
......@@ -1019,17 +1019,17 @@ void PCM(adec_bank_t *b, s16 *p_pcm, int jump)
tmp += *f++ * *v--;
tmp += *f++ * *v--;
tmp += *f++ * *v--;
if ((tmp += *f++ * *v) > 32767)
if ((tmp += *f++ * *v) > 1.0)