summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/demac/libdemac/demac_config.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/demac/libdemac/demac_config.h')
-rw-r--r--lib/rbcodec/codecs/demac/libdemac/demac_config.h145
1 files changed, 145 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/demac/libdemac/demac_config.h b/lib/rbcodec/codecs/demac/libdemac/demac_config.h
new file mode 100644
index 0000000000..fa4f008036
--- /dev/null
+++ b/lib/rbcodec/codecs/demac/libdemac/demac_config.h
@@ -0,0 +1,145 @@
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 "codeclib.h"
37#include <codecs.h>
38#endif
39
40#define APE_OUTPUT_DEPTH 29
41
42/* On ARMv4, using 32 bit ints for the filters is faster. */
43#if defined(CPU_ARM) && (ARM_ARCH == 4)
44#define FILTER_BITS 32
45#endif
46
47#if !defined(CPU_PP) && !defined(CPU_S5L870X)
48#define FILTER256_IRAM
49#endif
50
51#if CONFIG_CPU == PP5002 || defined(CPU_S5L870X)
52/* Code and data IRAM for speed (PP5002 has a broken cache), not enough IRAM
53 * for the insane filter buffer. Reciprocal table for division in IRAM. */
54#define ICODE_SECTION_DEMAC_ARM .icode
55#define ICODE_ATTR_DEMAC ICODE_ATTR
56#define ICONST_ATTR_DEMAC ICONST_ATTR
57#define IBSS_ATTR_DEMAC IBSS_ATTR
58#define IBSS_ATTR_DEMAC_INSANEBUF
59
60#elif CONFIG_CPU == PP5020
61/* Code and small data in DRAM for speed (PP5020 IRAM isn't completely single
62 * cycle). Insane filter buffer not in IRAM in favour of reciprocal table for
63 * divison. Decoded data buffers should be in IRAM (defined by the caller). */
64#define ICODE_SECTION_DEMAC_ARM .text
65#define ICODE_ATTR_DEMAC
66#define ICONST_ATTR_DEMAC
67#define IBSS_ATTR_DEMAC
68#define IBSS_ATTR_DEMAC_INSANEBUF
69
70#elif CONFIG_CPU == PP5022
71/* Code in DRAM, data in IRAM. Insane filter buffer not in IRAM in favour of
72 * reciprocal table for divison */
73#define ICODE_SECTION_DEMAC_ARM .text
74#define ICODE_ATTR_DEMAC
75#define ICONST_ATTR_DEMAC ICONST_ATTR
76#define IBSS_ATTR_DEMAC IBSS_ATTR
77#define IBSS_ATTR_DEMAC_INSANEBUF
78
79#else
80/* Code in DRAM, data in IRAM, including insane filter buffer. */
81#define ICODE_SECTION_DEMAC_ARM .text
82#define ICODE_ATTR_DEMAC
83#define ICONST_ATTR_DEMAC ICONST_ATTR
84#define IBSS_ATTR_DEMAC IBSS_ATTR
85#define IBSS_ATTR_DEMAC_INSANEBUF IBSS_ATTR
86#endif
87
88#else /* !ROCKBOX */
89
90#define APE_OUTPUT_DEPTH (ape_ctx->bps)
91
92#define MEM_ALIGN_ATTR __attribute__((aligned(16)))
93 /* adjust to target architecture for best performance */
94
95#define ICODE_ATTR_DEMAC
96#define ICONST_ATTR_DEMAC
97#define IBSS_ATTR_DEMAC
98#define IBSS_ATTR_DEMAC_INSANEBUF
99
100/* Use to give gcc hints on which branch is most likely taken */
101#if defined(__GNUC__) && __GNUC__ >= 3
102#define LIKELY(x) __builtin_expect(!!(x), 1)
103#define UNLIKELY(x) __builtin_expect(!!(x), 0)
104#else
105#define LIKELY(x) (x)
106#define UNLIKELY(x) (x)
107#endif
108
109#endif /* !ROCKBOX */
110
111/* Defaults */
112
113#ifndef FILTER_HISTORY_SIZE
114#define FILTER_HISTORY_SIZE 512
115#endif
116
117#ifndef PREDICTOR_HISTORY_SIZE
118#define PREDICTOR_HISTORY_SIZE 512
119#endif
120
121#ifndef FILTER_BITS
122#define FILTER_BITS 16
123#endif
124
125
126#ifndef __ASSEMBLER__
127
128#if defined(CPU_ARM) && (ARM_ARCH < 5 || defined(USE_IRAM))
129/* optimised unsigned integer division for ARMv4, in IRAM */
130unsigned udiv32_arm(unsigned a, unsigned b);
131#define UDIV32(a, b) udiv32_arm(a, b)
132#else
133/* default */
134#define UDIV32(a, b) (a / b)
135#endif
136
137#include <inttypes.h>
138#if FILTER_BITS == 32
139typedef int32_t filter_int;
140#elif FILTER_BITS == 16
141typedef int16_t filter_int;
142#endif
143#endif
144
145#endif /* _DEMAC_CONFIG_H */