mirror of https://github.com/FFmpeg/FFmpeg.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.9 KiB
73 lines
1.9 KiB
18 years ago
|
/*
|
||
|
* Copyright (c) 2007 Luca Barbato <lu_zero@gentoo.org>
|
||
|
*
|
||
|
* This file is part of FFmpeg.
|
||
|
*
|
||
|
* FFmpeg is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2.1 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* FFmpeg is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public
|
||
|
* License along with FFmpeg; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||
|
*/
|
||
|
|
||
|
/**
|
||
11 years ago
|
* @file
|
||
11 years ago
|
* miscellaneous audio operations
|
||
11 years ago
|
*/
|
||
18 years ago
|
|
||
16 years ago
|
#include "config.h"
|
||
|
#if HAVE_ALTIVEC_H
|
||
|
#include <altivec.h>
|
||
|
#endif
|
||
18 years ago
|
|
||
12 years ago
|
#include "libavutil/attributes.h"
|
||
11 years ago
|
#include "libavutil/cpu.h"
|
||
|
#include "libavutil/ppc/cpu.h"
|
||
13 years ago
|
#include "libavutil/ppc/types_altivec.h"
|
||
11 years ago
|
#include "libavutil/ppc/util_altivec.h"
|
||
11 years ago
|
#include "libavcodec/audiodsp.h"
|
||
|
|
||
|
#if HAVE_ALTIVEC
|
||
18 years ago
|
|
||
13 years ago
|
static int32_t scalarproduct_int16_altivec(const int16_t *v1, const int16_t *v2,
|
||
13 years ago
|
int order)
|
||
17 years ago
|
{
|
||
|
int i;
|
||
|
LOAD_ZERO;
|
||
13 years ago
|
register vec_s16 vec1;
|
||
16 years ago
|
register vec_s32 res = vec_splat_s32(0), t;
|
||
16 years ago
|
int32_t ires;
|
||
17 years ago
|
|
||
11 years ago
|
for (i = 0; i < order; i += 8) {
|
||
12 years ago
|
vec1 = vec_unaligned_load(v1);
|
||
11 years ago
|
t = vec_msum(vec1, vec_ld(0, v2), zero_s32v);
|
||
|
res = vec_sums(t, res);
|
||
|
v1 += 8;
|
||
|
v2 += 8;
|
||
17 years ago
|
}
|
||
|
res = vec_splat(res, 3);
|
||
|
vec_ste(res, 0, &ires);
|
||
11 years ago
|
|
||
17 years ago
|
return ires;
|
||
|
}
|
||
|
|
||
11 years ago
|
#endif /* HAVE_ALTIVEC */
|
||
|
|
||
|
av_cold void ff_audiodsp_init_ppc(AudioDSPContext *c)
|
||
18 years ago
|
{
|
||
11 years ago
|
#if HAVE_ALTIVEC
|
||
|
if (!PPC_ALTIVEC(av_get_cpu_flags()))
|
||
|
return;
|
||
|
|
||
17 years ago
|
c->scalarproduct_int16 = scalarproduct_int16_altivec;
|
||
11 years ago
|
#endif /* HAVE_ALTIVEC */
|
||
18 years ago
|
}
|