2 * Copyright (c) 2007 Luca Barbato <lu_zero@gentoo.org>
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 * miscellaneous audio operations
31 #include "libavutil/attributes.h"
32 #include "libavutil/cpu.h"
33 #include "libavutil/ppc/cpu.h"
34 #include "libavutil/ppc/types_altivec.h"
35 #include "libavutil/ppc/util_altivec.h"
36 #include "libavcodec/audiodsp.h"
40 static int32_t scalarproduct_int16_altivec(const int16_t *v1
, const int16_t *v2
,
45 register vec_s16 vec1
;
46 register vec_s32 res
= vec_splat_s32(0), t
;
49 for (i
= 0; i
< order
; i
+= 8) {
50 vec1
= vec_unaligned_load(v1
);
51 t
= vec_msum(vec1
, vec_ld(0, v2
), zero_s32v
);
52 res
= vec_sums(t
, res
);
56 res
= vec_splat(res
, 3);
57 vec_ste(res
, 0, &ires
);
62 #endif /* HAVE_ALTIVEC */
64 av_cold
void ff_audiodsp_init_ppc(AudioDSPContext
*c
)
67 if (!PPC_ALTIVEC(av_get_cpu_flags()))
70 c
->scalarproduct_int16
= scalarproduct_int16_altivec
;
71 #endif /* HAVE_ALTIVEC */