annotate libmpeg2/motion_comp_altivec.c @ 36029:49be954ad61a

Move variable declarations and definitions where they belong.
author ib
date Sun, 31 Mar 2013 22:36:42 +0000
parents 25337a2147e7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
1 /*
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
2 * motion_comp_altivec.c
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
3 * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
5 *
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
6 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
7 * See http://libmpeg2.sourceforge.net/ for updates.
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
8 *
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
9 * mpeg2dec is free software; you can redistribute it and/or modify
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
12 * (at your option) any later version.
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
13 *
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
14 * mpeg2dec is distributed in the hope that it will be useful,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
17 * GNU General Public License for more details.
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
18 *
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
22 */
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
23
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
24 #include "config.h"
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
25
28290
25337a2147e7 Lots and lots of #ifdef ARCH_... -> #if ARCH_...
reimar
parents: 12932
diff changeset
26 #if ARCH_PPC
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
27
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
28 #ifdef HAVE_ALTIVEC_H
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
29 #include <altivec.h>
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
30 #endif
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
31 #include <inttypes.h>
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
32
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
33 #include "mpeg2.h"
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 10271
diff changeset
34 #include "attributes.h"
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
35 #include "mpeg2_internal.h"
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
36
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
37 typedef vector signed char vector_s8_t;
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
38 typedef vector unsigned char vector_u8_t;
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
39 typedef vector signed short vector_s16_t;
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
40 typedef vector unsigned short vector_u16_t;
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
41 typedef vector signed int vector_s32_t;
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
42 typedef vector unsigned int vector_u32_t;
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
43
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
44 #ifndef COFFEE_BREAK /* Workarounds for gcc suckage */
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
45
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
46 static inline vector_u8_t my_vec_ld (int const A, const uint8_t * const B)
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
47 {
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
48 return vec_ld (A, (uint8_t *)B);
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
49 }
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
50 #undef vec_ld
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
51 #define vec_ld my_vec_ld
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
52
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
53 static inline vector_u8_t my_vec_and (vector_u8_t const A, vector_u8_t const B)
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
54 {
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
55 return vec_and (A, B);
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
56 }
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
57 #undef vec_and
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
58 #define vec_and my_vec_and
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
59
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
60 static inline vector_u8_t my_vec_avg (vector_u8_t const A, vector_u8_t const B)
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
61 {
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
62 return vec_avg (A, B);
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
63 }
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
64 #undef vec_avg
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
65 #define vec_avg my_vec_avg
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
66
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
67 #endif
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
68
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
69 static void MC_put_o_16_altivec (uint8_t * dest, const uint8_t * ref,
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
70 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
71 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
72 vector_u8_t perm, ref0, ref1, tmp;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
73
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
74 perm = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
75
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
76 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
77
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
78 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
79 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
80 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
81 tmp = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
82
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
83 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
84 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
85 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
86 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
87 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
88 tmp = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
89
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
90 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
91 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
92 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
93 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
94 dest += 2*stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
95 tmp = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
96 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
97
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
98 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
99 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
100 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
101 tmp = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
102 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
103 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
104
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
105 static void MC_put_o_8_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
106 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
107 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
108 vector_u8_t perm0, perm1, tmp0, tmp1, ref0, ref1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
109
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
110 tmp0 = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
111 tmp0 = vec_mergeh (tmp0, tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
112 perm0 = vec_pack ((vector_u16_t)tmp0, (vector_u16_t)tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
113 tmp1 = vec_lvsl (stride, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
114 tmp1 = vec_mergeh (tmp1, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
115 perm1 = vec_pack ((vector_u16_t)tmp1, (vector_u16_t)tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
116
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
117 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
118
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
119 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
120 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
121 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
122 tmp0 = vec_perm (ref0, ref1, perm0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
123
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
124 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
125 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
126 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
127 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
128 vec_ste ((vector_u32_t)tmp0, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
129 vec_ste ((vector_u32_t)tmp0, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
130 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
131 tmp1 = vec_perm (ref0, ref1, perm1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
132
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
133 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
134 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
135 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
136 vec_ste ((vector_u32_t)tmp1, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
137 vec_ste ((vector_u32_t)tmp1, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
138 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
139 tmp0 = vec_perm (ref0, ref1, perm0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
140 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
141
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
142 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
143 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
144 vec_ste ((vector_u32_t)tmp0, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
145 vec_ste ((vector_u32_t)tmp0, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
146 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
147 tmp1 = vec_perm (ref0, ref1, perm1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
148 vec_ste ((vector_u32_t)tmp1, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
149 vec_ste ((vector_u32_t)tmp1, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
150 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
151
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
152 static void MC_put_x_16_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
153 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
154 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
155 vector_u8_t permA, permB, ref0, ref1, tmp;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
156
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
157 permA = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
158 permB = vec_add (permA, vec_splat_u8 (1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
159
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
160 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
161
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
162 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
163 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
164 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
165 tmp = vec_avg (vec_perm (ref0, ref1, permA),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
166 vec_perm (ref0, ref1, permB));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
167
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
168 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
169 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
170 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
171 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
172 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
173 tmp = vec_avg (vec_perm (ref0, ref1, permA),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
174 vec_perm (ref0, ref1, permB));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
175
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
176 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
177 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
178 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
179 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
180 dest += 2*stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
181 tmp = vec_avg (vec_perm (ref0, ref1, permA),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
182 vec_perm (ref0, ref1, permB));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
183 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
184
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
185 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
186 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
187 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
188 tmp = vec_avg (vec_perm (ref0, ref1, permA),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
189 vec_perm (ref0, ref1, permB));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
190 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
191 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
192
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
193 static void MC_put_x_8_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
194 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
195 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
196 vector_u8_t perm0A, perm0B, perm1A, perm1B, ones, tmp0, tmp1, ref0, ref1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
197
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
198 ones = vec_splat_u8 (1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
199 tmp0 = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
200 tmp0 = vec_mergeh (tmp0, tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
201 perm0A = vec_pack ((vector_u16_t)tmp0, (vector_u16_t)tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
202 perm0B = vec_add (perm0A, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
203 tmp1 = vec_lvsl (stride, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
204 tmp1 = vec_mergeh (tmp1, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
205 perm1A = vec_pack ((vector_u16_t)tmp1, (vector_u16_t)tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
206 perm1B = vec_add (perm1A, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
207
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
208 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
209
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
210 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
211 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
212 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
213 tmp0 = vec_avg (vec_perm (ref0, ref1, perm0A),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
214 vec_perm (ref0, ref1, perm0B));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
215
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
216 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
217 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
218 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
219 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
220 vec_ste ((vector_u32_t)tmp0, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
221 vec_ste ((vector_u32_t)tmp0, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
222 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
223 tmp1 = vec_avg (vec_perm (ref0, ref1, perm1A),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
224 vec_perm (ref0, ref1, perm1B));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
225
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
226 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
227 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
228 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
229 vec_ste ((vector_u32_t)tmp1, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
230 vec_ste ((vector_u32_t)tmp1, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
231 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
232 tmp0 = vec_avg (vec_perm (ref0, ref1, perm0A),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
233 vec_perm (ref0, ref1, perm0B));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
234 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
235
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
236 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
237 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
238 vec_ste ((vector_u32_t)tmp0, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
239 vec_ste ((vector_u32_t)tmp0, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
240 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
241 tmp1 = vec_avg (vec_perm (ref0, ref1, perm1A),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
242 vec_perm (ref0, ref1, perm1B));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
243 vec_ste ((vector_u32_t)tmp1, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
244 vec_ste ((vector_u32_t)tmp1, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
245 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
246
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
247 static void MC_put_y_16_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
248 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
249 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
250 vector_u8_t perm, ref0, ref1, tmp0, tmp1, tmp;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
251
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
252 perm = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
253
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
254 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
255
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
256 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
257 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
258 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
259 tmp0 = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
260 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
261 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
262 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
263 tmp1 = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
264 tmp = vec_avg (tmp0, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
265
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
266 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
267 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
268 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
269 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
270 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
271 tmp0 = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
272 tmp = vec_avg (tmp0, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
273
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
274 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
275 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
276 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
277 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
278 dest += 2*stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
279 tmp1 = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
280 tmp = vec_avg (tmp0, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
281 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
282
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
283 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
284 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
285 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
286 tmp0 = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
287 tmp = vec_avg (tmp0, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
288 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
289 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
290
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
291 static void MC_put_y_8_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
292 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
293 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
294 vector_u8_t perm0, perm1, tmp0, tmp1, tmp, ref0, ref1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
295
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
296 tmp0 = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
297 tmp0 = vec_mergeh (tmp0, tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
298 perm0 = vec_pack ((vector_u16_t)tmp0, (vector_u16_t)tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
299 tmp1 = vec_lvsl (stride, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
300 tmp1 = vec_mergeh (tmp1, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
301 perm1 = vec_pack ((vector_u16_t)tmp1, (vector_u16_t)tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
302
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
303 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
304
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
305 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
306 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
307 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
308 tmp0 = vec_perm (ref0, ref1, perm0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
309 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
310 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
311 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
312 tmp1 = vec_perm (ref0, ref1, perm1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
313 tmp = vec_avg (tmp0, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
314
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
315 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
316 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
317 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
318 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
319 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
320 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
321 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
322 tmp0 = vec_perm (ref0, ref1, perm0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
323 tmp = vec_avg (tmp0, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
324
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
325 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
326 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
327 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
328 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
329 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
330 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
331 tmp1 = vec_perm (ref0, ref1, perm1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
332 tmp = vec_avg (tmp0, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
333 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
334
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
335 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
336 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
337 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
338 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
339 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
340 tmp0 = vec_perm (ref0, ref1, perm0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
341 tmp = vec_avg (tmp0, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
342 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
343 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
344 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
345
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
346 static void MC_put_xy_16_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
347 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
348 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
349 vector_u8_t permA, permB, ref0, ref1, A, B, avg0, avg1, xor0, xor1, tmp;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
350 vector_u8_t ones;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
351
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
352 ones = vec_splat_u8 (1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
353 permA = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
354 permB = vec_add (permA, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
355
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
356 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
357
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
358 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
359 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
360 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
361 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
362 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
363 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
364 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
365
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
366 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
367 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
368 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
369 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
370 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
371 avg1 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
372 xor1 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
373 tmp = vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
374 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
375 vec_xor (avg0, avg1)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
376
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
377 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
378 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
379 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
380 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
381 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
382 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
383 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
384 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
385 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
386 tmp = vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
387 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
388 vec_xor (avg0, avg1)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
389
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
390 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
391 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
392 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
393 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
394 dest += 2*stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
395 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
396 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
397 avg1 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
398 xor1 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
399 tmp = vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
400 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
401 vec_xor (avg0, avg1)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
402 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
403
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
404 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
405 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
406 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
407 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
408 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
409 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
410 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
411 tmp = vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
412 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
413 vec_xor (avg0, avg1)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
414 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
415 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
416
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
417 static void MC_put_xy_8_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
418 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
419 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
420 vector_u8_t perm0A, perm0B, perm1A, perm1B, ref0, ref1, A, B;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
421 vector_u8_t avg0, avg1, xor0, xor1, tmp, ones;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
422
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
423 ones = vec_splat_u8 (1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
424 perm0A = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
425 perm0A = vec_mergeh (perm0A, perm0A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
426 perm0A = vec_pack ((vector_u16_t)perm0A, (vector_u16_t)perm0A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
427 perm0B = vec_add (perm0A, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
428 perm1A = vec_lvsl (stride, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
429 perm1A = vec_mergeh (perm1A, perm1A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
430 perm1A = vec_pack ((vector_u16_t)perm1A, (vector_u16_t)perm1A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
431 perm1B = vec_add (perm1A, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
432
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
433 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
434
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
435 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
436 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
437 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
438 A = vec_perm (ref0, ref1, perm0A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
439 B = vec_perm (ref0, ref1, perm0B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
440 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
441 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
442
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
443 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
444 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
445 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
446 A = vec_perm (ref0, ref1, perm1A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
447 B = vec_perm (ref0, ref1, perm1B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
448 avg1 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
449 xor1 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
450 tmp = vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
451 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
452 vec_xor (avg0, avg1)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
453
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
454 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
455 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
456 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
457 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
458 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
459 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
460 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
461 A = vec_perm (ref0, ref1, perm0A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
462 B = vec_perm (ref0, ref1, perm0B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
463 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
464 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
465 tmp = vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
466 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
467 vec_xor (avg0, avg1)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
468
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
469 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
470 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
471 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
472 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
473 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
474 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
475 A = vec_perm (ref0, ref1, perm1A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
476 B = vec_perm (ref0, ref1, perm1B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
477 avg1 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
478 xor1 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
479 tmp = vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
480 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
481 vec_xor (avg0, avg1)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
482 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
483
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
484 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
485 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
486 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
487 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
488 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
489 A = vec_perm (ref0, ref1, perm0A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
490 B = vec_perm (ref0, ref1, perm0B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
491 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
492 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
493 tmp = vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
494 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
495 vec_xor (avg0, avg1)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
496 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
497 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
498 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
499
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
500 #if 0
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
501 static void MC_put_xy_8_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
502 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
503 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
504 vector_u8_t permA, permB, ref0, ref1, A, B, C, D, tmp, zero, ones;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
505 vector_u16_t splat2, temp;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
506
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
507 ones = vec_splat_u8 (1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
508 permA = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
509 permB = vec_add (permA, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
510
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
511 zero = vec_splat_u8 (0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
512 splat2 = vec_splat_u16 (2);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
513
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
514 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
515 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
516 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
517 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
518 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
519 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
520 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
521 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
522 C = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
523 D = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
524
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
525 temp = vec_add (vec_add ((vector_u16_t)vec_mergeh (zero, A),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
526 (vector_u16_t)vec_mergeh (zero, B)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
527 vec_add ((vector_u16_t)vec_mergeh (zero, C),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
528 (vector_u16_t)vec_mergeh (zero, D)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
529 temp = vec_sr (vec_add (temp, splat2), splat2);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
530 tmp = vec_pack (temp, temp);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
531
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
532 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
533 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
534 tmp = vec_avg (vec_perm (ref0, ref1, permA),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
535 vec_perm (ref0, ref1, permB));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
536 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
537 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
538 #endif
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
539
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
540 static void MC_avg_o_16_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
541 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
542 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
543 vector_u8_t perm, ref0, ref1, tmp, prev;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
544
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
545 perm = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
546
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
547 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
548
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
549 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
550 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
551 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
552 prev = vec_ld (0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
553 tmp = vec_avg (prev, vec_perm (ref0, ref1, perm));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
554
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
555 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
556 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
557 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
558 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
559 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
560 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
561 tmp = vec_avg (prev, vec_perm (ref0, ref1, perm));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
562
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
563 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
564 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
565 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
566 prev = vec_ld (2*stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
567 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
568 dest += 2*stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
569 tmp = vec_avg (prev, vec_perm (ref0, ref1, perm));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
570 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
571
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
572 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
573 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
574 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
575 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
576 tmp = vec_avg (prev, vec_perm (ref0, ref1, perm));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
577 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
578 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
579
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
580 static void MC_avg_o_8_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
581 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
582 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
583 vector_u8_t perm0, perm1, tmp0, tmp1, ref0, ref1, prev;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
584
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
585 tmp0 = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
586 tmp0 = vec_mergeh (tmp0, tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
587 perm0 = vec_pack ((vector_u16_t)tmp0, (vector_u16_t)tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
588 tmp1 = vec_lvsl (stride, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
589 tmp1 = vec_mergeh (tmp1, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
590 perm1 = vec_pack ((vector_u16_t)tmp1, (vector_u16_t)tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
591
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
592 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
593
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
594 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
595 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
596 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
597 prev = vec_ld (0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
598 tmp0 = vec_avg (prev, vec_perm (ref0, ref1, perm0));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
599
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
600 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
601 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
602 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
603 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
604 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
605 vec_ste ((vector_u32_t)tmp0, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
606 vec_ste ((vector_u32_t)tmp0, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
607 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
608 tmp1 = vec_avg (prev, vec_perm (ref0, ref1, perm1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
609
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
610 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
611 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
612 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
613 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
614 vec_ste ((vector_u32_t)tmp1, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
615 vec_ste ((vector_u32_t)tmp1, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
616 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
617 tmp0 = vec_avg (prev, vec_perm (ref0, ref1, perm0));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
618 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
619
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
620 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
621 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
622 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
623 vec_ste ((vector_u32_t)tmp0, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
624 vec_ste ((vector_u32_t)tmp0, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
625 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
626 tmp1 = vec_avg (prev, vec_perm (ref0, ref1, perm1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
627 vec_ste ((vector_u32_t)tmp1, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
628 vec_ste ((vector_u32_t)tmp1, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
629 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
630
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
631 static void MC_avg_x_16_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
632 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
633 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
634 vector_u8_t permA, permB, ref0, ref1, tmp, prev;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
635
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
636 permA = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
637 permB = vec_add (permA, vec_splat_u8 (1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
638
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
639 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
640
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
641 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
642 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
643 prev = vec_ld (0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
644 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
645 tmp = vec_avg (prev, vec_avg (vec_perm (ref0, ref1, permA),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
646 vec_perm (ref0, ref1, permB)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
647
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
648 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
649 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
650 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
651 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
652 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
653 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
654 tmp = vec_avg (prev, vec_avg (vec_perm (ref0, ref1, permA),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
655 vec_perm (ref0, ref1, permB)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
656
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
657 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
658 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
659 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
660 prev = vec_ld (2*stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
661 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
662 dest += 2*stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
663 tmp = vec_avg (prev, vec_avg (vec_perm (ref0, ref1, permA),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
664 vec_perm (ref0, ref1, permB)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
665 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
666
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
667 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
668 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
669 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
670 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
671 tmp = vec_avg (prev, vec_avg (vec_perm (ref0, ref1, permA),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
672 vec_perm (ref0, ref1, permB)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
673 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
674 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
675
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
676 static void MC_avg_x_8_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
677 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
678 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
679 vector_u8_t perm0A, perm0B, perm1A, perm1B, ones, tmp0, tmp1, ref0, ref1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
680 vector_u8_t prev;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
681
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
682 ones = vec_splat_u8 (1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
683 tmp0 = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
684 tmp0 = vec_mergeh (tmp0, tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
685 perm0A = vec_pack ((vector_u16_t)tmp0, (vector_u16_t)tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
686 perm0B = vec_add (perm0A, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
687 tmp1 = vec_lvsl (stride, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
688 tmp1 = vec_mergeh (tmp1, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
689 perm1A = vec_pack ((vector_u16_t)tmp1, (vector_u16_t)tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
690 perm1B = vec_add (perm1A, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
691
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
692 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
693
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
694 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
695 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
696 prev = vec_ld (0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
697 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
698 tmp0 = vec_avg (prev, vec_avg (vec_perm (ref0, ref1, perm0A),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
699 vec_perm (ref0, ref1, perm0B)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
700
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
701 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
702 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
703 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
704 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
705 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
706 vec_ste ((vector_u32_t)tmp0, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
707 vec_ste ((vector_u32_t)tmp0, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
708 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
709 tmp1 = vec_avg (prev, vec_avg (vec_perm (ref0, ref1, perm1A),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
710 vec_perm (ref0, ref1, perm1B)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
711
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
712 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
713 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
714 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
715 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
716 vec_ste ((vector_u32_t)tmp1, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
717 vec_ste ((vector_u32_t)tmp1, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
718 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
719 tmp0 = vec_avg (prev, vec_avg (vec_perm (ref0, ref1, perm0A),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
720 vec_perm (ref0, ref1, perm0B)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
721 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
722
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
723 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
724 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
725 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
726 vec_ste ((vector_u32_t)tmp0, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
727 vec_ste ((vector_u32_t)tmp0, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
728 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
729 tmp1 = vec_avg (prev, vec_avg (vec_perm (ref0, ref1, perm1A),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
730 vec_perm (ref0, ref1, perm1B)));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
731 vec_ste ((vector_u32_t)tmp1, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
732 vec_ste ((vector_u32_t)tmp1, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
733 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
734
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
735 static void MC_avg_y_16_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
736 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
737 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
738 vector_u8_t perm, ref0, ref1, tmp0, tmp1, tmp, prev;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
739
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
740 perm = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
741
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
742 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
743
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
744 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
745 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
746 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
747 tmp0 = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
748 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
749 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
750 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
751 prev = vec_ld (0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
752 tmp1 = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
753 tmp = vec_avg (prev, vec_avg (tmp0, tmp1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
754
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
755 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
756 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
757 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
758 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
759 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
760 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
761 tmp0 = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
762 tmp = vec_avg (prev, vec_avg (tmp0, tmp1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
763
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
764 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
765 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
766 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
767 prev = vec_ld (2*stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
768 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
769 dest += 2*stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
770 tmp1 = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
771 tmp = vec_avg (prev, vec_avg (tmp0, tmp1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
772 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
773
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
774 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
775 ref1 = vec_ld (15, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
776 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
777 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
778 tmp0 = vec_perm (ref0, ref1, perm);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
779 tmp = vec_avg (prev, vec_avg (tmp0, tmp1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
780 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
781 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
782
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
783 static void MC_avg_y_8_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
784 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
785 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
786 vector_u8_t perm0, perm1, tmp0, tmp1, tmp, ref0, ref1, prev;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
787
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
788 tmp0 = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
789 tmp0 = vec_mergeh (tmp0, tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
790 perm0 = vec_pack ((vector_u16_t)tmp0, (vector_u16_t)tmp0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
791 tmp1 = vec_lvsl (stride, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
792 tmp1 = vec_mergeh (tmp1, tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
793 perm1 = vec_pack ((vector_u16_t)tmp1, (vector_u16_t)tmp1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
794
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
795 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
796
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
797 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
798 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
799 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
800 tmp0 = vec_perm (ref0, ref1, perm0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
801 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
802 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
803 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
804 prev = vec_ld (0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
805 tmp1 = vec_perm (ref0, ref1, perm1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
806 tmp = vec_avg (prev, vec_avg (tmp0, tmp1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
807
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
808 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
809 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
810 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
811 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
812 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
813 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
814 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
815 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
816 tmp0 = vec_perm (ref0, ref1, perm0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
817 tmp = vec_avg (prev, vec_avg (tmp0, tmp1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
818
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
819 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
820 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
821 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
822 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
823 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
824 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
825 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
826 tmp1 = vec_perm (ref0, ref1, perm1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
827 tmp = vec_avg (prev, vec_avg (tmp0, tmp1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
828 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
829
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
830 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
831 ref1 = vec_ld (7, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
832 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
833 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
834 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
835 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
836 tmp0 = vec_perm (ref0, ref1, perm0);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
837 tmp = vec_avg (prev, vec_avg (tmp0, tmp1));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
838 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
839 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
840 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
841
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
842 static void MC_avg_xy_16_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
843 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
844 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
845 vector_u8_t permA, permB, ref0, ref1, A, B, avg0, avg1, xor0, xor1, tmp;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
846 vector_u8_t ones, prev;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
847
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
848 ones = vec_splat_u8 (1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
849 permA = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
850 permB = vec_add (permA, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
851
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
852 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
853
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
854 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
855 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
856 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
857 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
858 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
859 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
860 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
861
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
862 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
863 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
864 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
865 prev = vec_ld (0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
866 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
867 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
868 avg1 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
869 xor1 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
870 tmp = vec_avg (prev, vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
871 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
872 vec_xor (avg0, avg1))));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
873
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
874 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
875 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
876 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
877 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
878 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
879 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
880 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
881 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
882 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
883 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
884 tmp = vec_avg (prev,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
885 vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
886 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
887 vec_xor (avg0, avg1))));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
888
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
889 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
890 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
891 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
892 prev = vec_ld (2*stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
893 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
894 dest += 2*stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
895 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
896 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
897 avg1 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
898 xor1 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
899 tmp = vec_avg (prev,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
900 vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
901 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
902 vec_xor (avg0, avg1))));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
903 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
904
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
905 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
906 ref1 = vec_ld (16, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
907 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
908 vec_st (tmp, 0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
909 A = vec_perm (ref0, ref1, permA);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
910 B = vec_perm (ref0, ref1, permB);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
911 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
912 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
913 tmp = vec_avg (prev, vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
914 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
915 vec_xor (avg0, avg1))));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
916 vec_st (tmp, stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
917 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
918
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
919 static void MC_avg_xy_8_altivec (uint8_t * dest, const uint8_t * ref,
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
920 const int stride, int height)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
921 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
922 vector_u8_t perm0A, perm0B, perm1A, perm1B, ref0, ref1, A, B;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
923 vector_u8_t avg0, avg1, xor0, xor1, tmp, ones, prev;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
924
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
925 ones = vec_splat_u8 (1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
926 perm0A = vec_lvsl (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
927 perm0A = vec_mergeh (perm0A, perm0A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
928 perm0A = vec_pack ((vector_u16_t)perm0A, (vector_u16_t)perm0A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
929 perm0B = vec_add (perm0A, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
930 perm1A = vec_lvsl (stride, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
931 perm1A = vec_mergeh (perm1A, perm1A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
932 perm1A = vec_pack ((vector_u16_t)perm1A, (vector_u16_t)perm1A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
933 perm1B = vec_add (perm1A, ones);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
934
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
935 height = (height >> 1) - 1;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
936
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
937 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
938 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
939 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
940 A = vec_perm (ref0, ref1, perm0A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
941 B = vec_perm (ref0, ref1, perm0B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
942 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
943 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
944
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
945 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
946 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
947 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
948 prev = vec_ld (0, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
949 A = vec_perm (ref0, ref1, perm1A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
950 B = vec_perm (ref0, ref1, perm1B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
951 avg1 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
952 xor1 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
953 tmp = vec_avg (prev, vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
954 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
955 vec_xor (avg0, avg1))));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
956
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
957 do {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
958 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
959 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
960 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
961 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
962 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
963 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
964 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
965 A = vec_perm (ref0, ref1, perm0A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
966 B = vec_perm (ref0, ref1, perm0B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
967 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
968 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
969 tmp = vec_avg (prev,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
970 vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
971 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
972 vec_xor (avg0, avg1))));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
973
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
974 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
975 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
976 ref += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
977 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
978 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
979 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
980 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
981 A = vec_perm (ref0, ref1, perm1A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
982 B = vec_perm (ref0, ref1, perm1B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
983 avg1 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
984 xor1 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
985 tmp = vec_avg (prev,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
986 vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
987 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
988 vec_xor (avg0, avg1))));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
989 } while (--height);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
990
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
991 ref0 = vec_ld (0, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
992 ref1 = vec_ld (8, ref);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
993 prev = vec_ld (stride, dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
994 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
995 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
996 dest += stride;
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
997 A = vec_perm (ref0, ref1, perm0A);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
998 B = vec_perm (ref0, ref1, perm0B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
999 avg0 = vec_avg (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
1000 xor0 = vec_xor (A, B);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
1001 tmp = vec_avg (prev, vec_sub (vec_avg (avg0, avg1),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
1002 vec_and (vec_and (ones, vec_or (xor0, xor1)),
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
1003 vec_xor (avg0, avg1))));
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
1004 vec_ste ((vector_u32_t)tmp, 0, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
1005 vec_ste ((vector_u32_t)tmp, 4, (unsigned int *)dest);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
1006 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
1007
10271
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
1008 MPEG2_MC_EXTERN (altivec)
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
1009
f0e14d641160 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 9857
diff changeset
1010 #endif