* FFT/IFFT transforms
* AltiVec-enabled
* Copyright (c) 2003 Romain Dolbeau <romain@dolbeau.org>
- * Based on code Copyright (c) 2002 Fabrice Bellard.
+ * Based on code Copyright (c) 2002 Fabrice Bellard
*
* This file is part of FFmpeg.
*
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../dsputil.h"
-
-#include "gcc_fixes.h"
-
+#include "libavcodec/fft.h"
+#include "dsputil_ppc.h"
+#include "util_altivec.h"
#include "dsputil_altivec.h"
-/*
- those three macros are from libavcodec/fft.c
- and are required for the reference C code
-*/
-/* butter fly op */
-#define BF(pre, pim, qre, qim, pre1, pim1, qre1, qim1) \
-{\
- FFTSample ax, ay, bx, by;\
- bx=pre1;\
- by=pim1;\
- ax=qre1;\
- ay=qim1;\
- pre = (bx + ax);\
- pim = (by + ay);\
- qre = (bx - ax);\
- qim = (by - ay);\
-}
-#define MUL16(a,b) ((a) * (b))
-#define CMUL(pre, pim, are, aim, bre, bim) \
-{\
- pre = (MUL16(are, bre) - MUL16(aim, bim));\
- pim = (MUL16(are, bim) + MUL16(bre, aim));\
-}
-
-
/**
* Do a complex FFT with the parameters defined in ff_fft_init(). The
* input data must be permuted before with s->revtab table. No
* that successive MUL + ADD/SUB have been merged into
* fused multiply-add ('vec_madd' in altivec)
*/
-void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z)
+static void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z)
{
POWERPC_PERF_DECLARE(altivec_fft_num, s->nbits >= 6);
register const vector float vczero = (const vector float)vec_splat_u32(0.);
c1 = vcii(p,p,n,n);
- if (s->inverse)
- {
- c2 = vcii(p,p,n,p);
- }
- else
- {
- c2 = vcii(p,p,p,n);
- }
+ if (s->inverse) {
+ c2 = vcii(p,p,n,p);
+ } else {
+ c2 = vcii(p,p,p,n);
+ }
j = (np >> 2);
do {
POWERPC_PERF_STOP_COUNT(altivec_fft_num, s->nbits >= 6);
}
+
+av_cold void ff_fft_init_altivec(FFTContext *s)
+{
+ s->fft_calc = ff_fft_calc_altivec;
+ s->split_radix = 0;
+}