2 * WMA compatible decoder
3 * Copyright (c) 2002 The FFmpeg Project.
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.
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.
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
20 #ifndef CODECLIB_MDCT_H_INCLUDED
21 #define CODECLIB_MDCT_H_INCLUDED
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
);
31 /*Sign-15.16 format */
32 #define fixmul32b(x, y) \
36 asm ("smull %0, %1, %3, %4\n\t" \
37 "mov %2, %1, lsl #1" \
38 : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \
44 #elif defined(CPU_COLDFIRE)
46 static inline int32_t fixmul32b(int32_t x
, int32_t y
)
49 "mac.l %[x], %[y], %%acc0 \n" /* multiply */
50 "movclr.l %%acc0, %[x] \n" /* get higher half */
59 static inline fixed32
fixmul32b(fixed32 x
, fixed32 y
)
66 temp
>>= 31; //16+31-16 = 31 bits
75 void CMUL(fixed32
*x
, fixed32
*y
,
79 /* This version loses one bit of precision. Could be solved at the cost
80 * of 2 extra cycles if it becomes an issue. */
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
)
95 #elif defined CPU_COLDFIRE
97 void CMUL(fixed32
*x
, fixed32
*y
,
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]);"
110 : [x
] "a" (x
), [y
] "a" (y
),
111 [b
] "r" (b
), [t
] "r" (t
), [v
] "r" (v
)
116 void CMUL(fixed32
*pre
,
128 fixed32 _r1
= fixmul32b(_bref
, _aref
);
129 fixed32 _r2
= fixmul32b(_bimf
, _aimf
);
130 fixed32 _r3
= fixmul32b(_bref
, _aimf
);
131 fixed32 _r4
= fixmul32b(_bimf
, _aref
);
139 #endif // CODECLIB_MDCT_H_INCLUDED