diff options
-rw-r--r-- | Copyright | 12 | ||||
-rw-r--r-- | DOCS/tech/MAINTAINERS | 1 | ||||
-rw-r--r-- | DOCS/tech/binary-packaging.txt | 2 | ||||
-rw-r--r-- | DOCS/tech/general.txt | 2 | ||||
-rw-r--r-- | Makefile | 16 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | liba52/a52.h | 74 | ||||
-rw-r--r-- | liba52/a52_internal.h | 140 | ||||
-rw-r--r-- | liba52/bit_allocate.c | 265 | ||||
-rw-r--r-- | liba52/bitstream.c | 106 | ||||
-rw-r--r-- | liba52/bitstream.h | 152 | ||||
-rw-r--r-- | liba52/crc.c | 73 | ||||
-rw-r--r-- | liba52/downmix.c | 1788 | ||||
-rw-r--r-- | liba52/imdct.c | 1304 | ||||
-rw-r--r-- | liba52/imdct_3dnow.h | 581 | ||||
-rw-r--r-- | liba52/liba52.txt | 208 | ||||
-rw-r--r-- | liba52/liba52_changes.diff | 2473 | ||||
-rw-r--r-- | liba52/mm_accel.h | 46 | ||||
-rw-r--r-- | liba52/parse.c | 919 | ||||
-rw-r--r-- | liba52/resample.c | 82 | ||||
-rw-r--r-- | liba52/resample_altivec.c | 110 | ||||
-rw-r--r-- | liba52/resample_c.c | 205 | ||||
-rw-r--r-- | liba52/resample_mmx.c | 541 | ||||
-rw-r--r-- | liba52/srfftp.h | 303 | ||||
-rw-r--r-- | liba52/srfftp_3dnow.h | 187 | ||||
-rw-r--r-- | liba52/tables.h | 246 | ||||
-rw-r--r-- | liba52/test.c | 154 | ||||
-rw-r--r-- | libmpcodecs/ad_liba52.c | 16 | ||||
-rw-r--r-- | libmpdemux/muxer_mpeg.c | 2 |
29 files changed, 6 insertions, 10022 deletions
@@ -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 <aholtzma@ess.engr.uvic.ca> - 2000-2001 Michel Lespinasse <walken@zoy.org> - 2000 Yuqing Deng <Yuqing_Deng@brown.edu> - 2002 Nick Kurshev - 2004 Romain Dolbeau <romain@dolbeau.org> -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 @@ -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 @@ -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 <inttypes.h> #include <a52dec/a52.h> 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 <walken@zoy.org> - * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> - * - * 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 <stdint.h> -#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 <walken@zoy.org> - * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> - * - * 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 <walken@zoy.org> - * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> - * - * 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 <inttypes.h> - -#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 <walken@zoy.org> - * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> - * - * 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 <inttypes.h> - -#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; - |