1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Dave Chapman 2005-10-31 20:33:27 +00:00
parent 65de1cc6af
commit 798a4f3533
25 changed files with 334 additions and 63 deletions

View file

@ -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)

View file

@ -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.

View file

@ -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

View file

@ -32,6 +32,8 @@
#include <string.h> #include <string.h>
#include "bits.h" #include "bits.h"
uint8_t static_buffer[1024] IBSS_ATTR;
/* initialize buffer, call once before first getbits or showbits */ /* initialize buffer, call once before first getbits or showbits */
void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) 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; 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)); memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t));
memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t)); memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t));

View file

@ -144,7 +144,7 @@ static INLINE void faad_flushbits(bitfile *ld, uint32_t bits)
} }
/* return next n bits (right adjusted) */ /* 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; uint32_t ret;

View file

@ -870,6 +870,7 @@ static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac)
uint16_t ib; uint16_t ib;
uint16_t nf, nl, nq, nr; uint16_t nf, nl, nq, nr;
(void)wa;
nl = n; nl = n;
nf = 0; nf = 0;
j = 0; j = 0;

View file

@ -433,7 +433,6 @@ int32_t pow2_int(real_t val)
int32_t log2_int(uint32_t val) int32_t log2_int(uint32_t val)
{ {
uint32_t frac; uint32_t frac;
uint32_t whole = (val);
int32_t exp = 0; int32_t exp = 0;
uint32_t index; uint32_t index;
uint32_t index_frac; uint32_t index_frac;
@ -477,7 +476,6 @@ int32_t log2_int(uint32_t val)
real_t log2_fix(uint32_t val) real_t log2_fix(uint32_t val)
{ {
uint32_t frac; uint32_t frac;
uint32_t whole = (val >> REAL_BITS);
int8_t exp = 0; int8_t exp = 0;
uint32_t index; uint32_t index;
uint32_t index_frac; uint32_t index_frac;

View file

@ -32,8 +32,24 @@
extern "C" { extern "C" {
#endif #endif
#ifdef HAVE_CONFIG_H #include "faad_config.h"
# include "../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 #endif
#define INLINE __inline #define INLINE __inline
@ -55,7 +71,7 @@ extern "C" {
/* use double precision */ /* use double precision */
/* #define USE_DOUBLE_PRECISION */ /* #define USE_DOUBLE_PRECISION */
/* use fixed point reals */ /* use fixed point reals */
//#define FIXED_POINT #define FIXED_POINT
//#define BIG_IQ_TABLE //#define BIG_IQ_TABLE
/* Use if target platform has address generators with autoincrement */ /* Use if target platform has address generators with autoincrement */
@ -72,7 +88,7 @@ extern "C" {
/* Allow decoding of MAIN profile AAC */ /* Allow decoding of MAIN profile AAC */
#define MAIN_DEC #define MAIN_DEC
/* Allow decoding of SSR profile AAC */ /* Allow decoding of SSR profile AAC */
//#define SSR_DEC #define SSR_DEC
/* Allow decoding of LTP profile AAC */ /* Allow decoding of LTP profile AAC */
#define LTP_DEC #define LTP_DEC
/* Allow decoding of LD profile AAC */ /* Allow decoding of LD profile AAC */
@ -183,10 +199,10 @@ typedef float float32_t;
# if !STDC_HEADERS && HAVE_MEMORY_H # if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h> # include <memory.h>
# endif # endif
# include <string.h> //# include <string.h>
#endif #endif
#if HAVE_STRINGS_H #if HAVE_STRINGS_H
# include <strings.h> //# include <strings.h>
#endif #endif
#if HAVE_INTTYPES_H #if HAVE_INTTYPES_H
# include <inttypes.h> # include <inttypes.h>
@ -214,7 +230,7 @@ typedef float float32_t;
#endif #endif
#if STDC_HEADERS #if STDC_HEADERS
# include <string.h> //# include <string.h>
#else #else
# if !HAVE_STRCHR # if !HAVE_STRCHR
# define strchr index # define strchr index

View file

@ -53,7 +53,7 @@ uint16_t dbg_count;
/* static function declarations */ /* static function declarations */
static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
uint8_t *buffer, uint32_t buffer_size, 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); 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, static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
uint8_t *buffer, uint32_t buffer_size, 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 channels = 0;
uint8_t output_channels = 0; uint8_t output_channels = 0;

View file

@ -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 */

View file

@ -159,13 +159,14 @@ static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t
} }
#endif #endif
ALIGN real_t transf_buf[2*1024] = {0};
void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
uint8_t window_shape_prev, real_t *freq_in, uint8_t window_shape_prev, real_t *freq_in,
real_t *time_out, real_t *overlap, real_t *time_out, real_t *overlap,
uint8_t object_type, uint16_t frame_len) uint8_t object_type, uint16_t frame_len)
{ {
int16_t i; int16_t i;
ALIGN real_t transf_buf[2*1024] = {0};
const real_t *window_long = NULL; const real_t *window_long = NULL;
const real_t *window_long_prev = 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(); int64_t count = faad_get_ts();
#endif #endif
memset(transf_buf,0,sizeof(transf_buf));
/* select windows of current frame and previous frame (Sine or KBD) */ /* select windows of current frame and previous frame (Sine or KBD) */
#ifdef LD_DEC #ifdef LD_DEC
if (object_type == LD) 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 #ifdef LTP_DEC
ALIGN real_t windowed_buf[2*1024] = {0};
/* only works for LTP -> no overlapping, no short blocks */ /* only works for LTP -> no overlapping, no short blocks */
void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, 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 window_shape_prev, real_t *in_data, real_t *out_mdct,
uint8_t object_type, uint16_t frame_len) uint8_t object_type, uint16_t frame_len)
{ {
int16_t i; int16_t i;
ALIGN real_t windowed_buf[2*1024] = {0};
const real_t *window_long = NULL; const real_t *window_long = NULL;
const real_t *window_long_prev = 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 nshort = frame_len/8;
uint16_t nflat_ls = (nlong-nshort)/2; 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 #ifdef LD_DEC
if (object_type == LD) if (object_type == LD)
{ {

View file

@ -217,8 +217,8 @@ uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics,
uint16_t PCWs_done; uint16_t PCWs_done;
uint16_t numberOfSegments, numberOfSets, numberOfCodewords; uint16_t numberOfSegments, numberOfSets, numberOfCodewords;
codeword_t codeword[512]; static codeword_t codeword[512];
bits_t segment[512]; static bits_t segment[512];
uint16_t sp_offset[8]; uint16_t sp_offset[8];
uint16_t g, i, sortloop, set, bitsread; uint16_t g, i, sortloop, set, bitsread;

View file

@ -77,6 +77,8 @@ ALIGN static const real_t codebook[8] =
REAL_CONST(1.369533) 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, void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape, int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape,
uint8_t win_shape_prev, uint8_t sr_index, 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; uint8_t sfb;
uint16_t bin, i, num_samples; 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) if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
{ {

View file

@ -60,7 +60,7 @@ mdct_info *faad_mdct_init(uint16_t N)
{ {
mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info)); mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info));
assert(N % 8 == 0); //assert(N % 8 == 0);
mdct->N = N; mdct->N = N;
@ -123,10 +123,10 @@ void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
complex_t x; complex_t x;
#ifdef ALLOW_SMALL_FRAMELENGTH #ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT #ifdef FIXED_POINT
real_t scale, b_scale = 0; real_t scale = 0, b_scale = 0;
#endif #endif
#endif #endif
ALIGN complex_t Z1[512]; ALIGN static complex_t Z1[512];
complex_t *sincos = mdct->sincos; complex_t *sincos = mdct->sincos;
uint16_t N = mdct->N; 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; uint16_t k;
complex_t x; complex_t x;
ALIGN complex_t Z1[512]; ALIGN static complex_t Z1[512];
complex_t *sincos = mdct->sincos; complex_t *sincos = mdct->sincos;
uint16_t N = mdct->N; uint16_t N = mdct->N;

View file

@ -159,10 +159,10 @@ typedef struct
/* static function declarations */ /* static function declarations */
static void ps_data_decode(ps_info *ps); 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, static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
qmf_t *buffer, qmf_t **X_hybrid); 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, static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
qmf_t *buffer, qmf_t **X_hybrid); 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], 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; uint8_t i;
(void)hyb;
for (i = 0; i < frame_len; i++) for (i = 0; i < frame_len; i++)
{ {
real_t r0 = MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+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; uint8_t i;
real_t input_re1[2], input_re2[2], input_im1[2], input_im2[2]; real_t input_re1[2], input_re2[2], input_im1[2], input_im2[2];
(void)hyb;
for (i = 0; i < frame_len; i++) for (i = 0; i < frame_len; i++)
{ {
input_re1[0] = -MUL_F(filter[2], (QMF_RE(buffer[i+2]) + QMF_RE(buffer[i+10]))) + 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; 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 input_re1[4], input_re2[4], input_im1[4], input_im2[4];
real_t x[4]; real_t x[4];
(void)hyb;
for (i = 0; i < frame_len; i++) for (i = 0; i < frame_len; i++)
{ {
input_re1[0] = MUL_F(filter[6],QMF_RE(buffer[6+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; 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 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]; real_t out_re1[6], out_re2[6], out_im1[6], out_im2[6];
(void)hyb;
for (i = 0; i < frame_len; i++) for (i = 0; i < frame_len; i++)
{ {
for (n = 0; n < 6; n++) 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]) qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32])
{ {
uint8_t gr, n, m, bk; uint8_t gr, n, m, bk;
uint8_t temp_delay; uint8_t temp_delay = 0;
uint8_t sb, maxsb; uint8_t sb, maxsb;
const complex_t *Phi_Fract_SubQmf; const complex_t *Phi_Fract_SubQmf;
uint8_t temp_delay_ser[NO_ALLPASS_LINKS]; 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)); ps_info *ps = (ps_info*)faad_malloc(sizeof(ps_info));
memset(ps, 0, sizeof(ps_info)); memset(ps, 0, sizeof(ps_info));
(void)sr_index;
ps->hyb = hybrid_init(); ps->hyb = hybrid_init();
ps->ps_data_available = 0; ps->ps_data_available = 0;
@ -1935,8 +1940,11 @@ ps_info *ps_init(uint8_t sr_index)
/* main Parametric Stereo decoding function */ /* main Parametric Stereo decoding function */
uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]) 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_left[32][32];
qmf_t X_hybrid_right[32][32] = {{0}}; 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 */ /* delta decoding of the bitstream data */
ps_data_decode(ps); ps_data_decode(ps);

View file

@ -469,6 +469,7 @@ static uint16_t ps_extension(ps_info *ps, bitfile *ld,
uint8_t n; uint8_t n;
uint16_t bits = (uint16_t)faad_get_processed_bits(ld); uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
(void)num_bits_left;
if (ps_extension_id == 0) if (ps_extension_id == 0)
{ {
ps->enable_ipdopd = (uint8_t)faad_get1bit(ld ps->enable_ipdopd = (uint8_t)faad_get1bit(ld

View file

@ -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], 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, uint8_t ch, uint8_t dont_process,
const uint8_t downSampledSBR) const uint8_t downSampledSBR)
{ {
int16_t k, l; int16_t k, l;
#ifdef SBR_LOW_POWER (void)downSampledSBR;
ALIGN real_t deg[64];
#endif
#ifdef DRM #ifdef DRM
if (sbr->Is_DRM_SBR) 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, uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
const uint8_t just_seeked, const uint8_t downSampledSBR) const uint8_t just_seeked, const uint8_t downSampledSBR)
{ {
uint8_t dont_process = 0; uint8_t dont_process = 0;
uint8_t ret = 0; uint8_t ret = 0;
ALIGN qmf_t X[MAX_NTSR][64];
if (sbr == NULL) if (sbr == NULL)
return 20; return 20;
@ -452,12 +453,12 @@ uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_cha
return 0; return 0;
} }
ALIGN qmf_t X[MAX_NTSR][64];
uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
const uint8_t just_seeked, const uint8_t downSampledSBR) const uint8_t just_seeked, const uint8_t downSampledSBR)
{ {
uint8_t dont_process = 0; uint8_t dont_process = 0;
uint8_t ret = 0; uint8_t ret = 0;
ALIGN qmf_t X[MAX_NTSR][64];
if (sbr == NULL) if (sbr == NULL)
return 20; return 20;
@ -519,6 +520,10 @@ uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
return 0; 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)) #if (defined(PS_DEC) || defined(DRM_PS))
uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
const uint8_t just_seeked, const uint8_t downSampledSBR) 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 l, k;
uint8_t dont_process = 0; uint8_t dont_process = 0;
uint8_t ret = 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) if (sbr == NULL)
return 20; return 20;

View file

@ -359,6 +359,7 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
real_t rk2, rk0; real_t rk2, rk0;
#endif #endif
(void)bs_alter_scale;
/* mft only defined for k2 > k0 */ /* mft only defined for k2 > k0 */
if (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 derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
uint8_t k2) uint8_t k2)
{ {
uint8_t k, i; uint8_t k, i = 0;
uint32_t minus; uint32_t minus;
/* The following relation shall be satisfied: bs_xover_band < N_Master */ /* The following relation shall be satisfied: bs_xover_band < N_Master */

View file

@ -55,8 +55,9 @@ void hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
#endif #endif
,uint8_t ch) ,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) if (sbr->bs_frame_class[ch] == FIXFIX)
{ {
sbr->l_A[ch] = -1; 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; uint8_t m, l, j, k, k_l, k_h, p;
real_t nrg, div; real_t nrg, div;
(void)adj;
if (sbr->bs_interpol_freq == 1) if (sbr->bs_interpol_freq == 1)
{ {
for (l = 0; l < sbr->L_E[ch]; l++) for (l = 0; l < sbr->L_E[ch]; l++)

View file

@ -628,14 +628,14 @@ static void patch_construction(sbr_info *sbr)
do do
{ {
uint8_t j = k + 1; int8_t j = k + 1;
do do
{ {
j--; j--;
sb = sbr->f_master[j]; sb = sbr->f_master[j];
odd = (sb - 2 + sbr->k0) % 2; odd = (sb - 2 + sbr->k0) % 2;
} while (sb > (sbr->k0 - 1 + msb - odd)); } while (sb > (sbr->k0 - 1 + msb - odd));
sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0); sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0);

View file

@ -821,6 +821,7 @@ static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
uint16_t ret; uint16_t ret;
#endif #endif
(void)num_bits_left;
switch (bs_extension_id) switch (bs_extension_id)
{ {
#ifdef PS_DEC #ifdef PS_DEC

View file

@ -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 */ /* 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 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}; uint8_t t_E_temp[6] = {0};
t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch]; t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch];

View file

@ -409,7 +409,7 @@ uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics)
} }
} }
/* iquant() * /* iquant() */
/* output = sign(input)*abs(input)^(4/3) */ /* output = sign(input)*abs(input)^(4/3) */
/**/ /**/
static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) 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; const real_t *tab = iq_table;
(void)frame_len;
uint8_t g, sfb, win; uint8_t g, sfb, win;
uint16_t width, bin, k, gindex, wa, wb; uint16_t width, bin, k, gindex, wa, wb;
uint8_t error = 0; /* Init error flag */ 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) element *sce, int16_t *spec_data)
{ {
uint8_t retval, output_channels; uint8_t retval, output_channels;
ALIGN real_t spec_coef[1024]; ALIGN static real_t spec_coef[1024];
#ifdef PROFILE #ifdef PROFILE
int64_t count = faad_get_ts(); 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) element *cpe, int16_t *spec_data1, int16_t *spec_data2)
{ {
uint8_t retval; uint8_t retval;
ALIGN real_t spec_coef1[1024]; ALIGN static real_t spec_coef1[1024];
ALIGN real_t spec_coef2[1024]; ALIGN static real_t spec_coef2[1024];
#ifdef PROFILE #ifdef PROFILE
int64_t count = faad_get_ts(); int64_t count = faad_get_ts();

View file

@ -558,14 +558,16 @@ void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
/* Table 4.4.4 and */ /* Table 4.4.4 and */
/* Table 4.4.9 */ /* 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, static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
uint8_t channel, uint8_t *tag) uint8_t channel, uint8_t *tag)
{ {
uint8_t retval = 0; uint8_t retval = 0;
element sce = {0};
ic_stream *ics = &(sce.ics1); 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 sce.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG
DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_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 */ /* 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, static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld,
uint8_t channels, uint8_t *tag) 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 *ics1 = &(cpe.ics1);
ic_stream *ics2 = &(cpe.ics2); ic_stream *ics2 = &(cpe.ics2);
uint8_t result; 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.channel = channels;
cpe.paired_channel = channels+1; cpe.paired_channel = channels+1;
@ -876,7 +881,7 @@ static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld)
element el_empty = {0}; element el_empty = {0};
ic_stream ics_empty = {0}; ic_stream ics_empty = {0};
int16_t sh_data[1024]; static int16_t sh_data[1024];
c = faad_getbits(ld, LEN_TAG c = faad_getbits(ld, LEN_TAG
DEBUGVAR(1,900,"coupling_channel_element(): element_instance_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; uint8_t byte_aligned;
uint16_t i, count; uint16_t i, count;
(void)hDecoder;
/* element_instance_tag = */ faad_getbits(ld, LEN_TAG /* element_instance_tag = */ faad_getbits(ld, LEN_TAG
DEBUGVAR(1,60,"data_stream_element(): element_instance_tag")); DEBUGVAR(1,60,"data_stream_element(): element_instance_tag"));
byte_aligned = faad_get1bit(ld byte_aligned = faad_get1bit(ld
@ -1158,6 +1165,8 @@ static void gain_control_data(bitfile *ld, ic_stream *ics)
#endif #endif
#ifdef SCALABLE_DEC #ifdef SCALABLE_DEC
ALIGN int16_t spec_data1[1024] IBSS_ATTR;
ALIGN int16_t spec_data2[1024] IBSS_ATTR;
/* Table 4.4.13 ASME */ /* Table 4.4.13 ASME */
void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
bitfile *ld, program_config *pce, drc_info *drc) 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 *ics1 = &(cpe.ics1);
ic_stream *ics2 = &(cpe.ics2); ic_stream *ics2 = &(cpe.ics2);
int16_t *spec_data; 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; hDecoder->fr_ch_ele = 0;
hInfo->error = aac_scalable_main_header(hDecoder, ics1, ics2, ld, this_layer_stereo); 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 */ /* Table 4.4.27 */
static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld) 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 n_filt_bits = 2;
uint8_t length_bits = 6; uint8_t length_bits = 6;
uint8_t order_bits = 5; uint8_t order_bits = 5;
@ -2048,11 +2058,11 @@ static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count)
return n; return n;
case EXT_FILL_DATA: case EXT_FILL_DATA:
/* fill_nibble = */ faad_getbits(ld, 4 /* 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++) for (i = 0; i < count-1; i++)
{ {
/* fill_byte[i] = */ faad_getbits(ld, 8 /* 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; return count;
case EXT_DATA_ELEMENT: case EXT_DATA_ELEMENT:

View file

@ -36,9 +36,9 @@
static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress,
uint8_t *coef, real_t *a); uint8_t *coef, real_t *a);
static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, 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, 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 #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, 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 - 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, 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 - Simple all-zero filter of order "order" defined by