diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-06-25 21:32:25 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-04-25 22:13:20 +0200 |
commit | f40bfc9267b13b54e6379dfe7539447662879d24 (patch) | |
tree | 9b20069d5e62809ff434061ad730096836f916f2 /apps/codecs/lib/mdct.h | |
parent | a0009907de7a0107d49040d8a180f140e2eff299 (diff) | |
download | rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.tar.gz rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.zip |
Add codecs to librbcodec.
Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97
Reviewed-on: http://gerrit.rockbox.org/137
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'apps/codecs/lib/mdct.h')
-rw-r--r-- | apps/codecs/lib/mdct.h | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/apps/codecs/lib/mdct.h b/apps/codecs/lib/mdct.h deleted file mode 100644 index 48d1c25a55..0000000000 --- a/apps/codecs/lib/mdct.h +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
1 | /* | ||
2 | * WMA compatible decoder | ||
3 | * Copyright (c) 2002 The FFmpeg Project. | ||
4 | * | ||
5 | * This library is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU Lesser General Public | ||
7 | * License as published by the Free Software Foundation; either | ||
8 | * version 2 of the License, or (at your option) any later version. | ||
9 | * | ||
10 | * This library is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | * Lesser General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU Lesser General Public | ||
16 | * License along with this library; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef CODECLIB_MDCT_H_INCLUDED | ||
21 | #define CODECLIB_MDCT_H_INCLUDED | ||
22 | |||
23 | //#include "types.h" | ||
24 | #include "fft.h" | ||
25 | |||
26 | void ff_imdct_calc(unsigned int nbits, fixed32 *output, const fixed32 *input); | ||
27 | void ff_imdct_half(unsigned int nbits, fixed32 *output, const fixed32 *input); | ||
28 | |||
29 | #ifdef CPU_ARM | ||
30 | |||
31 | /*Sign-15.16 format */ | ||
32 | #define fixmul32b(x, y) \ | ||
33 | ({ int32_t __hi; \ | ||
34 | uint32_t __lo; \ | ||
35 | int32_t __result; \ | ||
36 | asm ("smull %0, %1, %3, %4\n\t" \ | ||
37 | "mov %2, %1, lsl #1" \ | ||
38 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ | ||
39 | : "%r" (x), "r" (y) \ | ||
40 | : "cc" ); \ | ||
41 | __result; \ | ||
42 | }) | ||
43 | |||
44 | #elif defined(CPU_COLDFIRE) | ||
45 | |||
46 | static inline int32_t fixmul32b(int32_t x, int32_t y) | ||
47 | { | ||
48 | asm ( | ||
49 | "mac.l %[x], %[y], %%acc0 \n" /* multiply */ | ||
50 | "movclr.l %%acc0, %[x] \n" /* get higher half */ | ||
51 | : [x] "+d" (x) | ||
52 | : [y] "d" (y) | ||
53 | ); | ||
54 | return x; | ||
55 | } | ||
56 | |||
57 | #else | ||
58 | |||
59 | static inline fixed32 fixmul32b(fixed32 x, fixed32 y) | ||
60 | { | ||
61 | fixed64 temp; | ||
62 | |||
63 | temp = x; | ||
64 | temp *= y; | ||
65 | |||
66 | temp >>= 31; //16+31-16 = 31 bits | ||
67 | |||
68 | return (fixed32)temp; | ||
69 | } | ||
70 | #endif | ||
71 | |||
72 | |||
73 | #ifdef CPU_ARM | ||
74 | static inline | ||
75 | void CMUL(fixed32 *x, fixed32 *y, | ||
76 | fixed32 a, fixed32 b, | ||
77 | fixed32 t, fixed32 v) | ||
78 | { | ||
79 | /* This version loses one bit of precision. Could be solved at the cost | ||
80 | * of 2 extra cycles if it becomes an issue. */ | ||
81 | int x1, y1, l; | ||
82 | asm( | ||
83 | "smull %[l], %[y1], %[b], %[t] \n" | ||
84 | "smlal %[l], %[y1], %[a], %[v] \n" | ||
85 | "rsb %[b], %[b], #0 \n" | ||
86 | "smull %[l], %[x1], %[a], %[t] \n" | ||
87 | "smlal %[l], %[x1], %[b], %[v] \n" | ||
88 | : [l] "=&r" (l), [x1]"=&r" (x1), [y1]"=&r" (y1), [b] "+r" (b) | ||
89 | : [a] "r" (a), [t] "r" (t), [v] "r" (v) | ||
90 | : "cc" | ||
91 | ); | ||
92 | *x = x1 << 1; | ||
93 | *y = y1 << 1; | ||
94 | } | ||
95 | #elif defined CPU_COLDFIRE | ||
96 | static inline | ||
97 | void CMUL(fixed32 *x, fixed32 *y, | ||
98 | fixed32 a, fixed32 b, | ||
99 | fixed32 t, fixed32 v) | ||
100 | { | ||
101 | asm volatile ("mac.l %[a], %[t], %%acc0;" | ||
102 | "msac.l %[b], %[v], %%acc0;" | ||
103 | "mac.l %[b], %[t], %%acc1;" | ||
104 | "mac.l %[a], %[v], %%acc1;" | ||
105 | "movclr.l %%acc0, %[a];" | ||
106 | "move.l %[a], (%[x]);" | ||
107 | "movclr.l %%acc1, %[a];" | ||
108 | "move.l %[a], (%[y]);" | ||
109 | : [a] "+&r" (a) | ||
110 | : [x] "a" (x), [y] "a" (y), | ||
111 | [b] "r" (b), [t] "r" (t), [v] "r" (v) | ||
112 | : "cc", "memory"); | ||
113 | } | ||
114 | #else | ||
115 | static inline | ||
116 | void CMUL(fixed32 *pre, | ||
117 | fixed32 *pim, | ||
118 | fixed32 are, | ||
119 | fixed32 aim, | ||
120 | fixed32 bre, | ||
121 | fixed32 bim) | ||
122 | { | ||
123 | //int64_t x,y; | ||
124 | fixed32 _aref = are; | ||
125 | fixed32 _aimf = aim; | ||
126 | fixed32 _bref = bre; | ||
127 | fixed32 _bimf = bim; | ||
128 | fixed32 _r1 = fixmul32b(_bref, _aref); | ||
129 | fixed32 _r2 = fixmul32b(_bimf, _aimf); | ||
130 | fixed32 _r3 = fixmul32b(_bref, _aimf); | ||
131 | fixed32 _r4 = fixmul32b(_bimf, _aref); | ||
132 | *pre = _r1 - _r2; | ||
133 | *pim = _r3 + _r4; | ||
134 | |||
135 | } | ||
136 | #endif | ||
137 | |||
138 | |||
139 | #endif // CODECLIB_MDCT_H_INCLUDED | ||