2008-11-16 17:49:37 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
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__
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "codeclib.h"
|
2008-11-16 17:49:37 +00:00
|
|
|
#include <codecs.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define APE_OUTPUT_DEPTH 29
|
|
|
|
|
2008-11-19 00:34:48 +00:00
|
|
|
/* On ARMv4, using 32 bit ints for the filters is faster. */
|
|
|
|
#if defined(CPU_ARM) && (ARM_ARCH == 4)
|
|
|
|
#define FILTER_BITS 32
|
|
|
|
#endif
|
|
|
|
|
2010-01-30 02:20:54 +00:00
|
|
|
#if !defined(CPU_PP) && !defined(CPU_S5L870X)
|
|
|
|
#define FILTER256_IRAM
|
|
|
|
#endif
|
|
|
|
|
2010-02-04 20:20:10 +00:00
|
|
|
#if CONFIG_CPU == PP5002 || defined(CPU_S5L870X)
|
2008-11-19 00:34:48 +00:00
|
|
|
/* Code in IRAM for speed, not enough IRAM for the insane filter buffer. */
|
2008-11-16 17:49:37 +00:00
|
|
|
#define ICODE_SECTION_DEMAC_ARM .icode
|
|
|
|
#define ICODE_ATTR_DEMAC ICODE_ATTR
|
|
|
|
#define IBSS_ATTR_DEMAC_INSANEBUF
|
2010-02-04 20:20:10 +00:00
|
|
|
#elif defined(CPU_PP502x)
|
|
|
|
/* Insane filter buffer not in IRAM due to division table. */
|
2008-11-19 00:34:48 +00:00
|
|
|
#define ICODE_SECTION_DEMAC_ARM .text
|
|
|
|
#define ICODE_ATTR_DEMAC
|
|
|
|
#define IBSS_ATTR_DEMAC_INSANEBUF
|
2008-11-16 17:49:37 +00:00
|
|
|
#else
|
|
|
|
#define ICODE_SECTION_DEMAC_ARM .text
|
|
|
|
#define ICODE_ATTR_DEMAC
|
2010-02-04 20:20:10 +00:00
|
|
|
#define IBSS_ATTR_DEMAC_INSANEBUF IBSS_ATTR
|
2008-11-16 17:49:37 +00:00
|
|
|
#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
|
|
|
|
|
2008-11-24 18:40:49 +00:00
|
|
|
/* Use to give gcc hints on which branch is most likely taken */
|
|
|
|
#if defined(__GNUC__) && __GNUC__ >= 3
|
|
|
|
#define LIKELY(x) __builtin_expect(!!(x), 1)
|
|
|
|
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
|
|
|
|
#else
|
|
|
|
#define LIKELY(x) (x)
|
|
|
|
#define UNLIKELY(x) (x)
|
|
|
|
#endif
|
|
|
|
|
2008-11-16 17:49:37 +00:00
|
|
|
#endif /* !ROCKBOX */
|
|
|
|
|
|
|
|
/* Defaults */
|
|
|
|
|
|
|
|
#ifndef FILTER_HISTORY_SIZE
|
|
|
|
#define FILTER_HISTORY_SIZE 512
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PREDICTOR_HISTORY_SIZE
|
|
|
|
#define PREDICTOR_HISTORY_SIZE 512
|
2008-11-19 00:34:48 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FILTER_BITS
|
|
|
|
#define FILTER_BITS 16
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLER__
|
2010-02-04 05:49:37 +00:00
|
|
|
|
|
|
|
#if defined(CPU_ARM) && (ARM_ARCH < 5 || defined(USE_IRAM))
|
|
|
|
/* optimised unsigned integer division for ARMv4, in IRAM */
|
|
|
|
unsigned udiv32_arm(unsigned a, unsigned b);
|
|
|
|
#define UDIV32(a, b) udiv32_arm(a, b)
|
|
|
|
#else
|
|
|
|
/* default */
|
|
|
|
#define UDIV32(a, b) (a / b)
|
|
|
|
#endif
|
|
|
|
|
2008-11-19 00:34:48 +00:00
|
|
|
#include <inttypes.h>
|
|
|
|
#if FILTER_BITS == 32
|
|
|
|
typedef int32_t filter_int;
|
|
|
|
#elif FILTER_BITS == 16
|
|
|
|
typedef int16_t filter_int;
|
|
|
|
#endif
|
2008-11-16 17:49:37 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _DEMAC_CONFIG_H */
|