Commit 12336778 authored by Gildas Bazin's avatar Gildas Bazin

* modules/codec/a52old/*, modules/codec/mpeg_audio/*, modules/codec/mpeg_video/*: got rid of deprecated decoders.
parent 2d3c9c2c
dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.82 2003/10/04 11:17:04 sam Exp $
dnl $Id: configure.ac,v 1.83 2003/10/04 11:59:59 gbazin Exp $
AC_INIT(vlc,0.6.3-cvs)
......@@ -349,10 +349,10 @@ AM_CONDITIONAL(BUILD_GETOPT, ${need_getopt})
if test "${SYS}" != "mingw32"; then
AC_TYPE_SIGNAL
AC_CHECK_LIB(m,cos,[
AX_ADD_LDFLAGS([imdct adjust distort a52tofloat32],[-lm])
AX_ADD_LDFLAGS([adjust distort a52tofloat32],[-lm])
])
AC_CHECK_LIB(m,pow,[
AX_ADD_LDFLAGS([ffmpeg stream_out_transcode imdct imdct3dn imdctsse i420_rgb faad],[-lm])
AX_ADD_LDFLAGS([ffmpeg stream_out_transcode i420_rgb faad],[-lm])
])
AC_CHECK_LIB(m,sqrt,[
AX_ADD_LDFLAGS([headphone_channel_mixer],[-lm])
......@@ -826,12 +826,6 @@ case "${target_cpu}" in
;;
esac
case "${ARCH}" in
hppa64)
AX_ADD_CFLAGS([mpeg_video_old],[-ffunction-sections])
;;
esac
dnl
dnl Enable profiling
dnl
......@@ -845,7 +839,6 @@ test "${enable_cprof}" != "yes" && enable_cprof="no"
dnl
dnl default modules
dnl
#AX_ADD_BUILTINS([mpeg_video_old idct idctclassic motion])
AX_ADD_PLUGINS([dummy rc logger gestures memcpy])
AX_ADD_PLUGINS([es mpga m4v mpeg_system ps ts avi asf aac mp4 rawdv])
AX_ADD_PLUGINS([spudec mpeg_audio lpcm a52 dts cinepak])
......@@ -3375,16 +3368,9 @@ AC_OUTPUT([
modules/audio_mixer/Makefile
modules/audio_output/Makefile
modules/codec/Makefile
modules/codec/a52old/Makefile
modules/codec/a52old/downmix/Makefile
modules/codec/a52old/imdct/Makefile
modules/codec/faad/Makefile
modules/codec/ffmpeg/Makefile
modules/codec/ffmpeg/postprocessing/Makefile
modules/codec/mpeg_audio/Makefile
modules/codec/mpeg_video/Makefile
modules/codec/mpeg_video/idct/Makefile
modules/codec/mpeg_video/motion/Makefile
modules/codec/spudec/Makefile
modules/control/Makefile
modules/control/corba/Makefile
......
.deps
.dirstamp
*.lo
*.la
*.dll
*.dylib
*.sl
*.so
Makefile.am
Makefile.in
Makefile
SOURCES_a52old = \
a52old.c \
adec.h \
internal.h \
decoder.c \
decoder.h \
parse.c \
exponent.c \
exponent.h \
bit_allocate.c \
mantissa.c \
mantissa.h \
rematrix.c \
imdct.c \
imdct.h \
downmix.h \
$(NULL)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* decoder.c: core A52 decoder
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: decoder.c,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@zoy.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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 <string.h> /* memcpy() */
#include <vlc/vlc.h>
#include <vlc/decoder.h>
#include "imdct.h"
#include "downmix.h"
#include "adec.h" /* a52dec_thread_t */
#include "internal.h"
static const float cmixlev_lut[4] = { 0.707, 0.595, 0.500, 0.707 };
static const float smixlev_lut[4] = { 0.707, 0.500, 0.0 , 0.500 };
int E_( a52_init )(a52dec_t * p_a52dec)
{
p_a52dec->mantissa.lfsr_state = 1; /* dither_gen initialization */
E_( imdct_init )(p_a52dec->p_imdct) ;
return 0;
}
int decode_frame (a52dec_t * p_a52dec, s16 * buffer)
{
int i;
if (parse_bsi (p_a52dec))
{
msg_Warn( p_a52dec->p_fifo, "parse error" );
parse_auxdata (p_a52dec);
return 1;
}
/* compute downmix parameters
* downmix to tow channels for now */
p_a52dec->dm_par.clev = 0.0;
p_a52dec->dm_par.slev = 0.0;
p_a52dec->dm_par.unit = 1.0;
if (p_a52dec->bsi.acmod & 0x1) /* have center */
p_a52dec->dm_par.clev = cmixlev_lut[p_a52dec->bsi.cmixlev];
if (p_a52dec->bsi.acmod & 0x4) /* have surround channels */
p_a52dec->dm_par.slev = smixlev_lut[p_a52dec->bsi.surmixlev];
p_a52dec->dm_par.unit /= 1.0 + p_a52dec->dm_par.clev + p_a52dec->dm_par.slev;
p_a52dec->dm_par.clev *= p_a52dec->dm_par.unit;
p_a52dec->dm_par.slev *= p_a52dec->dm_par.unit;
for (i = 0; i < 6; i++) {
/* Initialize freq/time sample storage */
memset(p_a52dec->samples, 0, sizeof(float) * 256 *
(p_a52dec->bsi.nfchans + p_a52dec->bsi.lfeon));
if( p_a52dec->p_fifo->b_die || p_a52dec->p_fifo->b_error )
{
return 1;
}
if( parse_audblk( p_a52dec, i ) )
{
msg_Warn( p_a52dec->p_fifo, "audioblock error" );
parse_auxdata( p_a52dec );
return 1;
}
if( p_a52dec->p_fifo->b_die || p_a52dec->p_fifo->b_error )
{
return 1;
}
if( exponent_unpack( p_a52dec ) )
{
msg_Warn( p_a52dec->p_fifo, "unpack error" );
parse_auxdata( p_a52dec );
return 1;
}
bit_allocate (p_a52dec);
mantissa_unpack (p_a52dec);
if( p_a52dec->p_fifo->b_die || p_a52dec->p_fifo->b_error )
{
return 1;
}
if (p_a52dec->bsi.acmod == 0x2)
{
rematrix (p_a52dec);
}
imdct (p_a52dec, buffer);
buffer += 2 * 256;
}
parse_auxdata (p_a52dec);
return 0;
}
This diff is collapsed.
/*****************************************************************************
* downmix.h : A52 downmix types
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: downmix.h,v 1.3 2002/08/08 00:35:11 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Renaud Dartus <reno@videolan.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.
*****************************************************************************/
typedef struct dm_par_t
{
float unit;
float clev;
float slev;
} dm_par_t;
typedef struct downmix_t
{
VLC_COMMON_MEMBERS
/* Module used and shortcuts */
module_t * p_module;
void (*pf_downmix_3f_2r_to_2ch)(float *, dm_par_t * dm_par);
void (*pf_downmix_3f_1r_to_2ch)(float *, dm_par_t * dm_par);
void (*pf_downmix_2f_2r_to_2ch)(float *, dm_par_t * dm_par);
void (*pf_downmix_2f_1r_to_2ch)(float *, dm_par_t * dm_par);
void (*pf_downmix_3f_0r_to_2ch)(float *, dm_par_t * dm_par);
void (*pf_stream_sample_2ch_to_s16)(s16 *, float *left, float *right);
void (*pf_stream_sample_1ch_to_s16)(s16 *, float *center);
} downmix_t;
.deps
.dirstamp
*.lo
*.la
*.dll
*.dylib
*.sl
*.so
Makefile.am
Makefile.in
Makefile
SOURCES_downmix = \
downmix.c \
downmix_c.c \
downmix_common.h \
$(NULL)
SOURCES_downmixsse = \
downmix.c \
downmix_sse.c \
downmix_common.h \
$(NULL)
SOURCES_downmix3dn = \
downmix.c \
downmix_3dn.c \
downmix_common.h \
$(NULL)
/*****************************************************************************
* downmix.c : A52 downmix module
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: downmix.c,v 1.2 2002/08/21 09:27:40 sam Exp $
*
* Authors: Renaud Dartus <reno@via.ecp.fr>
*
* 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 <stdlib.h>
#include <string.h>
#include <vlc/vlc.h>
#include "../downmix.h"
#include "downmix_common.h"
/*****************************************************************************
* Module initializer
*****************************************************************************/
static int Open ( vlc_object_t *p_this )
{
downmix_t *p_downmix = (downmix_t *)p_this;
p_downmix->pf_downmix_3f_2r_to_2ch = E_( downmix_3f_2r_to_2ch );
p_downmix->pf_downmix_3f_1r_to_2ch = E_( downmix_3f_1r_to_2ch );
p_downmix->pf_downmix_2f_2r_to_2ch = E_( downmix_2f_2r_to_2ch );
p_downmix->pf_downmix_2f_1r_to_2ch = E_( downmix_2f_1r_to_2ch );
p_downmix->pf_downmix_3f_0r_to_2ch = E_( downmix_3f_0r_to_2ch );
p_downmix->pf_stream_sample_2ch_to_s16 = E_( stream_sample_2ch_to_s16 );
p_downmix->pf_stream_sample_1ch_to_s16 = E_( stream_sample_1ch_to_s16 );
return VLC_SUCCESS;
}
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
#ifdef MODULE_NAME_IS_downmix
set_description( _("A52 downmix module") );
set_capability( "downmix", 50 );
add_shortcut( "c" );
#elif defined( MODULE_NAME_IS_downmixsse )
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();
/*****************************************************************************
* downmix_3dn.c: accelerated 3D Now! A52 downmix functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: downmix_3dn.c,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.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 <vlc/vlc.h>
#include "../downmix.h"
static const float sqrt2_3dn __asm__ ("sqrt2_3dn") = 0.7071068;
void E_( downmix_3f_2r_to_2ch ) (float * samples, dm_par_t * dm_par)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $128, %%ebx\n" /* loop counter */
"movd (%%ecx), %%mm5\n" /* unit */
"punpckldq %%mm5, %%mm5\n" /* unit | unit */
"movd 4(%%ecx), %%mm6\n" /* clev */
"punpckldq %%mm6, %%mm6\n" /* clev | clev */
"movd 8(%%ecx), %%mm7\n" /* slev */
"punpckldq %%mm7, %%mm7\n" /* slev | slev */
".align 16\n"
".loop:\n"
"movq (%%eax), %%mm0\n" /* left */
"movq 2048(%%eax), %%mm1\n" /* right */
"movq 1024(%%eax), %%mm2\n" /* center */
"movq 3072(%%eax), %%mm3\n" /* leftsur */
"movq 4096(%%eax), %%mm4\n" /* rightsur */
"pfmul %%mm5, %%mm0\n"
"pfmul %%mm5, %%mm1\n"
"pfmul %%mm6, %%mm2\n"
"pfadd %%mm2, %%mm0\n"
"pfadd %%mm2, %%mm1\n"
"pfmul %%mm7, %%mm3\n"
"pfmul %%mm7, %%mm4\n"
"pfadd %%mm3, %%mm0\n"
"pfadd %%mm4, %%mm1\n"
"movq %%mm0, (%%eax)\n"
"movq %%mm1, 1024(%%eax)\n"
"addl $8, %%eax\n"
"decl %%ebx\n"
"jnz .loop\n"
"popl %%ebx\n"
"femms\n"
: "=a" (samples)
: "a" (samples), "c" (dm_par));
}
void E_( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t * dm_par)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $128, %%ebx\n" /* loop counter */
"movd (%%ecx), %%mm5\n" /* unit */
"punpckldq %%mm5, %%mm5\n" /* unit | unit */
"movd 8(%%ecx), %%mm7\n" /* slev */
"punpckldq %%mm7, %%mm7\n" /* slev | slev */
".align 16\n"
".loop3:\n"
"movq (%%eax), %%mm0\n" /* left */
"movq 1024(%%eax), %%mm1\n" /* right */
"movq 2048(%%eax), %%mm3\n" /* leftsur */
"movq 3072(%%eax), %%mm4\n" /* rightsur */
"pfmul %%mm5, %%mm0\n"
"pfmul %%mm5, %%mm1\n"
"pfmul %%mm7, %%mm3\n"
"pfmul %%mm7, %%mm4\n"
"pfadd %%mm3, %%mm0\n"
"pfadd %%mm4, %%mm1\n"
"movq %%mm0, (%%eax)\n"
"movq %%mm1, 1024(%%eax)\n"
"addl $8, %%eax\n"
"decl %%ebx\n"
"jnz .loop3\n"
"popl %%ebx\n"
"femms\n"
: "=a" (samples)
: "a" (samples), "c" (dm_par));
}
void E_( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t * dm_par)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $128, %%ebx\n" /* loop counter */
"movd (%%ecx), %%mm5\n" /* unit */
"punpckldq %%mm5, %%mm5\n" /* unit | unit */
"movd 4(%%ecx), %%mm6\n" /* clev */
"punpckldq %%mm6, %%mm6\n" /* clev | clev */
"movd 8(%%ecx), %%mm7\n" /* slev */
"punpckldq %%mm7, %%mm7\n" /* slev | slev */
".align 16\n"
".loop4:\n"
"movq (%%eax), %%mm0\n" /* left */
"movq 2048(%%eax), %%mm1\n" /* right */
"movq 1024(%%eax), %%mm2\n" /* center */
"movq 3072(%%eax), %%mm3\n" /* sur */
"pfmul %%mm5, %%mm0\n"
"pfmul %%mm5, %%mm1\n"
"pfmul %%mm6, %%mm2\n"
"pfadd %%mm2, %%mm0\n"
"pfmul %%mm7, %%mm3\n"
"pfadd %%mm2, %%mm1\n"
"pfsub %%mm3, %%mm0\n"
"pfadd %%mm3, %%mm1\n"
"movq %%mm0, (%%eax)\n"
"movq %%mm1, 1024(%%eax)\n"
"addl $8, %%eax\n"
"decl %%ebx\n"
"jnz .loop4\n"
"popl %%ebx\n"
"femms\n"
: "=a" (samples)
: "a" (samples), "c" (dm_par));
}
void E_( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t * dm_par)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $128, %%ebx\n" /* loop counter */
"movd (%%ecx), %%mm5\n" /* unit */
"punpckldq %%mm5, %%mm5\n" /* unit | unit */
"movd 8(%%ecx), %%mm7\n" /* slev */
"punpckldq %%mm7, %%mm7\n" /* slev | slev */
".align 16\n"
".loop5:\n"
"movq (%%eax), %%mm0\n" /* left */
"movq 1024(%%eax), %%mm1\n" /* right */
"movq 2048(%%eax), %%mm3\n" /* sur */
"pfmul %%mm5, %%mm0\n"
"pfmul %%mm5, %%mm1\n"
"pfmul %%mm7, %%mm3\n"
"pfsub %%mm3, %%mm0\n"
"pfadd %%mm3, %%mm1\n"
"movq %%mm0, (%%eax)\n"
"movq %%mm1, 1024(%%eax)\n"
"addl $8, %%eax\n"
"decl %%ebx\n"
"jnz .loop5\n"
"popl %%ebx\n"
"femms\n"
: "=a" (samples)
: "a" (samples), "c" (dm_par));
}
void E_( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t * dm_par)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $128, %%ebx\n" /* loop counter */
"movd (%%ecx), %%mm5\n" /* unit */
"punpckldq %%mm5, %%mm5\n" /* unit | unit */
"movd 4(%%ecx), %%mm6\n" /* clev */
"punpckldq %%mm6, %%mm6\n" /* clev | clev */
".align 16\n"
".loop6:\n"
"movq (%%eax), %%mm0\n" /*left */
"movq 2048(%%eax), %%mm1\n" /* right */
"movq 1024(%%eax), %%mm2\n" /* center */
"pfmul %%mm5, %%mm0\n"
"pfmul %%mm5, %%mm1\n"
"pfmul %%mm6, %%mm2\n"
"pfadd %%mm2, %%mm0\n"
"pfadd %%mm2, %%mm1\n"
"movq %%mm0, (%%eax)\n"
"movq %%mm1, 1024(%%eax)\n"
"addl $8, %%eax\n"
"decl %%ebx\n"
"jnz .loop6\n"
"popl %%ebx\n"
"femms\n"
: "=a" (samples)
: "a" (samples), "c" (dm_par));
}
void E_( stream_sample_1ch_to_s16 ) (s16 *s16_samples, float *left)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"pushl %%edx\n"
"movl $sqrt2_3dn, %%edx\n"
"movd (%%edx), %%mm7\n"
"punpckldq %%mm7, %%mm7\n" /* sqrt2 | sqrt2 */
"movl $128, %%ebx\n"
".align 16\n"
".loop2:\n"
"movq (%%ecx), %%mm0\n" /* c1 | c0 */
"pfmul %%mm7, %%mm0\n"
"pf2id %%mm0, %%mm0\n" /* c1 c0 --> mm0, int_32 */
"packssdw %%mm0, %%mm0\n" /* c1 c1 c0 c0 --> mm0, int_16 */
"movq %%mm0, (%%eax)\n"
"addl $8, %%eax\n"
"addl $8, %%ecx\n"
"decl %%ebx\n"
"jnz .loop2\n"
"popl %%edx\n"
"popl %%ebx\n"
"femms\n"
: "=a" (s16_samples), "=c" (left)
: "a" (s16_samples), "c" (left));
}
void E_( stream_sample_2ch_to_s16 ) (s16 *s16_samples, float *left, float *right)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $128, %%ebx\n"
".align 16\n"
".loop1:\n"
"movq (%%ecx), %%mm0\n" /* l1 | l0 */
"movq (%%edx), %%mm1\n" /* r1 | r0 */
"movq %%mm0, %%mm2\n" /* l1 | l0 */
"punpckldq %%mm1, %%mm0\n" /* r0 | l0 */
"punpckhdq %%mm1, %%mm2\n" /* r1 | l1 */
"pf2id %%mm0, %%mm0\n" /* r0 l0 --> mm0, int_32 */
"pf2id %%mm2, %%mm2\n" /* r0 l0 --> mm0, int_32 */
"packssdw %%mm2, %%mm0\n" /* r1 l1 r0 l0 --> mm0, int_16 */
"movq %%mm0, (%%eax)\n"
"movq %%mm2, 8(%%eax)\n"
"addl $8, %%eax\n"
"addl $8, %%ecx\n"
"addl $8, %%edx\n"
"decl %%ebx\n"
"jnz .loop1\n"
"popl %%ebx\n"
"femms\n"
: "=a" (s16_samples), "=c" (left), "=d" (right)
: "a" (s16_samples), "c" (left), "d" (right));
}
/*****************************************************************************
* downmix_c.c: A52 downmix functions in C
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: downmix_c.c,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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 <string.h> /* memcpy() */
#include <vlc/vlc.h>
#include "../downmix.h"
void E_( downmix_3f_2r_to_2ch ) (float *samples, dm_par_t *dm_par)
{
int i;
float *left, *right, *center, *left_sur, *right_sur;
float left_tmp, right_tmp;
left = samples;
center = samples + 256;
right = samples + 256*2;
left_sur = samples + 256*3;
right_sur = samples + 256*4;
for (i=0; i < 256; i++) {
left_tmp = dm_par->unit * *left + dm_par->clev * *center + dm_par->slev * *left_sur++;
right_tmp = dm_par->unit * *right++ + dm_par->clev * *center + dm_par->slev * *right_sur++;
*left++ = left_tmp;
*center++ = right_tmp;
}
}
void E_( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t *dm_par)
{
int i;
float *left, *right, *left_sur, *right_sur;
float left_tmp, right_tmp;
left = &samples[0];
right = &samples[256];
left_sur = &samples[512];
right_sur = &samples[768];
for (i = 0; i < 256; i++) {
left_tmp = dm_par->unit * *left + dm_par->slev * *left_sur++;
right_tmp= dm_par->unit * *right + dm_par->slev * *right_sur++;
*left++ = left_tmp;
*right++ = right_tmp;
}
}
void E_( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t *dm_par)
{
int i;
float *left, *right, *center, *right_sur;
float left_tmp, right_tmp;
left = &samples[0];
right = &samples[512];
center = &samples[256];
right_sur = &samples[768];
for (i = 0; i < 256; i++) {
left_tmp = dm_par->unit * *left + dm_par->clev * *center - dm_par->slev * *right_sur;
right_tmp= dm_par->unit * *right++ + dm_par->clev * *center + dm_par->slev * *right_sur++;
*left++ = left_tmp;
*center++ = right_tmp;
}
}
void E_( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t *dm_par)
{
int i;
float *left, *right, *right_sur;
float left_tmp, right_tmp;
left = &samples[0];
right = &samples[256];
right_sur = &samples[512];
for (i = 0; i < 256; i++) {
left_tmp = dm_par->unit * *left - dm_par->slev * *right_sur;
right_tmp= dm_par->unit * *right + dm_par->slev * *right_sur++;
*left++ = left_tmp;
*right++ = right_tmp;
}
}
void E_( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t *dm_par)
{
int i;
float *left, *right, *center;
float left_tmp, right_tmp;
left = &samples[0];
center = &samples[256];
right = &samples[512];
for (i = 0; i < 256; i++) {
left_tmp = dm_par->unit * *left + dm_par->clev * *center;
right_tmp= dm_par->unit * *right++ + dm_par->clev * *center;
*left++ = left_tmp;
*center++ = right_tmp;
}
}
void E_( stream_sample_2ch_to_s16 ) (s16 *out_buf, float *left, float *right)
{
int i;
for (i=0; i < 256; i++) {
*out_buf++ = (s16) (*left++);
*out_buf++ = (s16) (*right++);
}
}
void E_( stream_sample_1ch_to_s16 ) (s16 *out_buf, float *center)
{
int i;
float tmp;
for (i=0; i < 256; i++) {
*out_buf++ = tmp = (s16) (0.7071f * *center++);
*out_buf++ = tmp;
}
}
/*****************************************************************************
* downmix_common.h: A52 downmix functions headers
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: downmix_common.h,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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.
*****************************************************************************/
void E_( downmix_3f_2r_to_2ch ) ( float *, dm_par_t * );
void E_( downmix_2f_2r_to_2ch ) ( float *, dm_par_t * );
void E_( downmix_3f_1r_to_2ch ) ( float *, dm_par_t * );
void E_( downmix_2f_1r_to_2ch ) ( float *, dm_par_t * );
void E_( downmix_3f_0r_to_2ch ) ( float *, dm_par_t * );
void E_( stream_sample_2ch_to_s16 ) ( s16 *, float *, float * );
void E_( stream_sample_1ch_to_s16 ) ( s16 *, float * );
/*****************************************************************************
* downmix_sse.c: accelerated SSE A52 downmix functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: downmix_sse.c,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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 <vlc/vlc.h>
#include "../downmix.h"
static const float sqrt2_sse __asm__ ("sqrt2_sse") __attribute__ ((aligned (16))) = 0.7071068;
void E_( downmix_3f_2r_to_2ch ) (float * samples, dm_par_t * dm_par)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $64, %%ebx\n" /* loop counter */
"movss (%%ecx), %%xmm5\n" /* unit */
"shufps $0, %%xmm5, %%xmm5\n" /* unit | unit | unit | unit */
"movss 4(%%ecx), %%xmm6\n" /* clev */
"shufps $0, %%xmm6, %%xmm6\n" /* clev | clev | clev | clev */
"movss 8(%%ecx), %%xmm7\n" /* slev */
"shufps $0, %%xmm7, %%xmm7\n" /* slev | slev | slev | slev */
".align 16\n"
".loop:\n"
"movaps (%%eax), %%xmm0\n" /* left */
"movaps 2048(%%eax), %%xmm1\n" /* right */
"movaps 1024(%%eax), %%xmm2\n" /* center */
"movaps 3072(%%eax), %%xmm3\n" /* leftsur */
"movaps 4096(%%eax), %%xmm4\n" /* rithgsur */
"mulps %%xmm5, %%xmm0\n"
"mulps %%xmm5, %%xmm1\n"
"mulps %%xmm6, %%xmm2\n"
"addps %%xmm2, %%xmm0\n"
"addps %%xmm2, %%xmm1\n"
"mulps %%xmm7, %%xmm3\n"
"mulps %%xmm7, %%xmm4\n"
"addps %%xmm3, %%xmm0\n"
"addps %%xmm4, %%xmm1\n"
"movaps %%xmm0, (%%eax)\n"
"movaps %%xmm1, 1024(%%eax)\n"
"addl $16, %%eax\n"
"decl %%ebx\n"
"jnz .loop\n"
"popl %%ebx\n"
: "=a" (samples)
: "a" (samples), "c" (dm_par));
}
void E_( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t * dm_par)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $64, %%ebx\n" /* loop counter */
"movss (%%ecx), %%xmm5\n" /* unit */
"shufps $0, %%xmm5, %%xmm5\n" /* unit | unit | unit | unit */
"movss 8(%%ecx), %%xmm7\n" /* slev */
"shufps $0, %%xmm7, %%xmm7\n" /* slev | slev | slev | slev */
".align 16\n"
".loop3:\n"
"movaps (%%eax), %%xmm0\n" /* left */
"movaps 1024(%%eax), %%xmm1\n" /* right */
"movaps 2048(%%eax), %%xmm3\n" /* leftsur */
"movaps 3072(%%eax), %%xmm4\n" /* rightsur */
"mulps %%xmm5, %%xmm0\n"
"mulps %%xmm5, %%xmm1\n"
"mulps %%xmm7, %%xmm3\n"
"mulps %%xmm7, %%xmm4\n"
"addps %%xmm3, %%xmm0\n"
"addps %%xmm4, %%xmm1\n"
"movaps %%xmm0, (%%eax)\n"
"movaps %%xmm1, 1024(%%eax)\n"
"addl $16, %%eax\n"
"decl %%ebx\n"
"jnz .loop3\n"
"popl %%ebx\n"
: "=a" (samples)
: "a" (samples), "c" (dm_par));
}
void E_( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t * dm_par)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $64, %%ebx\n" /* loop counter */
"movss (%%ecx), %%xmm5\n" /* unit */
"shufps $0, %%xmm5, %%xmm5\n" /* unit | unit | unit | unit */
"movss 4(%%ecx), %%xmm6\n" /* clev */
"shufps $0, %%xmm6, %%xmm6\n" /* clev | clev | clev | clev */
"movss 8(%%ecx), %%xmm7\n" /* slev */
"shufps $0, %%xmm7, %%xmm7\n" /* slev | slev | slev | slev */
".align 16\n"
".loop4:\n"
"movaps (%%eax), %%xmm0\n" /* left */
"movaps 2048(%%eax), %%xmm1\n" /* right */
"movaps 1024(%%eax), %%xmm2\n" /* center */
"movaps 3072(%%eax), %%xmm3\n" /* sur */
"mulps %%xmm5, %%xmm0\n"
"mulps %%xmm5, %%xmm1\n"
"mulps %%xmm6, %%xmm2\n"
"addps %%xmm2, %%xmm0\n"
"mulps %%xmm7, %%xmm3\n"
"addps %%xmm2, %%xmm1\n"
"subps %%xmm3, %%xmm0\n"
"addps %%xmm3, %%xmm1\n"
"movaps %%xmm0, (%%eax)\n"
"movaps %%xmm1, 1024(%%eax)\n"
"addl $16, %%eax\n"
"decl %%ebx\n"
"jnz .loop4\n"
"popl %%ebx\n"
: "=a" (samples)
: "a" (samples), "c" (dm_par));
}
void E_( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t * dm_par)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $64, %%ebx\n" /* loop counter */
"movss (%%ecx), %%xmm5\n" /* unit */
"shufps $0, %%xmm5, %%xmm5\n" /* unit | unit | unit | unit */
"movss 8(%%ecx), %%xmm7\n" /* slev */
"shufps $0, %%xmm7, %%xmm7\n" /* slev | slev | slev | slev */
".align 16\n"
".loop5:\n"
"movaps (%%eax), %%xmm0\n" /* left */
"movaps 1024(%%eax), %%xmm1\n" /* right */
"movaps 2048(%%eax), %%xmm3\n" /* sur */
"mulps %%xmm5, %%xmm0\n"
"mulps %%xmm5, %%xmm1\n"
"mulps %%xmm7, %%xmm3\n"
"subps %%xmm3, %%xmm0\n"
"addps %%xmm3, %%xmm1\n"
"movaps %%xmm0, (%%eax)\n"
"movaps %%xmm1, 1024(%%eax)\n"
"addl $16, %%eax\n"
"decl %%ebx\n"
"jnz .loop5\n"
"popl %%ebx\n"
: "=a" (samples)
: "a" (samples), "c" (dm_par));
}
void E_( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t * dm_par)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $64, %%ebx\n" /* loop counter */
"movss (%%ecx), %%xmm5\n" /* unit */
"shufps $0, %%xmm5, %%xmm5\n" /* unit | unit | unit | unit */
"movss 4(%%ecx), %%xmm6\n" /* clev */
"shufps $0, %%xmm6, %%xmm6\n" /* clev | clev | clev | clev */
".align 16\n"
".loop6:\n"
"movaps (%%eax), %%xmm0\n" /*left */
"movaps 2048(%%eax), %%xmm1\n" /* right */
"movaps 1024(%%eax), %%xmm2\n" /* center */
"mulps %%xmm5, %%xmm0\n"
"mulps %%xmm5, %%xmm1\n"
"mulps %%xmm6, %%xmm2\n"
"addps %%xmm2, %%xmm0\n"
"addps %%xmm2, %%xmm1\n"
"movaps %%xmm0, (%%eax)\n"
"movaps %%xmm1, 1024(%%eax)\n"
"addl $16, %%eax\n"
"decl %%ebx\n"
"jnz .loop6\n"
"popl %%ebx\n"
: "=a" (samples)
: "a" (samples), "c" (dm_par));
}
void E_( stream_sample_1ch_to_s16 ) (s16 *s16_samples, float *left)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"pushl %%edx\n"
"movl $sqrt2_sse, %%edx\n"
"movss (%%edx), %%xmm7\n"
"shufps $0, %%xmm7, %%xmm7\n" /* sqrt2 | sqrt2 | sqrt2 | sqrt2 */
"movl $64, %%ebx\n"
".align 16\n"
".loop2:\n"
"movaps (%%ecx), %%xmm0\n" /* c3 | c2 | c1 | c0 */
"mulps %%xmm7, %%xmm0\n"
"movhlps %%xmm0, %%xmm2\n" /* c3 | c2 */
"cvtps2pi %%xmm0, %%mm0\n" /* c1 c0 --> mm0, int_32 */
"cvtps2pi %%xmm2, %%mm1\n" /* c3 c2 --> mm1, int_32 */
"packssdw %%mm0, %%mm0\n" /* c1 c1 c0 c0 --> mm0, int_16 */
"packssdw %%mm1, %%mm1\n" /* c3 c3 c2 c2 --> mm1, int_16 */
"movq %%mm0, (%%eax)\n"
"movq %%mm1, 8(%%eax)\n"
"addl $16, %%eax\n"
"addl $16, %%ecx\n"
"decl %%ebx\n"
"jnz .loop2\n"
"popl %%edx\n"
"popl %%ebx\n"
"emms\n"
: "=a" (s16_samples), "=c" (left)
: "a" (s16_samples), "c" (left));
}
void E_( stream_sample_2ch_to_s16 ) (s16 *s16_samples, float *left, float *right)
{
__asm__ __volatile__ (
".align 16\n"
"pushl %%ebx\n"
"movl $64, %%ebx\n"
".align 16\n"
".loop1:\n"
"movaps (%%ecx), %%xmm0\n" /* l3 | l2 | l1 | l0 */
"movaps (%%edx), %%xmm1\n" /* r3 | r2 | r1 | r0 */
"movhlps %%xmm0, %%xmm2\n" /* l3 | l2 */
"movhlps %%xmm1, %%xmm3\n" /* r3 | r2 */
"unpcklps %%xmm1, %%xmm0\n" /* r1 | l1 | r0 | l0 */
"unpcklps %%xmm3, %%xmm2\n" /* r3 | l3 | r2 | l2 */
"cvtps2pi %%xmm0, %%mm0\n" /* r0 l0 --> mm0, int_32 */
"movhlps %%xmm0, %%xmm0\n"
"cvtps2pi %%xmm0, %%mm1\n" /* r1 l1 --> mm1, int_32 */
"cvtps2pi %%xmm2, %%mm2\n" /* r2 l2 --> mm2, int_32 */
"movhlps %%xmm2, %%xmm2\n"
"cvtps2pi %%xmm2, %%mm3\n" /* r3 l3 --> mm3, int_32 */
"packssdw %%mm1, %%mm0\n" /* r1 l1 r0 l0 --> mm0, int_16 */
"packssdw %%mm3, %%mm2\n" /* r3 l3 r2 l2 --> mm2, int_16 */
"movq %%mm0, (%%eax)\n"
"movq %%mm2, 8(%%eax)\n"
"addl $16, %%eax\n"
"addl $16, %%ecx\n"
"addl $16, %%edx\n"
"decl %%ebx\n"
"jnz .loop1\n"
"popl %%ebx\n"
"emms\n"
: "=a" (s16_samples), "=c" (left), "=d" (right)
: "a" (s16_samples), "c" (left), "d" (right));
}
/*****************************************************************************
* exponent.c: A52 exponent calculations
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: exponent.c,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@zoy.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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 <string.h> /* memcpy(), memset() */
#include <vlc/vlc.h>
#include <vlc/decoder.h>
#include "imdct.h"
#include "downmix.h"
#include "adec.h"
#include "internal.h"
#include "exponent.h"
int exponent_unpack (a52dec_t * p_a52dec)
{
u16 i;
for (i = 0; i < p_a52dec->bsi.nfchans; i++)
{
if (exp_unpack_ch (p_a52dec, UNPACK_FBW, p_a52dec->audblk.chexpstr[i],
p_a52dec->audblk.nchgrps[i],
p_a52dec->audblk.exps[i][0],
&p_a52dec->audblk.exps[i][1],
p_a52dec->audblk.fbw_exp[i]))
{
return 1;
}
}
if (p_a52dec->audblk.cplinu)
{
if (exp_unpack_ch (p_a52dec, UNPACK_CPL, p_a52dec->audblk.cplexpstr,
p_a52dec->audblk.ncplgrps,
p_a52dec->audblk.cplabsexp << 1,
p_a52dec->audblk.cplexps,
&p_a52dec->audblk.cpl_exp[p_a52dec->audblk.cplstrtmant]))
{
return 1;
}
}
if (p_a52dec->bsi.lfeon)
{
if (exp_unpack_ch (p_a52dec, UNPACK_LFE, p_a52dec->audblk.lfeexpstr,
2, p_a52dec->audblk.lfeexps[0],
&p_a52dec->audblk.lfeexps[1],
p_a52dec->audblk.lfe_exp))
{
return 1;
}
}
return 0;
}
/*****************************************************************************
* exponent.h: A52 exponent calculations
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: exponent.h,v 1.2 2002/08/08 00:35:11 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@zoy.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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.
*****************************************************************************/
static const s16 exps_1[128] =
{
-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
0, 0, 0
};
static const s16 exps_2[128] =
{
-2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
-2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
-2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
-2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
-2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
0, 0, 0
};
static const s16 exps_3[128] =
{
-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
0, 0, 0
};
#define UNPACK_FBW 1
#define UNPACK_CPL 2
#define UNPACK_LFE 4
static inline int exp_unpack_ch( a52dec_t * p_a52dec, u16 type,
u16 expstr, u16 ngrps, u16 initial_exp,
u16 exps[], s16 * dest )
{
u16 i,j;
s16 exp_acc;
if (expstr == EXP_REUSE)
{
return 0;
}
/* Handle the initial absolute exponent */
exp_acc = initial_exp;
j = 0;
/* In the case of a fbw channel then the initial absolute values is
* also an exponent */
if (type != UNPACK_CPL)
{
dest[j++] = exp_acc;
}
/* Loop through the groups and fill the dest array appropriately */
switch (expstr)
{
case EXP_D15: /* 1 */
for (i = 0; i < ngrps; i++)
{
if (exps[i] > 124)
{
msg_Err( p_a52dec->p_fifo, "invalid exponent" );
return 1;
}
exp_acc += (exps_1[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
exp_acc += (exps_2[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
exp_acc += (exps_3[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
}
break;
case EXP_D25: /* 2 */
for (i = 0; i < ngrps; i++)
{
if (exps[i] > 124)
{
msg_Err( p_a52dec->p_fifo, "invalid exponent" );
return 1;
}
exp_acc += (exps_1[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_2[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_3[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
}
break;
case EXP_D45: /* 3 */
for (i = 0; i < ngrps; i++)
{
if (exps[i] > 124)
{
msg_Err( p_a52dec->p_fifo, "invalid exponent" );
return 1;
}
exp_acc += (exps_1[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_2[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_3[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
}
break;
}
return 0;
}
This diff is collapsed.
/*****************************************************************************
* imdct.h : A52 IMDCT types
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: imdct.h,v 1.3 2002/08/08 00:35:11 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Renaud Dartus <reno@videolan.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.
*****************************************************************************/
typedef struct complex_t
{
float real;
float imag;
} complex_t;
#define N 512
typedef struct imdct_t imdct_t;
struct imdct_t
{
VLC_COMMON_MEMBERS
complex_t * buf;
void * buf_orig; /* pointer before memalign */
/* Delay buffer for time domain interleaving */
float * delay;
void * delay_orig; /* pointer before memalign */
float * delay1;
void * delay1_orig; /* pointer before memalign */
/* Twiddle factors for IMDCT */
float * xcos1;
void * xcos1_orig; /* pointer before memalign */
float * xsin1;
void * xsin1_orig; /* pointer before memalign */
float * xcos2;
void * xcos2_orig; /* pointer before memalign */
float * xsin2;
void * xsin2_orig; /* pointer before memalign */
float * xcos_sin_sse;
void * xcos_sin_sse_orig; /* pointer before memalign */
/* Twiddle factor LUT */
complex_t * w_2;
void * w_2_orig; /* pointer before memalign */
complex_t * w_4;
void * w_4_orig; /* pointer before memalign */
complex_t * w_8;
void * w_8_orig; /* pointer before memalign */
complex_t * w_16;
void * w_16_orig; /* pointer before memalign */
complex_t * w_32;
void * w_32_orig; /* pointer before memalign */
complex_t * w_64;
void * w_64_orig; /* pointer before memalign */
complex_t * w_1;
void * w_1_orig; /* pointer before memalign */
/* Module used and shortcuts */
module_t * p_module;
void (*pf_imdct_init) ( imdct_t * );
#if 0
void (*pf_fft_64p) (complex_t *a);
#endif
void (*pf_imdct_256) ( imdct_t *, float [], float [] );
void (*pf_imdct_256_nol) ( imdct_t *, float [], float [] );
void (*pf_imdct_512) ( imdct_t *, float [], float [] );
void (*pf_imdct_512_nol) ( imdct_t *, float [], float [] );
};
.deps
.dirstamp
*.lo
*.la
*.dll
*.dylib
*.sl
*.so
Makefile.am
Makefile.in
Makefile
COMMON_imdct = \
imdct.c \
imdct_common.c
SOURCES_imdct = \
imdct_c.c \
srfft_c.c \
$(COMMON_imdct)
SOURCES_imdctsse = \
imdct_sse.c \
srfft_sse.c \
$(COMMON_imdct)
SOURCES_imdct3dn = \
imdct_3dn.c \
srfft_3dn.c \
$(COMMON_imdct)
noinst_HEADERS += \
imdct_common.h \
retables.h \
srfft.h
/*****************************************************************************
* imdct.c : IMDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: imdct.c,v 1.2 2002/08/21 09:27:40 sam Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
*
* 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 <stdlib.h>
#include <string.h>
#include <vlc/vlc.h>
#include "../imdct.h"
#include "imdct_common.h"
/*****************************************************************************
* Module initializer
*****************************************************************************/
static int Open ( vlc_object_t *p_this )
{
imdct_t *p_imdct = (imdct_t *)p_this;
p_imdct->pf_imdct_init = E_( imdct_init );
p_imdct->pf_imdct_256 = E_( imdct_do_256 );
p_imdct->pf_imdct_256_nol = E_( imdct_do_256_nol );
p_imdct->pf_imdct_512 = E_( imdct_do_512 );
p_imdct->pf_imdct_512_nol = E_( imdct_do_512_nol );
return VLC_SUCCESS;
}
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
#if defined( MODULE_NAME_IS_imdct )
set_description( _("A52 IMDCT module") );
set_capability( "imdct", 50 );
add_shortcut( "c" );
#elif defined( MODULE_NAME_IS_imdctsse )
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();
This diff is collapsed.
/*****************************************************************************
* imdct_c.c: A52 DCT in C
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: imdct_c.c,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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 <string.h> /* memcpy() */
#include <math.h>
#include <stdio.h>
#include <vlc/vlc.h>
#include "../imdct.h"
#include "imdct_common.h"
#include "retables.h"
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
void E_( fft_64p ) ( complex_t *x );
void E_( fft_128p ) ( complex_t *x );
void E_( imdct_init ) (imdct_t * p_imdct)
{
int i;
float scale = 181.019;
/* Twiddle factors to turn IFFT into IMDCT */
for (i=0; i < 128; i++) {
p_imdct->xcos1[i] = cos(2.0f * M_PI * (8*i+1)/(8*N)) * scale;
p_imdct->xsin1[i] = sin(2.0f * M_PI * (8*i+1)/(8*N)) * scale;
}
}
void E_( imdct_do_512 ) (imdct_t * p_imdct, float data[], float delay[])
{
int i, j;
float tmp_a_r, tmp_a_i;
float *data_ptr;
float *delay_ptr;
float *window_ptr;
/* 512 IMDCT with source and dest data in 'data'
* Pre IFFT complex multiply plus IFFT complex conjugate */
for( i=0; i < 128; i++) {
j = pm128[i];
/* a = (data[256-2*j-1] - data[2*j]) * (xcos1[j] + xsin1[j]);
* c = data[2*j] * xcos1[j];
* b = data[256-2*j-1] * xsin1[j];
* buf1[i].real = a - b + c;
* buf1[i].imag = b + c; */
p_imdct->buf[i].real = (data[256-2*j-1] * p_imdct->xcos1[j]) - (data[2*j] * p_imdct->xsin1[j]);
p_imdct->buf[i].imag = -1.0 * (data[2*j] * p_imdct->xcos1[j] + data[256-2*j-1] * p_imdct->xsin1[j]);
}
E_( fft_128p ) ( &p_imdct->buf[0] );
/* Post IFFT complex multiply plus IFFT complex conjugate */
for (i=0; i < 128; i++) {
tmp_a_r = p_imdct->buf[i].real;
tmp_a_i = p_imdct->buf[i].imag;
/* a = (tmp_a_r - tmp_a_i) * (xcos1[j] + xsin1[j]);
* b = tmp_a_r * xsin1[j];
* c = tmp_a_i * xcos1[j];
* buf[j].real = a - b + c;
* buf[j].imag = b + c; */
p_imdct->buf[i].real =(tmp_a_r * p_imdct->xcos1[i]) + (tmp_a_i * p_imdct->xsin1[i]);
p_imdct->buf[i].imag =(tmp_a_r * p_imdct->xsin1[i]) - (tmp_a_i * p_imdct->xcos1[i]);
}
data_ptr = data;
delay_ptr = delay;
window_ptr = window;
/* Window and convert to real valued signal */
for (i=0; i< 64; i++) {
*data_ptr++ = -p_imdct->buf[64+i].imag * *window_ptr++ + *delay_ptr++;
*data_ptr++ = p_imdct->buf[64-i-1].real * *window_ptr++ + *delay_ptr++;
}
for(i=0; i< 64; i++) {
*data_ptr++ = -p_imdct->buf[i].real * *window_ptr++ + *delay_ptr++;
*data_ptr++ = p_imdct->buf[128-i-1].imag * *window_ptr++ + *delay_ptr++;
}
/* The trailing edge of the window goes into the delay line */
delay_ptr = delay;
for(i=0; i< 64; i++) {
*delay_ptr++ = -p_imdct->buf[64+i].real * *--window_ptr;
*delay_ptr++ = p_imdct->buf[64-i-1].imag * *--window_ptr;
}
for(i=0; i<64; i++) {
*delay_ptr++ = p_imdct->buf[i].imag * *--window_ptr;
*delay_ptr++ = -p_imdct->buf[128-i-1].real * *--window_ptr;
}
}
void E_( imdct_do_512_nol ) (imdct_t * p_imdct, float data[], float delay[])
{
int i, j;
float tmp_a_i;
float tmp_a_r;
float *data_ptr;
float *delay_ptr;
float *window_ptr;
/* 512 IMDCT with source and dest data in 'data'
* Pre IFFT complex multiply plus IFFT cmplx conjugate */
for( i=0; i < 128; i++) {
/* z[i] = (X[256-2*i-1] + j * X[2*i]) * (xcos1[i] + j * xsin1[i]) */
j = pm128[i];
/* a = (data[256-2*j-1] - data[2*j]) * (xcos1[j] + xsin1[j]);
* c = data[2*j] * xcos1[j];
* b = data[256-2*j-1] * xsin1[j];
* buf1[i].real = a - b + c;
* buf1[i].imag = b + c; */
p_imdct->buf[i].real = (data[256-2*j-1] * p_imdct->xcos1[j]) - (data[2*j] * p_imdct->xsin1[j]);
p_imdct->buf[i].imag = -1.0 * (data[2*j] * p_imdct->xcos1[j] + data[256-2*j-1] * p_imdct->xsin1[j]);
}
E_( fft_128p ) ( &p_imdct->buf[0] );
/* Post IFFT complex multiply plus IFFT complex conjugate*/
for (i=0; i < 128; i++) {
/* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ;
* int j1 = i; */
tmp_a_r = p_imdct->buf[i].real;
tmp_a_i = p_imdct->buf[i].imag;
/* a = (tmp_a_r - tmp_a_i) * (xcos1[j] + xsin1[j]);
* b = tmp_a_r * xsin1[j];
* c = tmp_a_i * xcos1[j];
* buf[j].real = a - b + c;
* buf[j].imag = b + c; */
p_imdct->buf[i].real =(tmp_a_r * p_imdct->xcos1[i]) + (tmp_a_i * p_imdct->xsin1[i]);
p_imdct->buf[i].imag =(tmp_a_r * p_imdct->xsin1[i]) - (tmp_a_i * p_imdct->xcos1[i]);
}
data_ptr = data;
delay_ptr = delay;
window_ptr = window;
/* Window and convert to real valued signal, no overlap here*/
for (i=0; i< 64; i++) {
*data_ptr++ = -p_imdct->buf[64+i].imag * *window_ptr++;
*data_ptr++ = p_imdct->buf[64-i-1].real * *window_ptr++;
}
for(i=0; i< 64; i++) {
*data_ptr++ = -p_imdct->buf[i].real * *window_ptr++;
*data_ptr++ = p_imdct->buf[128-i-1].imag * *window_ptr++;
}
/* The trailing edge of the window goes into the delay line */
delay_ptr = delay;
for(i=0; i< 64; i++) {
*delay_ptr++ = -p_imdct->buf[64+i].real * *--window_ptr;
*delay_ptr++ = p_imdct->buf[64-i-1].imag * *--window_ptr;
}
for(i=0; i<64; i++) {
*delay_ptr++ = p_imdct->buf[i].imag * *--window_ptr;
*delay_ptr++ = -p_imdct->buf[128-i-1].real * *--window_ptr;
}
}
/*****************************************************************************
* imdct_common.c: common A52 DCT functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: imdct_common.c,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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 <math.h>
#include <stdio.h>
#include <vlc/vlc.h>
#include "../imdct.h"
#include "retables.h"
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
void E_( fft_64p ) ( complex_t *x );
void E_( imdct_do_256 ) (imdct_t * p_imdct, float data[],float delay[])
{
int i, j, k;
int p, q;
float tmp_a_i;
float tmp_a_r;
float *data_ptr;
float *delay_ptr;
float *window_ptr;
complex_t *buf1, *buf2;
buf1 = &p_imdct->buf[0];
buf2 = &p_imdct->buf[64];
/* Pre IFFT complex multiply plus IFFT complex conjugate */
for (k=0; k<64; k++) {
/* X1[k] = X[2*k]
* X2[k] = X[2*k+1] */
j = pm64[k];
p = 2 * (128-2*j-1);
q = 2 * (2 * j);
/* Z1[k] = (X1[128-2*k-1] + j * X1[2*k]) * (xcos2[k] + j * xsin2[k]); */
buf1[k].real = data[p] * p_imdct->xcos2[j] - data[q] * p_imdct->xsin2[j];
buf1[k].imag = -1.0f*(data[q] * p_imdct->xcos2[j] + data[p] * p_imdct->xsin2[j]);
/* Z2[k] = (X2[128-2*k-1] + j * X2[2*k]) * (xcos2[k] + j * xsin2[k]); */
buf2[k].real = data[p + 1] * p_imdct->xcos2[j] - data[q + 1] * p_imdct->xsin2[j];
buf2[k].imag = -1.0f*(data[q + 1] * p_imdct->xcos2[j] + data[p + 1] * p_imdct->xsin2[j]);
}
E_( fft_64p ) ( &buf1[0] );
E_( fft_64p ) ( &buf2[0] );
/* Post IFFT complex multiply */
for( i=0; i < 64; i++) {
tmp_a_r = buf1[i].real;
tmp_a_i = -buf1[i].imag;
buf1[i].real = (tmp_a_r * p_imdct->xcos2[i]) - (tmp_a_i * p_imdct->xsin2[i]);
buf1[i].imag = (tmp_a_r * p_imdct->xsin2[i]) + (tmp_a_i * p_imdct->xcos2[i]);
tmp_a_r = buf2[i].real;
tmp_a_i = -buf2[i].imag;
buf2[i].real = (tmp_a_r * p_imdct->xcos2[i]) - (tmp_a_i * p_imdct->xsin2[i]);
buf2[i].imag = (tmp_a_r * p_imdct->xsin2[i]) + (tmp_a_i * p_imdct->xcos2[i]);
}
data_ptr = data;
delay_ptr = delay;
window_ptr = window;
/* Window and convert to real valued signal */
for(i=0; i< 64; i++) {
*data_ptr++ = -buf1[i].imag * *window_ptr++ + *delay_ptr++;
*data_ptr++ = buf1[64-i-1].real * *window_ptr++ + *delay_ptr++;
}
for(i=0; i< 64; i++) {
*data_ptr++ = -buf1[i].real * *window_ptr++ + *delay_ptr++;
*data_ptr++ = buf1[64-i-1].imag * *window_ptr++ + *delay_ptr++;
}
delay_ptr = delay;
for(i=0; i< 64; i++) {
*delay_ptr++ = -buf2[i].real * *--window_ptr;
*delay_ptr++ = buf2[64-i-1].imag * *--window_ptr;
}
for(i=0; i< 64; i++) {
*delay_ptr++ = buf2[i].imag * *--window_ptr;
*delay_ptr++ = -buf2[64-i-1].real * *--window_ptr;
}
}
void E_( imdct_do_256_nol ) (imdct_t * p_imdct, float data[], float delay[])
{
int i, j, k;
int p, q;
float tmp_a_i;
float tmp_a_r;
float *data_ptr;
float *delay_ptr;
float *window_ptr;
complex_t *buf1, *buf2;
buf1 = &p_imdct->buf[0];
buf2 = &p_imdct->buf[64];
/* Pre IFFT complex multiply plus IFFT cmplx conjugate */
for(k=0; k<64; k++) {
/* X1[k] = X[2*k]
* X2[k] = X[2*k+1] */
j = pm64[k];
p = 2 * (128-2*j-1);
q = 2 * (2 * j);
/* Z1[k] = (X1[128-2*k-1] + j * X1[2*k]) * (xcos2[k] + j * xsin2[k]); */
buf1[k].real = data[p] * p_imdct->xcos2[j] - data[q] * p_imdct->xsin2[j];
buf1[k].imag = -1.0f*(data[q] * p_imdct->xcos2[j] + data[p] * p_imdct->xsin2[j]);
/* Z2[k] = (X2[128-2*k-1] + j * X2[2*k]) * (xcos2[k] + j * xsin2[k]); */
buf2[k].real = data[p + 1] * p_imdct->xcos2[j] - data[q + 1] * p_imdct->xsin2[j];
buf2[k].imag = -1.0f*(data[q + 1] * p_imdct->xcos2[j] + data[p + 1] * p_imdct->xsin2[j]);
}
E_( fft_64p ) ( &buf1[0] );
E_( fft_64p ) ( &buf2[0] );
/* Post IFFT complex multiply */
for( i=0; i < 64; i++) {
/* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */
tmp_a_r = buf1[i].real;
tmp_a_i = -buf1[i].imag;
buf1[i].real =(tmp_a_r * p_imdct->xcos2[i]) - (tmp_a_i * p_imdct->xsin2[i]);
buf1[i].imag =(tmp_a_r * p_imdct->xsin2[i]) + (tmp_a_i * p_imdct->xcos2[i]);
/* y2[n] = z2[n] * (xcos2[n] + j * xsin2[n]) ; */
tmp_a_r = buf2[i].real;
tmp_a_i = -buf2[i].imag;
buf2[i].real =(tmp_a_r * p_imdct->xcos2[i]) - (tmp_a_i * p_imdct->xsin2[i]);
buf2[i].imag =(tmp_a_r * p_imdct->xsin2[i]) + (tmp_a_i * p_imdct->xcos2[i]);
}
data_ptr = data;
delay_ptr = delay;
window_ptr = window;
/* Window and convert to real valued signal, no overlap */
for(i=0; i< 64; i++) {
*data_ptr++ = -buf1[i].imag * *window_ptr++;
*data_ptr++ = buf1[64-i-1].real * *window_ptr++;
}
for(i=0; i< 64; i++) {
*data_ptr++ = -buf1[i].real * *window_ptr++ + *delay_ptr++;
*data_ptr++ = buf1[64-i-1].imag * *window_ptr++ + *delay_ptr++;
}
delay_ptr = delay;
for(i=0; i< 64; i++) {
*delay_ptr++ = -buf2[i].real * *--window_ptr;
*delay_ptr++ = buf2[64-i-1].imag * *--window_ptr;
}
for(i=0; i< 64; i++) {
*delay_ptr++ = buf2[i].imag * *--window_ptr;
*delay_ptr++ = -buf2[64-i-1].real * *--window_ptr;
}
}
/*****************************************************************************
* imdct_common.h: common A52 DCT headers
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: imdct_common.h,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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.
*****************************************************************************/
void E_( imdct_init ) ( imdct_t * p_imdct );
void E_( imdct_do_256 ) ( imdct_t * p_imdct, float data[], float delay[] );
void E_( imdct_do_256_nol ) ( imdct_t * p_imdct, float data[], float delay[] );
void E_( imdct_do_512 ) ( imdct_t * p_imdct, float data[], float delay[] );
void E_( imdct_do_512_nol ) ( imdct_t * p_imdct, float data[], float delay[] );
This diff is collapsed.
/*****************************************************************************
* retables.h: A52 DCT tables
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: retables.h,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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.
*****************************************************************************/
static float window[] ATTR_ALIGN(16) = {
0.00014, 0.00024, 0.00037, 0.00051, 0.00067, 0.00086, 0.00107, 0.00130,
0.00157, 0.00187, 0.00220, 0.00256, 0.00297, 0.00341, 0.00390, 0.00443,
0.00501, 0.00564, 0.00632, 0.00706, 0.00785, 0.00871, 0.00962, 0.01061,
0.01166, 0.01279, 0.01399, 0.01526, 0.01662, 0.01806, 0.01959, 0.02121,
0.02292, 0.02472, 0.02662, 0.02863, 0.03073, 0.03294, 0.03527, 0.03770,
0.04025, 0.04292, 0.04571, 0.04862, 0.05165, 0.05481, 0.05810, 0.06153,
0.06508, 0.06878, 0.07261, 0.07658, 0.08069, 0.08495, 0.08935, 0.09389,
0.09859, 0.10343, 0.10842, 0.11356, 0.11885, 0.12429, 0.12988, 0.13563,
0.14152, 0.14757, 0.15376, 0.16011, 0.16661, 0.17325, 0.18005, 0.18699,
0.19407, 0.20130, 0.20867, 0.21618, 0.22382, 0.23161, 0.23952, 0.24757,
0.25574, 0.26404, 0.27246, 0.28100, 0.28965, 0.29841, 0.30729, 0.31626,
0.32533, 0.33450, 0.34376, 0.35311, 0.36253, 0.37204, 0.38161, 0.39126,
0.40096, 0.41072, 0.42054, 0.43040, 0.44030, 0.45023, 0.46020, 0.47019,
0.48020, 0.49022, 0.50025, 0.51028, 0.52031, 0.53033, 0.54033, 0.55031,
0.56026, 0.57019, 0.58007, 0.58991, 0.59970, 0.60944, 0.61912, 0.62873,
0.63827, 0.64774, 0.65713, 0.66643, 0.67564, 0.68476, 0.69377, 0.70269,
0.71150, 0.72019, 0.72877, 0.73723, 0.74557, 0.75378, 0.76186, 0.76981,
0.77762, 0.78530, 0.79283, 0.80022, 0.80747, 0.81457, 0.82151, 0.82831,
0.83496, 0.84145, 0.84779, 0.85398, 0.86001, 0.86588, 0.87160, 0.87716,
0.88257, 0.88782, 0.89291, 0.89785, 0.90264, 0.90728, 0.91176, 0.91610,
0.92028, 0.92432, 0.92822, 0.93197, 0.93558, 0.93906, 0.94240, 0.94560,
0.94867, 0.95162, 0.95444, 0.95713, 0.95971, 0.96217, 0.96451, 0.96674,
0.96887, 0.97089, 0.97281, 0.97463, 0.97635, 0.97799, 0.97953, 0.98099,
0.98236, 0.98366, 0.98488, 0.98602, 0.98710, 0.98811, 0.98905, 0.98994,
0.99076, 0.99153, 0.99225, 0.99291, 0.99353, 0.99411, 0.99464, 0.99513,
0.99558, 0.99600, 0.99639, 0.99674, 0.99706, 0.99736, 0.99763, 0.99788,
0.99811, 0.99831, 0.99850, 0.99867, 0.99882, 0.99895, 0.99908, 0.99919,
0.99929, 0.99938, 0.99946, 0.99953, 0.99959, 0.99965, 0.99969, 0.99974,
0.99978, 0.99981, 0.99984, 0.99986, 0.99988, 0.99990, 0.99992, 0.99993,
0.99994, 0.99995, 0.99996, 0.99997, 0.99998, 0.99998, 0.99998, 0.99999,
0.99999, 0.99999, 0.99999, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000,
1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000
};
static const int pm128[128] =
{
0, 16, 32, 48, 64, 80, 96, 112, 8, 40, 72, 104, 24, 56, 88, 120,
4, 20, 36, 52, 68, 84, 100, 116, 12, 28, 44, 60, 76, 92, 108, 124,
2, 18, 34, 50, 66, 82, 98, 114, 10, 42, 74, 106, 26, 58, 90, 122,
6, 22, 38, 54, 70, 86, 102, 118, 14, 46, 78, 110, 30, 62, 94, 126,
1, 17, 33, 49, 65, 81, 97, 113, 9, 41, 73, 105, 25, 57, 89, 121,
5, 21, 37, 53, 69, 85, 101, 117, 13, 29, 45, 61, 77, 93, 109, 125,
3, 19, 35, 51, 67, 83, 99, 115, 11, 43, 75, 107, 27, 59, 91, 123,
7, 23, 39, 55, 71, 87, 103, 119, 15, 31, 47, 63, 79, 95, 111, 127
};
static const int pm64[64] =
{
0, 8, 16, 24, 32, 40, 48, 56,
4, 20, 36, 52, 12, 28, 44, 60,
2, 10, 18, 26, 34, 42, 50, 58,
6, 14, 22, 30, 38, 46, 54, 62,
1, 9, 17, 25, 33, 41, 49, 57,
5, 21, 37, 53, 13, 29, 45, 61,
3, 11, 19, 27, 35, 43, 51, 59,
7, 23, 39, 55, 15, 31, 47, 63
};
/*****************************************************************************
* srfft.h: A52 FFT tables
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: srfft.h,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
*
* 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.
*****************************************************************************/
static const complex_t delta16[4] ATTR_ALIGN(16) =
{ {1.00000000000000, 0.00000000000000},
{0.92387953251129, -0.38268343236509},
{0.70710678118655, -0.70710678118655},
{0.38268343236509, -0.92387953251129}};
static const complex_t delta16_3[4] ATTR_ALIGN(16) =
{ {1.00000000000000, 0.00000000000000},
{0.38268343236509, -0.92387953251129},
{-0.70710678118655, -0.70710678118655},
{-0.92387953251129, 0.38268343236509}};
static const complex_t delta32[8] ATTR_ALIGN(16) =
{ {1.00000000000000, 0.00000000000000},
{0.98078528040323, -0.19509032201613},
{0.92387953251129, -0.38268343236509},
{0.83146961230255, -0.55557023301960},
{0.70710678118655, -0.70710678118655},
{0.55557023301960, -0.83146961230255},
{0.38268343236509, -0.92387953251129},
{0.19509032201613, -0.98078528040323}};
static const complex_t delta32_3[8] ATTR_ALIGN(16) =
{ {1.00000000000000, 0.00000000000000},
{0.83146961230255, -0.55557023301960},
{0.38268343236509, -0.92387953251129},
{-0.19509032201613, -0.98078528040323},
{-0.70710678118655, -0.70710678118655},
{-0.98078528040323, -0.19509032201613},
{-0.92387953251129, 0.38268343236509},
{-0.55557023301960, 0.83146961230255}};
static const complex_t delta64[16] ATTR_ALIGN(16) =
{ {1.00000000000000, 0.00000000000000},
{0.99518472667220, -0.09801714032956},
{0.98078528040323, -0.19509032201613},
{0.95694033573221, -0.29028467725446},
{0.92387953251129, -0.38268343236509},
{0.88192126434836, -0.47139673682600},
{0.83146961230255, -0.55557023301960},
{0.77301045336274, -0.63439328416365},
{0.70710678118655, -0.70710678118655},
{0.63439328416365, -0.77301045336274},
{0.55557023301960, -0.83146961230255},
{0.47139673682600, -0.88192126434835},
{0.38268343236509, -0.92387953251129},
{0.29028467725446, -0.95694033573221},
{0.19509032201613, -0.98078528040323},
{0.09801714032956, -0.99518472667220}};
static const complex_t delta64_3[16] ATTR_ALIGN(16) =
{ {1.00000000000000, 0.00000000000000},
{0.95694033573221, -0.29028467725446},
{0.83146961230255, -0.55557023301960},
{0.63439328416365, -0.77301045336274},
{0.38268343236509, -0.92387953251129},
{0.09801714032956, -0.99518472667220},
{-0.19509032201613, -0.98078528040323},
{-0.47139673682600, -0.88192126434836},
{-0.70710678118655, -0.70710678118655},
{-0.88192126434835, -0.47139673682600},
{-0.98078528040323, -0.19509032201613},
{-0.99518472667220, 0.09801714032956},
{-0.92387953251129, 0.38268343236509},
{-0.77301045336274, 0.63439328416365},
{-0.55557023301960, 0.83146961230255},
{-0.29028467725446, 0.95694033573221}};
static const complex_t delta128[32] ATTR_ALIGN(16) =
{ {1.00000000000000, 0.00000000000000},
{0.99879545620517, -0.04906767432742},
{0.99518472667220, -0.09801714032956},
{0.98917650996478, -0.14673047445536},
{0.98078528040323, -0.19509032201613},
{0.97003125319454, -0.24298017990326},
{0.95694033573221, -0.29028467725446},
{0.94154406518302, -0.33688985339222},
{0.92387953251129, -0.38268343236509},
{0.90398929312344, -0.42755509343028},
{0.88192126434836, -0.47139673682600},
{0.85772861000027, -0.51410274419322},
{0.83146961230255, -0.55557023301960},
{0.80320753148064, -0.59569930449243},
{0.77301045336274, -0.63439328416365},
{0.74095112535496, -0.67155895484702},
{0.70710678118655, -0.70710678118655},
{0.67155895484702, -0.74095112535496},
{0.63439328416365, -0.77301045336274},
{0.59569930449243, -0.80320753148064},
{0.55557023301960, -0.83146961230255},
{0.51410274419322, -0.85772861000027},
{0.47139673682600, -0.88192126434835},
{0.42755509343028, -0.90398929312344},
{0.38268343236509, -0.92387953251129},
{0.33688985339222, -0.94154406518302},
{0.29028467725446, -0.95694033573221},
{0.24298017990326, -0.97003125319454},
{0.19509032201613, -0.98078528040323},
{0.14673047445536, -0.98917650996478},
{0.09801714032956, -0.99518472667220},
{0.04906767432742, -0.99879545620517}};
static const complex_t delta128_3[32] ATTR_ALIGN(16) =
{ {1.00000000000000, 0.00000000000000},
{0.98917650996478, -0.14673047445536},
{0.95694033573221, -0.29028467725446},
{0.90398929312344, -0.42755509343028},
{0.83146961230255, -0.55557023301960},
{0.74095112535496, -0.67155895484702},
{0.63439328416365, -0.77301045336274},
{0.51410274419322, -0.85772861000027},
{0.38268343236509, -0.92387953251129},
{0.24298017990326, -0.97003125319454},
{0.09801714032956, -0.99518472667220},
{-0.04906767432742, -0.99879545620517},
{-0.19509032201613, -0.98078528040323},
{-0.33688985339222, -0.94154406518302},
{-0.47139673682600, -0.88192126434836},
{-0.59569930449243, -0.80320753148065},
{-0.70710678118655, -0.70710678118655},
{-0.80320753148065, -0.59569930449243},
{-0.88192126434835, -0.47139673682600},
{-0.94154406518302, -0.33688985339222},
{-0.98078528040323, -0.19509032201613},
{-0.99879545620517, -0.04906767432742},
{-0.99518472667220, 0.09801714032956},
{-0.97003125319454, 0.24298017990326},
{-0.92387953251129, 0.38268343236509},
{-0.85772861000027, 0.51410274419322},
{-0.77301045336274, 0.63439328416365},
{-0.67155895484702, 0.74095112535496},
{-0.55557023301960, 0.83146961230255},
{-0.42755509343028, 0.90398929312344},
{-0.29028467725446, 0.95694033573221},
{-0.14673047445536, 0.98917650996478}};
#define HSQRT2 0.707106781188;
#define TRANSZERO(A0,A4,A8,A12) { \
u_r = wTB[0].real; \
v_i = u_r - wTB[k*2].real; \
u_r += wTB[k*2].real; \
u_i = wTB[0].imag; \
v_r = wTB[k*2].imag - u_i; \
u_i += wTB[k*2].imag; \
a_r = A0.real; \
a_i = A0.imag; \
a1_r = a_r; \
a1_r += u_r; \
A0.real = a1_r; \
a_r -= u_r; \
A8.real = a_r; \
a1_i = a_i; \
a1_i += u_i; \
A0.imag = a1_i; \
a_i -= u_i; \
A8.imag = a_i; \
a1_r = A4.real; \
a1_i = A4.imag; \
a_r = a1_r; \
a_r -= v_r; \
A4.real = a_r; \
a1_r += v_r; \
A12.real = a1_r; \
a_i = a1_i; \
a_i -= v_i; \
A4.imag = a_i; \
a1_i += v_i; \
A12.imag = a1_i; \
}
#define TRANSHALF_16(A2,A6,A10,A14) {\
u_r = wTB[2].real; \
a_r = u_r; \
u_i = wTB[2].imag; \
u_r += u_i; \
u_i -= a_r; \
a_r = wTB[6].real; \
a1_r = a_r; \
a_i = wTB[6].imag; \
a_r = a_i - a_r; \
a_i += a1_r; \
v_i = u_r - a_r; \
u_r += a_r; \
v_r = u_i + a_i; \
u_i -= a_i; \
v_i *= HSQRT2; \
v_r *= HSQRT2; \
u_r *= HSQRT2; \
u_i *= HSQRT2; \
a_r = A2.real; \
a_i = A2.imag; \
a1_r = a_r; \
a1_r += u_r; \
A2.real = a1_r; \
a_r -= u_r; \
A10.real = a_r; \
a1_i = a_i; \
a1_i += u_i; \
A2.imag = a1_i; \
a_i -= u_i; \
A10.imag = a_i; \
a1_r = A6.real; \
a1_i = A6.imag; \
a_r = a1_r; \
a1_r += v_r; \
A6.real = a1_r; \
a_r -= v_r; \
A14.real = a_r; \
a_i = a1_i; \
a1_i -= v_i; \
A6.imag = a1_i; \
a_i += v_i; \
A14.imag = a_i; \
}
#define TRANS(A1,A5,A9,A13,WT,WB,D,D3) { \
u_r = WT.real; \
a_r = u_r; \
a_r *= D.imag; \
u_r *= D.real; \
a_i = WT.imag; \
a1_i = a_i; \
a1_i *= D.real; \
a_i *= D.imag; \
u_r -= a_i; \
u_i = a_r; \
u_i += a1_i; \
a_r = WB.real; \
a1_r = a_r; \
a1_r *= D3.real; \
a_r *= D3.imag; \
a_i = WB.imag; \
a1_i = a_i; \
a_i *= D3.real; \
a1_i *= D3.imag; \
a1_r -= a1_i; \
a_r += a_i; \
v_i = u_r - a1_r; \
u_r += a1_r; \
v_r = a_r - u_i; \
u_i += a_r; \
a_r = A1.real; \
a_i = A1.imag; \
a1_r = a_r; \
a1_r += u_r; \
A1.real = a1_r; \
a_r -= u_r; \
A9.real = a_r; \
a1_i = a_i; \
a1_i += u_i; \
A1.imag = a1_i; \
a_i -= u_i; \
A9.imag = a_i; \
a1_r = A5.real; \
a1_i = A5.imag; \
a_r = a1_r; \
a1_r -= v_r; \
A5.real = a1_r; \
a_r += v_r; \
A13.real = a_r; \
a_i = a1_i; \
a1_i -= v_i; \
A5.imag = a1_i; \
a_i += v_i; \
A13.imag = a_i; \
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* internals.h: needed by the A52 decoder
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: internal.h,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Michel Lespinasse <walken@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.
*****************************************************************************/
/* Exponent strategy constants */
#define EXP_REUSE (0)
#define EXP_D15 (1)
#define EXP_D25 (2)
#define EXP_D45 (3)
/* Delta bit allocation constants */
#define DELTA_BIT_REUSE (0)
#define DELTA_BIT_NEW (1)
#define DELTA_BIT_NONE (2)
#define DELTA_BIT_RESERVED (3)
/* bit_allocate.c */
void bit_allocate (a52dec_t *);
/* exponent.c */
int exponent_unpack (a52dec_t *);
/* imdct.c */
void E_( imdct_init )(imdct_t * p_imdct);
void imdct (a52dec_t * p_a52dec, s16 * buffer);
/* mantissa.c */
void mantissa_unpack (a52dec_t *);
/* parse.c */
int parse_bsi (a52dec_t *);
int parse_audblk (a52dec_t *, int);
void parse_auxdata (a52dec_t *);
/* rematrix.c */
void rematrix (a52dec_t *);
/*****************************************************************************
* mantissa.c: A52 mantissa computation
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: mantissa.c,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
* Renaud Dartus <reno@videolan.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 <string.h> /* memcpy() */
#include <vlc/vlc.h>
#include <vlc/decoder.h>
#include "imdct.h"
#include "downmix.h"
#include "adec.h"
#include "mantissa.h"
void mantissa_unpack (a52dec_t * p_a52dec)
{
int i, j;
u32 done_cpl = 0;
p_a52dec->mantissa.q_1_pointer = -1;
p_a52dec->mantissa.q_2_pointer = -1;
p_a52dec->mantissa.q_4_pointer = -1;
for (i=0; i< p_a52dec->bsi.nfchans; i++) {
for (j=0; j < p_a52dec->audblk.endmant[i]; j++)
*(p_a52dec->samples+i*256+j) = coeff_get_float(p_a52dec, p_a52dec->audblk.fbw_bap[i][j],
p_a52dec->audblk.dithflag[i], p_a52dec->audblk.fbw_exp[i][j]);
if (p_a52dec->audblk.cplinu && p_a52dec->audblk.chincpl[i] && !(done_cpl)) {
/* ncplmant is equal to 12 * ncplsubnd
* Don't dither coupling channel until channel
* separation so that interchannel noise is uncorrelated
*/
for (j=p_a52dec->audblk.cplstrtmant; j < p_a52dec->audblk.cplendmant; j++)
p_a52dec->audblk.cpl_flt[j] = coeff_get_float(p_a52dec, p_a52dec->audblk.cpl_bap[j],
0, p_a52dec->audblk.cpl_exp[j]);
done_cpl = 1;
}
}
/* uncouple the channel if necessary */
if (p_a52dec->audblk.cplinu) {
for (i=0; i< p_a52dec->bsi.nfchans; i++) {
if (p_a52dec->audblk.chincpl[i])
uncouple_channel(p_a52dec, i);
}
}
if (p_a52dec->bsi.lfeon) {
/* There are always 7 mantissas for lfe, no dither for lfe */
for (j=0; j < 7 ; j++)
*(p_a52dec->samples+5*256+j) = coeff_get_float(p_a52dec, p_a52dec->audblk.lfe_bap[j],
0, p_a52dec->audblk.lfe_exp[j]);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
.deps
.dirstamp
*.lo
*.la
*.dll
*.dylib
*.sl
*.so
Makefile.am
Makefile.in
Makefile
SOURCES_mpeg_audio = \
decoder.c \
decoder.h \
layer1.c \
layer1.h \
layer2.c \
layer2.h \
math.c \
math.h \
generic.c \
generic.h \
$(NULL)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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