--- libfaad/bits.h 2004-03-11 14:32:39.000000000 +0100 +++ libfaad2/bits.h 2004-06-24 10:47:02.000000000 +0200 @@ -58,7 +61,7 @@ #if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__) #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax -#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__) +#elif defined(LINUX) || defined(DJGPP) #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) #else #define BSWAP(a) \ --- libfaad/common.h 2004-06-30 14:45:56.000000000 +0200 +++ libfaad2/common.h 2004-10-19 03:16:03.000000000 +0200 @@ -32,10 +35,13 @@ extern "C" { #endif -#ifdef HAVE_CONFIG_H -# include "../config.h" +/* Allow build on Cygwin*/ +#if defined(__CYGWIN__) +#define __STRICT_ANSI__ #endif +#include "../config.h" + #define INLINE __inline #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) #define ALIGN __declspec(align(16)) @@ -67,6 +67,6 @@ /* Use if target platform has address generators with autoincrement */ //#define PREFER_POINTERS -#ifdef _WIN32_WCE +#if defined(_WIN32_WCE) || defined(__arm__) #define FIXED_POINT #endif @@ -117,6 +123,9 @@ # ifdef MAIN_DEC # undef MAIN_DEC # endif +# ifdef SBR_DEC +# undef SBR_DEC +# endif #endif // FIXED_POINT #ifdef DRM @@ -157,6 +166,7 @@ #include +#if 0 typedef unsigned __int64 uint64_t; typedef unsigned __int32 uint32_t; typedef unsigned __int16 uint16_t; @@ -165,11 +175,31 @@ typedef __int32 int32_t; typedef __int16 int16_t; typedef __int8 int8_t; +#else +#include +#endif + typedef float float32_t; #else +/* #undef HAVE_FLOAT32_T */ +/* Define if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + #include #if HAVE_SYS_TYPES_H # include @@ -329,7 +329,7 @@ } - #if defined(_WIN32) && !defined(__MINGW32__) + #if defined(_WIN32) && !defined(__MINGW32__) && !defined(HAVE_LRINTF) #define HAS_LRINTF static INLINE int lrintf(float f) { @@ -341,7 +341,7 @@ } return i; } - #elif (defined(__i386__) && defined(__GNUC__)) && !defined(__MINGW32__) + #elif (defined(__i386__) && defined(__GNUC__)) && !defined(__MINGW32__) && !defined(HAVE_LRINTF) #define HAS_LRINTF // from http://www.stereopsis.com/FPU.html static INLINE int lrintf(float f) @@ -340,6 +370,8 @@ #else +#include + #ifdef HAVE_LRINTF # define HAS_LRINTF # define _ISOC9X_SOURCE 1 @@ -348,8 +380,6 @@ # define __USE_ISOC99 1 #endif - #include - #ifdef HAVE_SINF # define sin sinf #error --- libfaad2/output.c 2005/02/19 01:21:19 1.7 +++ libfaad2/output.c 2005/03/29 18:14:24 1.8 @@ -19,10 +19,9 @@ ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** -** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. -** -** $Id: output.c,v 1.42 2004/09/04 14:56:28 menno Exp $ +** Initially modified for use with MPlayer by Rich Felker on 2005/03/29 +** $Id: output.c,v 1.11 2005/04/05 05:43:41 rfelker Exp $ +** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ **/ #include "common.h" @@ -462,7 +462,7 @@ } } -void* output_to_PCM(NeAACDecHandle hDecoder, +void* output_to_PCM_sux(NeAACDecHandle hDecoder, real_t **input, void *sample_buffer, uint8_t channels, uint16_t frame_len, uint8_t format) { @@ -553,4 +553,51 @@ return sample_buffer; } +void* output_to_PCM(NeAACDecHandle hDecoder, + real_t **input, void *sample_buffer, uint8_t channels, + uint16_t frame_len, uint8_t format) +{ + int ch; + int i; + int16_t *short_sample_buffer = (int16_t*)sample_buffer; + real_t *ch0 = input[hDecoder->internal_channel[0]]; + real_t *ch1 = input[hDecoder->internal_channel[1]]; + real_t *ch2 = input[hDecoder->internal_channel[2]]; + real_t *ch3 = input[hDecoder->internal_channel[3]]; + real_t *ch4 = input[hDecoder->internal_channel[4]]; + + if (format != FAAD_FMT_16BIT) + return output_to_PCM_sux(hDecoder, input, sample_buffer, channels, frame_len, format); + + if (hDecoder->downMatrix) { + for(i = 0; i < frame_len; i++) + { + int32_t tmp; + tmp = (ch1[i] + ((ch0[i]+ch3[i])>>1) + ((ch0[i]+ch3[i])>>2) + (1<<(REAL_BITS))) >> (REAL_BITS+1); + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000; + short_sample_buffer[0] = tmp; + tmp = (ch2[i] + ((ch0[i]+ch4[i])>>1) + ((ch0[i]+ch4[i])>>2) + (1<<(REAL_BITS))) >> (REAL_BITS+1); + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000; + short_sample_buffer[1] = tmp; + short_sample_buffer += channels; + } + return sample_buffer; + } + + /* Copy output to a standard PCM buffer */ + for(i = 0; i < frame_len; i++) + { + for (ch = 0; ch < channels; ch++) + { + int32_t tmp = input[ch][i]; + tmp += (1 << (REAL_BITS-1)); + tmp >>= REAL_BITS; + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000; + *(short_sample_buffer++) = tmp; + } + } + + return sample_buffer; +} + #endif --- libfaad/ps_dec.c 2005-02-01 14:15:58.000000000 +0100 +++ libfaad2/ps_dec.c 2005-12-07 22:52:31.000000000 +0100 @@ -1960,8 +1935,8 @@ /* main Parametric Stereo decoding function */ uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]) { - qmf_t X_hybrid_left[32][32] = {{0}}; - qmf_t X_hybrid_right[32][32] = {{0}}; + qmf_t X_hybrid_left[32][32] = {{{0}}}; + qmf_t X_hybrid_right[32][32] = {{{0}}}; /* delta decoding of the bitstream data */ ps_data_decode(ps); --- libfaad/sbr_dec.c 2005-12-07 22:52:03.000000000 +0100 +++ libfaad2/sbr_dec.c 2005-12-07 22:52:31.000000000 +0100 @@ -604,8 +527,8 @@ uint8_t l, k; uint8_t dont_process = 0; uint8_t ret = 0; - ALIGN qmf_t X_left[38][64] = {{0}}; - ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */ + ALIGN qmf_t X_left[38][64] = {{{0}}}; + ALIGN qmf_t X_right[38][64] = {{{0}}}; /* must set this to 0 */ if (sbr == NULL) return 20;