Branch optimisation in both C (giving hints to gcc - verified using -fprofile-arcs...
[kugel-rb.git] / apps / codecs / demac / libdemac / demac_config.h
blob986e5376c435127cad8147d46ebad6bde4412c25
1 /*
3 libdemac - A Monkey's Audio decoder
5 $Id$
7 Copyright (C) Dave Chapman 2007
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
25 #ifndef _DEMAC_CONFIG_H
26 #define _DEMAC_CONFIG_H
28 /* Build-time choices for libdemac.
29 * Note that this file is included by both .c and .S files. */
31 #ifdef ROCKBOX
33 #include "config.h"
35 #ifndef __ASSEMBLER__
36 #include "codeclib.h"
37 #include <codecs.h>
38 #endif
40 #define APE_OUTPUT_DEPTH 29
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
47 #if CONFIG_CPU == PP5002
48 /* Code in IRAM for speed, not enough IRAM for the insane filter buffer. */
49 #define ICODE_SECTION_DEMAC_ARM .icode
50 #define ICODE_ATTR_DEMAC ICODE_ATTR
51 #define IBSS_ATTR_DEMAC_INSANEBUF
52 #elif CONFIG_CPU == PP5020
53 /* Not enough IRAM for the insane filter buffer. */
54 #define ICODE_SECTION_DEMAC_ARM .text
55 #define ICODE_ATTR_DEMAC
56 #define IBSS_ATTR_DEMAC_INSANEBUF
57 #else
58 #define ICODE_SECTION_DEMAC_ARM .text
59 #define ICODE_ATTR_DEMAC
60 #define IBSS_ATTR_DEMAC_INSANEBUF IBSS_ATTR
61 #endif
63 #else /* !ROCKBOX */
65 #define APE_OUTPUT_DEPTH (ape_ctx->bps)
67 #define IBSS_ATTR
68 #define IBSS_ATTR_DEMAC_INSANEBUF
69 #define ICONST_ATTR
70 #define ICODE_ATTR
71 #define ICODE_ATTR_DEMAC
73 /* Use to give gcc hints on which branch is most likely taken */
74 #if defined(__GNUC__) && __GNUC__ >= 3
75 #define LIKELY(x) __builtin_expect(!!(x), 1)
76 #define UNLIKELY(x) __builtin_expect(!!(x), 0)
77 #else
78 #define LIKELY(x) (x)
79 #define UNLIKELY(x) (x)
80 #endif
82 #endif /* !ROCKBOX */
84 /* Defaults */
86 #ifndef UDIV32
87 #define UDIV32(a, b) (a / b)
88 #endif
90 #ifndef FILTER_HISTORY_SIZE
91 #define FILTER_HISTORY_SIZE 512
92 #endif
94 #ifndef PREDICTOR_HISTORY_SIZE
95 #define PREDICTOR_HISTORY_SIZE 512
96 #endif
98 #ifndef FILTER_BITS
99 #define FILTER_BITS 16
100 #endif
103 #ifndef __ASSEMBLER__
104 #include <inttypes.h>
105 #if FILTER_BITS == 32
106 typedef int32_t filter_int;
107 #elif FILTER_BITS == 16
108 typedef int16_t filter_int;
109 #endif
110 #endif
112 #endif /* _DEMAC_CONFIG_H */