summaryrefslogtreecommitdiff
path: root/ffmpeg/libavcodec/ppc/fft_altivec.c
diff options
context:
space:
mode:
Diffstat (limited to 'ffmpeg/libavcodec/ppc/fft_altivec.c')
-rw-r--r--ffmpeg/libavcodec/ppc/fft_altivec.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/ffmpeg/libavcodec/ppc/fft_altivec.c b/ffmpeg/libavcodec/ppc/fft_altivec.c
index 651ee26..2357198 100644
--- a/ffmpeg/libavcodec/ppc/fft_altivec.c
+++ b/ffmpeg/libavcodec/ppc/fft_altivec.c
@@ -20,6 +20,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
+#include "libavutil/cpu.h"
#include "libavutil/ppc/types_altivec.h"
#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/fft.h"
@@ -36,8 +38,8 @@
void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z);
void ff_fft_calc_interleave_altivec(FFTContext *s, FFTComplex *z);
-#if HAVE_GNU_AS
-static void ff_imdct_half_altivec(FFTContext *s, FFTSample *output, const FFTSample *input)
+#if HAVE_GNU_AS && HAVE_ALTIVEC
+static void imdct_half_altivec(FFTContext *s, FFTSample *output, const FFTSample *input)
{
int j, k;
int n = 1 << s->mdct_bits;
@@ -117,7 +119,7 @@ static void ff_imdct_half_altivec(FFTContext *s, FFTSample *output, const FFTSam
} while(k >= 0);
}
-static void ff_imdct_calc_altivec(FFTContext *s, FFTSample *output, const FFTSample *input)
+static void imdct_calc_altivec(FFTContext *s, FFTSample *output, const FFTSample *input)
{
int k;
int n = 1 << s->mdct_bits;
@@ -127,7 +129,7 @@ static void ff_imdct_calc_altivec(FFTContext *s, FFTSample *output, const FFTSam
vec_u32 *p0 = (vec_u32*)(output+n4);
vec_u32 *p1 = (vec_u32*)(output+n4*3);
- ff_imdct_half_altivec(s, output+n4, input);
+ imdct_half_altivec(s, output + n4, input);
for (k = 0; k < n16; k++) {
vec_u32 a = p0[k] ^ sign;
@@ -136,15 +138,18 @@ static void ff_imdct_calc_altivec(FFTContext *s, FFTSample *output, const FFTSam
p1[k] = vec_perm(b, b, vcprm(3,2,1,0));
}
}
-#endif /* HAVE_GNU_AS */
+#endif /* HAVE_GNU_AS && HAVE_ALTIVEC */
-av_cold void ff_fft_init_altivec(FFTContext *s)
+av_cold void ff_fft_init_ppc(FFTContext *s)
{
-#if HAVE_GNU_AS
+#if HAVE_GNU_AS && HAVE_ALTIVEC
+ if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
+ return;
+
s->fft_calc = ff_fft_calc_interleave_altivec;
if (s->mdct_bits >= 5) {
- s->imdct_calc = ff_imdct_calc_altivec;
- s->imdct_half = ff_imdct_half_altivec;
+ s->imdct_calc = imdct_calc_altivec;
+ s->imdct_half = imdct_half_altivec;
}
-#endif
+#endif /* HAVE_GNU_AS && HAVE_ALTIVEC */
}