FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
int_altivec.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Luca Barbato <lu_zero@gentoo.org>
3  *
4  * This file is part of FFmpeg.
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 /**
22  * @file
23  * miscellaneous integer operations
24  */
25 
26 #include "config.h"
27 #if HAVE_ALTIVEC_H
28 #include <altivec.h>
29 #endif
30 
31 #include "libavutil/attributes.h"
34 #include "libavcodec/dsputil.h"
35 #include "dsputil_altivec.h"
36 
37 static int32_t scalarproduct_int16_altivec(const int16_t *v1, const int16_t *v2,
38  int order)
39 {
40  int i;
41  LOAD_ZERO;
42  register vec_s16 vec1;
43  register vec_s32 res = vec_splat_s32(0), t;
44  int32_t ires;
45 
46  for (i = 0; i < order; i += 8) {
47  vec1 = vec_unaligned_load(v1);
48  t = vec_msum(vec1, vec_ld(0, v2), zero_s32v);
49  res = vec_sums(t, res);
50  v1 += 8;
51  v2 += 8;
52  }
53  res = vec_splat(res, 3);
54  vec_ste(res, 0, &ires);
55 
56  return ires;
57 }
58 
60 {
62 }