diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-06-02 22:59:04 +0000 |
---|---|---|
committer | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-06-02 22:59:04 +0000 |
commit | 228ca70d485e2660c2e381d7112cbcca65c156a0 (patch) | |
tree | f7ab4303f2daa68c76271787a60d50cb1ada2e46 | |
parent | eb1dee5cbf86fba8d5081bae6071cc4a4fd68306 (diff) | |
download | mpv-228ca70d485e2660c2e381d7112cbcca65c156a0.tar.bz2 mpv-228ca70d485e2660c2e381d7112cbcca65c156a0.tar.xz |
update to the 2.0 release of faad, patch by adland
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12528 b3059339-0415-0410-9bf9-f77b7e298cf2
85 files changed, 26146 insertions, 22637 deletions
diff --git a/libfaad2/Makefile b/libfaad2/Makefile index 0af71f9b7c..6e8e5ab93b 100644 --- a/libfaad2/Makefile +++ b/libfaad2/Makefile @@ -3,7 +3,7 @@ LIBNAME = libfaad2.a include ../config.mak -SRCS = bits.c cfft.c common.c decoder.c dither.c drc.c error.c filtbank.c hcr.c huffman.c ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c pulse.c rvlc.c sbr_dct.c sbr_dec.c sbr_e_nf.c sbr_fbt.c sbr_hfadj.c sbr_hfgen.c sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c specrec.c ssr.c ssr_fb.c ssr_ipqf.c syntax.c tns.c +SRCS = bits.c cfft.c common.c decoder.c drc.c error.c filtbank.c hcr.c huffman.c ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c pulse.c rvlc.c sbr_dct.c sbr_dec.c sbr_e_nf.c sbr_fbt.c sbr_hfadj.c sbr_hfgen.c sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c specrec.c ssr.c ssr_fb.c ssr_ipqf.c syntax.c tns.c OBJS = $(SRCS:.c=.o) CFLAGS = -I. $(OPTFLAGS) diff --git a/libfaad2/README b/libfaad2/README index 5943bdb18c..8d2778f96b 100644 --- a/libfaad2/README +++ b/libfaad2/README @@ -1 +1 @@ -files from libfaad v2.0rc1 tarball's libfaad/ and include/ subdir +files from libfaad v2.0 tarball's libfaad/ and include/ subdir diff --git a/libfaad2/analysis.h b/libfaad2/analysis.h index f05c876269..05f7ce8b98 100644 --- a/libfaad2/analysis.h +++ b/libfaad2/analysis.h @@ -1,6 +1,6 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com ** ** 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 @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: analysis.h,v 1.3 2003/07/29 08:20:12 menno Exp $ +** $Id: analysis.h,v 1.1 2003/08/30 22:30:21 arpi Exp $ **/ #ifndef __ANALYSIS_H__ diff --git a/libfaad2/bits.c b/libfaad2/bits.c index 1d8c91bed3..8c01c5657c 100644 --- a/libfaad2/bits.c +++ b/libfaad2/bits.c @@ -1,6 +1,6 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com ** ** 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 @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: bits.c,v 1.1 2003/08/30 22:30:21 arpi Exp $ +** $Id: bits.c,v 1.2 2003/10/03 22:22:27 alex Exp $ **/ #include "common.h" @@ -33,7 +33,7 @@ #include "bits.h" /* initialize buffer, call once before first getbits or showbits */ -void faad_initbits(bitfile *ld, void *_buffer, uint32_t buffer_size) +void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) { uint32_t tmp; @@ -49,22 +49,16 @@ void faad_initbits(bitfile *ld, void *_buffer, uint32_t buffer_size) return; } - ld->buffer = malloc((buffer_size+12)*sizeof(uint8_t)); + ld->buffer = faad_malloc((buffer_size+12)*sizeof(uint8_t)); memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t)); memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t)); ld->buffer_size = buffer_size; tmp = getdword((uint32_t*)ld->buffer); -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif ld->bufa = tmp; tmp = getdword((uint32_t*)ld->buffer + 1); -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif ld->bufb = tmp; ld->start = (uint32_t*)ld->buffer; @@ -80,7 +74,13 @@ void faad_initbits(bitfile *ld, void *_buffer, uint32_t buffer_size) void faad_endbits(bitfile *ld) { if (ld) - if (ld->buffer) free(ld->buffer); + { + if (ld->buffer) + { + faad_free(ld->buffer); + ld->buffer = NULL; + } + } } uint32_t faad_get_processed_bits(bitfile *ld) @@ -105,11 +105,13 @@ void faad_flushbits_ex(bitfile *ld, uint32_t bits) uint32_t tmp; ld->bufa = ld->bufb; - tmp = getdword(ld->tail); - ld->tail++; -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif + if (ld->no_more_reading == 0) + { + tmp = getdword(ld->tail); + ld->tail++; + } else { + tmp = 0; + } ld->bufb = tmp; ld->bits_left += (32 - bits); ld->bytes_used += 4; @@ -149,7 +151,7 @@ uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits uint16_t bytes = (uint16_t)bits / 8; uint8_t remainder = (uint8_t)bits % 8; - uint8_t *buffer = (uint8_t*)malloc((bytes+1)*sizeof(uint8_t)); + uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t)); for (i = 0; i < bytes; i++) { @@ -166,6 +168,20 @@ uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits return buffer; } +#ifdef DRM +/* return the original data buffer */ +void *faad_origbitbuffer(bitfile *ld) +{ + return (void*)ld->start; +} + +/* return the original data buffer size */ +uint32_t faad_origbitbuffer_size(bitfile *ld) +{ + return ld->buffer_size; +} +#endif + /* reversed bit reading routines, used for RVLC and HCR */ void faad_initbits_rev(bitfile *ld, void *buffer, uint32_t bits_in_buffer) @@ -180,15 +196,9 @@ void faad_initbits_rev(bitfile *ld, void *buffer, ld->start = (uint32_t*)buffer + index - 2; tmp = getdword((uint32_t*)buffer + index); -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif ld->bufa = tmp; tmp = getdword((uint32_t*)buffer + index - 1); -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif ld->bufb = tmp; ld->tail = (uint32_t*)buffer + index; diff --git a/libfaad2/bits.h b/libfaad2/bits.h index 3d4bd811ea..c8f9ea2ed4 100644 --- a/libfaad2/bits.h +++ b/libfaad2/bits.h @@ -1,6 +1,6 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com ** ** 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 @@ -56,9 +56,9 @@ typedef struct _bitfile } bitfile; -#if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) +#if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__) #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax -#elif defined(ARCH_X86) && (defined(DJGPP) || defined(__GNUC__)) +#elif defined(LINUX) || defined(DJGPP) #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) #else #define BSWAP(a) \ @@ -71,9 +71,11 @@ static uint32_t bitmask[] = { 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF, 0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF, 0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF + /* added bitmask 32, correct?!?!?! */ + , 0xFFFFFFFF }; -void faad_initbits(bitfile *ld, void *buffer, uint32_t buffer_size); +void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size); void faad_endbits(bitfile *ld); void faad_initbits_rev(bitfile *ld, void *buffer, uint32_t bits_in_buffer); @@ -83,20 +85,36 @@ void faad_flushbits_ex(bitfile *ld, uint32_t bits); void faad_rewindbits(bitfile *ld); uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits DEBUGDEC); +#ifdef DRM +void *faad_origbitbuffer(bitfile *ld); +uint32_t faad_origbitbuffer_size(bitfile *ld); +#endif /* circumvent memory alignment errors on ARM */ static INLINE uint32_t getdword(void *mem) { #ifdef ARM uint32_t tmp; +#ifndef ARCH_IS_BIG_ENDIAN + ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3]; + ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2]; + ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1]; + ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0]; +#else ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0]; ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1]; ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2]; ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3]; +#endif return tmp; #else - return *(uint32_t*)mem; + uint32_t tmp; + tmp = *(uint32_t*)mem; +#ifndef ARCH_IS_BIG_ENDIAN + BSWAP(tmp); +#endif + return tmp; #endif } @@ -107,8 +125,8 @@ static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits) return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits]; } - bits -= ld->bits_left; - return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits)); + bits -= ld->bits_left; + return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits)); } static INLINE void faad_flushbits(bitfile *ld, uint32_t bits) @@ -148,12 +166,20 @@ static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC) { uint8_t r; - if (ld->bits_left == 0) - return (uint8_t)faad_getbits(ld, 1 DEBUGVAR(print,var,dbg)); - - ld->bits_left--; - r = (uint8_t)((ld->bufa >> ld->bits_left) & 1); + if (ld->bits_left > 0) + { + ld->bits_left--; + r = (uint8_t)((ld->bufa >> ld->bits_left) & 1); + return r; + } + /* bits_left == 0 */ +#if 0 + r = (uint8_t)(ld->bufb >> 31); + faad_flushbits_ex(ld, 1); +#else + r = (uint8_t)faad_getbits(ld, 1); +#endif return r; } @@ -200,9 +226,6 @@ static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits) ld->bufa = ld->bufb; tmp = getdword(ld->start); -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif ld->bufb = tmp; ld->start--; ld->bits_left += (32 - bits); @@ -248,7 +271,7 @@ static uint8_t faad_check_CRC(bitfile *ld, uint16_t len) faad_rewindbits(ld); - CRC = ~faad_getbits(ld, 8 + CRC = (uint8_t) ~faad_getbits(ld, 8 DEBUGVAR(1,999,"faad_check_CRC(): CRC")); /* CRC is stored inverted */ for (; len>0; len--) diff --git a/libfaad2/cfft.c b/libfaad2/cfft.c index 9765a84f6a..f2f9c25bc7 100644 --- a/libfaad2/cfft.c +++ b/libfaad2/cfft.c @@ -1,19 +1,19 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** ** 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 +** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: cfft.c,v 1.1 2003/08/30 22:30:21 arpi Exp $ +** $Id: cfft.c,v 1.2 2003/10/03 22:22:27 alex Exp $ **/ /* @@ -38,22 +38,172 @@ #include "structs.h" #include <stdlib.h> -#ifdef _WIN32_WCE -#define assert(x) -#else -#include <assert.h> -#endif #include "cfft.h" #include "cfft_tab.h" +/* static function declarations */ +#ifdef USE_SSE +static void passf2pos_sse(const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa); +static void passf2pos_sse_ido(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa); +static void passf4pos_sse_ido(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, + const complex_t *wa1, const complex_t *wa2, const complex_t *wa3); +#endif +static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa); +static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa); +static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign); +static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, + const complex_t *wa1, const complex_t *wa2, const complex_t *wa3); +static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, + const complex_t *wa1, const complex_t *wa2, const complex_t *wa3); +static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, + const complex_t *wa1, const complex_t *wa2, const complex_t *wa3, + const complex_t *wa4, const int8_t isign); +INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch, + const ui |