summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-11-16 17:49:37 +0000
committerJens Arnold <amiconn@rockbox.org>2008-11-16 17:49:37 +0000
commit1b14167861bb5bf4c692f8fc661b33e26a706183 (patch)
tree5a635ce1c95dd74235b29bd23ae9cd9bd4a8e93a
parent66ff812c4a4fb5bb39c6056a10d814944bda92dc (diff)
downloadrockbox-1b14167861bb5bf4c692f8fc661b33e26a706183.zip
rockbox-1b14167861bb5bf4c692f8fc661b33e26a706183.tar.gz
rockbox-1b14167861bb5bf4c692f8fc661b33e26a706183.tar.bz2
rockbox-1b14167861bb5bf4c692f8fc661b33e26a706183.tar.xz
Centralise compile-time configuration.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19121 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/demac/libdemac/decoder.c8
-rw-r--r--apps/codecs/demac/libdemac/demac_config.h80
-rw-r--r--apps/codecs/demac/libdemac/demac_iram.h50
-rw-r--r--apps/codecs/demac/libdemac/entropy.c13
-rw-r--r--apps/codecs/demac/libdemac/filter.c6
-rw-r--r--apps/codecs/demac/libdemac/filter.h5
-rw-r--r--apps/codecs/demac/libdemac/parser.h18
-rw-r--r--apps/codecs/demac/libdemac/predictor-arm.S7
-rw-r--r--apps/codecs/demac/libdemac/predictor-cf.S6
-rw-r--r--apps/codecs/demac/libdemac/predictor.c6
10 files changed, 101 insertions, 98 deletions
diff --git a/apps/codecs/demac/libdemac/decoder.c b/apps/codecs/demac/libdemac/decoder.c
index 2b8dcd2..540db47 100644
--- a/apps/codecs/demac/libdemac/decoder.c
+++ b/apps/codecs/demac/libdemac/decoder.c
@@ -29,18 +29,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
#include "predictor.h"
#include "entropy.h"
#include "filter.h"
-#include "demac_iram.h"
+#include "demac_config.h"
/* Statically allocate the filter buffers */
-static int16_t filterbuf32[(32*3 + HISTORY_SIZE) * 2] /* 2432 bytes */
+static int16_t filterbuf32[(32*3 + FILTER_HISTORY_SIZE) * 2] /* 2432 bytes */
IBSS_ATTR __attribute__((aligned(16)));
-static int16_t filterbuf256[(256*3 + HISTORY_SIZE) * 2] /* 5120 bytes */
+static int16_t filterbuf256[(256*3 + FILTER_HISTORY_SIZE) * 2] /* 5120 bytes */
IBSS_ATTR __attribute__((aligned(16)));
/* This is only needed for "insane" files, and no current Rockbox targets
can hope to decode them in realtime, although the Gigabeat S comes close. */
-static int16_t filterbuf1280[(1280*3 + HISTORY_SIZE) * 2] /* 17408 bytes */
+static int16_t filterbuf1280[(1280*3 + FILTER_HISTORY_SIZE) * 2] /* 17408 bytes */
IBSS_ATTR_DEMAC_INSANEBUF __attribute__((aligned(16)));
void init_frame_decoder(struct ape_ctx_t* ape_ctx,
diff --git a/apps/codecs/demac/libdemac/demac_config.h b/apps/codecs/demac/libdemac/demac_config.h
new file mode 100644
index 0000000..93fda76
--- /dev/null
+++ b/apps/codecs/demac/libdemac/demac_config.h
@@ -0,0 +1,80 @@
+/*
+
+libdemac - A Monkey's Audio decoder
+
+$Id$
+
+Copyright (C) Dave Chapman 2007
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
+
+*/
+
+#ifndef _DEMAC_CONFIG_H
+#define _DEMAC_CONFIG_H
+
+/* Build-time choices for libdemac.
+ * Note that this file is included by both .c and .S files. */
+
+#ifdef ROCKBOX
+
+#include "config.h"
+
+#ifndef __ASSEMBLER__
+#include "../lib/codeclib.h"
+#include <codecs.h>
+#endif
+
+#define APE_OUTPUT_DEPTH 29
+
+/* On PP5002 code should go into IRAM. Otherwise put the insane
+ * filter buffer into IRAM as long as there is no better use. */
+#if CONFIG_CPU == PP5002
+#define ICODE_SECTION_DEMAC_ARM .icode
+#define ICODE_ATTR_DEMAC ICODE_ATTR
+#define IBSS_ATTR_DEMAC_INSANEBUF
+#else
+#define ICODE_SECTION_DEMAC_ARM .text
+#define ICODE_ATTR_DEMAC
+#define IBSS_ATTR_DEMAC_INSANEBUF IBSS_ATTR
+#endif
+
+#else /* !ROCKBOX */
+
+#define APE_OUTPUT_DEPTH (ape_ctx->bps)
+
+#define IBSS_ATTR
+#define IBSS_ATTR_DEMAC_INSANEBUF
+#define ICONST_ATTR
+#define ICODE_ATTR
+#define ICODE_ATTR_DEMAC
+
+#endif /* !ROCKBOX */
+
+/* Defaults */
+
+#ifndef UDIV32
+#define UDIV32(a, b) (a / b)
+#endif
+
+#ifndef FILTER_HISTORY_SIZE
+#define FILTER_HISTORY_SIZE 512
+#endif
+
+#ifndef PREDICTOR_HISTORY_SIZE
+#define PREDICTOR_HISTORY_SIZE 512
+#endif
+
+#endif /* _DEMAC_CONFIG_H */
diff --git a/apps/codecs/demac/libdemac/demac_iram.h b/apps/codecs/demac/libdemac/demac_iram.h
deleted file mode 100644
index 5dd02f8..0000000
--- a/apps/codecs/demac/libdemac/demac_iram.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2008 Jens Arnold
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-/* Define how IRAM is used on the various targets. Note that this file
- * is included by both .c and .S files so must not contain any C code. */
-
-#ifndef _LIBDEMAC_IRAM_H
-#define _LIBDEMAC_IRAM_H
-
-#ifdef ROCKBOX
-#include "config.h"
-
-/* On PP5002 code should go into IRAM. Otherwise put the insane
- * filter buffer into IRAM as long as there is no better use. */
-#if CONFIG_CPU == PP5002
-#define ICODE_SECTION_DEMAC_ARM .icode
-#define ICODE_ATTR_DEMAC ICODE_ATTR
-#define IBSS_ATTR_DEMAC_INSANEBUF
-#else
-#define ICODE_SECTION_DEMAC_ARM .text
-#define ICODE_ATTR_DEMAC
-#define IBSS_ATTR_DEMAC_INSANEBUF IBSS_ATTR
-#endif
-
-#else
-
-#define IBSS_ATTR_DEMAC_INSANEBUF
-#define ICODE_ATTR_DEMAC
-
-#endif /* !ROCKBOX */
-
-#endif /* _LIBDEMAC_IRAM_H */
diff --git a/apps/codecs/demac/libdemac/entropy.c b/apps/codecs/demac/libdemac/entropy.c
index baddce0..54ff226 100644
--- a/apps/codecs/demac/libdemac/entropy.c
+++ b/apps/codecs/demac/libdemac/entropy.c
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
#include "parser.h"
#include "entropy.h"
-#include "demac_iram.h"
+#include "demac_config.h"
#define MODEL_ELEMENTS 64
@@ -115,20 +115,11 @@ each function (and the RNGC macro)).
*/
-#ifdef ROCKBOX
-#include "../lib/codeclib.h"
-/* for UDIV32() */
-#endif
-
-#ifndef UDIV32
-#define UDIV32(a, b) (a / b)
-#endif
-
/* BITSTREAM READING FUNCTIONS */
/* We deal with the input data one byte at a time - to ensure
functionality on CPUs of any endianness regardless of any requirements
- for aligned reads.
+ for aligned reads.
*/
static unsigned char* bytebuffer IBSS_ATTR;
diff --git a/apps/codecs/demac/libdemac/filter.c b/apps/codecs/demac/libdemac/filter.c
index a73215f..b47a37a 100644
--- a/apps/codecs/demac/libdemac/filter.c
+++ b/apps/codecs/demac/libdemac/filter.c
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
#include "demac.h"
#include "filter.h"
-#include "demac_iram.h"
+#include "demac_config.h"
#ifdef CPU_COLDFIRE
#include "vector_math16_cf.h"
@@ -203,7 +203,7 @@ static struct filter_t filter1 IBSS_ATTR;
static void do_init_filter(struct filter_t* f, int16_t* buf)
{
f->coeffs = buf;
- f->history_end = buf + ORDER*3 + HISTORY_SIZE;
+ f->history_end = buf + ORDER*3 + FILTER_HISTORY_SIZE;
/* Init pointers */
f->adaptcoeffs = f->coeffs + ORDER*2;
@@ -219,7 +219,7 @@ static void do_init_filter(struct filter_t* f, int16_t* buf)
void INIT_FILTER(int16_t* buf)
{
do_init_filter(&filter0, buf);
- do_init_filter(&filter1, buf + ORDER * 3 + HISTORY_SIZE);
+ do_init_filter(&filter1, buf + ORDER*3 + FILTER_HISTORY_SIZE);
}
int ICODE_ATTR_DEMAC APPLY_FILTER(int fileversion, int32_t* data0,
diff --git a/apps/codecs/demac/libdemac/filter.h b/apps/codecs/demac/libdemac/filter.h
index b98403c..acbb155 100644
--- a/apps/codecs/demac/libdemac/filter.h
+++ b/apps/codecs/demac/libdemac/filter.h
@@ -2,7 +2,7 @@
libdemac - A Monkey's Audio decoder
-$Id:$
+$Id$
Copyright (C) Dave Chapman 2007
@@ -27,9 +27,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
#include <inttypes.h>
-/* The size of the history buffers */
-#define HISTORY_SIZE 512
-
void init_filter_16_11(int16_t* buf);
int apply_filter_16_11(int fileversion, int32_t* decoded0, int32_t* decoded1, int count);
diff --git a/apps/codecs/demac/libdemac/parser.h b/apps/codecs/demac/libdemac/parser.h
index 4ef0977..53157f7 100644
--- a/apps/codecs/demac/libdemac/parser.h
+++ b/apps/codecs/demac/libdemac/parser.h
@@ -26,20 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
#define _APE_PARSER_H
#include <inttypes.h>
-
-#ifdef ROCKBOX
-/* Include the Rockbox Codec API when building for Rockbox */
-#define APE_OUTPUT_DEPTH 29
-#ifndef ROCKBOX_PLUGIN
-#include "../lib/codeclib.h"
-#include <codecs.h>
-#endif
-#else
-#define APE_OUTPUT_DEPTH (ape_ctx->bps)
-#define IBSS_ATTR
-#define ICONST_ATTR
-#define ICODE_ATTR
-#endif
+#include "demac_config.h"
/* The earliest and latest file formats supported by this library */
#define APE_MIN_VERSION 3970
@@ -66,7 +53,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
#define APE_FRAMECODE_STEREO_SILENCE 3
#define APE_FRAMECODE_PSEUDO_STEREO 4
-#define HISTORY_SIZE 512
#define PREDICTOR_ORDER 8
/* Total size of all predictor histories - 50 * sizeof(int32_t) */
#define PREDICTOR_SIZE 50
@@ -95,7 +81,7 @@ struct predictor_t
int32_t XcoeffsA[4];
int32_t YcoeffsB[5];
int32_t XcoeffsB[5];
- int32_t historybuffer[HISTORY_SIZE + PREDICTOR_SIZE];
+ int32_t historybuffer[PREDICTOR_HISTORY_SIZE + PREDICTOR_SIZE];
};
struct ape_ctx_t
diff --git a/apps/codecs/demac/libdemac/predictor-arm.S b/apps/codecs/demac/libdemac/predictor-arm.S
index f54260c..dfeba0d 100644
--- a/apps/codecs/demac/libdemac/predictor-arm.S
+++ b/apps/codecs/demac/libdemac/predictor-arm.S
@@ -21,7 +21,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
-#include "demac_iram.h"
+#include "demac_config.h"
.section ICODE_SECTION_DEMAC_ARM,"ax",%progbits
@@ -33,8 +33,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
/* NOTE: The following need to be kept in sync with parser.h */
-#define HISTORY_SIZE 512
-
#define YDELAYA 200
#define YDELAYB 168
#define XDELAYA 136
@@ -470,7 +468,8 @@ loop:
add r11, r12, #historybuffer @ r11 := &p->historybuffer[0]
- sub r10, r14, #HISTORY_SIZE*4 @ r10 := p->buf - HISTORY_SIZE
+ sub r10, r14, #PREDICTOR_HISTORY_SIZE*4
+ @ r10 := p->buf - PREDICTOR_HISTORY_SIZE
cmp r10, r11
bne endofloop
diff --git a/apps/codecs/demac/libdemac/predictor-cf.S b/apps/codecs/demac/libdemac/predictor-cf.S
index 3b9489e..b12d093 100644
--- a/apps/codecs/demac/libdemac/predictor-cf.S
+++ b/apps/codecs/demac/libdemac/predictor-cf.S
@@ -23,6 +23,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
+#include "demac_config.h"
.text
@@ -33,8 +34,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
/* NOTE: The following need to be kept in sync with parser.h */
-#define HISTORY_SIZE 512
-
#define YDELAYA 200
#define YDELAYB 168
#define XDELAYA 136
@@ -483,7 +482,8 @@ predictor_decode_stereo:
addq.l #4, %a5 | p->buf++
- lea.l (historybuffer+HISTORY_SIZE*4,%a6), %a3 | %a3 = &p->historybuffer[HISTORY_SIZE]
+ lea.l (historybuffer+PREDICTOR_HISTORY_SIZE*4,%a6), %a3
+ | %a3 = &p->historybuffer[PREDICTOR_HISTORY_SIZE]
cmp.l %a3, %a5
bne.s .endofloop
diff --git a/apps/codecs/demac/libdemac/predictor.c b/apps/codecs/demac/libdemac/predictor.c
index f0e3b65..1a9b48e 100644
--- a/apps/codecs/demac/libdemac/predictor.c
+++ b/apps/codecs/demac/libdemac/predictor.c
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
#include "parser.h"
#include "predictor.h"
-#include "demac_iram.h"
+#include "demac_config.h"
/* Return 0 if x is zero, -1 if x is positive, 1 if x is negative */
#define SIGN(x) (x) ? (((x) > 0) ? -1 : 1) : 0
@@ -196,7 +196,7 @@ int ICODE_ATTR_DEMAC predictor_decode_stereo(struct predictor_t* p,
p->buf++;
/* Have we filled the history buffer? */
- if (p->buf == p->historybuffer + HISTORY_SIZE) {
+ if (p->buf == p->historybuffer + PREDICTOR_HISTORY_SIZE) {
memmove(p->historybuffer, p->buf,
PREDICTOR_SIZE * sizeof(int32_t));
p->buf = p->historybuffer;
@@ -250,7 +250,7 @@ int ICODE_ATTR_DEMAC predictor_decode_mono(struct predictor_t* p,
p->buf++;
/* Have we filled the history buffer? */
- if (p->buf == p->historybuffer + HISTORY_SIZE) {
+ if (p->buf == p->historybuffer + PREDICTOR_HISTORY_SIZE) {
memmove(p->historybuffer, p->buf,
PREDICTOR_SIZE * sizeof(int32_t));
p->buf = p->historybuffer;