summaryrefslogtreecommitdiff
path: root/apps
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 /apps
parent66ff812c4a4fb5bb39c6056a10d814944bda92dc (diff)
downloadrockbox-1b14167861bb5bf4c692f8fc661b33e26a706183.tar.gz
rockbox-1b14167861bb5bf4c692f8fc661b33e26a706183.zip
Centralise compile-time configuration.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19121 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-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 2b8dcd2cf3..540db47636 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
29#include "predictor.h" 29#include "predictor.h"
30#include "entropy.h" 30#include "entropy.h"
31#include "filter.h" 31#include "filter.h"
32#include "demac_iram.h" 32#include "demac_config.h"
33 33
34/* Statically allocate the filter buffers */ 34/* Statically allocate the filter buffers */
35 35
36static int16_t filterbuf32[(32*3 + HISTORY_SIZE) * 2] /* 2432 bytes */ 36static int16_t filterbuf32[(32*3 + FILTER_HISTORY_SIZE) * 2] /* 2432 bytes */
37 IBSS_ATTR __attribute__((aligned(16))); 37 IBSS_ATTR __attribute__((aligned(16)));
38static int16_t filterbuf256[(256*3 + HISTORY_SIZE) * 2] /* 5120 bytes */ 38static int16_t filterbuf256[(256*3 + FILTER_HISTORY_SIZE) * 2] /* 5120 bytes */
39 IBSS_ATTR __attribute__((aligned(16))); 39 IBSS_ATTR __attribute__((aligned(16)));
40 40
41/* This is only needed for "insane" files, and no current Rockbox targets 41/* This is only needed for "insane" files, and no current Rockbox targets
42 can hope to decode them in realtime, although the Gigabeat S comes close. */ 42 can hope to decode them in realtime, although the Gigabeat S comes close. */
43static int16_t filterbuf1280[(1280*3 + HISTORY_SIZE) * 2] /* 17408 bytes */ 43static int16_t filterbuf1280[(1280*3 + FILTER_HISTORY_SIZE) * 2] /* 17408 bytes */
44 IBSS_ATTR_DEMAC_INSANEBUF __attribute__((aligned(16))); 44 IBSS_ATTR_DEMAC_INSANEBUF __attribute__((aligned(16)));
45 45
46void init_frame_decoder(struct ape_ctx_t* ape_ctx, 46void 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 0000000000..93fda76e25
--- /dev/null
+++ b/apps/codecs/demac/libdemac/demac_config.h
@@ -0,0 +1,80 @@
1/*
2
3libdemac - A Monkey's Audio decoder
4
5$Id$
6
7Copyright (C) Dave Chapman 2007
8
9This program is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 2 of the License, or
12(at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
22
23*/
24
25#ifndef _DEMAC_CONFIG_H
26#define _DEMAC_CONFIG_H
27
28/* Build-time choices for libdemac.
29 * Note that this file is included by both .c and .S files. */
30
31#ifdef ROCKBOX
32
33#include "config.h"
34
35#ifndef __ASSEMBLER__
36#include "../lib/codeclib.h"
37#include <codecs.h>
38#endif
39
40#define APE_OUTPUT_DEPTH 29
41
42/* On PP5002 code should go into IRAM. Otherwise put the insane
43 * filter buffer into IRAM as long as there is no better use. */
44#if CONFIG_CPU == PP5002
45#define ICODE_SECTION_DEMAC_ARM .icode
46#define ICODE_ATTR_DEMAC ICODE_ATTR
47#define IBSS_ATTR_DEMAC_INSANEBUF
48#else
49#define ICODE_SECTION_DEMAC_ARM .text
50#define ICODE_ATTR_DEMAC
51#define IBSS_ATTR_DEMAC_INSANEBUF IBSS_ATTR
52#endif
53
54#else /* !ROCKBOX */
55
56#define APE_OUTPUT_DEPTH (ape_ctx->bps)
57
58#define IBSS_ATTR
59#define IBSS_ATTR_DEMAC_INSANEBUF
60#define ICONST_ATTR
61#define ICODE_ATTR
62#define ICODE_ATTR_DEMAC
63
64#endif /* !ROCKBOX */
65
66/* Defaults */
67
68#ifndef UDIV32
69#define UDIV32(a, b) (a / b)
70#endif
71
72#ifndef FILTER_HISTORY_SIZE
73#define FILTER_HISTORY_SIZE 512
74#endif
75
76#ifndef PREDICTOR_HISTORY_SIZE
77#define PREDICTOR_HISTORY_SIZE 512
78#endif
79
80#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 5dd02f812d..0000000000
--- a/apps/codecs/demac/libdemac/demac_iram.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 Jens Arnold
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22/* Define how IRAM is used on the various targets. Note that this file
23 * is included by both .c and .S files so must not contain any C code. */
24
25#ifndef _LIBDEMAC_IRAM_H
26#define _LIBDEMAC_IRAM_H
27
28#ifdef ROCKBOX
29#include "config.h"
30
31/* On PP5002 code should go into IRAM. Otherwise put the insane
32 * filter buffer into IRAM as long as there is no better use. */
33#if CONFIG_CPU == PP5002
34#define ICODE_SECTION_DEMAC_ARM .icode
35#define ICODE_ATTR_DEMAC ICODE_ATTR
36#define IBSS_ATTR_DEMAC_INSANEBUF
37#else
38#define ICODE_SECTION_DEMAC_ARM .text
39#define ICODE_ATTR_DEMAC
40#define IBSS_ATTR_DEMAC_INSANEBUF IBSS_ATTR
41#endif
42
43#else
44
45#define IBSS_ATTR_DEMAC_INSANEBUF
46#define ICODE_ATTR_DEMAC
47
48#endif /* !ROCKBOX */
49
50#endif /* _LIBDEMAC_IRAM_H */
diff --git a/apps/codecs/demac/libdemac/entropy.c b/apps/codecs/demac/libdemac/entropy.c
index baddce07be..54ff226bce 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
27 27
28#include "parser.h" 28#include "parser.h"
29#include "entropy.h" 29#include "entropy.h"
30#include "demac_iram.h" 30#include "demac_config.h"
31 31
32#define MODEL_ELEMENTS 64 32#define MODEL_ELEMENTS 64
33 33
@@ -115,20 +115,11 @@ each function (and the RNGC macro)).
115 115
116*/ 116*/
117 117
118#ifdef ROCKBOX
119#include "../lib/codeclib.h"
120/* for UDIV32() */
121#endif
122
123#ifndef UDIV32
124#define UDIV32(a, b) (a / b)
125#endif
126
127/* BITSTREAM READING FUNCTIONS */ 118/* BITSTREAM READING FUNCTIONS */
128 119
129/* We deal with the input data one byte at a time - to ensure 120/* We deal with the input data one byte at a time - to ensure
130 functionality on CPUs of any endianness regardless of any requirements 121 functionality on CPUs of any endianness regardless of any requirements
131 for aligned reads. 122 for aligned reads.
132*/ 123*/
133 124
134static unsigned char* bytebuffer IBSS_ATTR; 125static unsigned char* bytebuffer IBSS_ATTR;
diff --git a/apps/codecs/demac/libdemac/filter.c b/apps/codecs/demac/libdemac/filter.c
index a73215f6d0..b47a37a041 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
27 27
28#include "demac.h" 28#include "demac.h"
29#include "filter.h" 29#include "filter.h"
30#include "demac_iram.h" 30#include "demac_config.h"
31 31
32#ifdef CPU_COLDFIRE 32#ifdef CPU_COLDFIRE
33#include "vector_math16_cf.h" 33#include "vector_math16_cf.h"
@@ -203,7 +203,7 @@ static struct filter_t filter1 IBSS_ATTR;
203static void do_init_filter(struct filter_t* f, int16_t* buf) 203static void do_init_filter(struct filter_t* f, int16_t* buf)
204{ 204{
205 f->coeffs = buf; 205 f->coeffs = buf;
206 f->history_end = buf + ORDER*3 + HISTORY_SIZE; 206 f->history_end = buf + ORDER*3 + FILTER_HISTORY_SIZE;
207 207
208 /* Init pointers */ 208 /* Init pointers */
209 f->adaptcoeffs = f->coeffs + ORDER*2; 209 f->adaptcoeffs = f->coeffs + ORDER*2;
@@ -219,7 +219,7 @@ static void do_init_filter(struct filter_t* f, int16_t* buf)
219void INIT_FILTER(int16_t* buf) 219void INIT_FILTER(int16_t* buf)
220{ 220{
221 do_init_filter(&filter0, buf); 221 do_init_filter(&filter0, buf);
222 do_init_filter(&filter1, buf + ORDER * 3 + HISTORY_SIZE); 222 do_init_filter(&filter1, buf + ORDER*3 + FILTER_HISTORY_SIZE);
223} 223}
224 224
225int ICODE_ATTR_DEMAC APPLY_FILTER(int fileversion, int32_t* data0, 225int 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 b98403cfc8..acbb155b29 100644
--- a/apps/codecs/demac/libdemac/filter.h
+++ b/apps/codecs/demac/libdemac/filter.h
@@ -2,7 +2,7 @@
2 2
3libdemac - A Monkey's Audio decoder 3libdemac - A Monkey's Audio decoder
4 4
5$Id:$ 5$Id$
6 6
7Copyright (C) Dave Chapman 2007 7Copyright (C) Dave Chapman 2007
8 8
@@ -27,9 +27,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
27 27
28#include <inttypes.h> 28#include <inttypes.h>
29 29
30/* The size of the history buffers */
31#define HISTORY_SIZE 512
32
33void init_filter_16_11(int16_t* buf); 30void init_filter_16_11(int16_t* buf);
34int apply_filter_16_11(int fileversion, int32_t* decoded0, int32_t* decoded1, int count); 31int apply_filter_16_11(int fileversion, int32_t* decoded0, int32_t* decoded1, int count);
35 32
diff --git a/apps/codecs/demac/libdemac/parser.h b/apps/codecs/demac/libdemac/parser.h
index 4ef0977e6b..53157f7681 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
26#define _APE_PARSER_H 26#define _APE_PARSER_H
27 27
28#include <inttypes.h> 28#include <inttypes.h>
29 29#include "demac_config.h"
30#ifdef ROCKBOX
31/* Include the Rockbox Codec API when building for Rockbox */
32#define APE_OUTPUT_DEPTH 29
33#ifndef ROCKBOX_PLUGIN
34#include "../lib/codeclib.h"
35#include <codecs.h>
36#endif
37#else
38#define APE_OUTPUT_DEPTH (ape_ctx->bps)
39#define IBSS_ATTR
40#define ICONST_ATTR
41#define ICODE_ATTR
42#endif
43 30
44/* The earliest and latest file formats supported by this library */ 31/* The earliest and latest file formats supported by this library */
45#define APE_MIN_VERSION 3970 32#define APE_MIN_VERSION 3970
@@ -66,7 +53,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
66#define APE_FRAMECODE_STEREO_SILENCE 3 53#define APE_FRAMECODE_STEREO_SILENCE 3
67#define APE_FRAMECODE_PSEUDO_STEREO 4 54#define APE_FRAMECODE_PSEUDO_STEREO 4
68 55
69#define HISTORY_SIZE 512
70#define PREDICTOR_ORDER 8 56#define PREDICTOR_ORDER 8
71/* Total size of all predictor histories - 50 * sizeof(int32_t) */ 57/* Total size of all predictor histories - 50 * sizeof(int32_t) */
72#define PREDICTOR_SIZE 50 58#define PREDICTOR_SIZE 50
@@ -95,7 +81,7 @@ struct predictor_t
95 int32_t XcoeffsA[4]; 81 int32_t XcoeffsA[4];
96 int32_t YcoeffsB[5]; 82 int32_t YcoeffsB[5];
97 int32_t XcoeffsB[5]; 83 int32_t XcoeffsB[5];
98 int32_t historybuffer[HISTORY_SIZE + PREDICTOR_SIZE]; 84 int32_t historybuffer[PREDICTOR_HISTORY_SIZE + PREDICTOR_SIZE];
99}; 85};
100 86
101struct ape_ctx_t 87struct ape_ctx_t
diff --git a/apps/codecs/demac/libdemac/predictor-arm.S b/apps/codecs/demac/libdemac/predictor-arm.S
index f54260c934..dfeba0dcc8 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
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
22 22
23*/ 23*/
24#include "demac_iram.h" 24#include "demac_config.h"
25 25
26 .section ICODE_SECTION_DEMAC_ARM,"ax",%progbits 26 .section ICODE_SECTION_DEMAC_ARM,"ax",%progbits
27 27
@@ -33,8 +33,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
33 33
34/* NOTE: The following need to be kept in sync with parser.h */ 34/* NOTE: The following need to be kept in sync with parser.h */
35 35
36#define HISTORY_SIZE 512
37
38#define YDELAYA 200 36#define YDELAYA 200
39#define YDELAYB 168 37#define YDELAYB 168
40#define XDELAYA 136 38#define XDELAYA 136
@@ -470,7 +468,8 @@ loop:
470 468
471 add r11, r12, #historybuffer @ r11 := &p->historybuffer[0] 469 add r11, r12, #historybuffer @ r11 := &p->historybuffer[0]
472 470
473 sub r10, r14, #HISTORY_SIZE*4 @ r10 := p->buf - HISTORY_SIZE 471 sub r10, r14, #PREDICTOR_HISTORY_SIZE*4
472 @ r10 := p->buf - PREDICTOR_HISTORY_SIZE
474 473
475 cmp r10, r11 474 cmp r10, r11
476 bne endofloop 475 bne endofloop
diff --git a/apps/codecs/demac/libdemac/predictor-cf.S b/apps/codecs/demac/libdemac/predictor-cf.S
index 3b9489e791..b12d0932b0 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
23Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 23Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
24 24
25*/ 25*/
26#include "demac_config.h"
26 27
27 .text 28 .text
28 29
@@ -33,8 +34,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
33 34
34/* NOTE: The following need to be kept in sync with parser.h */ 35/* NOTE: The following need to be kept in sync with parser.h */
35 36
36#define HISTORY_SIZE 512
37
38#define YDELAYA 200 37#define YDELAYA 200
39#define YDELAYB 168 38#define YDELAYB 168
40#define XDELAYA 136 39#define XDELAYA 136
@@ -483,7 +482,8 @@ predictor_decode_stereo:
483 482
484 addq.l #4, %a5 | p->buf++ 483 addq.l #4, %a5 | p->buf++
485 484
486 lea.l (historybuffer+HISTORY_SIZE*4,%a6), %a3 | %a3 = &p->historybuffer[HISTORY_SIZE] 485 lea.l (historybuffer+PREDICTOR_HISTORY_SIZE*4,%a6), %a3
486 | %a3 = &p->historybuffer[PREDICTOR_HISTORY_SIZE]
487 487
488 cmp.l %a3, %a5 488 cmp.l %a3, %a5
489 bne.s .endofloop 489 bne.s .endofloop
diff --git a/apps/codecs/demac/libdemac/predictor.c b/apps/codecs/demac/libdemac/predictor.c
index f0e3b65556..1a9b48e0ca 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
27 27
28#include "parser.h" 28#include "parser.h"
29#include "predictor.h" 29#include "predictor.h"
30#include "demac_iram.h" 30#include "demac_config.h"
31 31
32/* Return 0 if x is zero, -1 if x is positive, 1 if x is negative */ 32/* Return 0 if x is zero, -1 if x is positive, 1 if x is negative */
33#define SIGN(x) (x) ? (((x) > 0) ? -1 : 1) : 0 33#define SIGN(x) (x) ? (((x) > 0) ? -1 : 1) : 0
@@ -196,7 +196,7 @@ int ICODE_ATTR_DEMAC predictor_decode_stereo(struct predictor_t* p,
196 p->buf++; 196 p->buf++;
197 197
198 /* Have we filled the history buffer? */ 198 /* Have we filled the history buffer? */
199 if (p->buf == p->historybuffer + HISTORY_SIZE) { 199 if (p->buf == p->historybuffer + PREDICTOR_HISTORY_SIZE) {
200 memmove(p->historybuffer, p->buf, 200 memmove(p->historybuffer, p->buf,
201 PREDICTOR_SIZE * sizeof(int32_t)); 201 PREDICTOR_SIZE * sizeof(int32_t));
202 p->buf = p->historybuffer; 202 p->buf = p->historybuffer;
@@ -250,7 +250,7 @@ int ICODE_ATTR_DEMAC predictor_decode_mono(struct predictor_t* p,
250 p->buf++; 250 p->buf++;
251 251
252 /* Have we filled the history buffer? */ 252 /* Have we filled the history buffer? */
253 if (p->buf == p->historybuffer + HISTORY_SIZE) { 253 if (p->buf == p->historybuffer + PREDICTOR_HISTORY_SIZE) {
254 memmove(p->historybuffer, p->buf, 254 memmove(p->historybuffer, p->buf,
255 PREDICTOR_SIZE * sizeof(int32_t)); 255 PREDICTOR_SIZE * sizeof(int32_t));
256 p->buf = p->historybuffer; 256 p->buf = p->historybuffer;