diff options
author | Dave Chapman <dave@dchapman.com> | 2005-10-31 20:33:27 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2005-10-31 20:33:27 +0000 |
commit | 798a4f3533cc63be2b313797bd4be5d53bda8fb9 (patch) | |
tree | 0e2b8bdeff50b3d0a1cbe73c591f97ef73179b65 | |
parent | 65de1cc6af31f547bd36d320f09cbcc6e6975421 (diff) |
Changes to make libfaad compile in Rockbox. Also remove compiler warnings, use some IRAM (IRAM usage needs reviewing) and drastically reduce the stack usage
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7700 a1c6a512-1295-4272-9138-f99709370657
25 files changed, 334 insertions, 63 deletions
diff --git a/apps/codecs/libfaad/Makefile b/apps/codecs/libfaad/Makefile new file mode 100644 index 0000000000..98ad9b9160 --- /dev/null +++ b/apps/codecs/libfaad/Makefile @@ -0,0 +1,47 @@ +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# $Id$ +# + +INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ + -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR) + +ifdef APPEXTRA +INCLUDES += -I$(APPSDIR)/$(APPEXTRA) +endif + +FAADOPTS = -O2 -Wno-char-subscripts +CFLAGS = $(GCCOPTS) $(FAADOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} + +# This sets up 'SRC' based on the files mentioned in SOURCES +include $(TOOLSDIR)/makesrc.inc + +SOURCES = $(SRC) +OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o) +OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2)) +DEPFILE = $(OBJDIR)/dep-libfaad +DIRS = + +OUTPUT = $(BUILDDIR)/libfaad.a + +all: $(OUTPUT) + +$(OUTPUT): $(OBJS) + @echo "AR $@" + @$(AR) ruv $@ $+ >/dev/null 2>&1 + +$(OBJDIR)/libfaad/%.o: $(APPSDIR)/codecs/libfaad/%.c + @echo "(libfaad) CC $<" + @$(CC) -c $(CFLAGS) -I$(APPSDIR)/codecs/libfaad/ $< -o $@ + +include $(TOOLSDIR)/make.inc + +clean: + @echo "cleaning libfaad" + @rm -f $(OBJS) $(OUTPUT) $(DEPFILE) + +-include $(DEPFILE) diff --git a/apps/codecs/libfaad/README.rockbox b/apps/codecs/libfaad/README.rockbox new file mode 100644 index 0000000000..5b70f231ba --- /dev/null +++ b/apps/codecs/libfaad/README.rockbox @@ -0,0 +1,19 @@ +Library: libfaad (FAAD2) +Imported: 2005-10-31 by Dave Chapman + +This directory contains the libfaad library from the FAAD2 project. + +LICENSING INFORMATION + +FAAD2 is licensed under the GNU General Public License and is +Copyright (C) 2003 M. Bakker (mbakker(at)nero.com), Ahead Software AG + +IMPORT DETAILS + +The decoder is based on the CVS version of libfaad from 2 February 2005. + +A non GPL compatible clause was added to the license as part of the +CVS commit on 2 February 2005 - so we are not able to use later +versions of that project in Rockbox. + + diff --git a/apps/codecs/libfaad/SOURCES b/apps/codecs/libfaad/SOURCES new file mode 100644 index 0000000000..4c7a34d210 --- /dev/null +++ b/apps/codecs/libfaad/SOURCES @@ -0,0 +1,35 @@ +bits.c +cfft.c +common.c +decoder.c +drc.c +drm_dec.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 +ps_dec.c +ps_syntax.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 +syntax.c +tns.c diff --git a/apps/codecs/libfaad/bits.c b/apps/codecs/libfaad/bits.c index 952a4a9df7..e2e609edd1 100644 --- a/apps/codecs/libfaad/bits.c +++ b/apps/codecs/libfaad/bits.c @@ -32,6 +32,8 @@ #include <string.h> #include "bits.h" +uint8_t static_buffer[1024] IBSS_ATTR; + /* initialize buffer, call once before first getbits or showbits */ void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) { @@ -49,7 +51,7 @@ void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) return; } - ld->buffer = faad_malloc((buffer_size+12)*sizeof(uint8_t)); + ld->buffer = &static_buffer; memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t)); memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t)); diff --git a/apps/codecs/libfaad/bits.h b/apps/codecs/libfaad/bits.h index 56d413e0c8..0ebe04b03f 100644 --- a/apps/codecs/libfaad/bits.h +++ b/apps/codecs/libfaad/bits.h @@ -144,7 +144,7 @@ static INLINE void faad_flushbits(bitfile *ld, uint32_t bits) } /* return next n bits (right adjusted) */ -static INLINE uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC) +static uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC) { uint32_t ret; diff --git a/apps/codecs/libfaad/cfft.c b/apps/codecs/libfaad/cfft.c index 441cd692de..8eec8aa85c 100644 --- a/apps/codecs/libfaad/cfft.c +++ b/apps/codecs/libfaad/cfft.c @@ -870,6 +870,7 @@ static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac) uint16_t ib; uint16_t nf, nl, nq, nr; + (void)wa; nl = n; nf = 0; j = 0; diff --git a/apps/codecs/libfaad/common.c b/apps/codecs/libfaad/common.c index c0676b479f..debc125b3e 100644 --- a/apps/codecs/libfaad/common.c +++ b/apps/codecs/libfaad/common.c @@ -433,7 +433,6 @@ int32_t pow2_int(real_t val) int32_t log2_int(uint32_t val) { uint32_t frac; - uint32_t whole = (val); int32_t exp = 0; uint32_t index; uint32_t index_frac; @@ -477,7 +476,6 @@ int32_t log2_int(uint32_t val) real_t log2_fix(uint32_t val) { uint32_t frac; - uint32_t whole = (val >> REAL_BITS); int8_t exp = 0; uint32_t index; uint32_t index_frac; diff --git a/apps/codecs/libfaad/common.h b/apps/codecs/libfaad/common.h index efe8288b36..7ee0eda589 100644 --- a/apps/codecs/libfaad/common.h +++ b/apps/codecs/libfaad/common.h @@ -32,8 +32,24 @@ extern "C" { #endif -#ifdef HAVE_CONFIG_H -# include "../config.h" +#include "faad_config.h" +#include "../codec.h" +#include "../lib/codeclib.h" + +extern struct codec_api* ci; + +#if defined(DEBUG) || defined(SIMULATOR) +#undef DEBUGF +#define DEBUGF ci->debugf +#else +#define DEBUGF(...) +#endif + +#ifdef ROCKBOX_HAS_LOGF +#undef LOGF +#define LOGF ci->logf +#else +#define LOGF(...) #endif #define INLINE __inline @@ -55,7 +71,7 @@ extern "C" { /* use double precision */ /* #define USE_DOUBLE_PRECISION */ /* use fixed point reals */ -//#define FIXED_POINT +#define FIXED_POINT //#define BIG_IQ_TABLE /* Use if target platform has address generators with autoincrement */ @@ -72,7 +88,7 @@ extern "C" { /* Allow decoding of MAIN profile AAC */ #define MAIN_DEC /* Allow decoding of SSR profile AAC */ -//#define SSR_DEC +#define SSR_DEC /* Allow decoding of LTP profile AAC */ #define LTP_DEC /* Allow decoding of LD profile AAC */ @@ -183,10 +199,10 @@ typedef float float32_t; # if !STDC_HEADERS && HAVE_MEMORY_H # include <memory.h> # endif -# include <string.h> +//# include <string.h> #endif #if HAVE_STRINGS_H -# include <strings.h> +//# include <strings.h> #endif #if HAVE_INTTYPES_H # include <inttypes.h> @@ -214,7 +230,7 @@ typedef float float32_t; #endif #if STDC_HEADERS -# include <string.h> +//# include <string.h> #else # if !HAVE_STRCHR # define strchr index diff --git a/apps/codecs/libfaad/decoder.c b/apps/codecs/libfaad/decoder.c index b2c37dadb8..1c8fbd90a1 100644 --- a/apps/codecs/libfaad/decoder.c +++ b/apps/codecs/libfaad/decoder.c @@ -53,7 +53,7 @@ uint16_t dbg_count; /* static function declarations */ static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, uint8_t *buffer, uint32_t buffer_size, - void **sample_buffer, uint32_t sample_buffer_size); + void **sample_buffer, int32_t sample_buffer_size); static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo); @@ -724,7 +724,7 @@ void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, uint8_t *buffer, uint32_t buffer_size, - void **sample_buffer2, uint32_t sample_buffer_size) + void **sample_buffer2, int32_t sample_buffer_size) { uint8_t channels = 0; uint8_t output_channels = 0; diff --git a/apps/codecs/libfaad/faad_config.h b/apps/codecs/libfaad/faad_config.h new file mode 100644 index 0000000000..163b55669e --- /dev/null +++ b/apps/codecs/libfaad/faad_config.h @@ -0,0 +1,120 @@ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ + +#include <config.h> + +/* Define if you want to use libfaad together with Digital Radio Mondiale + (DRM) */ +/* #undef DRM */ + +/* Define if you want support for Digital Radio Mondiale (DRM) parametric + stereo */ +/* #undef DRM_PS */ + +/* Define to 1 if you have the <dlfcn.h> header file. */ +//#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the <errno.h> header file. */ +//#define HAVE_ERRNO_H 1 + +/* Define if needed */ +/* #undef HAVE_FLOAT32_T */ + +/* Define to 1 if you have the <float.h> header file. */ +//#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have the IOKit API */ +/* #undef HAVE_IOKIT_IOKITLIB_H */ + +/* Define to 1 if you have the <limits.h> header file. */ +//#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the <mathf.h> header file. */ +/* #undef HAVE_MATHF_H */ + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the <memory.h> header file. */ +//#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +//#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the <strings.h> header file. */ +//#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strsep' function. */ +//#define HAVE_STRSEP 1 + +/* Define to 1 if you have the <sysfs/libsysfs.h> header file. */ +/* #undef HAVE_SYSFS_LIBSYSFS_H */ + +/* Define to 1 if you have the <sys/stat.h> header file. */ +//#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +//#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +//#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +//#define HAVE_UNISTD_H 1 + +/* Name of package */ +#define PACKAGE "faad2" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +//#define TIME_WITH_SYS_TIME 1 + +/* Version number of package */ +#define LIBFAAD_VERSION "2.0" + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#ifdef ROCKBOX_BIG_ENDIAN +#define WORDS_BIGENDIAN 1 +#endif + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `long' if <sys/types.h> does not define. */ +/* #undef off_t */ diff --git a/apps/codecs/libfaad/filtbank.c b/apps/codecs/libfaad/filtbank.c index 13cc265e21..603e02fa86 100644 --- a/apps/codecs/libfaad/filtbank.c +++ b/apps/codecs/libfaad/filtbank.c @@ -159,13 +159,14 @@ static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t } #endif +ALIGN real_t transf_buf[2*1024] = {0}; + void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, real_t *overlap, uint8_t object_type, uint16_t frame_len) { int16_t i; - ALIGN real_t transf_buf[2*1024] = {0}; const real_t *window_long = NULL; const real_t *window_long_prev = NULL; @@ -182,6 +183,7 @@ void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, int64_t count = faad_get_ts(); #endif + memset(transf_buf,0,sizeof(transf_buf)); /* select windows of current frame and previous frame (Sine or KBD) */ #ifdef LD_DEC if (object_type == LD) @@ -331,13 +333,13 @@ void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, #ifdef LTP_DEC +ALIGN real_t windowed_buf[2*1024] = {0}; /* only works for LTP -> no overlapping, no short blocks */ void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct, uint8_t object_type, uint16_t frame_len) { int16_t i; - ALIGN real_t windowed_buf[2*1024] = {0}; const real_t *window_long = NULL; const real_t *window_long_prev = NULL; @@ -348,8 +350,9 @@ void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint16_t nshort = frame_len/8; uint16_t nflat_ls = (nlong-nshort)/2; - assert(window_sequence != EIGHT_SHORT_SEQUENCE); + //assert(window_sequence != EIGHT_SHORT_SEQUENCE); + memset(windowed_buf,0,sizeof(windowed_buf)); #ifdef LD_DEC if (object_type == LD) { diff --git a/apps/codecs/libfaad/hcr.c b/apps/codecs/libfaad/hcr.c index a5e67bb85d..f2766c38e1 100644 --- a/apps/codecs/libfaad/hcr.c +++ b/apps/codecs/libfaad/hcr.c @@ -217,8 +217,8 @@ uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, uint16_t PCWs_done; uint16_t numberOfSegments, numberOfSets, numberOfCodewords; - codeword_t codeword[512]; - bits_t segment[512]; + static codeword_t codeword[512]; + static bits_t segment[512]; uint16_t sp_offset[8]; uint16_t g, i, sortloop, set, bitsread; diff --git a/apps/codecs/libfaad/lt_predict.c b/apps/codecs/libfaad/lt_predict.c index ad6bc77f69..3edb9c7586 100644 --- a/apps/codecs/libfaad/lt_predict.c +++ b/apps/codecs/libfaad/lt_predict.c @@ -77,6 +77,8 @@ ALIGN static const real_t codebook[8] = REAL_CONST(1.369533) }; +ALIGN real_t x_est[2048]; +ALIGN real_t X_est[2048]; void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec, int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape, uint8_t win_shape_prev, uint8_t sr_index, @@ -84,8 +86,6 @@ void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec, { uint8_t sfb; uint16_t bin, i, num_samples; - ALIGN real_t x_est[2048]; - ALIGN real_t X_est[2048]; if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) { diff --git a/apps/codecs/libfaad/mdct.c b/apps/codecs/libfaad/mdct.c index 78712a0bc5..158ea22205 100644 --- a/apps/codecs/libfaad/mdct.c +++ b/apps/codecs/libfaad/mdct.c @@ -60,7 +60,7 @@ mdct_info *faad_mdct_init(uint16_t N) { mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info)); - assert(N % 8 == 0); + //assert(N % 8 == 0); mdct->N = N; @@ -123,10 +123,10 @@ void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out) complex_t x; #ifdef ALLOW_SMALL_FRAMELENGTH #ifdef FIXED_POINT - real_t scale, b_scale = 0; + real_t scale = 0, b_scale = 0; #endif #endif - ALIGN complex_t Z1[512]; + ALIGN static complex_t Z1[512]; complex_t *sincos = mdct->sincos; uint16_t N = mdct->N; @@ -230,7 +230,7 @@ void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out) uint16_t k; complex_t x; - ALIGN complex_t Z1[512]; + ALIGN static complex_t Z1[512]; complex_t *sincos = mdct->sincos; uint16_t N = mdct->N; diff --git a/apps/codecs/libfaad/ps_dec.c b/apps/codecs/libfaad/ps_dec.c index cfc5629cbe..b219f58ae0 100644 --- a/apps/codecs/libfaad/ps_dec.c +++ b/apps/codecs/libfaad/ps_dec.c @@ -159,10 +159,10 @@ typedef struct /* static function declarations */ static void ps_data_decode(ps_info *ps); -static hyb_info *hybrid_init(); +static hyb_info *hybrid_init(void); static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter, qmf_t *buffer, qmf_t **X_hybrid); -static void INLINE DCT3_4_unscaled(real_t *y, real_t *x); +static INLINE void DCT3_4_unscaled(real_t *y, real_t *x); static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter, qmf_t *buffer, qmf_t **X_hybrid); static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], @@ -256,6 +256,7 @@ static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filt { uint8_t i; + (void)hyb; for (i = 0; i < frame_len; i++) { real_t r0 = MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))); @@ -290,6 +291,7 @@ static void channel_filter4(hyb_info *hyb, uint8_t frame_len, const real_t *filt uint8_t i; real_t input_re1[2], input_re2[2], input_im1[2], input_im2[2]; + (void)hyb; for (i = 0; i < frame_len; i++) { input_re1[0] = -MUL_F(filter[2], (QMF_RE(buffer[i+2]) + QMF_RE(buffer[i+10]))) + @@ -338,7 +340,7 @@ static void channel_filter4(hyb_info *hyb, uint8_t frame_len, const real_t *filt } } -static void INLINE DCT3_4_unscaled(real_t *y, real_t *x) +static INLINE void DCT3_4_unscaled(real_t *y, real_t *x) { real_t f0, f1, f2, f3, f4, f5, f6, f7, f8; @@ -365,6 +367,7 @@ static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filt real_t input_re1[4], input_re2[4], input_im1[4], input_im2[4]; real_t x[4]; + (void)hyb; for (i = 0; i < frame_len; i++) { input_re1[0] = MUL_F(filter[6],QMF_RE(buffer[6+i])); @@ -429,7 +432,7 @@ static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filt } } -static void INLINE DCT3_6_unscaled(real_t *y, real_t *x) +static INLINE void DCT3_6_unscaled(real_t *y, real_t *x) { real_t f0, f1, f2, f3, f4, f5, f6, f7; @@ -457,6 +460,7 @@ static void channel_filter12(hyb_info *hyb, uint8_t frame_len, const real_t *fil real_t input_re1[6], input_re2[6], input_im1[6], input_im2[6]; real_t out_re1[6], out_re2[6], out_im1[6], out_im2[6]; + (void)hyb; for (i = 0; i < frame_len; i++) { for (n = 0; n < 6; n++) @@ -1027,7 +1031,7 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][ qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]) { uint8_t gr, n, m, bk; - uint8_t temp_delay; + uint8_t temp_delay = 0; uint8_t sb, maxsb; const complex_t *Phi_Fract_SubQmf; uint8_t temp_delay_ser[NO_ALLPASS_LINKS]; @@ -1847,6 +1851,7 @@ ps_info *ps_init(uint8_t sr_index) ps_info *ps = (ps_info*)faad_malloc(sizeof(ps_info)); memset(ps, 0, sizeof(ps_info)); + (void)sr_index; ps->hyb = hybrid_init(); ps->ps_data_available = 0; @@ -1935,8 +1940,11 @@ ps_info *ps_init(uint8_t sr_index) /* 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]; + qmf_t X_hybrid_right[32][32]; + + memset(&X_hybrid_left,0,sizeof(X_hybrid_left)); + memset(&X_hybrid_right,0,sizeof(X_hybrid_right)); /* delta decoding of the bitstream data */ ps_data_decode(ps); diff --git a/apps/codecs/libfaad/ps_syntax.c b/apps/codecs/libfaad/ps_syntax.c index 6c909c01f6..290d7e5523 100644 --- a/apps/codecs/libfaad/ps_syntax.c +++ b/apps/codecs/libfaad/ps_syntax.c @@ -469,6 +469,7 @@ static uint16_t ps_extension(ps_info *ps, bitfile *ld, uint8_t n; uint16_t bits = (uint16_t)faad_get_processed_bits(ld); + (void)num_bits_left; if (ps_extension_id == 0) { ps->enable_ipdopd = (uint8_t)faad_get1bit(ld diff --git a/apps/codecs/libfaad/sbr_dec.c b/apps/codecs/libfaad/sbr_dec.c index 04752d793b..c18ea454d5 100644 --- a/apps/codecs/libfaad/sbr_dec.c +++ b/apps/codecs/libfaad/sbr_dec.c @@ -226,16 +226,17 @@ static void sbr_save_matrix(sbr_info *sbr, uint8_t ch) } } +#ifdef SBR_LOW_POWER + ALIGN real_t deg[64]; +#endif + static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64], uint8_t ch, uint8_t dont_process, const uint8_t downSampledSBR) { int16_t k, l; -#ifdef SBR_LOW_POWER - ALIGN real_t deg[64]; -#endif - + (void)downSampledSBR; #ifdef DRM if (sbr->Is_DRM_SBR) { @@ -369,12 +370,12 @@ static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_ } } +ALIGN qmf_t X[MAX_NTSR][64]; uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, const uint8_t just_seeked, const uint8_t downSampledSBR) { uint8_t dont_process = 0; uint8_t ret = 0; - ALIGN qmf_t X[MAX_NTSR][64]; if (sbr == NULL) return 20; @@ -452,12 +453,12 @@ uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_cha return 0; } +ALIGN qmf_t X[MAX_NTSR][64]; uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, const uint8_t just_seeked, const uint8_t downSampledSBR) { uint8_t dont_process = 0; uint8_t ret = 0; - ALIGN qmf_t X[MAX_NTSR][64]; if (sbr == NULL) return 20; @@ -519,6 +520,10 @@ uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, return 0; } + +ALIGN qmf_t X_left[38][64];// = {{0}}; +ALIGN qmf_t X_right[38][64];// = {{0}}; /* must set this to 0 */ + #if (defined(PS_DEC) || defined(DRM_PS)) uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, const uint8_t just_seeked, const uint8_t downSampledSBR) @@ -526,9 +531,9 @@ uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *righ 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 */ + memset(X_left,0,sizeof(X_left)); + memset(X_right,0,sizeof(X_right)); if (sbr == NULL) return 20; diff --git a/apps/codecs/libfaad/sbr_fbt.c b/apps/codecs/libfaad/sbr_fbt.c index b90ae7d769..812c4059f9 100644 --- a/apps/codecs/libfaad/sbr_fbt.c +++ b/apps/codecs/libfaad/sbr_fbt.c @@ -359,6 +359,7 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2, real_t rk2, rk0; #endif + (void)bs_alter_scale; /* mft only defined for k2 > k0 */ if (k2 <= k0) { @@ -504,7 +505,7 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2, uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band, uint8_t k2) { - uint8_t k, i; + uint8_t k, i = 0; uint32_t minus; /* The following relation shall be satisfied: bs_xover_band < N_Master */ diff --git a/apps/codecs/libfaad/sbr_hfadj.c b/apps/codecs/libfaad/sbr_hfadj.c index 17d63f41c2..374d16f443 100644 --- a/apps/codecs/libfaad/sbr_hfadj.c +++ b/apps/codecs/libfaad/sbr_hfadj.c @@ -55,8 +55,9 @@ void hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64] #endif ,uint8_t ch) { - ALIGN sbr_hfadj_info adj = {{{0}}}; + ALIGN sbr_hfadj_info adj; + memset(&adj,0,sizeof(adj)); if (sbr->bs_frame_class[ch] == FIXFIX) { sbr->l_A[ch] = -1; @@ -131,6 +132,7 @@ static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t m, l, j, k, k_l, k_h, p; real_t nrg, div; + (void)adj; if (sbr->bs_interpol_freq == 1) { for (l = 0; l < sbr->L_E[ch]; l++) diff --git a/apps/codecs/libfaad/sbr_hfgen.c b/apps/codecs/libfaad/sbr_hfgen.c index 5f306c43f3..4991839218 100644 --- a/apps/codecs/libfaad/sbr_hfgen.c +++ b/apps/codecs/libfaad/sbr_hfgen.c @@ -628,14 +628,14 @@ static void patch_construction(sbr_info *sbr) do { - uint8_t j = k + 1; + int8_t j = k + 1; do { j--; - sb = sbr->f_master[j]; odd = (sb - 2 + sbr->k0) % 2; + } while (sb > (sbr->k0 - 1 + msb - odd)); sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0); diff --git a/apps/codecs/libfaad/sbr_syntax.c b/apps/codecs/libfaad/sbr_syntax.c index 4920d701e6..267e954a2e 100644 --- a/apps/codecs/libfaad/sbr_syntax.c +++ b/apps/codecs/libfaad/sbr_syntax.c @@ -821,6 +821,7 @@ static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr, uint16_t ret; #endif + (void)num_bits_left; switch (bs_extension_id) { #ifdef PS_DEC diff --git a/apps/codecs/libfaad/sbr_tf_grid.c b/apps/codecs/libfaad/sbr_tf_grid.c index d41fad6358..2c21173490 100644 --- a/apps/codecs/libfaad/sbr_tf_grid.c +++ b/apps/codecs/libfaad/sbr_tf_grid.c @@ -50,7 +50,8 @@ static uint8_t middleBorder(sbr_info *sbr, uint8_t ch); /* first build into temp vector to be able to use previous vector on error */ uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch) { - uint8_t l, border, temp; + uint8_t l, temp; + int8_t border; uint8_t t_E_temp[6] = {0}; t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch]; diff --git a/apps/codecs/libfaad/specrec.c b/apps/codecs/libfaad/specrec.c index a452fbd90e..6d74c77562 100644 --- a/apps/codecs/libfaad/specrec.c +++ b/apps/codecs/libfaad/specrec.c @@ -409,7 +409,7 @@ uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics) } } -/* iquant() * +/* iquant() */ /* output = sign(input)*abs(input)^(4/3) */ /**/ static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) @@ -543,6 +543,7 @@ static uint8_t quant_to_spec(NeAACDecHandle hDecoder, }; const real_t *tab = iq_table; + (void)frame_len; uint8_t g, sfb, win; uint16_t width, bin, k, gindex, wa, wb; uint8_t error = 0; /* Init error flag */ @@ -856,7 +857,7 @@ uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, element *sce, int16_t *spec_data) { uint8_t retval, output_channels; - ALIGN real_t spec_coef[1024]; + ALIGN static real_t spec_coef[1024]; #ifdef PROFILE int64_t count = faad_get_ts(); @@ -1048,8 +1049,8 @@ uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_st element *cpe, int16_t *spec_data1, int16_t *spec_data2) { uint8_t retval; - ALIGN real_t spec_coef1[1024]; - ALIGN real_t spec_coef2[1024]; + ALIGN static real_t spec_coef1[1024]; + ALIGN static real_t spec_coef2[1024]; #ifdef PROFILE int64_t count = faad_get_ts(); diff --git a/apps/codecs/libfaad/syntax.c b/apps/codecs/libfaad/syntax.c index 1ce086eb4b..85e927b74d 100644 --- a/apps/codecs/libfaad/syntax.c +++ b/apps/codecs/libfaad/syntax.c @@ -558,14 +558,16 @@ void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, /* Table 4.4.4 and */ /* Table 4.4.9 */ +ALIGN int16_t spec_data[1024] = {0}; +element sce IBSS_ATTR; static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, uint8_t channel, uint8_t *tag) { uint8_t retval = 0; - element sce = {0}; ic_stream *ics = &(sce.ics1); - ALIGN int16_t spec_data[1024] = {0}; + memset(spec_data,0,sizeof(spec_data)); + memset(&sce,0,sizeof(sce)); sce.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_tag")); @@ -601,16 +603,19 @@ static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, } /* Table 4.4.5 */ +ALIGN int16_t spec_data1[1024]; +ALIGN int16_t spec_data2[1024]; +element cpe IBSS_ATTR; static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld, uint8_t channels, uint8_t *tag) { - ALIGN int16_t spec_data1[1024] = {0}; - ALIGN int16_t spec_data2[1024] = {0}; - element cpe = {0}; ic_stream *ics1 = &(cpe.ics1); ic_stream *ics2 = &(cpe.ics2); uint8_t result; + memset(spec_data1,0,sizeof(spec_data1)); + memset(spec_data2,0,sizeof(spec_data2)); + memset(&cpe,0,sizeof(cpe)); cpe.channel = channels; cpe.paired_channel = channels+1; @@ -876,7 +881,7 @@ static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld) element el_empty = {0}; ic_stream ics_empty = {0}; - int16_t sh_data[1024]; + static int16_t sh_data[1024]; c = faad_getbits(ld, LEN_TAG DEBUGVAR(1,900,"coupling_channel_element(): element_instance_tag")); @@ -961,6 +966,8 @@ static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld) uint8_t byte_aligned; uint16_t i, count; + (void)hDecoder; + /* element_instance_tag = */ faad_getbits(ld, LEN_TAG DEBUGVAR(1,60,"data_stream_element(): element_instance_tag")); byte_aligned = faad_get1bit(ld @@ -1158,6 +1165,8 @@ static void gain_control_data(bitfile *ld, ic_stream *ics) #endif #ifdef SCALABLE_DEC +ALIGN int16_t spec_data1[1024] IBSS_ATTR; +ALIGN int16_t spec_data2[1024] IBSS_ATTR; /* Table 4.4.13 ASME */ void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc) @@ -1170,9 +1179,9 @@ void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo ic_stream *ics1 = &(cpe.ics1); ic_stream *ics2 = &(cpe.ics2); int16_t *spec_data; - ALIGN int16_t spec_data1[1024] = {0}; - ALIGN int16_t spec_data2[1024] = {0}; + memset(spec_data1,0,sizeof(spec_data1)); + memset(spec_data2,0,sizeof(spec_data2)); hDecoder->fr_ch_ele = 0; hInfo->error = aac_scalable_main_header(hDecoder, ics1, ics2, ld, this_layer_stereo); @@ -1810,7 +1819,8 @@ static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfil /* Table 4.4.27 */ static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld) { - uint8_t w, filt, i, start_coef_bits, coef_bits; + uint8_t w, filt, i, start_coef_bits = 0; + int8_t coef_bits; uint8_t n_filt_bits = 2; uint8_t length_bits = 6; uint8_t order_bits = 5; @@ -2048,11 +2058,11 @@ static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count) return n; case EXT_FILL_DATA: /* fill_nibble = */ faad_getbits(ld, 4 - DEBUGVAR(1,136,"extension_payload(): fill_nibble")); /* must be ‘0000’ */ + DEBUGVAR(1,136,"extension_payload(): fill_nibble")); /* must be æ0000Æ */ for (i = 0; i < count-1; i++) { /* fill_byte[i] = */ faad_getbits(ld, 8 - DEBUGVAR(1,88,"extension_payload(): fill_byte")); /* must be ‘10100101’ */ + DEBUGVAR(1,88,"extension_payload(): fill_byte")); /* must be æ10100101Æ */ } return count; case EXT_DATA_ELEMENT: diff --git a/apps/codecs/libfaad/tns.c b/apps/codecs/libfaad/tns.c index fa33e57a14..a759174196 100644 --- a/apps/codecs/libfaad/tns.c +++ b/apps/codecs/libfaad/tns.c @@ -36,9 +36,9 @@ static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, uint8_t *coef, real_t *a); static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, - uint8_t order); + int8_t order); static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, - uint8_t order); + int8_t order); #ifdef _MSC_VER @@ -226,7 +226,7 @@ static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_c } static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, - uint8_t order) + int8_t order) { /* - Simple all-pole filter of order "order" defined by @@ -269,7 +269,7 @@ static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *l } static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, - uint8_t order) + int8_t order) { /* - Simple all-zero filter of order "order" defined by |