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"
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"
* 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>
#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
/* 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;
*****************************************************************************/
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 );
}
}
}
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 );
}
* 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>
*
/*
* 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;
/*****************************************************************************
* 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 * );
* 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>
#include <string.h> /* memcpy(), memset() */
#include <vlc/vlc.h>
+#include <vlc/aout.h>
#include <vlc/decoder.h>
#include "generic.h"
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;
* 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>
#include <vlc/vlc.h>
#include <vlc/decoder.h>
-
+#include <vlc/aout.h>
#include "generic.h"
#include "decoder.h"
#include "math.h" /* DCT32(), PCM() */
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];
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];
* 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>
*
* 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);
* 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>
#include <vlc/vlc.h>
#include <vlc/decoder.h>
-
+#include <vlc/aout.h>
#include "generic.h"
#include "decoder.h"
#include "math.h" /* DCT32(), PCM() */
*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};
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};
* 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>
*
* 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 );
* 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>
* 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] =
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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 += 31;
* adec_math.h : PCM and DCT
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: math.h,v 1.1 2002/08/04 17:23:42 sam Exp $
+ * $Id: math.h,v 1.2 2002/08/17 15:35:10 fenrir Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
* Prototypes
*****************************************************************************/
void DCT32 ( adec_bank_t *, float * );
-void PCM ( adec_bank_t *, s16 *, int );
+void PCM ( adec_bank_t *, float *, int );