From 12f67b8372d8f7146a2983f24727ea6306aa70c0 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 9 May 2010 14:45:29 +0000 Subject: Remove internal liba52 copy. Nowadays FFmpeg is faster than liba52 and external liba52 is well supported. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31147 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Copyright | 12 - DOCS/tech/MAINTAINERS | 1 - DOCS/tech/binary-packaging.txt | 2 +- DOCS/tech/general.txt | 2 +- Makefile | 16 +- configure | 20 +- liba52/a52.h | 74 -- liba52/a52_internal.h | 140 --- liba52/bit_allocate.c | 265 ----- liba52/bitstream.c | 106 -- liba52/bitstream.h | 152 --- liba52/crc.c | 73 -- liba52/downmix.c | 1788 ----------------------------- liba52/imdct.c | 1304 --------------------- liba52/imdct_3dnow.h | 581 ---------- liba52/liba52.txt | 208 ---- liba52/liba52_changes.diff | 2473 ---------------------------------------- liba52/mm_accel.h | 46 - liba52/parse.c | 919 --------------- liba52/resample.c | 82 -- liba52/resample_altivec.c | 110 -- liba52/resample_c.c | 205 ---- liba52/resample_mmx.c | 541 --------- liba52/srfftp.h | 303 ----- liba52/srfftp_3dnow.h | 187 --- liba52/tables.h | 246 ---- liba52/test.c | 154 --- libmpcodecs/ad_liba52.c | 16 - libmpdemux/muxer_mpeg.c | 2 - 29 files changed, 6 insertions(+), 10022 deletions(-) delete mode 100644 liba52/a52.h delete mode 100644 liba52/a52_internal.h delete mode 100644 liba52/bit_allocate.c delete mode 100644 liba52/bitstream.c delete mode 100644 liba52/bitstream.h delete mode 100644 liba52/crc.c delete mode 100644 liba52/downmix.c delete mode 100644 liba52/imdct.c delete mode 100644 liba52/imdct_3dnow.h delete mode 100644 liba52/liba52.txt delete mode 100644 liba52/liba52_changes.diff delete mode 100644 liba52/mm_accel.h delete mode 100644 liba52/parse.c delete mode 100644 liba52/resample.c delete mode 100644 liba52/resample_altivec.c delete mode 100644 liba52/resample_c.c delete mode 100644 liba52/resample_mmx.c delete mode 100644 liba52/srfftp.h delete mode 100644 liba52/srfftp_3dnow.h delete mode 100644 liba52/tables.h delete mode 100644 liba52/test.c diff --git a/Copyright b/Copyright index 24261f58d2..46fdb03248 100644 --- a/Copyright +++ b/Copyright @@ -37,18 +37,6 @@ Copyright: 1992 by Jutta Degener and Carsten Bormann, TU Berlin License: permissive, see libmpcodecs/native/xa_gsm.c -Name: liba52 -Version: 0.7.4 + patches -URL: http://liba52.sourceforge.net/ -Directory: liba52 -Copyright: 1999-2000 Aaron Holtzman - 2000-2001 Michel Lespinasse - 2000 Yuqing Deng - 2002 Nick Kurshev - 2004 Romain Dolbeau -License: GNU General Public License - - Name: libdvdcss Version: 1.2.10 URL: http://developers.videolan.org/libdvdcss/ diff --git a/DOCS/tech/MAINTAINERS b/DOCS/tech/MAINTAINERS index 7b7b1c710c..b9b84d8fc2 100644 --- a/DOCS/tech/MAINTAINERS +++ b/DOCS/tech/MAINTAINERS @@ -93,7 +93,6 @@ Imported libs/projects: * VIDIX core: Benjamin Zores * mp3lib: None * loader: None - * liba52: None * libmpeg2: None * libdvdcss: Diego Biurrun * libdvdread: Diego Biurrun diff --git a/DOCS/tech/binary-packaging.txt b/DOCS/tech/binary-packaging.txt index 9d852372db..3aec8b2312 100644 --- a/DOCS/tech/binary-packaging.txt +++ b/DOCS/tech/binary-packaging.txt @@ -45,7 +45,7 @@ the following features MUST be included in any official binary package: * codecs - FAAD(internal) - libavcodec(internal) - - native codecs (libmpeg2/liba52/mp3lib) + - native codecs (libmpeg2/mp3lib) - Vorbis Tremor codec(internal) - RealPlayer codecs support (*) - Win32/VfW/DShow/QT codecs support (*) diff --git a/DOCS/tech/general.txt b/DOCS/tech/general.txt index b9ac61ff10..36a584b746 100644 --- a/DOCS/tech/general.txt +++ b/DOCS/tech/general.txt @@ -196,7 +196,7 @@ Now, go on: Only used if none of the above works. 4. Codecs. Consists of libmpcodecs/* and separate files or libs, - for example liba52, libmpeg2, loader, mp3lib. + for example libmpeg2, loader, mp3lib. mplayer.c doesn't call them directly, but through the dec_audio.c and dec_video.c files, so the mplayer.c doesn't have to know anything about diff --git a/Makefile b/Makefile index e1d2ad9578..1b2c99c0e9 100644 --- a/Makefile +++ b/Makefile @@ -108,16 +108,6 @@ SRCS_COMMON-$(HAVE_SYS_MMAN_H) += libaf/af_export.c osdep/mmap_anon.c SRCS_COMMON-$(JPEG) += libmpcodecs/vd_ijpg.c SRCS_COMMON-$(LADSPA) += libaf/af_ladspa.c SRCS_COMMON-$(LIBA52) += libmpcodecs/ad_liba52.c -SRCS_LIBA52_INTERNAL += liba52/crc.c \ - liba52/resample.c \ - liba52/bit_allocate.c \ - liba52/bitstream.c \ - liba52/downmix.c \ - liba52/imdct.c \ - liba52/parse.c \ - -SRCS_COMMON-$(LIBA52_INTERNAL) += $(SRCS_LIBA52_INTERNAL) - SRCS_COMMON-$(LIBASS) += libmpcodecs/vf_ass.c \ libass/ass_mp.c \ @@ -758,7 +748,6 @@ DIRS = . \ gui/wm \ gui/win32 \ input \ - liba52 \ libaf \ libao2 \ libass \ @@ -1020,8 +1009,6 @@ codec-cfg-test$(EXESUF): codec-cfg.c codecs.conf.h help_mp.h $(TEST_OBJS) codecs2html$(EXESUF): codec-cfg.c help_mp.h $(TEST_OBJS) $(CC) -I. -DCODECS2HTML -o $@ $^ -liba52/test$(EXESUF): cpudetect.o $(SRCS_LIBA52_INTERNAL:.c=.o) -lm - libvo/aspecttest$(EXESUF): libvo/aspect.o libvo/geometry.o $(TEST_OBJS) LOADER_TEST_OBJS = $(SRCS_WIN32_EMULATION:.c=.o) $(SRCS_QTX_EMULATION:.S=.o) libavutil/libavutil.a osdep/mmap_anon.o cpudetect.o $(TEST_OBJS) @@ -1031,8 +1018,7 @@ loader/qtx/list$(EXESUF) loader/qtx/qtxload$(EXESUF): $(LOADER_TEST_OBJS) mp3lib/test$(EXESUF) mp3lib/test2$(EXESUF): $(SRCS_MP3LIB:.c=.o) libvo/aclib.o cpudetect.o $(TEST_OBJS) -TESTS = codecs2html codec-cfg-test liba52/test libvo/aspecttest \ - mp3lib/test mp3lib/test2 +TESTS = codecs2html codec-cfg-test libvo/aspecttest mp3lib/test mp3lib/test2 ifdef ARCH_X86 TESTS += loader/qtx/list loader/qtx/qtxload diff --git a/configure b/configure index 415ae52bc4..1f0e1a29fb 100755 --- a/configure +++ b/configure @@ -335,7 +335,6 @@ Codecs: --enable-libdca enable libdca support [autodetect] --disable-mp3lib disable builtin mp3lib [autodetect] --disable-liba52 disable liba52 [autodetect] - --enable-liba52-internal enable builtin liba52 [disabled] --disable-libmpeg2 disable builtin libmpeg2 [autodetect] --disable-musepack disable musepack support [autodetect] --disable-libopencore_amrnb disable libopencore_amr narrowband [autodetect] @@ -631,7 +630,6 @@ _speex=auto _theora=auto _mp3lib=auto _liba52=auto -_liba52_internal=no _libdca=auto _libmpeg2=auto _faad=auto @@ -1028,8 +1026,6 @@ for ac_option do --disable-theora) _theora=no ;; --enable-mp3lib) _mp3lib=yes ;; --disable-mp3lib) _mp3lib=no ;; - --enable-liba52-internal) _liba52_internal=yes ;; - --disable-liba52-internal) _liba52_internal=no ;; --enable-liba52) _liba52=yes ;; --disable-liba52) _liba52=no ;; --enable-libdca) _libdca=yes ;; @@ -6796,27 +6792,19 @@ fi echores "$_mp3lib" echocheck "liba52 support" -if test "$_liba52_internal" = auto ; then - test "$cc_vendor" = intel && test "$_cc_major" -le 10 -o "$_cc_major" -eq 11 -a "$_cc_minor" -eq 0 && _liba52_internal=no || _liba52_internal=yes -fi def_liba52='#undef CONFIG_LIBA52' -def_liba52_internal="#undef CONFIG_LIBA52_INTERNAL" -if test "$_liba52_internal" = yes ; then - _liba52=yes - def_liba52_internal="#define CONFIG_LIBA52_INTERNAL 1" - res_comment="internal" -elif test "$_liba52_internal" = no && test "$_liba52" = auto ; then +if test "$_liba52" = auto ; then _liba52=no cat > $TMPC << EOF #include #include int main(void) { a52_state_t *testHand; testHand=a52_init(0); return 0; } EOF - cc_check -la52 && _liba52=yes && res_comment="external" && extra_ldflags="$extra_ldflags -la52" + cc_check -la52 && _liba52=yes && extra_ldflags="$extra_ldflags -la52" fi if test "$_liba52" = yes ; then def_liba52='#define CONFIG_LIBA52 1' - codecmodules="liba52($res_comment) $codecmodules" + codecmodules="liba52 $codecmodules" else nocodecmodules="liba52 $nocodecmodules" fi @@ -8582,7 +8570,6 @@ KAI = $_kai KVA = $_kva LADSPA = $_ladspa LIBA52 = $_liba52 -LIBA52_INTERNAL = $_liba52_internal LIBASS = $_ass LIBASS_INTERNAL = $ass_internal LIBBS2B = $_libbs2b @@ -8965,7 +8952,6 @@ $def_faac $def_faad $def_faad_internal $def_liba52 -$def_liba52_internal $def_libdca $def_libdv $def_liblzo diff --git a/liba52/a52.h b/liba52/a52.h deleted file mode 100644 index 3547ad1d36..0000000000 --- a/liba52/a52.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * a52.h - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * Modified for use with MPlayer, changes contained in liba52_changes.diff. - * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ - * $Id$ - * - * a52dec 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. - * - * a52dec 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-1307 USA - */ - -#ifndef A52_H -#define A52_H - -#include -#include "mm_accel.h" - -#ifndef LIBA52_DOUBLE -typedef float sample_t; -#else -typedef double sample_t; -#endif - -typedef struct a52_state_s a52_state_t; - -#define A52_CHANNEL 0 -#define A52_MONO 1 -#define A52_STEREO 2 -#define A52_3F 3 -#define A52_2F1R 4 -#define A52_3F1R 5 -#define A52_2F2R 6 -#define A52_3F2R 7 -#define A52_CHANNEL1 8 -#define A52_CHANNEL2 9 -#define A52_DOLBY 10 -#define A52_CHANNEL_MASK 15 - -#define A52_LFE 16 -#define A52_ADJUST_LEVEL 32 - -a52_state_t * a52_init (uint32_t mm_accel); -sample_t * a52_samples (a52_state_t * state); -int a52_syncinfo (uint8_t * buf, int * flags, - int * sample_rate, int * bit_rate); -int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, - sample_t * level, sample_t bias); -void a52_dynrng (a52_state_t * state, - sample_t (* call) (sample_t, void *), void * data); -int a52_block (a52_state_t * state); -void a52_free (a52_state_t * state); - -void* a52_resample_init(uint32_t mm_accel,int flags,int chans); -extern int (* a52_resample) (float * _f, int16_t * s16); - -uint16_t crc16_block(uint8_t *data,uint32_t num_bytes); - -#endif /* A52_H */ diff --git a/liba52/a52_internal.h b/liba52/a52_internal.h deleted file mode 100644 index 1f6d205931..0000000000 --- a/liba52/a52_internal.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * a52_internal.h - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * Modified for use with MPlayer, changes contained in liba52_changes.diff. - * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ - * $Id$ - * - * a52dec 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. - * - * a52dec 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-1307 USA - */ - -typedef struct { - uint8_t bai; /* fine SNR offset, fast gain */ - uint8_t deltbae; /* delta bit allocation exists */ - int8_t deltba[50]; /* per-band delta bit allocation */ -} ba_t; - -typedef struct { - uint8_t exp[256]; /* decoded channel exponents */ - int8_t bap[256]; /* derived channel bit allocation */ -} expbap_t; - -struct a52_state_s { - uint8_t fscod; /* sample rate */ - uint8_t halfrate; /* halfrate factor */ - uint8_t acmod; /* coded channels */ - uint8_t lfeon; /* coded lfe channel */ - sample_t clev; /* centre channel mix level */ - sample_t slev; /* surround channels mix level */ - - int output; /* type of output */ - sample_t level; /* output level */ - sample_t bias; /* output bias */ - - int dynrnge; /* apply dynamic range */ - sample_t dynrng; /* dynamic range */ - void * dynrngdata; /* dynamic range callback funtion and data */ - sample_t (* dynrngcall) (sample_t range, void * dynrngdata); - - uint8_t chincpl; /* channel coupled */ - uint8_t phsflginu; /* phase flags in use (stereo only) */ - uint8_t cplstrtmant; /* coupling channel start mantissa */ - uint8_t cplendmant; /* coupling channel end mantissa */ - uint32_t cplbndstrc; /* coupling band structure */ - sample_t cplco[5][18]; /* coupling coordinates */ - - /* derived information */ - uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */ - uint8_t ncplbnd; /* number of coupling bands */ - - uint8_t rematflg; /* stereo rematrixing */ - - uint8_t endmant[5]; /* channel end mantissa */ - - uint16_t bai; /* bit allocation information */ - - uint32_t * buffer_start; - uint16_t lfsr_state; /* dither state */ - uint32_t bits_left; - uint32_t current_word; - - uint8_t csnroffst; /* coarse SNR offset */ - ba_t cplba; /* coupling bit allocation parameters */ - ba_t ba[5]; /* channel bit allocation parameters */ - ba_t lfeba; /* lfe bit allocation parameters */ - - uint8_t cplfleak; /* coupling fast leak init */ - uint8_t cplsleak; /* coupling slow leak init */ - - expbap_t cpl_expbap; - expbap_t fbw_expbap[5]; - expbap_t lfe_expbap; - - sample_t * samples; - int downmixed; -}; - -#define LEVEL_PLUS6DB 2.0 -#define LEVEL_PLUS3DB 1.4142135623730951 -#define LEVEL_3DB 0.7071067811865476 -#define LEVEL_45DB 0.5946035575013605 -#define LEVEL_6DB 0.5 - -#define EXP_REUSE (0) -#define EXP_D15 (1) -#define EXP_D25 (2) -#define EXP_D45 (3) - -#define DELTA_BIT_REUSE (0) -#define DELTA_BIT_NEW (1) -#define DELTA_BIT_NONE (2) -#define DELTA_BIT_RESERVED (3) - -#if ARCH_X86_64 -# define REG_a "rax" -# define REG_d "rdx" -# define REG_S "rsi" -# define REG_D "rdi" -# define REG_BP "rbp" -#else -# define REG_a "eax" -# define REG_d "edx" -# define REG_S "esi" -# define REG_D "edi" -# define REG_BP "ebp" -#endif - -void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, - int start, int end, int fastleak, int slowleak, - expbap_t * expbap); - -int a52_downmix_init (int input, int flags, sample_t * level, - sample_t clev, sample_t slev); -void downmix_accel_init(uint32_t mm_accel); -int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level, - sample_t clev, sample_t slev); -extern void (*a52_downmix) (sample_t * samples, int acmod, int output, sample_t bias, - sample_t clev, sample_t slev); -extern void (*a52_upmix) (sample_t * samples, int acmod, int output); - -void a52_imdct_init (uint32_t mm_accel); -void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias); -extern void (*a52_imdct_512) (sample_t * data, sample_t * delay, sample_t bias); -void imdct_do_512 (sample_t * data, sample_t * delay, sample_t bias); diff --git a/liba52/bit_allocate.c b/liba52/bit_allocate.c deleted file mode 100644 index 0567b22852..0000000000 --- a/liba52/bit_allocate.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - * bit_allocate.c - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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-1307 USA - */ - -#include "config.h" - -#include - -#include "a52.h" -#include "a52_internal.h" - -static int hthtab[3][50] = { - {0x730, 0x730, 0x7c0, 0x800, 0x820, 0x840, 0x850, 0x850, 0x860, 0x860, - 0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x890, 0x890, - 0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900, - 0x910, 0x910, 0x910, 0x910, 0x900, 0x8f0, 0x8c0, 0x870, 0x820, 0x7e0, - 0x7a0, 0x770, 0x760, 0x7a0, 0x7c0, 0x7c0, 0x6e0, 0x400, 0x3c0, 0x3c0}, - {0x710, 0x710, 0x7a0, 0x7f0, 0x820, 0x830, 0x840, 0x850, 0x850, 0x860, - 0x860, 0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x880, - 0x890, 0x890, 0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8e0, 0x8f0, - 0x900, 0x910, 0x910, 0x910, 0x910, 0x900, 0x8e0, 0x8b0, 0x870, 0x820, - 0x7e0, 0x7b0, 0x760, 0x770, 0x7a0, 0x7c0, 0x780, 0x5d0, 0x3c0, 0x3c0}, - {0x680, 0x680, 0x750, 0x7b0, 0x7e0, 0x810, 0x820, 0x830, 0x840, 0x850, - 0x850, 0x850, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, - 0x870, 0x870, 0x870, 0x870, 0x880, 0x880, 0x880, 0x890, 0x8a0, 0x8b0, - 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900, 0x910, 0x910, 0x910, 0x900, 0x8f0, - 0x8d0, 0x8b0, 0x840, 0x7f0, 0x790, 0x760, 0x7a0, 0x7c0, 0x7b0, 0x720} -}; - -static int8_t baptab[305] = { - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 93 padding elems */ - - 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 14, 14, 14, 14, 14, - 14, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, - 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, - 5, 4, 4, -3, -3, 3, 3, 3, -2, -2, -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, 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, 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, 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, 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, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 /* 148 padding elems */ -}; - -static int bndtab[30] = {21, 22, 23, 24, 25, 26, 27, 28, 31, 34, - 37, 40, 43, 46, 49, 55, 61, 67, 73, 79, - 85, 97, 109, 121, 133, 157, 181, 205, 229, 253}; - -static int8_t latab[256] = { - -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, - -52, -52, -51, -50, -49, -48, -47, -47, -46, -45, -44, -44, - -43, -42, -41, -41, -40, -39, -38, -38, -37, -36, -36, -35, - -35, -34, -33, -33, -32, -32, -31, -30, -30, -29, -29, -28, - -28, -27, -27, -26, -26, -25, -25, -24, -24, -23, -23, -22, - -22, -21, -21, -21, -20, -20, -19, -19, -19, -18, -18, -18, - -17, -17, -17, -16, -16, -16, -15, -15, -15, -14, -14, -14, - -13, -13, -13, -13, -12, -12, -12, -12, -11, -11, -11, -11, - -10, -10, -10, -10, -10, -9, -9, -9, -9, -9, -8, -8, - -8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -6, -6, - -6, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, - -5, -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -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, -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, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; - -#define UPDATE_LEAK() \ -do { \ - fastleak += fdecay; \ - if (fastleak > psd + fgain) \ - fastleak = psd + fgain; \ - slowleak += sdecay; \ - if (slowleak > psd + sgain) \ - slowleak = psd + sgain; \ -} while (0) - -#define COMPUTE_MASK() \ -do { \ - if (psd > dbknee) \ - mask -= (psd - dbknee) >> 2; \ - if (mask > hth [i >> halfrate]) \ - mask = hth [i >> halfrate]; \ - mask -= snroffset + 128 * deltba[i]; \ - mask = (mask > 0) ? 0 : ((-mask) >> 5); \ - mask -= floor; \ -} while (0) - -void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, - int start, int end, int fastleak, int slowleak, - expbap_t * expbap) -{ - static int slowgain[4] = {0x540, 0x4d8, 0x478, 0x410}; - static int dbpbtab[4] = {0xc00, 0x500, 0x300, 0x100}; - static int floortab[8] = {0x910, 0x950, 0x990, 0x9d0, - 0xa10, 0xa90, 0xb10, 0x1400}; - - int i, j; - uint8_t * exp; - int8_t * bap; - int fdecay, fgain, sdecay, sgain, dbknee, floor, snroffset; - int psd, mask; - int8_t * deltba; - int * hth; - int halfrate; - - halfrate = state->halfrate; - fdecay = (63 + 20 * ((state->bai >> 7) & 3)) >> halfrate; /* fdcycod */ - fgain = 128 + 128 * (ba->bai & 7); /* fgaincod */ - sdecay = (15 + 2 * (state->bai >> 9)) >> halfrate; /* sdcycod */ - sgain = slowgain[(state->bai >> 5) & 3]; /* sgaincod */ - dbknee = dbpbtab[(state->bai >> 3) & 3]; /* dbpbcod */ - hth = hthtab[state->fscod]; - /* - * if there is no delta bit allocation, make deltba point to an area - * known to contain zeroes. baptab+156 here. - */ - deltba = (ba->deltbae == DELTA_BIT_NONE) ? baptab + 156 : ba->deltba; - floor = floortab[state->bai & 7]; /* floorcod */ - snroffset = 960 - 64 * state->csnroffst - 4 * (ba->bai >> 3) + floor; - floor >>= 5; - - exp = expbap->exp; - bap = expbap->bap; - - i = bndstart; - j = start; - if (start == 0) { /* not the coupling channel */ - int lowcomp; - - lowcomp = 0; - j = end - 1; - do { - if (i < j) { - if (exp[i+1] == exp[i] - 2) - lowcomp = 384; - else if (lowcomp && (exp[i+1] > exp[i])) - lowcomp -= 64; - } - psd = 128 * exp[i]; - mask = psd + fgain + lowcomp; - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } while ((i < 3) || ((i < 7) && (exp[i] > exp[i-1]))); - fastleak = psd + fgain; - slowleak = psd + sgain; - - while (i < 7) { - if (i < j) { - if (exp[i+1] == exp[i] - 2) - lowcomp = 384; - else if (lowcomp && (exp[i+1] > exp[i])) - lowcomp -= 64; - } - psd = 128 * exp[i]; - UPDATE_LEAK (); - mask = ((fastleak + lowcomp < slowleak) ? - fastleak + lowcomp : slowleak); - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } - - if (end == 7) /* lfe channel */ - return; - - do { - if (exp[i+1] == exp[i] - 2) - lowcomp = 320; - else if (lowcomp && (exp[i+1] > exp[i])) - lowcomp -= 64; - psd = 128 * exp[i]; - UPDATE_LEAK (); - mask = ((fastleak + lowcomp < slowleak) ? - fastleak + lowcomp : slowleak); - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } while (i < 20); - - while (lowcomp > 128) { /* two iterations maximum */ - lowcomp -= 128; - psd = 128 * exp[i]; - UPDATE_LEAK (); - mask = ((fastleak + lowcomp < slowleak) ? - fastleak + lowcomp : slowleak); - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } - j = i; - } - - do { - int startband, endband; - - startband = j; - endband = ((bndtab-20)[i] < end) ? (bndtab-20)[i] : end; - psd = 128 * exp[j++]; - while (j < endband) { - int next, delta; - - next = 128 * exp[j++]; - delta = next - psd; - switch (delta >> 9) { - case -6: case -5: case -4: case -3: case -2: - psd = next; - break; - case -1: - psd = next + latab[(-delta) >> 1]; - break; - case 0: - psd += latab[delta >> 1]; - break; - } - } - /* minpsd = -289 */ - UPDATE_LEAK (); - mask = (fastleak < slowleak) ? fastleak : slowleak; - COMPUTE_MASK (); - i++; - j = startband; - do { - /* max(mask+4*exp)=147=-(minpsd+fgain-deltba-snroffset)>>5+4*exp */ - /* min(mask+4*exp)=-156=-(sgain-deltba-snroffset)>>5 */ - bap[j] = (baptab+156)[mask + 4 * exp[j]]; - } while (++j < endband); - } while (j < end); -} diff --git a/liba52/bitstream.c b/liba52/bitstream.c deleted file mode 100644 index 7307527194..0000000000 --- a/liba52/bitstream.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * bitstream.c - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * Modified for use with MPlayer, changes contained in liba52_changes.diff. - * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ - * $Id$ - * - * a52dec 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. - * - * a52dec 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-1307 USA - */ - -#include "config.h" - -#include - -#include "a52.h" -#include "a52_internal.h" -#include "bitstream.h" - -#define BUFFER_SIZE 4096 - -#ifdef ALT_BITSTREAM_READER -int indx=0; -#endif - -void a52_bitstream_set_ptr (a52_state_t * state, uint8_t * buf) -{ - int align; - - align = (long)buf & 3; - state->buffer_start = (uint32_t *) (buf - align); - state->bits_left = 0; -#ifdef ALT_BITSTREAM_READER - indx=0; -#endif - bitstream_get (state, align * 8); -} - -static inline void bitstream_fill_current (a52_state_t * state) -{ - uint32_t tmp; - - tmp = *(state->buffer_start++); - state->current_word = swab32 (tmp); -} - -/* - * The fast paths for _get is in the - * bitstream.h header file so it can be inlined. - * - * The "bottom half" of this routine is suffixed _bh - * - * -ah - */ - -uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits) -{ - uint32_t result; - - num_bits -= state->bits_left; - result = ((state->current_word << (32 - state->bits_left)) >> - (32 - state->bits_left)); - - bitstream_fill_current (state); - - if (num_bits != 0) - result = (result << num_bits) | (state->current_word >> (32 - num_bits)); - - state->bits_left = 32 - num_bits; - - return result; -} - -int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits) -{ - int32_t result; - - num_bits -= state->bits_left; - result = ((((int32_t)state->current_word) << (32 - state->bits_left)) >> - (32 - state->bits_left)); - - bitstream_fill_current(state); - - if (num_bits != 0) - result = (result << num_bits) | (state->current_word >> (32 - num_bits)); - - state->bits_left = 32 - num_bits; - - return result; -} diff --git a/liba52/bitstream.h b/liba52/bitstream.h deleted file mode 100644 index 76f5556ea9..0000000000 --- a/liba52/bitstream.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * bitstream.h - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * Modified for use with MPlayer, changes contained in liba52_changes.diff. - * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ - * $Id$ - * - * a52dec 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. - * - * a52dec 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-1307 USA - */ - -/* code from ffmpeg/libavcodec */ -#if defined(__sparc__) || defined(hpux) -/* - * the alt bitstream reader performs unaligned memory accesses; that doesn't work - * on sparc/hpux. For now, disable ALT_BITSTREAM_READER. - */ -#undef ALT_BITSTREAM_READER -#else -// alternative (faster) bitstram reader (reades upto 3 bytes over the end of the input) -#define ALT_BITSTREAM_READER - -/* used to avoid misaligned exceptions on some archs (alpha, ...) */ -#if ARCH_X86 || HAVE_ARMV6 -# define unaligned32(a) (*(uint32_t*)(a)) -#else -# ifdef __GNUC__ -static inline uint32_t unaligned32(const void *v) { - struct Unaligned { - uint32_t i; - } __attribute__((packed)); - - return ((const struct Unaligned *) v)->i; -} -# elif defined(__DECC) -static inline uint32_t unaligned32(const void *v) { - return *(const __unaligned uint32_t *) v; -} -# else -static inline uint32_t unaligned32(const void *v) { - return *(const uint32_t *) v; -} -# endif -#endif //!ARCH_X86 - -#endif - -/* (stolen from the kernel) */ -#if HAVE_BIGENDIAN - -# define swab32(x) (x) - -#else - -# if defined (__i386__) - -# define swab32(x) __i386_swab32(x) - static inline const uint32_t __i386_swab32(uint32_t x) - { - __asm__("bswap %0" : "=r" (x) : "0" (x)); - return x; - } - -# else - -# define swab32(x) __generic_swab32(x) - static inline const uint32_t __generic_swab32(uint32_t x) - { - return ((((uint8_t*)&x)[0] << 24) | (((uint8_t*)&x)[1] << 16) | - (((uint8_t*)&x)[2] << 8) | (((uint8_t*)&x)[3])); - } -# endif -#endif - -#ifdef ALT_BITSTREAM_READER -extern int indx; -#endif - -void a52_bitstream_set_ptr (a52_state_t * state, uint8_t * buf); -uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits); -int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits); - -static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits) -{ -#ifdef ALT_BITSTREAM_READER - uint32_t result= swab32( unaligned32(((uint8_t *)state->buffer_start)+(indx>>3)) ); - - result<<= (indx&0x07); - result>>= 32 - num_bits; - indx+= num_bits; - - return result; -#else - uint32_t result; - - if (num_bits < state->bits_left) { - result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits); - state->bits_left -= num_bits; - return result; - } - - return a52_bitstream_get_bh (state, num_bits); -#endif -} - -static inline void bitstream_skip(a52_state_t * state, int num_bits) -{ -#ifdef ALT_BITSTREAM_READER - indx+= num_bits; -#else - bitstream_get(state, num_bits); -#endif -} - -static inline int32_t bitstream_get_2 (a52_state_t * state, uint32_t num_bits) -{ -#ifdef ALT_BITSTREAM_READER - int32_t result= swab32( unaligned32(((uint8_t *)state->buffer_start)+(indx>>3)) ); - - result<<= (indx&0x07); - result>>= 32 - num_bits; - indx+= num_bits; - - return result; -#else - int32_t result; - - if (num_bits < state->bits_left) { - result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits); - state->bits_left -= num_bits; - return result; - } - - return a52_bitstream_get_bh_2 (state, num_bits); -#endif -} diff --git a/liba52/crc.c b/liba52/crc.c deleted file mode 100644 index aa0a19c005..0000000000 --- a/liba52/crc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * crc.c - * - * Copyright (C) Aaron Holtzman - May 1999 - * - * This file is part of ac3dec, a free Dolby AC-3 stream decoder. - * - * ac3dec 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, or (at your option) - * any later version. - * - * ac3dec 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include - -static const uint16_t crc_lut[256] = -{ - 0x0000,0x8005,0x800f,0x000a,0x801b,0x001e,0x0014,0x8011, - 0x8033,0x0036,0x003c,0x8039,0x0028,0x802d,0x8027,0x0022, - 0x8063,0x0066,0x006c,0x8069,0x0078,0x807d,0x8077,0x0072, - 0x0050,0x8055,0x805f,0x005a,0x804b,0x004e,0x0044,0x8041, - 0x80c3,0x00c6,0x00cc,0x80c9,0x00d8,0x80dd,0x80d7,0x00d2, - 0x00f0,0x80f5,0x80ff,0x00fa,0x80eb,0x00ee,0x00e4,0x80e1, - 0x00a0,0x80a5,0x80af,0x00aa,0x80bb,0x00be,0x00b4,0x80b1, - 0x8093,0x0096,0x009c,0x8099,0x0088,0x808d,0x8087,0x0082, - 0x8183,0x0186,0x018c,0x8189,0x0198,0x819d,0x8197,0x0192, - 0x01b0,0x81b5,0x81bf,0x01ba,0x81ab,0x01ae,0x01a4,0x81a1, - 0x01e0,0x81e5,0x81ef,0x01ea,0x81fb,0x01fe,0x01f4,0x81f1, - 0x81d3,0x01d6,0x01dc,0x81d9,0x01c8,0x81cd,0x81c7,0x01c2, - 0x0140,0x8145,0x814f,0x014a,0x815b,0x015e,0x0154,0x8151, - 0x8173,0x0176,0x017c,0x8179,0x0168,0x816d,0x8167,0x0162, - 0x8123,0x0126,0x012c,0x8129,0x0138,0x813d,0x8137,0x0132, - 0x0110,0x8115,0x811f,0x011a,0x810b,0x010e,0x0104,0x8101, - 0x8303,0x0306,0x030c,0x8309,0x0318,0x831d,0x8317,0x0312, - 0x0330,0x8335,0x833f,0x033a,0x832b,0x032e,0x0324,0x8321, - 0x0360,0x8365,0x836f,0x036a,0x837b,0x037e,0x0374,0x8371, - 0x8353,0x0356,0x035c,0x8359,0x0348,0x834d,0x8347,0x0342, - 0x03c0,0x83c5,0x83cf,0x03ca,0x83db,0x03de,0x03d4,0x83d1, - 0x83f3,0x03f6,0x03fc,0x83f9,0x03e8,0x83ed,0x83e7,0x03e2, - 0x83a3,0x03a6,0x03ac,0x83a9,0x03b8,0x83bd,0x83b7,0x03b2, - 0x0390,0x8395,0x839f,0x039a,0x838b,0x038e,0x0384,0x8381, - 0x0280,0x8285,0x828f,0x028a,0x829b,0x029e,0x0294,0x8291, - 0x82b3,0x02b6,0x02bc,0x82b9,0x02a8,0x82ad,0x82a7,0x02a2, - 0x82e3,0x02e6,0x02ec,0x82e9,0x02f8,0x82fd,0x82f7,0x02f2, - 0x02d0,0x82d5,0x82df,0x02da,0x82cb,0x02ce,0x02c4,0x82c1, - 0x8243,0x0246,0x024c,0x8249,0x0258,0x825d,0x8257,0x0252, - 0x0270,0x8275,0x827f,0x027a,0x826b,0x026e,0x0264,0x8261, - 0x0220,0x8225,0x822f,0x022a,0x823b,0x023e,0x0234,0x8231, - 0x8213,0x0216,0x021c,0x8219,0x0208,0x820d,0x8207,0x0202 -}; - -uint16_t crc16_block(uint8_t *data,uint32_t num_bytes) -{ - uint32_t i; - uint16_t state=0; - - for(i=0;i>8)] ^ (state<<8); - - return state; -} diff --git a/liba52/downmix.c b/liba52/downmix.c deleted file mode 100644 index 212c87d921..0000000000 --- a/liba52/downmix.c +++ /dev/null @@ -1,1788 +0,0 @@ -/* - * downmix.c - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * Modified for use with MPlayer, changes contained in liba52_changes.diff. - * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ - * $Id$ - * - * a52dec 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. - * - * a52dec 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-1307 USA - * - * SSE optimizations from Michael Niedermayer (michaelni@gmx.at) - */ - -#include "config.h" - -#include -#include - -#include "a52.h" -#include "a52_internal.h" -#include "mm_accel.h" - -#define CONVERT(acmod,output) (((output) << 3) + (acmod)) - - -void (*a52_downmix)(sample_t * samples, int acmod, int output, sample_t bias, - sample_t clev, sample_t slev)= NULL; -void (*a52_upmix)(sample_t * samples, int acmod, int output)= NULL; - -static void downmix_SSE (sample_t * samples, int acmod, int output, sample_t bias, - sample_t clev, sample_t slev); -static void downmix_3dnow (sample_t * samples, int acmod, int output, sample_t bias, - sample_t clev, sample_t slev); -static void downmix_C (sample_t * samples, int acmod, int output, sample_t bias, - sample_t clev, sample_t slev); -static void upmix_MMX (sample_t * samples, int acmod, int output); -static void upmix_C (sample_t * samples, int acmod, int output); - -void downmix_accel_init(uint32_t mm_accel) -{ - a52_upmix= upmix_C; - a52_downmix= downmix_C; -#if ARCH_X86 || ARCH_X86_64 - if(mm_accel & MM_ACCEL_X86_MMX) a52_upmix= upmix_MMX; - if(mm_accel & MM_ACCEL_X86_SSE) a52_downmix= downmix_SSE; - if(mm_accel & MM_ACCEL_X86_3DNOW) a52_downmix= downmix_3dnow; -#endif -} - -int a52_downmix_init (int input, int flags, sample_t * level, - sample_t clev, sample_t slev) -{ - static uint8_t table[11][8] = { - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, - {A52_MONO, A52_MONO, A52_MONO, A52_MONO, - A52_MONO, A52_MONO, A52_MONO, A52_MONO}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, - A52_STEREO, A52_3F, A52_STEREO, A52_3F}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, - A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, - A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R}, - {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO, - A52_MONO, A52_MONO, A52_MONO, A52_MONO}, - {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO, - A52_MONO, A52_MONO, A52_MONO, A52_MONO}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY, - A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY} - }; - int output; - - output = flags & A52_CHANNEL_MASK; - if (output > A52_DOLBY) - return -1; - - output = table[output][input & 7]; - - if ((output == A52_STEREO) && - ((input == A52_DOLBY) || ((input == A52_3F) && (clev == LEVEL_3DB)))) - output = A52_DOLBY; - - if (flags & A52_ADJUST_LEVEL) - switch (CONVERT (input & 7, output)) { - - case CONVERT (A52_3F, A52_MONO): - *level *= LEVEL_3DB / (1 + clev); - break; - - case CONVERT (A52_STEREO, A52_MONO): - case CONVERT (A52_2F2R, A52_2F1R): - case CONVERT (A52_3F2R, A52_3F1R): - level_3db: - *level *= LEVEL_3DB; - break; - - case CONVERT (A52_3F2R, A52_2F1R): - if (clev < LEVEL_PLUS3DB - 1) - goto level_3db; - /* break thru */ - case CONVERT (A52_3F, A52_STEREO): - case CONVERT (A52_3F1R, A52_2F1R): - case CONVERT (A52_3F1R, A52_2F2R): - case CONVERT (A52_3F2R, A52_2F2R): - *level /= 1 + clev; - break; - - case CONVERT (A52_2F1R, A52_MONO): - *level *= LEVEL_PLUS3DB / (2 + slev); - break; - - case CONVERT (A52_2F1R, A52_STEREO): - case CONVERT (A52_3F1R, A52_3F): - *level /= 1 + slev * LEVEL_3DB; - break; - - case CONVERT (A52_3F1R, A52_MONO): - *level *= LEVEL_3DB / (1 + clev + 0.5 * slev); - break; - - case CONVERT (A52_3F1R, A52_STEREO): - *level /= 1 + clev + slev * LEVEL_3DB; - break; - - case CONVERT (A52_2F2R, A52_MONO): - *level *= LEVEL_3DB / (1 + slev); - break; - - case CONVERT (A52_2F2R, A52_STEREO): - case CONVERT (A52_3F2R, A52_3F): - *level /= 1 + slev; - break; - - case CONVERT (A52_3F2R, A52_MONO): - *level *= LEVEL_3DB / (1 + clev + slev); - break; - - case CONVERT (A52_3F2R, A52_STEREO): - *level /= 1 + clev + slev; - break; - - case CONVERT (A52_MONO, A52_DOLBY): - *level *= LEVEL_PLUS3DB; - break; - - case CONVERT (A52_3F, A52_DOLBY): - case CONVERT (A52_2F1R, A52_DOLBY): - *level *= 1 / (1 + LEVEL_3DB); - break; - - case CONVERT (A52_3F1R, A52_DOLBY): - case CONVERT (A52_2F2R, A52_DOLBY): - *level *= 1 / (1 + 2 * LEVEL_3DB); - break; - - case CONVERT (A52_3F2R, A52_DOLBY): - *level *= 1 / (1 + 3 * LEVEL_3DB); - break; - } - - return output; -} - -int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level, - sample_t clev, sample_t slev) -{ - switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { - - case CONVERT (A52_CHANNEL, A52_CHANNEL): - case CONVERT (A52_MONO, A52_MONO): - case CONVERT (A52_STEREO, A52_STEREO): - case CONVERT (A52_3F, A52_3F): - case CONVERT (A52_2F1R, A52_2F1R): - case CONVERT (A52_3F1R, A52_3F1R): - case CONVERT (A52_2F2R, A52_2F2R): - case CONVERT (A52_3F2R, A52_3F2R): - case CONVERT (A52_STEREO, A52_DOLBY): - coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level; - return 0; - - case CONVERT (A52_CHANNEL, A52_MONO): - coeff[0] = coeff[1] = level * LEVEL_6DB; - return 3; - - case CONVERT (A52_STEREO, A52_MONO): - coeff[0] = coeff[1] = level * LEVEL_3DB; - return 3; - - case CONVERT (A52_3F, A52_MONO): - coeff[0] = coeff[2] = level * LEVEL_3DB; - coeff[1] = level * clev * LEVEL_PLUS3DB; - return 7; - - case CONVERT (A52_2F1R, A52_MONO): - coeff[0] = coeff[1] = level * LEVEL_3DB; - coeff[2] = level * slev * LEVEL_3DB; - return 7; - - case CONVERT (A52_2F2R, A52_MONO): - coeff[0] = coeff[1] = level * LEVEL_3DB; - coeff[2] = coeff[3] = level * slev * LEVEL_3DB; - return 15; - - case CONVERT (A52_3F1R, A52_MONO): - coeff[0] = coeff[2] = level * LEVEL_3DB; - coeff[1] = level * clev * LEVEL_PLUS3DB; - coeff[3] = level * slev * LEVEL_3DB; - return 15; - - case CONVERT (A52_3F2R, A52_MONO): - coeff[0] = coeff[2] = level * LEVEL_3DB; - coeff[1] = level * clev * LEVEL_PLUS3DB; - coeff[3] = coeff[4] = level * slev * LEVEL_3DB; - return 31; - - case CONVERT (A52_MONO, A52_DOLBY): - coeff[0] = level * LEVEL_3DB; - return 0; - - case CONVERT (A52_3F, A52_DOLBY): - clev = LEVEL_3DB; - case CONVERT (A52_3F, A52_STEREO): - case CONVERT (A52_3F1R, A52_2F1R): - case CONVERT (A52_3F2R, A52_2F2R): - coeff[0] = coeff[2] = coeff[3] = coeff[4] = level; - coeff[1] = level * clev; - return 7; - - case CONVERT (A52_2F1R, A52_DOLBY): - slev = 1; - case CONVERT (A52_2F1R, A52_STEREO): - coeff[0] = coeff[1] = level; - coeff[2] = level * slev * LEVEL_3DB; - return 7; - - case CONVERT (A52_3F1R, A52_DOLBY): - clev = LEVEL_3DB; - slev = 1; - case CONVERT (A52_3F1R, A52_STEREO): - coeff[0] = coeff[2] = level; - coeff[1] = level * clev; - coeff[3] = level * slev * LEVEL_3DB; - return 15; - - case CONVERT (A52_2F2R, A52_DOLBY): - slev = LEVEL_3DB; - case CONVERT (A52_2F2R, A52_STEREO): - coeff[0] = coeff[1] = level; - coeff[2] = coeff[3] = level * slev; - return 15; - - case CONVERT (A52_3F2R, A52_DOLBY): - clev = LEVEL_3DB; - case CONVERT (A52_3F2R, A52_2F1R): - slev = LEVEL_3DB; - case CONVERT (A52_3F2R, A52_STEREO): - coeff[0] = coeff[2] = level; - coeff[1] = level * clev; - coeff[3] = coeff[4] = level * slev; - return 31; - - case CONVERT (A52_3F1R, A52_3F): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = level * slev * LEVEL_3DB; - return 13; - - case CONVERT (A52_3F2R, A52_3F): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = coeff[4] = level * slev; - return 29; - - case CONVERT (A52_2F2R, A52_2F1R): - coeff[0] = coeff[1] = level; - coeff[2] = coeff[3] = level * LEVEL_3DB; - return 12; - - case CONVERT (A52_3F2R, A52_3F1R): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = coeff[4] = level * LEVEL_3DB; - return 24; - - case CONVERT (A52_2F1R, A52_2F2R): - coeff[0] = coeff[1] = level; - coeff[2] = level * LEVEL_3DB; - return 0; - - case CONVERT (A52_3F1R, A52_2F2R): - coeff[0] = coeff[2] = level; - coeff[1] = level * clev; - coeff[3] = level * LEVEL_3DB; - return 7; - - case CONVERT (A52_3F1R, A52_3F2R): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = level * LEVEL_3DB; - return 0; - - case CONVERT (A52_CHANNEL, A52_CHANNEL1): - coeff[0] = level; - coeff[1] = 0; - return 0; - - case CONVERT (A52_CHANNEL, A52_CHANNEL2): - coeff[0] = 0; - coeff[1] = level; - return 0; - } - - return -1; /* NOTREACHED */ -} - -static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias) -{ - int i; - - for (i = 0; i < 256; i++) - dest[i] += src[i] + bias; -} - -static void mix3to1 (sample_t * samples, sample_t bias) -{ - int i; - - for (i = 0; i < 256; i++) - samples[i] += samples[i + 256] + samples[i + 512] + bias; -} - -static void mix4to1 (sample_t * samples, sample_t bias) -{ - int i; - - for (i = 0; i < 256; i++) - samples[i] += (samples[i + 256] + samples[i + 512] + - samples[i + 768] + bias); -} - -static void mix5to1 (sample_t * samples, sample_t bias) -{ - int i; - - for (i = 0; i < 256; i++) - samples[i] += (samples[i + 256] + samples[i + 512] + - samples[i + 768] + samples[i + 1024] + bias); -} - -static void mix3to2 (sample_t * samples, sample_t bias) -{ - int i; - sample_t common; - - for (i = 0; i < 256; i++) { - common = samples[i + 256] + bias; - samples[i] += common; - samples[i + 256] = samples[i + 512] + common; - } -} - -static void mix21to2 (sample_t * left, sample_t * right, sample_t bias) -{ - int i; - sample_t common; - - for (i = 0; i < 256; i++) { - common = right[i + 256] + bias; - left[i] += common; - right[i] += common; - } -} - -static void mix21toS (sample_t * samples, sample_t bias) -{ - int i; - sample_t surround; - - for (i = 0; i < 256; i++) { - surround = samples[i + 512]; - samples[i] += bias - surround; - samples[i + 256] += bias + surround; - } -} - -static void mix31to2 (sample_t * samples, sample_t bias) -{ - int i; - sample_t common; - - for (i = 0; i < 256; i++) { - common = samples[i + 256] + samples[i + 768] + bias; - samples[i] += common; - samples[i + 256] = samples[i + 512] + common; - } -} - -static void mix31toS (sample_t * samples, sample_t bias) -{ - int i; - sample_t common, surround; - - for (i = 0; i < 256; i++) { - common = samples[i + 256] + bias; - surround = samples[i + 768]; - samples[i] += common - surround; - samples[i + 256] = samples[i + 512] + common + surround; - } -} - -static void mix22toS (sample_t * samples, sample_t bias) -{ - int i; - sample_t surround; - - for (i = 0; i < 256; i++) { - surround = samples[i + 512] + samples[i + 768]; - samples[i] += bias - surround; - samples[i + 256] += bias + surround; - } -} - -static void mix32to2 (sample_t * samples, sample_t bias) -{ - int i; - sample_t common; - - for (i = 0; i < 256; i++) { - common = samples[i + 256] + bias; - samples[i] += common + samples[i + 768]; - samples[i + 256] = common + samples[i + 512] + samples[i + 1024]; - } -} - -static void mix32toS (sample_t * samples, sample_t bias) -{ - int i; - sample_t common, surround; - - for (i = 0; i < 256; i++) { - common = samples[i + 256] + bias; - surround = samples[i + 768] + samples[i + 1024]; - samples[i] += common - surround; - samples[i + 256] = samples[i + 512] + common + surround; - } -} - -static void move2to1 (sample_t * src, sample_t * dest, sample_t bias) -{ - int i; - - for (i = 0; i < 256; i++) - dest[i] = src[i] + src[i + 256] + bias; -} - -static void zero (sample_t * samples) -{ - int i; - - for (i = 0; i < 256; i++) - samples[i] = 0; -} - -void downmix_C (sample_t * samples, int acmod, int output, sample_t bias, - sample_t clev, sample_t slev) -{ - switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { - - case CONVERT (A52_CHANNEL, A52_CHANNEL2): - memcpy (samples, samples + 256, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_CHANNEL, A52_MONO): - case CONVERT (A52_STEREO, A52_MONO): - mix_2to1: - mix2to1 (samples, samples + 256, bias); - break; - - case CONVERT (A52_2F1R, A52_MONO): - if (slev == 0) - goto mix_2to1; - case CONVERT (A52_3F, A52_MONO): - mix_3to1: - mix3to1 (samples, bias); - break; - - case CONVERT (A52_3F1R, A52_MONO): - if (slev == 0) - goto mix_3to1; - case CONVERT (A52_2F2R, A52_MONO): - if (slev == 0) - goto mix_2to1; - mix4to1 (samples, bias); - break; - - case CONVERT (A52_3F2R, A52_MONO): - if (slev == 0) - goto mix_3to1; - mix5to1 (samples, bias); - break; - - case CONVERT (A52_MONO, A52_DOLBY): - memcpy (samples + 256, samples, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_3F, A52_STEREO): - case CONVERT (A52_3F, A52_DOLBY): - mix_3to2: - mix3to2 (samples, bias); - break; - - case CONVERT (A52_2F1R, A52_STEREO): - if (slev == 0) - break; - mix21to2 (samples, samples + 256, bias); - break; - - case CONVERT (A52_2F1R, A52_DOLBY): - mix21toS (samples, bias); - break; - - case CONVERT (A52_3F1R, A52_STEREO): - if (slev == 0) - goto mix_3to2; - mix31to2 (samples, bias); - break; - - case CONVERT (A52_3F1R, A52_DOLBY): - mix31toS (samples, bias); - break; - - case CONVERT (A52_2F2R, A52_STEREO): - if (slev == 0) - break; - mix2to1 (samples, samples + 512, bias); - mix2to1 (samples + 256, samples + 768, bias); - break; - - case CONVERT (A52_2F2R, A52_DOLBY): - mix22toS (samples, bias); - break; - - case CONVERT (A52_3F2R, A52_STEREO): - if (slev == 0) - goto mix_3to2; - mix32to2 (samples, bias); - break; - - case CONVERT (A52_3F2R, A52_DOLBY): - mix32toS (samples, bias); - break; - - case CONVERT (A52_3F1R, A52_3F): - if (slev == 0) - break; - mix21to2 (samples, samples + 512, bias); - break; - - case CONVERT (A52_3F2R, A52_3F): - if (slev == 0) - break; - mix2to1 (samples, samples + 768, bias); - mix2to1 (samples + 512, samples + 1024, bias); - break; - - case CONVERT (A52_3F1R, A52_2F1R): - mix3to2 (samples, bias); - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_2F2R, A52_2F1R): - mix2to1 (samples + 512, samples + 768, bias); - break; - - case CONVERT (A52_3F2R, A52_2F1R): - mix3to2 (samples, bias); //FIXME possible bug? (output doesnt seem to be used) - move2to1 (samples + 768, samples + 512, bias); - break; - - case CONVERT (A52_3F2R, A52_3F1R): - mix2to1 (samples + 768, samples + 1024, bias); - break; - - case CONVERT (A52_2F1R, A52_2F2R): - memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_3F1R, A52_2F2R): - mix3to2 (samples, bias); - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_3F2R, A52_2F2R): - mix3to2 (samples, bias); - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); - memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_3F1R, A52_3F2R): - memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); - break; - } -} - -void upmix_C (sample_t * samples, int acmod, int output) -{ - switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { - - case CONVERT (A52_CHANNEL, A52_CHANNEL2): - memcpy (samples + 256, samples, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_3F2R, A52_MONO): - zero (samples + 1024); - case CONVERT (A52_3F1R, A52_MONO): - case CONVERT (A52_2F2R, A52_MONO): - zero (samples + 768); - case CONVERT (A52_3F, A52_MONO): - case CONVERT (A52_2F1R, A52_MONO): - zero (samples + 512); - case CONVERT (A52_CHANNEL, A52_MONO): - case CONVERT (A52_STEREO, A52_MONO): - zero (samples + 256); - break; - - case CONVERT (A52_3F2R, A52_STEREO): - case CONVERT (A52_3F2R, A52_DOLBY): - zero (samples + 1024); - case CONVERT (A52_3F1R, A52_STEREO): - case CONVERT (A52_3F1R, A52_DOLBY): - zero (samples + 768); - case CONVERT (A52_3F, A52_STEREO): - case CONVERT (A52_3F, A52_DOLBY): - mix_3to2: - memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t)); - zero (samples + 256); - break; - - case CONVERT (A52_2F2R, A52_STEREO): - case CONVERT (A52_2F2R, A52_DOLBY): - zero (samples + 768); - case CONVERT (A52_2F1R, A52_STEREO): - case CONVERT (A52_2F1R, A52_DOLBY): - zero (samples + 512); - break; - - case CONVERT (A52_3F2R, A52_3F): - zero (samples + 1024); - case CONVERT (A52_3F1R, A52_3F): - case CONVERT (A52_2F2R, A52_2F1R): - zero (samples + 768); - break; - - case CONVERT (A52_3F2R, A52_3F1R): - zero (samples + 1024); - break; - - case CONVERT (A52_3F2R, A52_2F1R): - zero (samples + 1024); - case CONVERT (A52_3F1R, A52_2F1R): - mix_31to21: - memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); - goto mix_3to2; - - case CONVERT (A52_3F2R, A52_2F2R): - memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); - goto mix_31to21; - } -} - -#if ARCH_X86 || ARCH_X86_64 -static void mix2to1_SSE (sample_t * dest, sample_t * src, sample_t bias) -{ - __asm__ volatile( - "movlps %2, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps (%0, %%"REG_S"), %%xmm0 \n\t" - "movaps 16(%0, %%"REG_S"), %%xmm1\n\t" - "addps (%1, %%"REG_S"), %%xmm0 \n\t" - "addps 16(%1, %%"REG_S"), %%xmm1\n\t" - "addps %%xmm7, %%xmm0 \n\t" - "addps %%xmm7, %%xmm1 \n\t" - "movaps %%xmm0, (%1, %%"REG_S") \n\t" - "movaps %%xmm1, 16(%1, %%"REG_S")\n\t" - "add $32, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (src+256), "r" (dest+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix3to1_SSE (sample_t * samples, sample_t bias) -{ - __asm__ volatile( - "movlps %1, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps (%0, %%"REG_S"), %%xmm0 \n\t" - "movaps 1024(%0, %%"REG_S"), %%xmm1\n\t" - "addps 2048(%0, %%"REG_S"), %%xmm0\n\t" - "addps %%xmm7, %%xmm1 \n\t" - "addps %%xmm1, %%xmm0 \n\t" - "movaps %%xmm0, (%0, %%"REG_S") \n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (samples+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix4to1_SSE (sample_t * samples, sample_t bias) -{ - __asm__ volatile( - "movlps %1, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps (%0, %%"REG_S"), %%xmm0 \n\t" - "movaps 1024(%0, %%"REG_S"), %%xmm1\n\t" - "addps 2048(%0, %%"REG_S"), %%xmm0\n\t" - "addps 3072(%0, %%"REG_S"), %%xmm1\n\t" - "addps %%xmm7, %%xmm0 \n\t" - "addps %%xmm1, %%xmm0 \n\t" - "movaps %%xmm0, (%0, %%"REG_S") \n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (samples+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix5to1_SSE (sample_t * samples, sample_t bias) -{ - __asm__ volatile( - "movlps %1, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps (%0, %%"REG_S"), %%xmm0 \n\t" - "movaps 1024(%0, %%"REG_S"), %%xmm1\n\t" - "addps 2048(%0, %%"REG_S"), %%xmm0\n\t" - "addps 3072(%0, %%"REG_S"), %%xmm1\n\t" - "addps %%xmm7, %%xmm0 \n\t" - "addps 4096(%0, %%"REG_S"), %%xmm1\n\t" - "addps %%xmm1, %%xmm0 \n\t" - "movaps %%xmm0, (%0, %%"REG_S") \n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (samples+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix3to2_SSE (sample_t * samples, sample_t bias) -{ - __asm__ volatile( - "movlps %1, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps 1024(%0, %%"REG_S"), %%xmm0\n\t" - "addps %%xmm7, %%xmm0 \n\t" //common - "movaps (%0, %%"REG_S"), %%xmm1 \n\t" - "movaps 2048(%0, %%"REG_S"), %%xmm2\n\t" - "addps %%xmm0, %%xmm1 \n\t" - "addps %%xmm0, %%xmm2 \n\t" - "movaps %%xmm1, (%0, %%"REG_S") \n\t" - "movaps %%xmm2, 1024(%0, %%"REG_S")\n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (samples+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix21to2_SSE (sample_t * left, sample_t * right, sample_t bias) -{ - __asm__ volatile( - "movlps %2, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps 1024(%1, %%"REG_S"), %%xmm0\n\t" - "addps %%xmm7, %%xmm0 \n\t" //common - "movaps (%0, %%"REG_S"), %%xmm1 \n\t" - "movaps (%1, %%"REG_S"), %%xmm2 \n\t" - "addps %%xmm0, %%xmm1 \n\t" - "addps %%xmm0, %%xmm2 \n\t" - "movaps %%xmm1, (%0, %%"REG_S") \n\t" - "movaps %%xmm2, (%1, %%"REG_S") \n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (left+256), "r" (right+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix21toS_SSE (sample_t * samples, sample_t bias) -{ - __asm__ volatile( - "movlps %1, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps 2048(%0, %%"REG_S"), %%xmm0\n\t" // surround - "movaps (%0, %%"REG_S"), %%xmm1 \n\t" - "movaps 1024(%0, %%"REG_S"), %%xmm2\n\t" - "addps %%xmm7, %%xmm1 \n\t" - "addps %%xmm7, %%xmm2 \n\t" - "subps %%xmm0, %%xmm1 \n\t" - "addps %%xmm0, %%xmm2 \n\t" - "movaps %%xmm1, (%0, %%"REG_S") \n\t" - "movaps %%xmm2, 1024(%0, %%"REG_S")\n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (samples+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix31to2_SSE (sample_t * samples, sample_t bias) -{ - __asm__ volatile( - "movlps %1, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps 1024(%0, %%"REG_S"), %%xmm0\n\t" - "addps 3072(%0, %%"REG_S"), %%xmm0\n\t" - "addps %%xmm7, %%xmm0 \n\t" // common - "movaps (%0, %%"REG_S"), %%xmm1 \n\t" - "movaps 2048(%0, %%"REG_S"), %%xmm2\n\t" - "addps %%xmm0, %%xmm1 \n\t" - "addps %%xmm0, %%xmm2 \n\t" - "movaps %%xmm1, (%0, %%"REG_S") \n\t" - "movaps %%xmm2, 1024(%0, %%"REG_S")\n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (samples+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix31toS_SSE (sample_t * samples, sample_t bias) -{ - __asm__ volatile( - "movlps %1, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps 1024(%0, %%"REG_S"), %%xmm0\n\t" - "movaps 3072(%0, %%"REG_S"), %%xmm3\n\t" // surround - "addps %%xmm7, %%xmm0 \n\t" // common - "movaps (%0, %%"REG_S"), %%xmm1 \n\t" - "movaps 2048(%0, %%"REG_S"), %%xmm2\n\t" - "addps %%xmm0, %%xmm1 \n\t" - "addps %%xmm0, %%xmm2 \n\t" - "subps %%xmm3, %%xmm1 \n\t" - "addps %%xmm3, %%xmm2 \n\t" - "movaps %%xmm1, (%0, %%"REG_S") \n\t" - "movaps %%xmm2, 1024(%0, %%"REG_S")\n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (samples+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix22toS_SSE (sample_t * samples, sample_t bias) -{ - __asm__ volatile( - "movlps %1, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps 2048(%0, %%"REG_S"), %%xmm0\n\t" - "addps 3072(%0, %%"REG_S"), %%xmm0\n\t" // surround - "movaps (%0, %%"REG_S"), %%xmm1 \n\t" - "movaps 1024(%0, %%"REG_S"), %%xmm2\n\t" - "addps %%xmm7, %%xmm1 \n\t" - "addps %%xmm7, %%xmm2 \n\t" - "subps %%xmm0, %%xmm1 \n\t" - "addps %%xmm0, %%xmm2 \n\t" - "movaps %%xmm1, (%0, %%"REG_S") \n\t" - "movaps %%xmm2, 1024(%0, %%"REG_S")\n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (samples+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix32to2_SSE (sample_t * samples, sample_t bias) -{ - __asm__ volatile( - "movlps %1, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps 1024(%0, %%"REG_S"), %%xmm0\n\t" - "addps %%xmm7, %%xmm0 \n\t" // common - "movaps %%xmm0, %%xmm1 \n\t" // common - "addps (%0, %%"REG_S"), %%xmm0 \n\t" - "addps 2048(%0, %%"REG_S"), %%xmm1\n\t" - "addps 3072(%0, %%"REG_S"), %%xmm0\n\t" - "addps 4096(%0, %%"REG_S"), %%xmm1\n\t" - "movaps %%xmm0, (%0, %%"REG_S") \n\t" - "movaps %%xmm1, 1024(%0, %%"REG_S")\n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (samples+256), "m" (bias) - : "%"REG_S - ); -} - -static void mix32toS_SSE (sample_t * samples, sample_t bias) -{ - __asm__ volatile( - "movlps %1, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps 1024(%0, %%"REG_S"), %%xmm0\n\t" - "movaps 3072(%0, %%"REG_S"), %%xmm2\n\t" - "addps %%xmm7, %%xmm0 \n\t" // common - "addps 4096(%0, %%"REG_S"), %%xmm2\n\t" // surround - "movaps (%0, %%"REG_S"), %%xmm1 \n\t" - "movaps 2048(%0, %%"REG_S"), %%xmm3\n\t" - "subps %%xmm2, %%xmm1 \n\t" - "addps %%xmm2, %%xmm3 \n\t" - "addps %%xmm0, %%xmm1 \n\t" - "addps %%xmm0, %%xmm3 \n\t" - "movaps %%xmm1, (%0, %%"REG_S") \n\t" - "movaps %%xmm3, 1024(%0, %%"REG_S")\n\t" - "add $16, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (samples+256), "m" (bias) - : "%"REG_S - ); -} - -static void move2to1_SSE (sample_t * src, sample_t * dest, sample_t bias) -{ - __asm__ volatile( - "movlps %2, %%xmm7 \n\t" - "shufps $0x00, %%xmm7, %%xmm7 \n\t" - "mov $-1024, %%"REG_S" \n\t" - ASMALIGN(4) - "1: \n\t" - "movaps (%0, %%"REG_S"), %%xmm0 \n\t" - "movaps 16(%0, %%"REG_S"), %%xmm1\n\t" - "addps 1024(%0, %%"REG_S"), %%xmm0\n\t" - "addps 1040(%0, %%"REG_S"), %%xmm1\n\t" - "addps %%xmm7, %%xmm0 \n\t" - "addps %%xmm7, %%xmm1 \n\t" - "movaps %%xmm0, (%1, %%"REG_S") \n\t" - "movaps %%xmm1, 16(%1, %%"REG_S")\n\t" - "add $32, %%"REG_S" \n\t" - " jnz 1b \n\t" - :: "r" (src+256), "r" (dest+256), "m" (bias) - : "%"REG_S - ); -} - -static void zero_MMX(sample_t * samples) -{ - __asm__ volatile( - "mov $-1024, %%"REG_S" \n\t" - "pxor %%mm0, %%mm0 \n\t" - ASMALIGN(4) - "1: \n\t" - "mo