Commit afa6c926 authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/codec/a52old/a52old.c: ported the old A52 decoder to aout3.

  * ./modules/audio_filter/converter/s16tofloat32.c: converter needed for
    a52old, includes the walken trick and b_in_place = true.
parent 620b69bb
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -444,9 +444,10 @@ PLUGINS="${PLUGINS} misc/dummy/dummy misc/null"
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file 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 codec/mpeg_audio/mpeg_audio"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/a52old/a52old codec/lpcm/lpcm"
PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/a52old/a52old"
#PLUGINS="${PLUGINS} 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/converter/float32tos16 audio_filter/converter/float32tos8 audio_filter/converter/float32tou16 audio_filter/converter/float32tou8 audio_filter/converter/a52tospdif audio_filter/converter/fixed32tofloat32 audio_filter/converter/fixed32tos16 audio_filter/converter/s16tofloat32"
PLUGINS="${PLUGINS} audio_filter/resampler/trivial"
PLUGINS="${PLUGINS} audio_mixer/trivial audio_mixer/spdif"
PLUGINS="${PLUGINS} audio_output/file"
......@@ -1427,6 +1428,17 @@ AC_ARG_ENABLE(mga,
PLUGINS="${PLUGINS} video_output/mga/mga video_output/mga/xmga"
fi ])
dnl
dnl SVGAlib module
dnl
AC_ARG_ENABLE(svgalib,
[ --enable-svgalib SVGAlib support (default disabled)])
if test "x${enable_svgalib}" = "xyes"
then
PLUGINS="${PLUGINS} video_output/svgalib"
svgalib_LDFLAGS="${svgalib_LDFLAGS} -lvga -lvgagl"
fi
dnl
dnl GGI module
dnl
......@@ -2090,6 +2102,7 @@ AC_SUBST(motionaltivec_CFLAGS)
AC_SUBST(qt_CFLAGS)
AC_SUBST(qte_CFLAGS)
AC_SUBST(sdl_CFLAGS)
AC_SUBST(svgalib_CFLAGS)
AC_SUBST(x11_CFLAGS)
AC_SUBST(xvideo_CFLAGS)
......@@ -2142,6 +2155,7 @@ AC_SUBST(qt_LDFLAGS)
AC_SUBST(qte_LDFLAGS)
AC_SUBST(rc_LDFLAGS)
AC_SUBST(sdl_LDFLAGS)
AC_SUBST(svgalib_LDFLAGS)
AC_SUBST(vcd_LDFLAGS)
AC_SUBST(vorbis_LDFLAGS)
AC_SUBST(waveout_LDFLAGS)
......
......@@ -5,3 +5,4 @@ float32tou8_SOURCES = float32tou8.c
a52tospdif_SOURCES = a52tospdif.c
fixed32tos16_SOURCES = fixed32tos16.c
fixed32tofloat32_SOURCES = fixed32tofloat32.c
s16tofloat32_SOURCES = s16tofloat32.c
/*****************************************************************************
* s16tofloat32.c : converter from signed 16 bits integer to float32
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: s16tofloat32.c,v 1.1 2002/08/21 09:27:40 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
#include "audio_output.h"
#include "aout_internal.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Create ( vlc_object_t * );
static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
aout_buffer_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for s16->float32 conversion") );
set_capability( "audio filter", 1 );
set_callbacks( Create, NULL );
vlc_module_end();
/*****************************************************************************
* Create: allocate trivial mixer
*****************************************************************************
* This function allocates and initializes a Crop vout method.
*****************************************************************************/
static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( p_filter->input.i_format != AOUT_FMT_S16_NE
|| p_filter->output.i_format != AOUT_FMT_FLOAT32 )
{
return -1;
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
{
return -1;
}
p_filter->pf_do_work = DoWork;
p_filter->b_in_place = VLC_TRUE;
return 0;
}
/*****************************************************************************
* DoWork: convert a buffer
*****************************************************************************/
static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{
int i = p_in_buf->i_nb_samples * p_filter->input.i_channels;
/* We start from the end because b_in_place is true */
s16 * p_in = (s16 *)p_in_buf->p_buffer + i - 1;
float * p_out = (float *)p_out_buf->p_buffer + i - 1;
while( i-- )
{
#if 0
/* Slow version */
*p_out = (float)*p_in / 32768.0;
#else
/* This is walken's trick based on IEEE float format. On my PIII
* this takes 16 seconds to perform one billion conversions, instead
* of 19 seconds for the above division. */
s32 i_out = *p_in + 0x43c00000;
float f_out = *(float *)&i_out;
*p_out = f_out - 384.0;
#endif
p_in--; p_out--;
}
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 2;
}
......@@ -2,7 +2,7 @@
* a52old.c: A52 decoder module main file
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: a52old.c,v 1.2 2002/08/04 20:04:11 sam Exp $
* $Id: a52old.c,v 1.3 2002/08/21 09:27:40 sam Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
......@@ -31,6 +31,8 @@
#include <vlc/aout.h>
#include <vlc/decoder.h>
#include "aout_internal.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h> /* getpid() */
#endif
......@@ -39,17 +41,16 @@
#include "downmix.h"
#include "adec.h"
#define A52DEC_FRAME_SIZE (2*1536)
#define A52DEC_FRAME_SIZE 1536
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int OpenDecoder ( vlc_object_t * );
static int RunDecoder ( decoder_fifo_t * );
static int InitThread ( a52dec_t * p_adec );
static void EndThread ( a52dec_t * p_adec );
static void BitstreamCallback ( bit_stream_t *p_bit_stream,
vlc_bool_t b_new_pes );
static int InitThread ( a52dec_t * );
static void EndThread ( a52dec_t * );
static void BitstreamCallback ( bit_stream_t *, vlc_bool_t );
/*****************************************************************************
* Module descriptor
......@@ -94,6 +95,10 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
void * p_orig; /* pointer before memalign */
vlc_bool_t b_sync = 0;
mtime_t i_pts;
aout_buffer_t *p_aout_buffer;
audio_sample_format_t output_format;
/* Allocate the memory needed to store the thread's structure */
p_a52dec = (a52dec_t *)vlc_memalign( &p_orig, 16, sizeof(a52dec_t) );
memset( p_a52dec, 0, sizeof( a52dec_t ) );
......@@ -121,7 +126,6 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
/* FIXME : do we have enough room to store the decoded frames ?? */
while ((!p_a52dec->p_fifo->b_die) && (!p_a52dec->p_fifo->b_error))
{
s16 * buffer;
sync_info_t sync_info;
if( !b_sync )
......@@ -154,54 +158,64 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
continue;
}
if( ( p_a52dec->p_aout_fifo != NULL ) &&
( p_a52dec->p_aout_fifo->i_rate != sync_info.sample_rate ) )
if( ( p_a52dec->p_aout_input == NULL )||
( output_format.i_rate != sync_info.sample_rate ) )
{
/* Make sure the output thread leaves the NextFrame() function */
vlc_mutex_lock (&(p_a52dec->p_aout_fifo->data_lock));
aout_DestroyFifo (p_a52dec->p_aout_fifo);
vlc_cond_signal (&(p_a52dec->p_aout_fifo->data_wait));
vlc_mutex_unlock (&(p_a52dec->p_aout_fifo->data_lock));
if( p_a52dec->p_aout_input )
{
/* Delete old output */
msg_Warn( p_a52dec->p_fifo, "opening a new aout" );
aout_InputDelete( p_a52dec->p_aout, p_a52dec->p_aout_input );
}
p_a52dec->p_aout_fifo = NULL;
/* Set output configuration */
output_format.i_format = AOUT_FMT_S16_NE;
output_format.i_channels = 2; /* FIXME ! */
output_format.i_rate = sync_info.sample_rate;
p_a52dec->p_aout_input = aout_InputNew( p_a52dec->p_fifo,
&p_a52dec->p_aout,
&output_format );
}
/* Creating the audio output fifo if not created yet */
if (p_a52dec->p_aout_fifo == NULL ) {
p_a52dec->p_aout_fifo =
aout_CreateFifo( p_a52dec->p_fifo, AOUT_FIFO_PCM, 2,
sync_info.sample_rate, A52DEC_FRAME_SIZE, NULL );
if ( p_a52dec->p_aout_fifo == NULL )
{
p_a52dec->p_fifo->b_error = 1;
break;
}
if( p_a52dec->p_aout_input == NULL )
{
msg_Err( p_a52dec->p_fifo, "failed to create aout fifo" );
p_a52dec->p_fifo->b_error = 1;
continue;
}
CurrentPTS( &p_a52dec->bit_stream,
&p_a52dec->p_aout_fifo->date[p_a52dec->p_aout_fifo->i_end_frame],
NULL );
if( !p_a52dec->p_aout_fifo->date[p_a52dec->p_aout_fifo->i_end_frame] )
p_aout_buffer = aout_BufferNew( p_a52dec->p_aout,
p_a52dec->p_aout_input,
A52DEC_FRAME_SIZE );
if( !p_aout_buffer )
{
p_a52dec->p_aout_fifo->date[
p_a52dec->p_aout_fifo->i_end_frame] =
LAST_MDATE;
msg_Err( p_a52dec->p_fifo, "cannot get aout buffer" );
p_a52dec->p_fifo->b_error = 1;
continue;
}
buffer = ((s16 *)p_a52dec->p_aout_fifo->buffer) +
(p_a52dec->p_aout_fifo->i_end_frame * A52DEC_FRAME_SIZE);
if (decode_frame (p_a52dec, buffer))
CurrentPTS( &p_a52dec->bit_stream, &i_pts, NULL );
if( i_pts > 0 )
{
p_a52dec->i_pts = i_pts;
}
p_aout_buffer->start_date = p_a52dec->i_pts;
p_a52dec->i_pts += (mtime_t)1000000 * (mtime_t)A52DEC_FRAME_SIZE
/ (mtime_t)output_format.i_rate;
p_aout_buffer->end_date = p_a52dec->i_pts;
if (decode_frame (p_a52dec, (s16*)p_aout_buffer->p_buffer))
{
b_sync = 0;
aout_BufferDelete( p_a52dec->p_aout, p_a52dec->p_aout_input,
p_aout_buffer );
continue;
}
vlc_mutex_lock (&p_a52dec->p_aout_fifo->data_lock);
p_a52dec->p_aout_fifo->i_end_frame =
(p_a52dec->p_aout_fifo->i_end_frame + 1) & AOUT_FIFO_SIZE;
vlc_cond_signal (&p_a52dec->p_aout_fifo->data_wait);
vlc_mutex_unlock (&p_a52dec->p_aout_fifo->data_lock);
else
{
aout_BufferPlay( p_a52dec->p_aout, p_a52dec->p_aout_input,
p_aout_buffer );
}
RealignBits(&p_a52dec->bit_stream);
}
......@@ -302,7 +316,9 @@ static int InitThread( a52dec_t * p_a52dec )
/*
* Initialize the output properties
*/
p_a52dec->p_aout_fifo = NULL;
p_a52dec->p_aout = NULL;
p_a52dec->p_aout_input = NULL;
p_a52dec->i_pts = 0;
/*
* Bit stream
......@@ -319,14 +335,9 @@ static int InitThread( a52dec_t * p_a52dec )
static void EndThread (a52dec_t * p_a52dec)
{
/* If the audio output fifo was created, we destroy it */
if (p_a52dec->p_aout_fifo != NULL)
if( p_a52dec->p_aout_input )
{
aout_DestroyFifo (p_a52dec->p_aout_fifo);
/* Make sure the output thread leaves the NextFrame() function */
vlc_mutex_lock (&(p_a52dec->p_aout_fifo->data_lock));
vlc_cond_signal (&(p_a52dec->p_aout_fifo->data_wait));
vlc_mutex_unlock (&(p_a52dec->p_aout_fifo->data_lock));
aout_InputDelete( p_a52dec->p_aout, p_a52dec->p_aout_input );
}
/* Free allocated structures */
......
......@@ -2,7 +2,7 @@
* adec.h : A52 decoder interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: adec.h,v 1.2 2002/08/08 00:35:11 sam Exp $
* $Id: adec.h,v 1.3 2002/08/21 09:27:40 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Renaud Dartus <reno@videolan.org>
......@@ -399,7 +399,9 @@ struct a52dec_s
/*
* Output properties
*/
aout_fifo_t * p_aout_fifo; /* stores the decompressed audio frames */
aout_instance_t * p_aout;
aout_input_t * p_aout_input;
mtime_t i_pts;
float * samples;
void * samples_orig; /* pointer before memalign */
......
......@@ -2,7 +2,7 @@
* downmix.c : A52 downmix module
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: downmix.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: downmix.c,v 1.2 2002/08/21 09:27:40 sam Exp $
*
* Authors: Renaud Dartus <reno@via.ecp.fr>
*
......@@ -62,11 +62,13 @@ vlc_module_begin();
set_description( _("SSE A52 downmix module") );
set_capability( "downmix", 200 );
add_shortcut( "sse" );
add_requirement( SSE );
#elif defined( MODULE_NAME_IS_downmix3dn )
set_description( _("3D Now! A52 downmix module") );
set_capability( "downmix", 200 );
add_shortcut( "3dn" );
add_shortcut( "3dnow" );
add_requirement( 3DNOW );
#endif
set_callbacks( Open, NULL );
vlc_module_end();
......
......@@ -2,7 +2,7 @@
* imdct.c : IMDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: imdct.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: imdct.c,v 1.2 2002/08/21 09:27:40 sam Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
*
......@@ -60,11 +60,13 @@ vlc_module_begin();
set_description( _("SSE A52 IMDCT module") );
set_capability( "imdct", 200 );
add_shortcut( "sse" );
add_requirement( SSE );
#elif defined( MODULE_NAME_IS_imdct3dn )
set_description( _("3D Now! A52 IMDCT module") );
set_capability( "imdct", 200 );
add_shortcut( "3dn" );
add_shortcut( "3dnow" );
add_requirement( 3DNOW );
#endif
set_callbacks( Open, NULL );
vlc_module_end();
......
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