From: Darren S. <li...@yo...> - 2008-08-13 16:48:46
|
# HG changeset patch # User Darren Salt <li...@yo...> # Date 1218634110 -3600 # Node ID 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 # Parent 608e33e144c7eebe016fbf306771bff4219d1629 Update to libfaad 2.6.1, fixing a crash with a corrupted AAC file. Source is the version in the 1.2 branch. diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 ChangeLog --- a/ChangeLog Wed Aug 13 14:28:30 2008 +0100 +++ b/ChangeLog Fri Aug 08 11:18:08 2008 +0100 @@ -2,6 +2,7 @@ xine-lib (1.1.15) 2008-??-?? * Security fixes: - Fix crashes with various corrupted media files, including Ogg. (CVE-2008-3231) + This includes a libfaad update from the 1.2 branch. - Delay V4L video frame preallocation until we know how large they'll be. * Use external ffmpeg by default. * V4L: Don't segfault if asked for an input that doesn't exist. diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/Makefile.am --- a/src/libfaad/Makefile.am Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/Makefile.am Fri Aug 08 11:18:08 2008 +0100 @@ -103,4 +103,18 @@ noinst_HEADERS = \ ssr_win.h \ structs.h \ syntax.h \ - tns.h + tns.h \ + neaacdec.h \ + codebook/hcb.h \ + codebook/hcb_1.h \ + codebook/hcb_2.h \ + codebook/hcb_3.h \ + codebook/hcb_4.h \ + codebook/hcb_5.h \ + codebook/hcb_6.h \ + codebook/hcb_7.h \ + codebook/hcb_8.h \ + codebook/hcb_9.h \ + codebook/hcb_10.h \ + codebook/hcb_11.h \ + codebook/hcb_sf.h diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/analysis.h --- a/src/libfaad/analysis.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/analysis.h Fri Aug 08 11:18:08 2008 +0100 @@ -1,6 +1,6 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** Copyright (C) 2003-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: analysis.h,v 1.7 2005/10/29 23:57:06 tmmm Exp $ +** $Id: analysis.h,v 1.18 2007/11/01 12:33:29 menno Exp $ **/ #ifndef __ANALYSIS_H__ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/bits.c --- a/src/libfaad/bits.c Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/bits.c Fri Aug 08 11:18:08 2008 +0100 @@ -1,6 +1,6 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** Copyright (C) 2003-2005 M. Bakker, Nero 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 @@ -19,17 +19,19 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... -** -** $Id: bits.c,v 1.9 2005/10/29 23:57:06 tmmm Exp $ +** For more info contact Nero AG through Mpe...@ne.... +** +** $Id: bits.c,v 1.44 2007/11/01 12:33:29 menno Exp $ **/ #include "common.h" #include "structs.h" #include <stdlib.h> -#include <string.h> #include "bits.h" /* initialize buffer, call once before first getbits or showbits */ @@ -40,25 +42,38 @@ void faad_initbits(bitfile *ld, const vo if (ld == NULL) return; - memset(ld, 0, sizeof(bitfile)); + // useless + //memset(ld, 0, sizeof(bitfile)); if (buffer_size == 0 || _buffer == NULL) { ld->error = 1; - ld->no_more_reading = 1; return; } - 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 = _buffer; ld->buffer_size = buffer_size; - - tmp = getdword((uint32_t*)ld->buffer); - ld->bufa = tmp; - - tmp = getdword((uint32_t*)ld->buffer + 1); + ld->bytes_left = buffer_size; + + if (ld->bytes_left >= 4) + { + tmp = getdword((uint32_t*)ld->buffer); + ld->bytes_left -= 4; + } else { + tmp = getdword_n((uint32_t*)ld->buffer, ld->bytes_left); + ld->bytes_left = 0; + } + ld->bufa = tmp; + + if (ld->bytes_left >= 4) + { + tmp = getdword((uint32_t*)ld->buffer + 1); + ld->bytes_left -= 4; + } else { + tmp = getdword_n((uint32_t*)ld->buffer + 1, ld->bytes_left); + ld->bytes_left = 0; + } ld->bufb = tmp; ld->start = (uint32_t*)ld->buffer; @@ -66,21 +81,12 @@ void faad_initbits(bitfile *ld, const vo ld->bits_left = 32; - ld->bytes_used = 0; - ld->no_more_reading = 0; ld->error = 0; } void faad_endbits(bitfile *ld) { - if (ld) - { - if (ld->buffer) - { - faad_free(ld->buffer); - ld->buffer = NULL; - } - } + // void } uint32_t faad_get_processed_bits(bitfile *ld) @@ -90,12 +96,12 @@ uint32_t faad_get_processed_bits(bitfile uint8_t faad_byte_align(bitfile *ld) { - uint8_t remainder = (uint8_t)((32 - ld->bits_left) % 8); + int remainder = (32 - ld->bits_left) & 0x7; if (remainder) { faad_flushbits(ld, 8 - remainder); - return (8 - remainder); + return (uint8_t)(8 - remainder); } return 0; } @@ -105,20 +111,22 @@ void faad_flushbits_ex(bitfile *ld, uint uint32_t tmp; ld->bufa = ld->bufb; - if (ld->no_more_reading == 0) + if (ld->bytes_left >= 4) [... 23 lines omitted ...] +// if (ld->bytes_left < 0) +// ld->error = 1; } /* rewind to beginning */ @@ -126,30 +134,79 @@ void faad_rewindbits(bitfile *ld) { uint32_t tmp; - tmp = ld->start[0]; -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif - ld->bufa = tmp; - - tmp = ld->start[1]; -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif - ld->bufb = tmp; + ld->bytes_left = ld->buffer_size; + + if (ld->bytes_left >= 4) + { + tmp = getdword((uint32_t*)&ld->start[0]); + ld->bytes_left -= 4; + } else { + tmp = getdword_n((uint32_t*)&ld->start[0], ld->bytes_left); + ld->bytes_left = 0; + } + ld->bufa = tmp; + + if (ld->bytes_left >= 4) + { + tmp = getdword((uint32_t*)&ld->start[1]); + ld->bytes_left -= 4; + } else { + tmp = getdword_n((uint32_t*)&ld->start[1], ld->bytes_left); + ld->bytes_left = 0; + } + ld->bufb = tmp; + ld->bits_left = 32; ld->tail = &ld->start[2]; - ld->bytes_used = 0; - ld->no_more_reading = 0; +} + +/* reset to a certain point */ +void faad_resetbits(bitfile *ld, int bits) +{ + uint32_t tmp; + int words = bits >> 5; + int remainder = bits & 0x1F; + + ld->bytes_left = ld->buffer_size - words*4; + + if (ld->bytes_left >= 4) + { + tmp = getdword(&ld->start[words]); + ld->bytes_left -= 4; + } else { + tmp = getdword_n(&ld->start[words], ld->bytes_left); + ld->bytes_left = 0; + } + ld->bufa = tmp; + + if (ld->bytes_left >= 4) + { + tmp = getdword(&ld->start[words+1]); + ld->bytes_left -= 4; + } else { + tmp = getdword_n(&ld->start[words+1], ld->bytes_left); + ld->bytes_left = 0; + } + ld->bufb = tmp; + + ld->bits_left = 32 - remainder; + ld->tail = &ld->start[words+2]; + + /* recheck for reading too many bytes */ + ld->error = 0; +// if (ld->bytes_left == 0) +// ld->no_more_reading = 1; +// if (ld->bytes_left < 0) +// ld->error = 1; } uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits DEBUGDEC) { - uint16_t i; - uint8_t temp; - uint16_t bytes = (uint16_t)bits / 8; - uint8_t remainder = (uint8_t)bits % 8; + int i; + unsigned int temp; + int bytes = bits >> 3; + int remainder = bits & 0x7; uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t)); @@ -160,9 +217,9 @@ uint8_t *faad_getbitbuffer(bitfile *ld, if (remainder) { - temp = (uint8_t)faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder); - - buffer[bytes] = temp; + temp = faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder); + + buffer[bytes] = (uint8_t)temp; } return buffer; @@ -207,7 +264,8 @@ void faad_initbits_rev(bitfile *ld, void if (ld->bits_left == 0) ld->bits_left = 32; - ld->bytes_used = 0; - ld->no_more_reading = 0; - ld->error = 0; -} + ld->bytes_left = ld->buffer_size; + ld->error = 0; +} + +/* EOF */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/bits.h --- a/src/libfaad/bits.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/bits.h Fri Aug 08 11:18:08 2008 +0100 @@ -1,28 +1,31 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** +** Copyright (C) 2003-2005 M. Bakker, Nero 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 ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: bits.h,v 1.11 2005/10/30 01:21:53 tmmm Exp $ +** $Id: bits.h,v 1.45 2007/11/01 12:33:29 menno Exp $ **/ #ifndef __BITS_H__ @@ -37,8 +40,10 @@ extern "C" { #include <stdio.h> #endif -#define BYTE_NUMBIT 8 -#define bit2byte(a) ((a+7)/BYTE_NUMBIT) +#define BYTE_NUMBIT 8 +#define BYTE_NUMBIT_LD 3 +//#define bit2byte(a) ((a+7)/BYTE_NUMBIT) +#define bit2byte(a) ((a+7)>>BYTE_NUMBIT_LD) typedef struct _bitfile { @@ -47,25 +52,16 @@ typedef struct _bitfile uint32_t bufb; uint32_t bits_left; uint32_t buffer_size; /* size of the buffer in bytes */ - uint32_t bytes_used; - uint8_t no_more_reading; + uint32_t bytes_left; uint8_t error; uint32_t *tail; uint32_t *start; - void *buffer; + const void *buffer; } bitfile; -#if defined(_MSC_VER) -#define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax -#elif defined(LINUX) || defined(DJGPP) || defined (__MINGW32__) || defined (__CYGWIN__) -#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) -#else -#define BSWAP(a) \ - ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) -#endif - -static uint32_t bitmask[] = { +#if 0 +static uint32_t const bitmask[] = { 0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF, @@ -74,6 +70,7 @@ static uint32_t bitmask[] = { /* added bitmask 32, correct?!?!?! */ , 0xFFFFFFFF }; +#endif void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size); void faad_endbits(bitfile *ld); @@ -83,6 +80,7 @@ uint32_t faad_get_processed_bits(bitfile uint32_t faad_get_processed_bits(bitfile *ld); void faad_flushbits_ex(bitfile *ld, uint32_t bits); void faad_rewindbits(bitfile *ld); +void faad_resetbits(bitfile *ld, int bits); uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits DEBUGDEC); #ifdef DRM @@ -93,7 +91,6 @@ uint32_t faad_origbitbuffer_size(bitfile /* 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]; @@ -108,25 +105,52 @@ static INLINE uint32_t getdword(void *me #endif return tmp; +} + +/* reads only n bytes from the stream instead of the standard 4 */ +static /*INLINE*/ uint32_t getdword_n(void *mem, int n) +{ + uint32_t tmp = 0; +#ifndef ARCH_IS_BIG_ENDIAN + switch (n) + { + case 3: + ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2]; + case 2: + ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1]; + case 1: + ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0]; [... 44 lines omitted ...] /* return next n bits (right adjusted) */ -static INLINE uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC) +static /*INLINE*/ uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC) { uint32_t ret; - if (ld->no_more_reading || n == 0) + if (n == 0) return 0; ret = faad_showbits(ld, n); @@ -230,21 +254,22 @@ static INLINE void faad_flushbits_rev(bi ld->start--; ld->bits_left += (32 - bits); - ld->bytes_used += 4; - if (ld->bytes_used == ld->buffer_size) - ld->no_more_reading = 1; - if (ld->bytes_used > ld->buffer_size) + if (ld->bytes_left < 4) + { ld->error = 1; - } -} - -static INLINE uint32_t faad_getbits_rev(bitfile *ld, uint32_t n + ld->bytes_left = 0; + } else { + ld->bytes_left -= 4; + } +// if (ld->bytes_left == 0) +// ld->no_more_reading = 1; + } +} + +static /*INLINE*/ uint32_t faad_getbits_rev(bitfile *ld, uint32_t n DEBUGDEC) { uint32_t ret; - - if (ld->no_more_reading) - return 0; if (n == 0) return 0; @@ -261,28 +286,73 @@ static INLINE uint32_t faad_getbits_rev( } #ifdef DRM +/* CRC lookup table for G8 polynome in DRM standard */ +static const uint8_t crc_table_G8[256] = { + 0x0, 0x1d, 0x3a, 0x27, 0x74, 0x69, 0x4e, 0x53, + 0xe8, 0xf5, 0xd2, 0xcf, 0x9c, 0x81, 0xa6, 0xbb, + 0xcd, 0xd0, 0xf7, 0xea, 0xb9, 0xa4, 0x83, 0x9e, + 0x25, 0x38, 0x1f, 0x2, 0x51, 0x4c, 0x6b, 0x76, + 0x87, 0x9a, 0xbd, 0xa0, 0xf3, 0xee, 0xc9, 0xd4, + 0x6f, 0x72, 0x55, 0x48, 0x1b, 0x6, 0x21, 0x3c, + 0x4a, 0x57, 0x70, 0x6d, 0x3e, 0x23, 0x4, 0x19, + 0xa2, 0xbf, 0x98, 0x85, 0xd6, 0xcb, 0xec, 0xf1, + 0x13, 0xe, 0x29, 0x34, 0x67, 0x7a, 0x5d, 0x40, + 0xfb, 0xe6, 0xc1, 0xdc, 0x8f, 0x92, 0xb5, 0xa8, + 0xde, 0xc3, 0xe4, 0xf9, 0xaa, 0xb7, 0x90, 0x8d, + 0x36, 0x2b, 0xc, 0x11, 0x42, 0x5f, 0x78, 0x65, + 0x94, 0x89, 0xae, 0xb3, 0xe0, 0xfd, 0xda, 0xc7, + 0x7c, 0x61, 0x46, 0x5b, 0x8, 0x15, 0x32, 0x2f, + 0x59, 0x44, 0x63, 0x7e, 0x2d, 0x30, 0x17, 0xa, + 0xb1, 0xac, 0x8b, 0x96, 0xc5, 0xd8, 0xff, 0xe2, + 0x26, 0x3b, 0x1c, 0x1, 0x52, 0x4f, 0x68, 0x75, + 0xce, 0xd3, 0xf4, 0xe9, 0xba, 0xa7, 0x80, 0x9d, + 0xeb, 0xf6, 0xd1, 0xcc, 0x9f, 0x82, 0xa5, 0xb8, + 0x3, 0x1e, 0x39, 0x24, 0x77, 0x6a, 0x4d, 0x50, + 0xa1, 0xbc, 0x9b, 0x86, 0xd5, 0xc8, 0xef, 0xf2, + 0x49, 0x54, 0x73, 0x6e, 0x3d, 0x20, 0x7, 0x1a, + 0x6c, 0x71, 0x56, 0x4b, 0x18, 0x5, 0x22, 0x3f, + 0x84, 0x99, 0xbe, 0xa3, 0xf0, 0xed, 0xca, 0xd7, + 0x35, 0x28, 0xf, 0x12, 0x41, 0x5c, 0x7b, 0x66, + 0xdd, 0xc0, 0xe7, 0xfa, 0xa9, 0xb4, 0x93, 0x8e, + 0xf8, 0xe5, 0xc2, 0xdf, 0x8c, 0x91, 0xb6, 0xab, + 0x10, 0xd, 0x2a, 0x37, 0x64, 0x79, 0x5e, 0x43, + 0xb2, 0xaf, 0x88, 0x95, 0xc6, 0xdb, 0xfc, 0xe1, + 0x5a, 0x47, 0x60, 0x7d, 0x2e, 0x33, 0x14, 0x9, + 0x7f, 0x62, 0x45, 0x58, 0xb, 0x16, 0x31, 0x2c, + 0x97, 0x8a, 0xad, 0xb0, 0xe3, 0xfe, 0xd9, 0xc4, +}; + static uint8_t faad_check_CRC(bitfile *ld, uint16_t len) { - uint8_t CRC; - uint16_t r=255; /* Initialize to all ones */ + int bytes, rem; + unsigned int CRC; + unsigned int r=255; /* Initialize to all ones */ /* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */ #define GPOLY 0435 faad_rewindbits(ld); - CRC = (uint8_t) ~faad_getbits(ld, 8 - DEBUGVAR(1,999,"faad_check_CRC(): CRC")); /* CRC is stored inverted */ - - for (; len>0; len--) + CRC = (unsigned int) ~faad_getbits(ld, 8 + DEBUGVAR(1,999,"faad_check_CRC(): CRC")) & 0xFF; /* CRC is stored inverted */ + + bytes = len >> 3; + rem = len & 0x7; + + for (; bytes > 0; bytes--) + { + r = crc_table_G8[( r ^ faad_getbits(ld, 8 DEBUGVAR(1,998,"")) ) & 0xFF]; + } + for (; rem > 0; rem--) { r = ( (r << 1) ^ (( ( faad_get1bit(ld DEBUGVAR(1,998,"")) & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF; } if (r != CRC) - { - return 8; + // if (0) + { + return 28; } else { return 0; } diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/cfft.c --- a/src/libfaad/cfft.c Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/cfft.c Fri Aug 08 11:18:08 2008 +0100 @@ -1,28 +1,31 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** +** Copyright (C) 2003-2005 M. Bakker, Nero 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 ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: cfft.c,v 1.12 2006/09/26 18:00:31 dgp85 Exp $ +** $Id: cfft.c,v 1.35 2007/11/01 12:33:29 menno Exp $ **/ /* @@ -546,7 +549,7 @@ static void passf5(const uint16_t ido, c ComplexMult(&RE(c4), &RE(c5), ti12, ti11, RE(t5), RE(t4)); ComplexMult(&IM(c4), &IM(c5), - ti12, ti12, IM(t5), IM(t4)); + ti12, ti11, IM(t5), IM(t4)); RE(ch[ah+l1]) = RE(c2) + IM(c5); IM(ch[ah+l1]) = IM(c2) - RE(c5); @@ -648,7 +651,7 @@ static void passf5(const uint16_t ido, c ComplexMult(&RE(c4), &RE(c5), ti12, ti11, RE(t5), RE(t4)); ComplexMult(&IM(c4), &IM(c5), - ti12, ti12, IM(t5), IM(t4)); + ti12, ti11, IM(t5), IM(t4)); IM(d2) = IM(c2) - RE(c5); IM(d3) = IM(c3) - RE(c4); @@ -992,13 +995,11 @@ cfft_info *cffti(uint16_t n) void cfftu(cfft_info *cfft) { - if ( ! cfft ) return; - - faad_free(cfft->work); + if (cfft->work) faad_free(cfft->work); #ifndef FIXED_POINT - faad_free(cfft->tab); -#endif - - faad_free(cfft); -} - + if (cfft->tab) faad_free(cfft->tab); +#endif + + if (cfft) faad_free(cfft); +} + diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/cfft.h --- a/src/libfaad/cfft.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/cfft.h Fri Aug 08 11:18:08 2008 +0100 @@ -1,6 +1,6 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** Copyright (C) 2003-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: cfft.h,v 1.9 2005/10/29 23:57:06 tmmm Exp $ +** $Id: cfft.h,v 1.24 2007/11/01 12:33:29 menno Exp $ **/ #ifndef __CFFT_H__ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/cfft_tab.h --- a/src/libfaad/cfft_tab.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/cfft_tab.h Fri Aug 08 11:18:08 2008 +0100 @@ -1,28 +1,31 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** +** Copyright (C) 2003-2005 M. Bakker, Nero 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 ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: cfft_tab.h,v 1.6 2005/10/29 23:57:06 tmmm Exp $ +** $Id: cfft_tab.h,v 1.21 2007/11/01 12:33:29 menno Exp $ **/ #ifndef __CFFT_TAB_H__ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb.h --- a/src/libfaad/codebook/hcb.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: hcb.h,v 1.6 2005/10/29 23:57:08 tmmm Exp $ +** $Id: hcb.h,v 1.8 2007/11/01 12:34:10 menno Exp $ **/ #ifndef __HCB_H__ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_1.h --- a/src/libfaad/codebook/hcb_1.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_1.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: hcb_1.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** $Id: hcb_1.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_1 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_10.h --- a/src/libfaad/codebook/hcb_10.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_10.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... -** -** $Id: hcb_10.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** For more info contact Nero AG through Mpe...@ne.... +** +** $Id: hcb_10.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_10 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_11.h --- a/src/libfaad/codebook/hcb_11.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_11.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: hcb_11.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** $Id: hcb_11.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_11 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_2.h --- a/src/libfaad/codebook/hcb_2.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_2.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: hcb_2.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** $Id: hcb_2.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_2 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_3.h --- a/src/libfaad/codebook/hcb_3.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_3.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: hcb_3.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** $Id: hcb_3.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* Binary search huffman table HCB_3 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_4.h --- a/src/libfaad/codebook/hcb_4.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_4.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: hcb_4.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** $Id: hcb_4.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_4 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_5.h --- a/src/libfaad/codebook/hcb_5.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_5.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: hcb_5.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** $Id: hcb_5.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* Binary search huffman table HCB_5 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_6.h --- a/src/libfaad/codebook/hcb_6.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_6.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: hcb_6.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** $Id: hcb_6.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_6 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_7.h --- a/src/libfaad/codebook/hcb_7.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_7.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: hcb_7.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** $Id: hcb_7.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* Binary search huffman table HCB_7 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_8.h --- a/src/libfaad/codebook/hcb_8.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_8.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: hcb_8.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** $Id: hcb_8.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_8 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_9.h --- a/src/libfaad/codebook/hcb_9.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_9.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... -** -** $Id: hcb_9.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** For more info contact Nero AG through Mpe...@ne.... +** +** $Id: hcb_9.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* Binary search huffman table HCB_9 */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/codebook/hcb_sf.h --- a/src/libfaad/codebook/hcb_sf.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/codebook/hcb_sf.h Fri Aug 08 11:18:08 2008 +0100 @@ -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-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... -** -** $Id: hcb_sf.h,v 1.4 2005/10/29 23:57:08 tmmm Exp $ +** For more info contact Nero AG through Mpe...@ne.... +** +** $Id: hcb_sf.h,v 1.7 2007/11/01 12:34:11 menno Exp $ **/ /* Binary search huffman table HCB_SF */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/common.c --- a/src/libfaad/common.c Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/common.c Fri Aug 08 11:18:08 2008 +0100 @@ -1,28 +1,31 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** +** Copyright (C) 2003-2005 M. Bakker, Nero 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 ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: common.c,v 1.8 2005/10/29 23:57:06 tmmm Exp $ +** $Id: common.c,v 1.26 2007/11/01 12:33:30 menno Exp $ **/ /* just some common functions that could be used anywhere */ @@ -229,16 +232,16 @@ static uint32_t __r2 = 1; * which gives a period of 18.410.713.077.675.721.215. The result is the * XORed values of both generators. */ -uint32_t random_int(void) +uint32_t ne_rng(uint32_t *__r1, uint32_t *__r2) { uint32_t t1, t2, t3, t4; - t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available + t3 = t1 = *__r1; t4 = t2 = *__r2; // Parity calculation is done via table lookup, this is also available t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations. t1 <<= 31; t2 = Parity [t2]; - return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 ); + return (*__r1 = (t3 >> 1) | t1 ) ^ (*__r2 = (t4 + t4) | t2 ); } uint32_t ones32(uint32_t x) diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/common.h --- a/src/libfaad/common.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/common.h Fri Aug 08 11:18:08 2008 +0100 @@ -1,28 +1,31 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** +** Copyright (C) 2003-2005 M. Bakker, Nero 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 ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: common.h,v 1.17 2006/06/17 20:43:57 dgp85 Exp $ +** $Id: common.h,v 1.72 2007/11/01 12:33:30 menno Exp $ **/ #ifndef __COMMON_H__ @@ -32,13 +35,16 @@ extern "C" { extern "C" { #endif -#ifdef __CYGWIN__ -#define __STRICT_ANSI__ -#endif - -#include "config.h" - +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if 1 #define INLINE __inline +#else +#define INLINE inline +#endif + #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) #define ALIGN __declspec(align(16)) #else @@ -63,10 +69,13 @@ extern "C" { /* Use if target platform has address generators with autoincrement */ //#define PREFER_POINTERS -#if defined(_WIN32_WCE) || defined(__arm__) +#ifdef _WIN32_WCE #define FIXED_POINT #endif +#ifdef __BFIN__ +#define FIXED_POINT +#endif #define ERROR_RESILIENCE @@ -79,8 +88,6 @@ extern "C" { #define LTP_DEC /* Allow decoding of LD profile AAC */ #define LD_DEC -/* Allow decoding of scalable profiles */ -//#define SCALABLE_DEC /* Allow decoding of Digital Radio Mondiale (DRM) */ //#define DRM //#define DRM_PS @@ -114,20 +121,25 @@ extern "C" { //#define SBR_LOW_POWER #define PS_DEC +#ifdef SBR_LOW_POWER +#undef PS_DEC +#endif + /* FIXED POINT: No MAIN decoding */ #ifdef FIXED_POINT # ifdef MAIN_DEC # undef MAIN_DEC # endif -# ifdef SBR_DEC -# undef SBR_DEC -# endif #endif // FIXED_POINT #ifdef DRM -# ifndef SCALABLE_DEC -# define SCALABLE_DEC -# endif +# ifndef ALLOW_SMALL_FRAMELENGTH +# define ALLOW_SMALL_FRAMELENGTH +# endif +# undef LD_DEC +# undef LTP_DEC +# undef MAIN_DEC +# undef SSR_DEC #endif @@ -152,40 +164,10 @@ extern "C" { /* END COMPILE TIME DEFINITIONS */ -#include <stdio.h> -#if HAVE_SYS_TYPES_H -# include <sys/types.h> [... 40 lines omitted ...] typedef __int16 int16_t; typedef __int8 int8_t; -# else /* WIN32 */ typedef float float32_t; + + +#else + +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# else +/* we need these... */ +#ifndef __TCS__ typedef unsigned long long uint64_t; +typedef long long int64_t; +#else +typedef unsigned long uint64_t; +typedef long int64_t; +#endif typedef unsigned long uint32_t; typedef unsigned short uint16_t; typedef unsigned char uint8_t; -typedef long long int64_t; typedef long int32_t; typedef short int16_t; typedef char int8_t; -# endif /* WIN32 */ # endif #endif #if HAVE_UNISTD_H -# include <unistd.h> +//# include <unistd.h> #endif #ifndef HAVE_FLOAT32_T @@ -227,6 +247,8 @@ char *strchr(), *strrchr(); # define memcpy(d, s, n) bcopy((s), (d), (n)) # define memmove(d, s, n) bcopy((s), (d), (n)) # endif +#endif + #endif #ifdef WORDS_BIGENDIAN @@ -289,7 +311,6 @@ char *strchr(), *strrchr(); } -#ifndef HAVE_LRINTF #if defined(_WIN32) && !defined(__MINGW32__) #define HAS_LRINTF static INLINE int lrintf(float f) @@ -302,7 +323,9 @@ char *strchr(), *strrchr(); } return i; } - #elif (defined(__i386__) && defined(__GNUC__)) + #elif (defined(__i386__) && defined(__GNUC__) && \ + !defined(__CYGWIN__) && !defined(__MINGW32__)) + #ifndef HAVE_LRINTF #define HAS_LRINTF // from http://www.stereopsis.com/FPU.html static INLINE int lrintf(float f) @@ -315,8 +338,9 @@ char *strchr(), *strrchr(); : "m" (f)); return i; } + #endif /* HAVE_LRINTF */ #endif -#endif + #ifdef __ICL /* only Intel C compiler has fmath ??? */ @@ -331,8 +355,6 @@ char *strchr(), *strrchr(); #else -#include <math.h> - #ifdef HAVE_LRINTF # define HAS_LRINTF # define _ISOC9X_SOURCE 1 @@ -341,6 +363,8 @@ char *strchr(), *strrchr(); # define __USE_ISOC99 1 #endif + #include <math.h> + #ifdef HAVE_SINF # define sin sinf #error @@ -380,7 +404,7 @@ typedef real_t complex_t[2]; /* common functions */ uint8_t cpu_has_sse(void); -uint32_t random_int(void); +uint32_t ne_rng(uint32_t *__r1, uint32_t *__r2); uint32_t ones32(uint32_t x); uint32_t floor_log2(uint32_t x); uint32_t wl_min_lzc(uint32_t x); diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/decoder.c --- a/src/libfaad/decoder.c Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/decoder.c Fri Aug 08 11:18:08 2008 +0100 @@ -1,28 +1,31 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** +** Copyright (C) 2003-2005 M. Bakker, Nero 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 ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: decoder.c,v 1.10 2005/10/29 23:57:06 tmmm Exp $ +** $Id: decoder.c,v 1.111 2007/11/01 12:33:30 menno Exp $ **/ #include "common.h" @@ -90,6 +93,7 @@ uint32_t NEAACDECAPI NeAACDecGetCapabili return cap; } +const unsigned char mes[] = { 0x67,0x20,0x61,0x20,0x20,0x20,0x6f,0x20,0x72,0x20,0x65,0x20,0x6e,0x20,0x20,0x20,0x74,0x20,0x68,0x20,0x67,0x20,0x69,0x20,0x72,0x20,0x79,0x20,0x70,0x20,0x6f,0x20,0x63 }; NeAACDecHandle NEAACDECAPI NeAACDecOpen(void) { uint8_t i; @@ -100,6 +104,7 @@ NeAACDecHandle NEAACDECAPI NeAACDecOpen( memset(hDecoder, 0, sizeof(NeAACDecStruct)); + hDecoder->cmes = mes; hDecoder->config.outputFormat = FAAD_FMT_16BIT; hDecoder->config.defObjectType = MAIN; hDecoder->config.defSampleRate = 44100; /* Default: 44.1kHz */ @@ -116,6 +121,9 @@ NeAACDecHandle NEAACDECAPI NeAACDecOpen( hDecoder->frame = 0; hDecoder->sample_buffer = NULL; + hDecoder->__r1 = 1; + hDecoder->__r2 = 1; + for (i = 0; i < MAX_CHANNELS; i++) { hDecoder->window_shape_prev[i] = 0; @@ -194,6 +202,7 @@ uint8_t NEAACDECAPI NeAACDecSetConfigura return 0; } + int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer, uint32_t buffer_size, uint32_t *samplerate, uint8_t *channels) @@ -203,6 +212,7 @@ int32_t NEAACDECAPI NeAACDecInit(NeAACDe adif_header adif; adts_header adts; + if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL)) return -1; @@ -257,7 +267,6 @@ int32_t NEAACDECAPI NeAACDecInit(NeAACDe } faad_endbits(&ld); } - hDecoder->channelConfiguration = *channels; #if (defined(PS_DEC) || defined(DRM_PS)) /* check if we have a mono file */ @@ -267,6 +276,8 @@ int32_t NEAACDECAPI NeAACDecInit(NeAACDe *channels = 2; } #endif + + hDecoder->channelConfiguration = *channels; #ifdef SBR_DEC /* implicit signalling */ @@ -422,8 +433,8 @@ int8_t NEAACDECAPI NeAACDecInitDRM(NeAAC if ((channels == DRMCH_MONO) || (channels == DRMCH_STEREO)) (*hDecoder)->sbr_present_flag = 0; else - (*hDecoder)->sbr_present_flag = 1; -#endif + (*hDecoder)->sbr_present_flag = 1; +#endif (*hDecoder)->fb = filter_bank_init((*hDecoder)->frameLength); @@ -525,8 +536,14 @@ static void create_channel_config(NeAACD chdir = hInfo->num_front_channels; if (chdir & 1) { +#if (defined(PS_DEC) || defined(DRM_PS)) + /* When PS is enabled output is always stereo */ + hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT; +#else hInfo->channel_position[chpos++] = FRONT_CHANNEL_CENTER; chdir--; +#endif } for (i = 0; i < chdir; i += 2) { @@ -565,8 +582,15 @@ static void create_channel_config(NeAACD [... 23 lines omitted ...] +static void conceal_output(NeAACDecHandle hDecoder, uint16_t frame_len, + uint8_t out_ch, void *sample_buffer) +{ + return; +} +#endif + static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, uint8_t *buffer, uint32_t buffer_size, void **sample_buffer2, uint32_t sample_buffer_size) { + uint16_t i; uint8_t channels = 0; uint8_t output_channels = 0; - bitfile ld; + bitfile ld = {0}; uint32_t bitsconsumed; uint16_t frame_len; void *sample_buffer; @@ -752,6 +788,33 @@ static void* aac_frame_decode(NeAACDecHa memset(hInfo, 0, sizeof(NeAACDecFrameInfo)); memset(hDecoder->internal_channel, 0, MAX_CHANNELS*sizeof(hDecoder->internal_channel[0])); + +#ifdef USE_TIME_LIMIT + if ((TIME_LIMIT * get_sample_rate(hDecoder->sf_index)) > hDecoder->TL_count) + { + hDecoder->TL_count += 1024; + } else { + hInfo->error = (NUM_ERROR_MESSAGES-1); + goto error; + } +#endif + + + /* check for some common metadata tag types in the bitstream + * No need to return an error + */ + /* ID3 */ + if (buffer_size >= 128) + { + if (memcmp(buffer, "TAG", 3) == 0) + { + /* found it */ + hInfo->bytesconsumed = 128; /* 128 bytes fixed size */ + /* no error, but no output either */ + return NULL; + } + } + /* initialize the bitstream */ faad_initbits(&ld, buffer, buffer_size); @@ -780,7 +843,7 @@ static void* aac_frame_decode(NeAACDecHa /* We do not support stereo right now */ if (0) //(hDecoder->channelConfiguration == 2) { - hInfo->error = 8; // Throw CRC error + hInfo->error = 28; // Throw CRC error goto error; } @@ -808,14 +871,14 @@ static void* aac_frame_decode(NeAACDecHa #endif /* decode the complete bitstream */ -#ifdef SCALABLE_DEC - if ((hDecoder->object_type == 6) || (hDecoder->object_type == DRM_ER_LC)) - { - aac_scalable_main_element(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); +#ifdef DRM + if (/*(hDecoder->object_type == 6) ||*/ (hDecoder->object_type == DRM_ER_LC)) + { + DRM_aac_scalable_main_element(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); } else { #endif raw_data_block(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); -#ifdef SCALABLE_DEC +#ifdef DRM } #endif @@ -978,8 +1041,14 @@ static void* aac_frame_decode(NeAACDecHa } #endif + sample_buffer = output_to_PCM(hDecoder, hDecoder->time_out, sample_buffer, output_channels, frame_len, hDecoder->config.outputFormat); + + +#ifdef DRM + //conceal_output(hDecoder, frame_len, output_channels, sample_buffer); +#endif hDecoder->postSeekResetFlag = 0; @@ -1013,6 +1082,30 @@ static void* aac_frame_decode(NeAACDecHa error: + +#ifdef DRM + hDecoder->error_state = ERROR_STATE_INIT; +#endif + + /* reset filterbank state */ + for (i = 0; i < MAX_CHANNELS; i++) + { + if (hDecoder->fb_intermed[i] != NULL) + { + memset(hDecoder->fb_intermed[i], 0, hDecoder->frameLength*sizeof(real_t)); + } + } +#ifdef SBR_DEC + for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) + { + if (hDecoder->sbr[i] != NULL) + { + sbrReset(hDecoder->sbr[i]); + } + } +#endif + + faad_endbits(&ld); /* cleanup */ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/decoder.h --- a/src/libfaad/decoder.h Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/decoder.h Fri Aug 08 11:18:08 2008 +0100 @@ -1,6 +1,6 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** Copyright (C) 2003-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: decoder.h,v 1.9 2005/10/29 23:57:06 tmmm Exp $ +** $Id: decoder.h,v 1.48 2007/11/01 12:33:30 menno Exp $ **/ #ifndef __DECODER_H__ diff -r 18c0264660b951b8e5672f1a66d1bcecdfeb6ea8 -r 608e33e144c7eebe016fbf306771bff4219d1629 src/libfaad/drc.c --- a/src/libfaad/drc.c Wed Aug 13 14:28:30 2008 +0100 +++ b/src/libfaad/drc.c Fri Aug 08 11:18:08 2008 +0100 @@ -1,6 +1,6 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** Copyright (C) 2003-2005 M. Bakker, Nero 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 @@ -19,10 +19,13 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpe...@ne.... +** For more info contact Nero AG through Mpe...@ne.... ** -** $Id: drc.c,v 1.7 2005/10/29 23:57:06 tmmm Exp $ +** $Id: drc.c,v 1.28 200... [truncated message content] |