summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2005-10-31 20:33:27 +0000
committerDave Chapman <dave@dchapman.com>2005-10-31 20:33:27 +0000
commit798a4f3533cc63be2b313797bd4be5d53bda8fb9 (patch)
tree0e2b8bdeff50b3d0a1cbe73c591f97ef73179b65
parent65de1cc6af31f547bd36d320f09cbcc6e6975421 (diff)
downloadrockbox-798a4f3533cc63be2b313797bd4be5d53bda8fb9.tar.gz
rockbox-798a4f3533cc63be2b313797bd4be5d53bda8fb9.zip
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
-rw-r--r--apps/codecs/libfaad/Makefile47
-rw-r--r--apps/codecs/libfaad/README.rockbox19
-rw-r--r--apps/codecs/libfaad/SOURCES35
-rw-r--r--apps/codecs/libfaad/bits.c4
-rw-r--r--apps/codecs/libfaad/bits.h2
-rw-r--r--apps/codecs/libfaad/cfft.c1
-rw-r--r--apps/codecs/libfaad/common.c2
-rw-r--r--apps/codecs/libfaad/common.h30
-rw-r--r--apps/codecs/libfaad/decoder.c4
-rw-r--r--apps/codecs/libfaad/faad_config.h120
-rw-r--r--apps/codecs/libfaad/filtbank.c9
-rw-r--r--apps/codecs/libfaad/hcr.c4
-rw-r--r--apps/codecs/libfaad/lt_predict.c4
-rw-r--r--apps/codecs/libfaad/mdct.c8
-rw-r--r--apps/codecs/libfaad/ps_dec.c22
-rw-r--r--apps/codecs/libfaad/ps_syntax.c1
-rw-r--r--apps/codecs/libfaad/sbr_dec.c21
-rw-r--r--apps/codecs/libfaad/sbr_fbt.c3
-rw-r--r--apps/codecs/libfaad/sbr_hfadj.c4
-rw-r--r--apps/codecs/libfaad/sbr_hfgen.c4
-rw-r--r--apps/codecs/libfaad/sbr_syntax.c1
-rw-r--r--apps/codecs/libfaad/sbr_tf_grid.c3
-rw-r--r--apps/codecs/libfaad/specrec.c9
-rw-r--r--apps/codecs/libfaad/syntax.c32
-rw-r--r--apps/codecs/libfaad/tns.c8
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 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
12
13ifdef APPEXTRA
14INCLUDES += -I$(APPSDIR)/$(APPEXTRA)
15endif
16
17FAADOPTS = -O2 -Wno-char-subscripts
18CFLAGS = $(GCCOPTS) $(FAADOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
19
20# This sets up 'SRC' based on the files mentioned in SOURCES
21include $(TOOLSDIR)/makesrc.inc
22
23SOURCES = $(SRC)
24OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
25OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
26DEPFILE = $(OBJDIR)/dep-libfaad
27DIRS =
28
29OUTPUT = $(BUILDDIR)/libfaad.a
30
31all: $(OUTPUT)
32
33$(OUTPUT): $(OBJS)
34 @echo "AR $@"
35 @$(AR) ruv $@ $+ >/dev/null 2>&1
36
37$(OBJDIR)/libfaad/%.o: $(APPSDIR)/codecs/libfaad/%.c
38 @echo "(libfaad) CC $<"
39 @$(CC) -c $(CFLAGS) -I$(APPSDIR)/codecs/libfaad/ $< -o $@
40
41include $(TOOLSDIR)/make.inc
42
43clean:
44 @echo "cleaning libfaad"
45 @rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
46
47-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 @@
1Library: libfaad (FAAD2)
2Imported: 2005-10-31 by Dave Chapman
3
4This directory contains the libfaad library from the FAAD2 project.
5
6LICENSING INFORMATION
7
8FAAD2 is licensed under the GNU General Public License and is
9Copyright (C) 2003 M. Bakker (mbakker(at)nero.com), Ahead Software AG
10
11IMPORT DETAILS
12
13The decoder is based on the CVS version of libfaad from 2 February 2005.
14
15A non GPL compatible clause was added to the license as part of the
16CVS commit on 2 February 2005 - so we are not able to use later
17versions of that project in Rockbox.
18
19
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 @@
1bits.c
2cfft.c
3common.c
4decoder.c
5drc.c
6drm_dec.c
7error.c
8filtbank.c
9hcr.c
10huffman.c
11ic_predict.c
12is.c
13lt_predict.c
14mdct.c
15mp4.c
16ms.c
17output.c
18pns.c
19ps_dec.c
20ps_syntax.c
21pulse.c
22rvlc.c
23sbr_dct.c
24sbr_dec.c
25sbr_e_nf.c
26sbr_fbt.c
27sbr_hfadj.c
28sbr_hfgen.c
29sbr_huff.c
30sbr_qmf.c
31sbr_syntax.c
32sbr_tf_grid.c
33specrec.c
34syntax.c
35tns.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 @@
32#include <string.h> 32#include <string.h>
33#include "bits.h" 33#include "bits.h"
34 34
35uint8_t static_buffer[1024] IBSS_ATTR;
36
35/* initialize buffer, call once before first getbits or showbits */ 37/* initialize buffer, call once before first getbits or showbits */
36void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) 38void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size)
37{ 39{
@@ -49,7 +51,7 @@ void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size)
49 return; 51 return;
50 } 52 }
51 53
52 ld->buffer = faad_malloc((buffer_size+12)*sizeof(uint8_t)); 54 ld->buffer = &static_buffer;
53 memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t)); 55 memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t));
54 memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t)); 56 memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t));
55 57
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)
144} 144}
145 145
146/* return next n bits (right adjusted) */ 146/* return next n bits (right adjusted) */
147static INLINE uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC) 147static uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC)
148{ 148{
149 uint32_t ret; 149 uint32_t ret;
150 150
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)
870 uint16_t ib; 870 uint16_t ib;
871 uint16_t nf, nl, nq, nr; 871 uint16_t nf, nl, nq, nr;
872 872
873 (void)wa;
873 nl = n; 874 nl = n;
874 nf = 0; 875 nf = 0;
875 j = 0; 876 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)
433int32_t log2_int(uint32_t val) 433int32_t log2_int(uint32_t val)
434{ 434{
435 uint32_t frac; 435 uint32_t frac;
436 uint32_t whole = (val);
437 int32_t exp = 0; 436 int32_t exp = 0;
438 uint32_t index; 437 uint32_t index;
439 uint32_t index_frac; 438 uint32_t index_frac;
@@ -477,7 +476,6 @@ int32_t log2_int(uint32_t val)
477real_t log2_fix(uint32_t val) 476real_t log2_fix(uint32_t val)
478{ 477{
479 uint32_t frac; 478 uint32_t frac;
480 uint32_t whole = (val >> REAL_BITS);
481 int8_t exp = 0; 479 int8_t exp = 0;
482 uint32_t index; 480 uint32_t index;
483 uint32_t index_frac; 481 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 @@
32extern "C" { 32extern "C" {
33#endif 33#endif
34 34
35#ifdef HAVE_CONFIG_H 35#include "faad_config.h"
36# include "../config.h" 36#include "../codec.h"
37#include "../lib/codeclib.h"
38
39extern struct codec_api* ci;
40
41#if defined(DEBUG) || defined(SIMULATOR)
42#undef DEBUGF
43#define DEBUGF ci->debugf
44#else
45#define DEBUGF(...)
46#endif
47
48#ifdef ROCKBOX_HAS_LOGF
49#undef LOGF
50#define LOGF ci->logf
51#else
52#define LOGF(...)
37#endif 53#endif
38 54
39#define INLINE __inline 55#define INLINE __inline
@@ -55,7 +71,7 @@ extern "C" {
55/* use double precision */ 71/* use double precision */
56/* #define USE_DOUBLE_PRECISION */ 72/* #define USE_DOUBLE_PRECISION */
57/* use fixed point reals */ 73/* use fixed point reals */
58//#define FIXED_POINT 74#define FIXED_POINT
59//#define BIG_IQ_TABLE 75//#define BIG_IQ_TABLE
60 76
61/* Use if target platform has address generators with autoincrement */ 77/* Use if target platform has address generators with autoincrement */
@@ -72,7 +88,7 @@ extern "C" {
72/* Allow decoding of MAIN profile AAC */ 88/* Allow decoding of MAIN profile AAC */
73#define MAIN_DEC 89#define MAIN_DEC
74/* Allow decoding of SSR profile AAC */ 90/* Allow decoding of SSR profile AAC */
75//#define SSR_DEC 91#define SSR_DEC
76/* Allow decoding of LTP profile AAC */ 92/* Allow decoding of LTP profile AAC */
77#define LTP_DEC 93#define LTP_DEC
78/* Allow decoding of LD profile AAC */ 94/* Allow decoding of LD profile AAC */
@@ -183,10 +199,10 @@ typedef float float32_t;
183# if !STDC_HEADERS && HAVE_MEMORY_H 199# if !STDC_HEADERS && HAVE_MEMORY_H
184# include <memory.h> 200# include <memory.h>
185# endif 201# endif
186# include <string.h> 202//# include <string.h>
187#endif 203#endif
188#if HAVE_STRINGS_H 204#if HAVE_STRINGS_H
189# include <strings.h> 205//# include <strings.h>
190#endif 206#endif
191#if HAVE_INTTYPES_H 207#if HAVE_INTTYPES_H
192# include <inttypes.h> 208# include <inttypes.h>
@@ -214,7 +230,7 @@ typedef float float32_t;
214#endif 230#endif
215 231
216#if STDC_HEADERS 232#if STDC_HEADERS
217# include <string.h> 233//# include <string.h>
218#else 234#else
219# if !HAVE_STRCHR 235# if !HAVE_STRCHR
220# define strchr index 236# 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;
53/* static function declarations */ 53/* static function declarations */
54static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, 54static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
55 uint8_t *buffer, uint32_t buffer_size, 55 uint8_t *buffer, uint32_t buffer_size,
56 void **sample_buffer, uint32_t sample_buffer_size); 56 void **sample_buffer, int32_t sample_buffer_size);
57static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo); 57static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo);
58 58
59 59
@@ -724,7 +724,7 @@ void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
724 724
725static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, 725static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
726 uint8_t *buffer, uint32_t buffer_size, 726 uint8_t *buffer, uint32_t buffer_size,
727 void **sample_buffer2, uint32_t sample_buffer_size) 727 void **sample_buffer2, int32_t sample_buffer_size)
728{ 728{
729 uint8_t channels = 0; 729 uint8_t channels = 0;
730 uint8_t output_channels = 0; 730 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 @@
1/* config.h. Generated by configure. */
2/* config.h.in. Generated from configure.in by autoheader. */
3
4#include <config.h>
5
6/* Define if you want to use libfaad together with Digital Radio Mondiale
7 (DRM) */
8/* #undef DRM */
9
10/* Define if you want support for Digital Radio Mondiale (DRM) parametric
11 stereo */
12/* #undef DRM_PS */
13
14/* Define to 1 if you have the <dlfcn.h> header file. */
15//#define HAVE_DLFCN_H 1
16
17/* Define to 1 if you have the <errno.h> header file. */
18//#define HAVE_ERRNO_H 1
19
20/* Define if needed */
21/* #undef HAVE_FLOAT32_T */
22
23/* Define to 1 if you have the <float.h> header file. */
24//#define HAVE_FLOAT_H 1
25
26/* Define to 1 if you have the `getpwuid' function. */
27#define HAVE_GETPWUID 1
28
29/* Define to 1 if you have the <inttypes.h> header file. */
30#define HAVE_INTTYPES_H 1
31
32/* Define if you have the IOKit API */
33/* #undef HAVE_IOKIT_IOKITLIB_H */
34
35/* Define to 1 if you have the <limits.h> header file. */
36//#define HAVE_LIMITS_H 1
37
38/* Define to 1 if you have the <mathf.h> header file. */
39/* #undef HAVE_MATHF_H */
40
41/* Define to 1 if you have the `memcpy' function. */
42#define HAVE_MEMCPY 1
43
44/* Define to 1 if you have the <memory.h> header file. */
45//#define HAVE_MEMORY_H 1
46
47/* Define to 1 if you have the <stdint.h> header file. */
48//#define HAVE_STDINT_H 1
49
50/* Define to 1 if you have the <stdlib.h> header file. */
51#define HAVE_STDLIB_H 1
52
53/* Define to 1 if you have the `strchr' function. */
54#define HAVE_STRCHR 1
55
56/* Define to 1 if you have the <strings.h> header file. */
57//#define HAVE_STRINGS_H 1
58
59/* Define to 1 if you have the <string.h> header file. */
60#define HAVE_STRING_H 1
61
62/* Define to 1 if you have the `strsep' function. */
63//#define HAVE_STRSEP 1
64
65/* Define to 1 if you have the <sysfs/libsysfs.h> header file. */
66/* #undef HAVE_SYSFS_LIBSYSFS_H */
67
68/* Define to 1 if you have the <sys/stat.h> header file. */
69//#define HAVE_SYS_STAT_H 1
70
71/* Define to 1 if you have the <sys/time.h> header file. */
72//#define HAVE_SYS_TIME_H 1
73
74/* Define to 1 if you have the <sys/types.h> header file. */
75//#define HAVE_SYS_TYPES_H 1
76
77/* Define to 1 if you have the <unistd.h> header file. */
78//#define HAVE_UNISTD_H 1
79
80/* Name of package */
81#define PACKAGE "faad2"
82
83/* Define to the address where bug reports for this package should be sent. */
84#define PACKAGE_BUGREPORT ""
85
86/* Define to the full name of this package. */
87#define PACKAGE_NAME ""
88
89/* Define to the full name and version of this package. */
90#define PACKAGE_STRING ""
91
92/* Define to the one symbol short name of this package. */
93#define PACKAGE_TARNAME ""
94
95/* Define to the version of this package. */
96#define PACKAGE_VERSION ""
97
98/* Define to 1 if you have the ANSI C header files. */
99#define STDC_HEADERS 1
100
101/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
102//#define TIME_WITH_SYS_TIME 1
103
104/* Version number of package */
105#define LIBFAAD_VERSION "2.0"
106
107/* Define to 1 if your processor stores words with the most significant byte
108 first (like Motorola and SPARC, unlike Intel and VAX). */
109#ifdef ROCKBOX_BIG_ENDIAN
110#define WORDS_BIGENDIAN 1
111#endif
112
113/* Define to `__inline__' or `__inline' if that's what the C compiler
114 calls it, or to nothing if 'inline' is not supported under any name. */
115#ifndef __cplusplus
116/* #undef inline */
117#endif
118
119/* Define to `long' if <sys/types.h> does not define. */
120/* #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
159} 159}
160#endif 160#endif
161 161
162ALIGN real_t transf_buf[2*1024] = {0};
163
162void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, 164void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
163 uint8_t window_shape_prev, real_t *freq_in, 165 uint8_t window_shape_prev, real_t *freq_in,
164 real_t *time_out, real_t *overlap, 166 real_t *time_out, real_t *overlap,
165 uint8_t object_type, uint16_t frame_len) 167 uint8_t object_type, uint16_t frame_len)
166{ 168{
167 int16_t i; 169 int16_t i;
168 ALIGN real_t transf_buf[2*1024] = {0};
169 170
170 const real_t *window_long = NULL; 171 const real_t *window_long = NULL;
171 const real_t *window_long_prev = NULL; 172 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,
182 int64_t count = faad_get_ts(); 183 int64_t count = faad_get_ts();
183#endif 184#endif
184 185
186 memset(transf_buf,0,sizeof(transf_buf));
185 /* select windows of current frame and previous frame (Sine or KBD) */ 187 /* select windows of current frame and previous frame (Sine or KBD) */
186#ifdef LD_DEC 188#ifdef LD_DEC
187 if (object_type == LD) 189 if (object_type == LD)
@@ -331,13 +333,13 @@ void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
331 333
332 334
333#ifdef LTP_DEC 335#ifdef LTP_DEC
336ALIGN real_t windowed_buf[2*1024] = {0};
334/* only works for LTP -> no overlapping, no short blocks */ 337/* only works for LTP -> no overlapping, no short blocks */
335void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, 338void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
336 uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct, 339 uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct,
337 uint8_t object_type, uint16_t frame_len) 340 uint8_t object_type, uint16_t frame_len)
338{ 341{
339 int16_t i; 342 int16_t i;
340 ALIGN real_t windowed_buf[2*1024] = {0};
341 343
342 const real_t *window_long = NULL; 344 const real_t *window_long = NULL;
343 const real_t *window_long_prev = NULL; 345 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,
348 uint16_t nshort = frame_len/8; 350 uint16_t nshort = frame_len/8;
349 uint16_t nflat_ls = (nlong-nshort)/2; 351 uint16_t nflat_ls = (nlong-nshort)/2;
350 352
351 assert(window_sequence != EIGHT_SHORT_SEQUENCE); 353 //assert(window_sequence != EIGHT_SHORT_SEQUENCE);
352 354
355 memset(windowed_buf,0,sizeof(windowed_buf));
353#ifdef LD_DEC 356#ifdef LD_DEC
354 if (object_type == LD) 357 if (object_type == LD)
355 { 358 {
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,
217 uint16_t PCWs_done; 217 uint16_t PCWs_done;
218 uint16_t numberOfSegments, numberOfSets, numberOfCodewords; 218 uint16_t numberOfSegments, numberOfSets, numberOfCodewords;
219 219
220 codeword_t codeword[512]; 220 static codeword_t codeword[512];
221 bits_t segment[512]; 221 static bits_t segment[512];
222 222
223 uint16_t sp_offset[8]; 223 uint16_t sp_offset[8];
224 uint16_t g, i, sortloop, set, bitsread; 224 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] =
77 REAL_CONST(1.369533) 77 REAL_CONST(1.369533)
78}; 78};
79 79
80ALIGN real_t x_est[2048];
81ALIGN real_t X_est[2048];
80void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec, 82void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
81 int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape, 83 int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape,
82 uint8_t win_shape_prev, uint8_t sr_index, 84 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,
84{ 86{
85 uint8_t sfb; 87 uint8_t sfb;
86 uint16_t bin, i, num_samples; 88 uint16_t bin, i, num_samples;
87 ALIGN real_t x_est[2048];
88 ALIGN real_t X_est[2048];
89 89
90 if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) 90 if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
91 { 91 {
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)
60{ 60{
61 mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info)); 61 mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info));
62 62
63 assert(N % 8 == 0); 63 //assert(N % 8 == 0);
64 64
65 mdct->N = N; 65 mdct->N = N;
66 66
@@ -123,10 +123,10 @@ void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
123 complex_t x; 123 complex_t x;
124#ifdef ALLOW_SMALL_FRAMELENGTH 124#ifdef ALLOW_SMALL_FRAMELENGTH
125#ifdef FIXED_POINT 125#ifdef FIXED_POINT
126 real_t scale, b_scale = 0; 126 real_t scale = 0, b_scale = 0;
127#endif 127#endif
128#endif 128#endif
129 ALIGN complex_t Z1[512]; 129 ALIGN static complex_t Z1[512];
130 complex_t *sincos = mdct->sincos; 130 complex_t *sincos = mdct->sincos;
131 131
132 uint16_t N = mdct->N; 132 uint16_t N = mdct->N;
@@ -230,7 +230,7 @@ void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
230 uint16_t k; 230 uint16_t k;
231 231
232 complex_t x; 232 complex_t x;
233 ALIGN complex_t Z1[512]; 233 ALIGN static complex_t Z1[512];
234 complex_t *sincos = mdct->sincos; 234 complex_t *sincos = mdct->sincos;
235 235
236 uint16_t N = mdct->N; 236 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
159 159
160/* static function declarations */ 160/* static function declarations */
161static void ps_data_decode(ps_info *ps); 161static void ps_data_decode(ps_info *ps);
162static hyb_info *hybrid_init(); 162static hyb_info *hybrid_init(void);
163static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter, 163static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
164 qmf_t *buffer, qmf_t **X_hybrid); 164 qmf_t *buffer, qmf_t **X_hybrid);
165static void INLINE DCT3_4_unscaled(real_t *y, real_t *x); 165static INLINE void DCT3_4_unscaled(real_t *y, real_t *x);
166static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter, 166static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
167 qmf_t *buffer, qmf_t **X_hybrid); 167 qmf_t *buffer, qmf_t **X_hybrid);
168static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], 168static 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
256{ 256{
257 uint8_t i; 257 uint8_t i;
258 258
259 (void)hyb;
259 for (i = 0; i < frame_len; i++) 260 for (i = 0; i < frame_len; i++)
260 { 261 {
261 real_t r0 = MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))); 262 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
290 uint8_t i; 291 uint8_t i;
291 real_t input_re1[2], input_re2[2], input_im1[2], input_im2[2]; 292 real_t input_re1[2], input_re2[2], input_im1[2], input_im2[2];
292 293
294 (void)hyb;
293 for (i = 0; i < frame_len; i++) 295 for (i = 0; i < frame_len; i++)
294 { 296 {
295 input_re1[0] = -MUL_F(filter[2], (QMF_RE(buffer[i+2]) + QMF_RE(buffer[i+10]))) + 297 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
338 } 340 }
339} 341}
340 342
341static void INLINE DCT3_4_unscaled(real_t *y, real_t *x) 343static INLINE void DCT3_4_unscaled(real_t *y, real_t *x)
342{ 344{
343 real_t f0, f1, f2, f3, f4, f5, f6, f7, f8; 345 real_t f0, f1, f2, f3, f4, f5, f6, f7, f8;
344 346
@@ -365,6 +367,7 @@ static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filt
365 real_t input_re1[4], input_re2[4], input_im1[4], input_im2[4]; 367 real_t input_re1[4], input_re2[4], input_im1[4], input_im2[4];
366 real_t x[4]; 368 real_t x[4];
367 369
370 (void)hyb;
368 for (i = 0; i < frame_len; i++) 371 for (i = 0; i < frame_len; i++)
369 { 372 {
370 input_re1[0] = MUL_F(filter[6],QMF_RE(buffer[6+i])); 373 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
429 } 432 }
430} 433}
431 434
432static void INLINE DCT3_6_unscaled(real_t *y, real_t *x) 435static INLINE void DCT3_6_unscaled(real_t *y, real_t *x)
433{ 436{
434 real_t f0, f1, f2, f3, f4, f5, f6, f7; 437 real_t f0, f1, f2, f3, f4, f5, f6, f7;
435 438
@@ -457,6 +460,7 @@ static void channel_filter12(hyb_info *hyb, uint8_t frame_len, const real_t *fil
457 real_t input_re1[6], input_re2[6], input_im1[6], input_im2[6]; 460 real_t input_re1[6], input_re2[6], input_im1[6], input_im2[6];
458 real_t out_re1[6], out_re2[6], out_im1[6], out_im2[6]; 461 real_t out_re1[6], out_re2[6], out_im1[6], out_im2[6];
459 462
463 (void)hyb;
460 for (i = 0; i < frame_len; i++) 464 for (i = 0; i < frame_len; i++)
461 { 465 {
462 for (n = 0; n < 6; n++) 466 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][
1027 qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]) 1031 qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32])
1028{ 1032{
1029 uint8_t gr, n, m, bk; 1033 uint8_t gr, n, m, bk;
1030 uint8_t temp_delay; 1034 uint8_t temp_delay = 0;
1031 uint8_t sb, maxsb; 1035 uint8_t sb, maxsb;
1032 const complex_t *Phi_Fract_SubQmf; 1036 const complex_t *Phi_Fract_SubQmf;
1033 uint8_t temp_delay_ser[NO_ALLPASS_LINKS]; 1037 uint8_t temp_delay_ser[NO_ALLPASS_LINKS];
@@ -1847,6 +1851,7 @@ ps_info *ps_init(uint8_t sr_index)
1847 ps_info *ps = (ps_info*)faad_malloc(sizeof(ps_info)); 1851 ps_info *ps = (ps_info*)faad_malloc(sizeof(ps_info));
1848 memset(ps, 0, sizeof(ps_info)); 1852 memset(ps, 0, sizeof(ps_info));
1849 1853
1854 (void)sr_index;
1850 ps->hyb = hybrid_init(); 1855 ps->hyb = hybrid_init();
1851 1856
1852 ps->ps_data_available = 0; 1857 ps->ps_data_available = 0;
@@ -1935,8 +1940,11 @@ ps_info *ps_init(uint8_t sr_index)
1935/* main Parametric Stereo decoding function */ 1940/* main Parametric Stereo decoding function */
1936uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]) 1941uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
1937{ 1942{
1938 qmf_t X_hybrid_left[32][32] = {{0}}; 1943 qmf_t X_hybrid_left[32][32];
1939 qmf_t X_hybrid_right[32][32] = {{0}}; 1944 qmf_t X_hybrid_right[32][32];
1945
1946 memset(&X_hybrid_left,0,sizeof(X_hybrid_left));
1947 memset(&X_hybrid_right,0,sizeof(X_hybrid_right));
1940 1948
1941 /* delta decoding of the bitstream data */ 1949 /* delta decoding of the bitstream data */
1942 ps_data_decode(ps); 1950 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,
469 uint8_t n; 469 uint8_t n;
470 uint16_t bits = (uint16_t)faad_get_processed_bits(ld); 470 uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
471 471
472 (void)num_bits_left;
472 if (ps_extension_id == 0) 473 if (ps_extension_id == 0)
473 { 474 {
474 ps->enable_ipdopd = (uint8_t)faad_get1bit(ld 475 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)
226 } 226 }
227} 227}
228 228
229#ifdef SBR_LOW_POWER
230 ALIGN real_t deg[64];
231#endif
232
229static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64], 233static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64],
230 uint8_t ch, uint8_t dont_process, 234 uint8_t ch, uint8_t dont_process,
231 const uint8_t downSampledSBR) 235 const uint8_t downSampledSBR)
232{ 236{
233 int16_t k, l; 237 int16_t k, l;
234 238
235#ifdef SBR_LOW_POWER 239 (void)downSampledSBR;
236 ALIGN real_t deg[64];
237#endif
238
239#ifdef DRM 240#ifdef DRM
240 if (sbr->Is_DRM_SBR) 241 if (sbr->Is_DRM_SBR)
241 { 242 {
@@ -369,12 +370,12 @@ static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_
369 } 370 }
370} 371}
371 372
373ALIGN qmf_t X[MAX_NTSR][64];
372uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, 374uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
373 const uint8_t just_seeked, const uint8_t downSampledSBR) 375 const uint8_t just_seeked, const uint8_t downSampledSBR)
374{ 376{
375 uint8_t dont_process = 0; 377 uint8_t dont_process = 0;
376 uint8_t ret = 0; 378 uint8_t ret = 0;
377 ALIGN qmf_t X[MAX_NTSR][64];
378 379
379 if (sbr == NULL) 380 if (sbr == NULL)
380 return 20; 381 return 20;
@@ -452,12 +453,12 @@ uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_cha
452 return 0; 453 return 0;
453} 454}
454 455
456ALIGN qmf_t X[MAX_NTSR][64];
455uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, 457uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
456 const uint8_t just_seeked, const uint8_t downSampledSBR) 458 const uint8_t just_seeked, const uint8_t downSampledSBR)
457{ 459{
458 uint8_t dont_process = 0; 460 uint8_t dont_process = 0;
459 uint8_t ret = 0; 461 uint8_t ret = 0;
460 ALIGN qmf_t X[MAX_NTSR][64];
461 462
462 if (sbr == NULL) 463 if (sbr == NULL)
463 return 20; 464 return 20;
@@ -519,6 +520,10 @@ uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
519 return 0; 520 return 0;
520} 521}
521 522
523
524ALIGN qmf_t X_left[38][64];// = {{0}};
525ALIGN qmf_t X_right[38][64];// = {{0}}; /* must set this to 0 */
526
522#if (defined(PS_DEC) || defined(DRM_PS)) 527#if (defined(PS_DEC) || defined(DRM_PS))
523uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, 528uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
524 const uint8_t just_seeked, const uint8_t downSampledSBR) 529 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
526 uint8_t l, k; 531 uint8_t l, k;
527 uint8_t dont_process = 0; 532 uint8_t dont_process = 0;
528 uint8_t ret = 0; 533 uint8_t ret = 0;
529 ALIGN qmf_t X_left[38][64] = {{0}};
530 ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */
531 534
535 memset(X_left,0,sizeof(X_left));
536 memset(X_right,0,sizeof(X_right));
532 if (sbr == NULL) 537 if (sbr == NULL)
533 return 20; 538 return 20;
534 539
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,
359 real_t rk2, rk0; 359 real_t rk2, rk0;
360#endif 360#endif
361 361
362 (void)bs_alter_scale;
362 /* mft only defined for k2 > k0 */ 363 /* mft only defined for k2 > k0 */
363 if (k2 <= k0) 364 if (k2 <= k0)
364 { 365 {
@@ -504,7 +505,7 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
504uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band, 505uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
505 uint8_t k2) 506 uint8_t k2)
506{ 507{
507 uint8_t k, i; 508 uint8_t k, i = 0;
508 uint32_t minus; 509 uint32_t minus;
509 510
510 /* The following relation shall be satisfied: bs_xover_band < N_Master */ 511 /* 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]
55#endif 55#endif
56 ,uint8_t ch) 56 ,uint8_t ch)
57{ 57{
58 ALIGN sbr_hfadj_info adj = {{{0}}}; 58 ALIGN sbr_hfadj_info adj;
59 59
60 memset(&adj,0,sizeof(adj));
60 if (sbr->bs_frame_class[ch] == FIXFIX) 61 if (sbr->bs_frame_class[ch] == FIXFIX)
61 { 62 {
62 sbr->l_A[ch] = -1; 63 sbr->l_A[ch] = -1;
@@ -131,6 +132,7 @@ static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
131 uint8_t m, l, j, k, k_l, k_h, p; 132 uint8_t m, l, j, k, k_l, k_h, p;
132 real_t nrg, div; 133 real_t nrg, div;
133 134
135 (void)adj;
134 if (sbr->bs_interpol_freq == 1) 136 if (sbr->bs_interpol_freq == 1)
135 { 137 {
136 for (l = 0; l < sbr->L_E[ch]; l++) 138 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)
628 628
629 do 629 do
630 { 630 {
631 uint8_t j = k + 1; 631 int8_t j = k + 1;
632 632
633 do 633 do
634 { 634 {
635 j--; 635 j--;
636
637 sb = sbr->f_master[j]; 636 sb = sbr->f_master[j];
638 odd = (sb - 2 + sbr->k0) % 2; 637 odd = (sb - 2 + sbr->k0) % 2;
638
639 } while (sb > (sbr->k0 - 1 + msb - odd)); 639 } while (sb > (sbr->k0 - 1 + msb - odd));
640 640
641 sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0); 641 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,
821 uint16_t ret; 821 uint16_t ret;
822#endif 822#endif
823 823
824 (void)num_bits_left;
824 switch (bs_extension_id) 825 switch (bs_extension_id)
825 { 826 {
826#ifdef PS_DEC 827#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);
50/* first build into temp vector to be able to use previous vector on error */ 50/* first build into temp vector to be able to use previous vector on error */
51uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch) 51uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
52{ 52{
53 uint8_t l, border, temp; 53 uint8_t l, temp;
54 int8_t border;
54 uint8_t t_E_temp[6] = {0}; 55 uint8_t t_E_temp[6] = {0};
55 56
56 t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch]; 57 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)
409 } 409 }
410} 410}
411 411
412/* iquant() * 412/* iquant() */
413/* output = sign(input)*abs(input)^(4/3) */ 413/* output = sign(input)*abs(input)^(4/3) */
414/**/ 414/**/
415static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) 415static 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,
543 }; 543 };
544 const real_t *tab = iq_table; 544 const real_t *tab = iq_table;
545 545
546 (void)frame_len;
546 uint8_t g, sfb, win; 547 uint8_t g, sfb, win;
547 uint16_t width, bin, k, gindex, wa, wb; 548 uint16_t width, bin, k, gindex, wa, wb;
548 uint8_t error = 0; /* Init error flag */ 549 uint8_t error = 0; /* Init error flag */
@@ -856,7 +857,7 @@ uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics,
856 element *sce, int16_t *spec_data) 857 element *sce, int16_t *spec_data)
857{ 858{
858 uint8_t retval, output_channels; 859 uint8_t retval, output_channels;
859 ALIGN real_t spec_coef[1024]; 860 ALIGN static real_t spec_coef[1024];
860 861
861#ifdef PROFILE 862#ifdef PROFILE
862 int64_t count = faad_get_ts(); 863 int64_t count = faad_get_ts();
@@ -1048,8 +1049,8 @@ uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_st
1048 element *cpe, int16_t *spec_data1, int16_t *spec_data2) 1049 element *cpe, int16_t *spec_data1, int16_t *spec_data2)
1049{ 1050{
1050 uint8_t retval; 1051 uint8_t retval;
1051 ALIGN real_t spec_coef1[1024]; 1052 ALIGN static real_t spec_coef1[1024];
1052 ALIGN real_t spec_coef2[1024]; 1053 ALIGN static real_t spec_coef2[1024];
1053 1054
1054#ifdef PROFILE 1055#ifdef PROFILE
1055 int64_t count = faad_get_ts(); 1056 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,
558 558
559/* Table 4.4.4 and */ 559/* Table 4.4.4 and */
560/* Table 4.4.9 */ 560/* Table 4.4.9 */
561ALIGN int16_t spec_data[1024] = {0};
562element sce IBSS_ATTR;
561static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, 563static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
562 uint8_t channel, uint8_t *tag) 564 uint8_t channel, uint8_t *tag)
563{ 565{
564 uint8_t retval = 0; 566 uint8_t retval = 0;
565 element sce = {0};
566 ic_stream *ics = &(sce.ics1); 567 ic_stream *ics = &(sce.ics1);
567 ALIGN int16_t spec_data[1024] = {0};
568 568
569 memset(spec_data,0,sizeof(spec_data));
570 memset(&sce,0,sizeof(sce));
569 sce.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG 571 sce.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG
570 DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_tag")); 572 DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_tag"));
571 573
@@ -601,16 +603,19 @@ static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
601} 603}
602 604
603/* Table 4.4.5 */ 605/* Table 4.4.5 */
606ALIGN int16_t spec_data1[1024];
607ALIGN int16_t spec_data2[1024];
608element cpe IBSS_ATTR;
604static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld, 609static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld,
605 uint8_t channels, uint8_t *tag) 610 uint8_t channels, uint8_t *tag)
606{ 611{
607 ALIGN int16_t spec_data1[1024] = {0};
608 ALIGN int16_t spec_data2[1024] = {0};
609 element cpe = {0};
610 ic_stream *ics1 = &(cpe.ics1); 612 ic_stream *ics1 = &(cpe.ics1);
611 ic_stream *ics2 = &(cpe.ics2); 613 ic_stream *ics2 = &(cpe.ics2);
612 uint8_t result; 614 uint8_t result;
613 615
616 memset(spec_data1,0,sizeof(spec_data1));
617 memset(spec_data2,0,sizeof(spec_data2));
618 memset(&cpe,0,sizeof(cpe));
614 cpe.channel = channels; 619 cpe.channel = channels;
615 cpe.paired_channel = channels+1; 620 cpe.paired_channel = channels+1;
616 621
@@ -876,7 +881,7 @@ static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld)
876 881
877 element el_empty = {0}; 882 element el_empty = {0};
878 ic_stream ics_empty = {0}; 883 ic_stream ics_empty = {0};
879 int16_t sh_data[1024]; 884 static int16_t sh_data[1024];
880 885
881 c = faad_getbits(ld, LEN_TAG 886 c = faad_getbits(ld, LEN_TAG
882 DEBUGVAR(1,900,"coupling_channel_element(): element_instance_tag")); 887 DEBUGVAR(1,900,"coupling_channel_element(): element_instance_tag"));
@@ -961,6 +966,8 @@ static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld)
961 uint8_t byte_aligned; 966 uint8_t byte_aligned;
962 uint16_t i, count; 967 uint16_t i, count;
963 968
969 (void)hDecoder;
970
964 /* element_instance_tag = */ faad_getbits(ld, LEN_TAG 971 /* element_instance_tag = */ faad_getbits(ld, LEN_TAG
965 DEBUGVAR(1,60,"data_stream_element(): element_instance_tag")); 972 DEBUGVAR(1,60,"data_stream_element(): element_instance_tag"));
966 byte_aligned = faad_get1bit(ld 973 byte_aligned = faad_get1bit(ld
@@ -1158,6 +1165,8 @@ static void gain_control_data(bitfile *ld, ic_stream *ics)
1158#endif 1165#endif
1159 1166
1160#ifdef SCALABLE_DEC 1167#ifdef SCALABLE_DEC
1168ALIGN int16_t spec_data1[1024] IBSS_ATTR;
1169ALIGN int16_t spec_data2[1024] IBSS_ATTR;
1161/* Table 4.4.13 ASME */ 1170/* Table 4.4.13 ASME */
1162void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, 1171void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
1163 bitfile *ld, program_config *pce, drc_info *drc) 1172 bitfile *ld, program_config *pce, drc_info *drc)
@@ -1170,9 +1179,9 @@ void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo
1170 ic_stream *ics1 = &(cpe.ics1); 1179 ic_stream *ics1 = &(cpe.ics1);
1171 ic_stream *ics2 = &(cpe.ics2); 1180 ic_stream *ics2 = &(cpe.ics2);
1172 int16_t *spec_data; 1181 int16_t *spec_data;
1173 ALIGN int16_t spec_data1[1024] = {0};
1174 ALIGN int16_t spec_data2[1024] = {0};
1175 1182
1183 memset(spec_data1,0,sizeof(spec_data1));
1184 memset(spec_data2,0,sizeof(spec_data2));
1176 hDecoder->fr_ch_ele = 0; 1185 hDecoder->fr_ch_ele = 0;
1177 1186
1178 hInfo->error = aac_scalable_main_header(hDecoder, ics1, ics2, ld, this_layer_stereo); 1187 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
1810/* Table 4.4.27 */ 1819/* Table 4.4.27 */
1811static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld) 1820static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld)
1812{ 1821{
1813 uint8_t w, filt, i, start_coef_bits, coef_bits; 1822 uint8_t w, filt, i, start_coef_bits = 0;
1823 int8_t coef_bits;
1814 uint8_t n_filt_bits = 2; 1824 uint8_t n_filt_bits = 2;
1815 uint8_t length_bits = 6; 1825 uint8_t length_bits = 6;
1816 uint8_t order_bits = 5; 1826 uint8_t order_bits = 5;
@@ -2048,11 +2058,11 @@ static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count)
2048 return n; 2058 return n;
2049 case EXT_FILL_DATA: 2059 case EXT_FILL_DATA:
2050 /* fill_nibble = */ faad_getbits(ld, 4 2060 /* fill_nibble = */ faad_getbits(ld, 4
2051 DEBUGVAR(1,136,"extension_payload(): fill_nibble")); /* must be 0000 */ 2061 DEBUGVAR(1,136,"extension_payload(): fill_nibble")); /* must be æ0000Æ */
2052 for (i = 0; i < count-1; i++) 2062 for (i = 0; i < count-1; i++)
2053 { 2063 {
2054 /* fill_byte[i] = */ faad_getbits(ld, 8 2064 /* fill_byte[i] = */ faad_getbits(ld, 8
2055 DEBUGVAR(1,88,"extension_payload(): fill_byte")); /* must be 10100101 */ 2065 DEBUGVAR(1,88,"extension_payload(): fill_byte")); /* must be æ10100101Æ */
2056 } 2066 }
2057 return count; 2067 return count;
2058 case EXT_DATA_ELEMENT: 2068 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 @@
36static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, 36static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress,
37 uint8_t *coef, real_t *a); 37 uint8_t *coef, real_t *a);
38static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, 38static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
39 uint8_t order); 39 int8_t order);
40static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, 40static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
41 uint8_t order); 41 int8_t order);
42 42
43 43
44#ifdef _MSC_VER 44#ifdef _MSC_VER
@@ -226,7 +226,7 @@ static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_c
226} 226}
227 227
228static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, 228static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
229 uint8_t order) 229 int8_t order)
230{ 230{
231 /* 231 /*
232 - Simple all-pole filter of order "order" defined by 232 - 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
269} 269}
270 270
271static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, 271static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
272 uint8_t order) 272 int8_t order)
273{ 273{
274 /* 274 /*
275 - Simple all-zero filter of order "order" defined by 275 - Simple all-zero filter of order "order" defined by