Mercurial > mplayer.hg
annotate libswscale/yuv2rgb_altivec.c @ 27422:8c9a131feb83
Mention IVTV, S3 and SH_VEU drivers within VIDIX section of manpage.
author | ben |
---|---|
date | Mon, 11 Aug 2008 23:15:24 +0000 |
parents | 5707f04b8e69 |
children | 15df1f217e6d |
rev | line source |
---|---|
18861 | 1 /* |
27155
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
2 * AltiVec acceleration for colorspace conversion |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
3 * |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
4 * copyright (C) 2004 Marc Hoffman <marc.hoffman@analog.com> |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
5 * |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
6 * This file is part of FFmpeg. |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
7 * |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or modify |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
11 * (at your option) any later version. |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
12 * |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
16 * GNU General Public License for more details. |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
17 * |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
19 * along with FFmpeg; if not, write to the Free Software |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
21 */ |
18861 | 22 |
27155
d5d7ecbbf0d8
Place license header at the top of the file for consistency.
diego
parents:
26219
diff
changeset
|
23 /* |
27158 | 24 Convert I420 YV12 to RGB in various formats, |
25 it rejects images that are not in 420 formats, | |
26 it rejects images that don't have widths of multiples of 16, | |
27 it rejects images that don't have heights of multiples of 2. | |
28 Reject defers to C simulation code. | |
29 | |
30 Lots of optimizations to be done here. | |
18861 | 31 |
27158 | 32 1. Need to fix saturation code. I just couldn't get it to fly with packs |
33 and adds, so we currently use max/min to clip. | |
18861 | 34 |
27158 | 35 2. The inefficient use of chroma loading needs a bit of brushing up. |
18861 | 36 |
27158 | 37 3. Analysis of pipeline stalls needs to be done. Use shark to identify |
38 pipeline stalls. | |
18861 | 39 |
40 | |
27156 | 41 MODIFIED to calculate coeffs from currently selected color space. |
27158 | 42 MODIFIED core to be a macro where you specify the output format. |
43 ADDED UYVY conversion which is never called due to some thing in swscale. | |
27156 | 44 CORRECTED algorithim selection to be strict on input formats. |
27158 | 45 ADDED runtime detection of AltiVec. |
18861 | 46 |
27156 | 47 ADDED altivec_yuv2packedX vertical scl + RGB converter |
18861 | 48 |
27156 | 49 March 27,2004 |
50 PERFORMANCE ANALYSIS | |
18861 | 51 |
27158 | 52 The C version uses 25% of the processor or ~250Mips for D1 video rawvideo |
53 used as test. | |
54 The AltiVec version uses 10% of the processor or ~100Mips for D1 video | |
55 same sequence. | |
18861 | 56 |
27158 | 57 720 * 480 * 30 ~10MPS |
18861 | 58 |
27158 | 59 so we have roughly 10 clocks per pixel. This is too high, something has |
60 to be wrong. | |
18861 | 61 |
27158 | 62 OPTIMIZED clip codes to utilize vec_max and vec_packs removing the |
63 need for vec_min. | |
18861 | 64 |
27158 | 65 OPTIMIZED DST OUTPUT cache/DMA controls. We are pretty much guaranteed to have |
66 the input video frame, it was just decompressed so it probably resides in L1 | |
67 caches. However, we are creating the output video stream. This needs to use the | |
68 DSTST instruction to optimize for the cache. We couple this with the fact that | |
69 we are not going to be visiting the input buffer again so we mark it Least | |
70 Recently Used. This shaves 25% of the processor cycles off. | |
71 | |
72 Now memcpy is the largest mips consumer in the system, probably due | |
27156 | 73 to the inefficient X11 stuff. |
18861 | 74 |
27156 | 75 GL libraries seem to be very slow on this machine 1.33Ghz PB running |
76 Jaguar, this is not the case for my 1Ghz PB. I thought it might be | |
27158 | 77 a versioning issue, however I have libGL.1.2.dylib for both |
78 machines. (We need to figure this out now.) | |
79 | |
80 GL2 libraries work now with patch for RGB32. | |
18861 | 81 |
27158 | 82 NOTE: quartz vo driver ARGB32_to_RGB24 consumes 30% of the processor. |
18861 | 83 |
27158 | 84 Integrated luma prescaling adjustment for saturation/contrast/brightness |
85 adjustment. | |
20094
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20006
diff
changeset
|
86 */ |
19766 | 87 |
18861 | 88 #include <stdio.h> |
89 #include <stdlib.h> | |
90 #include <string.h> | |
91 #include <inttypes.h> | |
92 #include <assert.h> | |
93 #include "config.h" | |
94 #ifdef HAVE_MALLOC_H | |
95 #include <malloc.h> | |
96 #endif | |
97 #include "rgb2rgb.h" | |
98 #include "swscale.h" | |
99 #include "swscale_internal.h" | |
100 | |
101 #undef PROFILE_THE_BEAST | |
102 #undef INC_SCALING | |
103 | |
104 typedef unsigned char ubyte; | |
105 typedef signed char sbyte; | |
106 | |
107 | |
108 /* RGB interleaver, 16 planar pels 8-bit samples per channel in | |
109 homogeneous vector registers x0,x1,x2 are interleaved with the | |
110 following technique: | |
111 | |
112 o0 = vec_mergeh (x0,x1); | |
113 o1 = vec_perm (o0, x2, perm_rgb_0); | |
114 o2 = vec_perm (o0, x2, perm_rgb_1); | |
115 o3 = vec_mergel (x0,x1); | |
116 o4 = vec_perm (o3,o2,perm_rgb_2); | |
117 o5 = vec_perm (o3,o2,perm_rgb_3); | |
118 | |
119 perm_rgb_0: o0(RG).h v1(B) --> o1* | |
120 0 1 2 3 4 | |
121 rgbr|gbrg|brgb|rgbr | |
122 0010 0100 1001 0010 | |
123 0102 3145 2673 894A | |
124 | |
125 perm_rgb_1: o0(RG).h v1(B) --> o2 | |
126 0 1 2 3 4 | |
127 gbrg|brgb|bbbb|bbbb | |
128 0100 1001 1111 1111 | |
129 B5CD 6EF7 89AB CDEF | |
130 | |
131 perm_rgb_2: o3(RG).l o2(rgbB.l) --> o4* | |
132 0 1 2 3 4 | |
133 gbrg|brgb|rgbr|gbrg | |
134 1111 1111 0010 0100 | |
135 89AB CDEF 0182 3945 | |
136 | |
137 perm_rgb_2: o3(RG).l o2(rgbB.l) ---> o5* | |
138 0 1 2 3 4 | |
139 brgb|rgbr|gbrg|brgb | |
140 1001 0010 0100 1001 | |
141 a67b 89cA BdCD eEFf | |
142 | |
143 */ | |
144 static | |
145 const vector unsigned char | |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
146 perm_rgb_0 = {0x00,0x01,0x10,0x02,0x03,0x11,0x04,0x05, |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
147 0x12,0x06,0x07,0x13,0x08,0x09,0x14,0x0a}, |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
148 perm_rgb_1 = {0x0b,0x15,0x0c,0x0d,0x16,0x0e,0x0f,0x17, |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
149 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f}, |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
150 perm_rgb_2 = {0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
151 0x00,0x01,0x18,0x02,0x03,0x19,0x04,0x05}, |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
152 perm_rgb_3 = {0x1a,0x06,0x07,0x1b,0x08,0x09,0x1c,0x0a, |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
153 0x0b,0x1d,0x0c,0x0d,0x1e,0x0e,0x0f,0x1f}; |
18861 | 154 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
155 #define vec_merge3(x2,x1,x0,y0,y1,y2) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
156 do { \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
157 typeof(x0) o0,o2,o3; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
158 o0 = vec_mergeh (x0,x1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
159 y0 = vec_perm (o0, x2, perm_rgb_0); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
160 o2 = vec_perm (o0, x2, perm_rgb_1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
161 o3 = vec_mergel (x0,x1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
162 y1 = vec_perm (o3,o2,perm_rgb_2); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
163 y2 = vec_perm (o3,o2,perm_rgb_3); \ |
18861 | 164 } while(0) |
165 | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
166 #define vec_mstbgr24(x0,x1,x2,ptr) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
167 do { \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
168 typeof(x0) _0,_1,_2; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
169 vec_merge3 (x0,x1,x2,_0,_1,_2); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
170 vec_st (_0, 0, ptr++); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
171 vec_st (_1, 0, ptr++); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
172 vec_st (_2, 0, ptr++); \ |
18861 | 173 } while (0); |
174 | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
175 #define vec_mstrgb24(x0,x1,x2,ptr) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
176 do { \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
177 typeof(x0) _0,_1,_2; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
178 vec_merge3 (x2,x1,x0,_0,_1,_2); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
179 vec_st (_0, 0, ptr++); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
180 vec_st (_1, 0, ptr++); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
181 vec_st (_2, 0, ptr++); \ |
18861 | 182 } while (0); |
183 | |
184 /* pack the pixels in rgb0 format | |
185 msb R | |
186 lsb 0 | |
187 */ | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
188 #define vec_mstrgb32(T,x0,x1,x2,x3,ptr) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
189 do { \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
190 T _0,_1,_2,_3; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
191 _0 = vec_mergeh (x0,x1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
192 _1 = vec_mergeh (x2,x3); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
193 _2 = (T)vec_mergeh ((vector unsigned short)_0,(vector unsigned short)_1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
194 _3 = (T)vec_mergel ((vector unsigned short)_0,(vector unsigned short)_1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
195 vec_st (_2, 0*16, (T *)ptr); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
196 vec_st (_3, 1*16, (T *)ptr); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
197 _0 = vec_mergel (x0,x1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
198 _1 = vec_mergel (x2,x3); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
199 _2 = (T)vec_mergeh ((vector unsigned short)_0,(vector unsigned short)_1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
200 _3 = (T)vec_mergel ((vector unsigned short)_0,(vector unsigned short)_1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
201 vec_st (_2, 2*16, (T *)ptr); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
202 vec_st (_3, 3*16, (T *)ptr); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
203 ptr += 4; \ |
18861 | 204 } while (0); |
205 | |
206 /* | |
207 | |
208 | 1 0 1.4021 | | Y | | |
209 | 1 -0.3441 -0.7142 |x| Cb| | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
210 | 1 1.7718 0 | | Cr| |
18861 | 211 |
212 | |
213 Y: [-128 127] | |
214 Cb/Cr : [-128 127] | |
215 | |
216 typical yuv conversion work on Y: 0-255 this version has been optimized for jpeg decode. | |
217 | |
218 */ | |
219 | |
220 | |
221 | |
222 | |
223 #define vec_unh(x) \ | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
224 (vector signed short) \ |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
225 vec_perm(x,(typeof(x)){0}, \ |
27317
5707f04b8e69
compilation fix with GCC 4.0.1 on MacOSX tiger, broken by the removal of AVV() macro
gpoirier
parents:
27313
diff
changeset
|
226 ((vector unsigned char){0x10,0x00,0x10,0x01,0x10,0x02,0x10,0x03,\ |
5707f04b8e69
compilation fix with GCC 4.0.1 on MacOSX tiger, broken by the removal of AVV() macro
gpoirier
parents:
27313
diff
changeset
|
227 0x10,0x04,0x10,0x05,0x10,0x06,0x10,0x07})) |
18861 | 228 #define vec_unl(x) \ |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
229 (vector signed short) \ |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
230 vec_perm(x,(typeof(x)){0}, \ |
27317
5707f04b8e69
compilation fix with GCC 4.0.1 on MacOSX tiger, broken by the removal of AVV() macro
gpoirier
parents:
27313
diff
changeset
|
231 ((vector unsigned char){0x10,0x08,0x10,0x09,0x10,0x0A,0x10,0x0B,\ |
5707f04b8e69
compilation fix with GCC 4.0.1 on MacOSX tiger, broken by the removal of AVV() macro
gpoirier
parents:
27313
diff
changeset
|
232 0x10,0x0C,0x10,0x0D,0x10,0x0E,0x10,0x0F})) |
18861 | 233 |
234 #define vec_clip_s16(x) \ | |
27317
5707f04b8e69
compilation fix with GCC 4.0.1 on MacOSX tiger, broken by the removal of AVV() macro
gpoirier
parents:
27313
diff
changeset
|
235 vec_max (vec_min (x, ((vector signed short){235,235,235,235,235,235,235,235})), \ |
5707f04b8e69
compilation fix with GCC 4.0.1 on MacOSX tiger, broken by the removal of AVV() macro
gpoirier
parents:
27313
diff
changeset
|
236 ((vector signed short){ 16, 16, 16, 16, 16, 16, 16, 16})) |
18861 | 237 |
238 #define vec_packclp(x,y) \ | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
239 (vector unsigned char)vec_packs \ |
27317
5707f04b8e69
compilation fix with GCC 4.0.1 on MacOSX tiger, broken by the removal of AVV() macro
gpoirier
parents:
27313
diff
changeset
|
240 ((vector unsigned short)vec_max (x,((vector signed short) {0})), \ |
5707f04b8e69
compilation fix with GCC 4.0.1 on MacOSX tiger, broken by the removal of AVV() macro
gpoirier
parents:
27313
diff
changeset
|
241 (vector unsigned short)vec_max (y,((vector signed short) {0}))) |
18861 | 242 |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
243 //#define out_pixels(a,b,c,ptr) vec_mstrgb32(typeof(a),((typeof (a)){0}),a,a,a,ptr) |
18861 | 244 |
245 | |
246 static inline void cvtyuvtoRGB (SwsContext *c, | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
247 vector signed short Y, vector signed short U, vector signed short V, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
248 vector signed short *R, vector signed short *G, vector signed short *B) |
18861 | 249 { |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
250 vector signed short vx,ux,uvx; |
18861 | 251 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
252 Y = vec_mradds (Y, c->CY, c->OY); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
253 U = vec_sub (U,(vector signed short) |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
254 vec_splat((vector signed short){128},0)); |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
255 V = vec_sub (V,(vector signed short) |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
256 vec_splat((vector signed short){128},0)); |
18861 | 257 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
258 // ux = (CBU*(u<<c->CSHIFT)+0x4000)>>15; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
259 ux = vec_sl (U, c->CSHIFT); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
260 *B = vec_mradds (ux, c->CBU, Y); |
18861 | 261 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
262 // vx = (CRV*(v<<c->CSHIFT)+0x4000)>>15; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
263 vx = vec_sl (V, c->CSHIFT); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
264 *R = vec_mradds (vx, c->CRV, Y); |
18861 | 265 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
266 // uvx = ((CGU*u) + (CGV*v))>>15; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
267 uvx = vec_mradds (U, c->CGU, Y); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
268 *G = vec_mradds (V, c->CGV, uvx); |
18861 | 269 } |
270 | |
271 | |
272 /* | |
273 ------------------------------------------------------------------------------ | |
274 CS converters | |
275 ------------------------------------------------------------------------------ | |
276 */ | |
277 | |
278 | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
279 #define DEFCSP420_CVT(name,out_pixels) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
280 static int altivec_##name (SwsContext *c, \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
281 unsigned char **in, int *instrides, \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
282 int srcSliceY, int srcSliceH, \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
283 unsigned char **oplanes, int *outstrides) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
284 { \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
285 int w = c->srcW; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
286 int h = srcSliceH; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
287 int i,j; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
288 int instrides_scl[3]; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
289 vector unsigned char y0,y1; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
290 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
291 vector signed char u,v; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
292 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
293 vector signed short Y0,Y1,Y2,Y3; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
294 vector signed short U,V; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
295 vector signed short vx,ux,uvx; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
296 vector signed short vx0,ux0,uvx0; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
297 vector signed short vx1,ux1,uvx1; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
298 vector signed short R0,G0,B0; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
299 vector signed short R1,G1,B1; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
300 vector unsigned char R,G,B; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
301 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
302 vector unsigned char *y1ivP, *y2ivP, *uivP, *vivP; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
303 vector unsigned char align_perm; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
304 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
305 vector signed short \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
306 lCY = c->CY, \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
307 lOY = c->OY, \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
308 lCRV = c->CRV, \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
309 lCBU = c->CBU, \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
310 lCGU = c->CGU, \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
311 lCGV = c->CGV; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
312 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
313 vector unsigned short lCSHIFT = c->CSHIFT; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
314 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
315 ubyte *y1i = in[0]; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
316 ubyte *y2i = in[0]+instrides[0]; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
317 ubyte *ui = in[1]; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
318 ubyte *vi = in[2]; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
319 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
320 vector unsigned char *oute \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
321 = (vector unsigned char *) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
322 (oplanes[0]+srcSliceY*outstrides[0]); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
323 vector unsigned char *outo \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
324 = (vector unsigned char *) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
325 (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
326 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
327 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
328 instrides_scl[0] = instrides[0]*2-w; /* the loop moves y{1,2}i by w */ \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
329 instrides_scl[1] = instrides[1]-w/2; /* the loop moves ui by w/2 */ \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
330 instrides_scl[2] = instrides[2]-w/2; /* the loop moves vi by w/2 */ \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
331 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
332 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
333 for (i=0;i<h/2;i++) { \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
334 vec_dstst (outo, (0x02000002|(((w*3+32)/32)<<16)), 0); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
335 vec_dstst (oute, (0x02000002|(((w*3+32)/32)<<16)), 1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
336 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
337 for (j=0;j<w/16;j++) { \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
338 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
339 y1ivP = (vector unsigned char *)y1i; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
340 y2ivP = (vector unsigned char *)y2i; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
341 uivP = (vector unsigned char *)ui; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
342 vivP = (vector unsigned char *)vi; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
343 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
344 align_perm = vec_lvsl (0, y1i); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
345 y0 = (vector unsigned char) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
346 vec_perm (y1ivP[0], y1ivP[1], align_perm); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
347 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
348 align_perm = vec_lvsl (0, y2i); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
349 y1 = (vector unsigned char) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
350 vec_perm (y2ivP[0], y2ivP[1], align_perm); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
351 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
352 align_perm = vec_lvsl (0, ui); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
353 u = (vector signed char) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
354 vec_perm (uivP[0], uivP[1], align_perm); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
355 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
356 align_perm = vec_lvsl (0, vi); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
357 v = (vector signed char) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
358 vec_perm (vivP[0], vivP[1], align_perm); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
359 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
360 u = (vector signed char) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
361 vec_sub (u,(vector signed char) \ |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
362 vec_splat((vector signed char){128},0)); \ |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
363 v = (vector signed char) \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
364 vec_sub (v,(vector signed char) \ |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
365 vec_splat((vector signed char){128},0)); \ |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
366 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
367 U = vec_unpackh (u); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
368 V = vec_unpackh (v); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
369 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
370 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
371 Y0 = vec_unh (y0); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
372 Y1 = vec_unl (y0); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
373 Y2 = vec_unh (y1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
374 Y3 = vec_unl (y1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
375 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
376 Y0 = vec_mradds (Y0, lCY, lOY); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
377 Y1 = vec_mradds (Y1, lCY, lOY); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
378 Y2 = vec_mradds (Y2, lCY, lOY); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
379 Y3 = vec_mradds (Y3, lCY, lOY); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
380 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
381 /* ux = (CBU*(u<<CSHIFT)+0x4000)>>15 */ \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
382 ux = vec_sl (U, lCSHIFT); \ |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
383 ux = vec_mradds (ux, lCBU, (vector signed short){0}); \ |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
384 ux0 = vec_mergeh (ux,ux); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
385 ux1 = vec_mergel (ux,ux); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
386 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
387 /* vx = (CRV*(v<<CSHIFT)+0x4000)>>15; */ \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
388 vx = vec_sl (V, lCSHIFT); \ |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
389 vx = vec_mradds (vx, lCRV, (vector signed short){0}); \ |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
390 vx0 = vec_mergeh (vx,vx); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
391 vx1 = vec_mergel (vx,vx); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
392 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
393 /* uvx = ((CGU*u) + (CGV*v))>>15 */ \ |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
394 uvx = vec_mradds (U, lCGU, (vector signed short){0}); \ |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
395 uvx = vec_mradds (V, lCGV, uvx); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
396 uvx0 = vec_mergeh (uvx,uvx); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
397 uvx1 = vec_mergel (uvx,uvx); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
398 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
399 R0 = vec_add (Y0,vx0); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
400 G0 = vec_add (Y0,uvx0); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
401 B0 = vec_add (Y0,ux0); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
402 R1 = vec_add (Y1,vx1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
403 G1 = vec_add (Y1,uvx1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
404 B1 = vec_add (Y1,ux1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
405 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
406 R = vec_packclp (R0,R1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
407 G = vec_packclp (G0,G1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
408 B = vec_packclp (B0,B1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
409 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
410 out_pixels(R,G,B,oute); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
411 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
412 R0 = vec_add (Y2,vx0); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
413 G0 = vec_add (Y2,uvx0); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
414 B0 = vec_add (Y2,ux0); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
415 R1 = vec_add (Y3,vx1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
416 G1 = vec_add (Y3,uvx1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
417 B1 = vec_add (Y3,ux1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
418 R = vec_packclp (R0,R1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
419 G = vec_packclp (G0,G1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
420 B = vec_packclp (B0,B1); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
421 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
422 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
423 out_pixels(R,G,B,outo); \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
424 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
425 y1i += 16; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
426 y2i += 16; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
427 ui += 8; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
428 vi += 8; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
429 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
430 } \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
431 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
432 outo += (outstrides[0])>>4; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
433 oute += (outstrides[0])>>4; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
434 \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
435 ui += instrides_scl[1]; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
436 vi += instrides_scl[2]; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
437 y1i += instrides_scl[0]; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
438 y2i += instrides_scl[0]; \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
439 } \ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
440 return srcSliceH; \ |
18861 | 441 } |
442 | |
443 | |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
444 #define out_abgr(a,b,c,ptr) vec_mstrgb32(typeof(a),((typeof (a)){0}),c,b,a,ptr) |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
445 #define out_bgra(a,b,c,ptr) vec_mstrgb32(typeof(a),c,b,a,((typeof (a)){0}),ptr) |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
446 #define out_rgba(a,b,c,ptr) vec_mstrgb32(typeof(a),a,b,c,((typeof (a)){0}),ptr) |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
447 #define out_argb(a,b,c,ptr) vec_mstrgb32(typeof(a),((typeof (a)){0}),a,b,c,ptr) |
18861 | 448 #define out_rgb24(a,b,c,ptr) vec_mstrgb24(a,b,c,ptr) |
449 #define out_bgr24(a,b,c,ptr) vec_mstbgr24(a,b,c,ptr) | |
450 | |
451 DEFCSP420_CVT (yuv2_abgr, out_abgr) | |
452 #if 1 | |
453 DEFCSP420_CVT (yuv2_bgra, out_bgra) | |
454 #else | |
23129 | 455 static int altivec_yuv2_bgra32 (SwsContext *c, |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
456 unsigned char **in, int *instrides, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
457 int srcSliceY, int srcSliceH, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
458 unsigned char **oplanes, int *outstrides) |
23129 | 459 { |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
460 int w = c->srcW; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
461 int h = srcSliceH; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
462 int i,j; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
463 int instrides_scl[3]; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
464 vector unsigned char y0,y1; |
23129 | 465 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
466 vector signed char u,v; |
23129 | 467 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
468 vector signed short Y0,Y1,Y2,Y3; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
469 vector signed short U,V; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
470 vector signed short vx,ux,uvx; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
471 vector signed short vx0,ux0,uvx0; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
472 vector signed short vx1,ux1,uvx1; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
473 vector signed short R0,G0,B0; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
474 vector signed short R1,G1,B1; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
475 vector unsigned char R,G,B; |
23129 | 476 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
477 vector unsigned char *uivP, *vivP; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
478 vector unsigned char align_perm; |
23129 | 479 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
480 vector signed short |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
481 lCY = c->CY, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
482 lOY = c->OY, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
483 lCRV = c->CRV, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
484 lCBU = c->CBU, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
485 lCGU = c->CGU, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
486 lCGV = c->CGV; |
23129 | 487 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
488 vector unsigned short lCSHIFT = c->CSHIFT; |
23129 | 489 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
490 ubyte *y1i = in[0]; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
491 ubyte *y2i = in[0]+w; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
492 ubyte *ui = in[1]; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
493 ubyte *vi = in[2]; |
23129 | 494 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
495 vector unsigned char *oute |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
496 = (vector unsigned char *) |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
497 (oplanes[0]+srcSliceY*outstrides[0]); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
498 vector unsigned char *outo |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
499 = (vector unsigned char *) |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
500 (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]); |
23129 | 501 |
502 | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
503 instrides_scl[0] = instrides[0]; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
504 instrides_scl[1] = instrides[1]-w/2; /* the loop moves ui by w/2 */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
505 instrides_scl[2] = instrides[2]-w/2; /* the loop moves vi by w/2 */ |
23129 | 506 |
507 | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
508 for (i=0;i<h/2;i++) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
509 vec_dstst (outo, (0x02000002|(((w*3+32)/32)<<16)), 0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
510 vec_dstst (oute, (0x02000002|(((w*3+32)/32)<<16)), 1); |
23129 | 511 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
512 for (j=0;j<w/16;j++) { |
23129 | 513 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
514 y0 = vec_ldl (0,y1i); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
515 y1 = vec_ldl (0,y2i); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
516 uivP = (vector unsigned char *)ui; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
517 vivP = (vector unsigned char *)vi; |
23129 | 518 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
519 align_perm = vec_lvsl (0, ui); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
520 u = (vector signed char)vec_perm (uivP[0], uivP[1], align_perm); |
23129 | 521 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
522 align_perm = vec_lvsl (0, vi); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
523 v = (vector signed char)vec_perm (vivP[0], vivP[1], align_perm); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
524 u = (vector signed char) |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
525 vec_sub (u,(vector signed char) |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
526 vec_splat((vector signed char){128},0)); |
23129 | 527 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
528 v = (vector signed char) |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
529 vec_sub (v, (vector signed char) |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
530 vec_splat((vector signed char){128},0)); |
23129 | 531 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
532 U = vec_unpackh (u); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
533 V = vec_unpackh (v); |
23129 | 534 |
535 | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
536 Y0 = vec_unh (y0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
537 Y1 = vec_unl (y0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
538 Y2 = vec_unh (y1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
539 Y3 = vec_unl (y1); |
23129 | 540 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
541 Y0 = vec_mradds (Y0, lCY, lOY); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
542 Y1 = vec_mradds (Y1, lCY, lOY); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
543 Y2 = vec_mradds (Y2, lCY, lOY); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
544 Y3 = vec_mradds (Y3, lCY, lOY); |
23129 | 545 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
546 /* ux = (CBU*(u<<CSHIFT)+0x4000)>>15 */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
547 ux = vec_sl (U, lCSHIFT); |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
548 ux = vec_mradds (ux, lCBU, (vector signed short){0}); |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
549 ux0 = vec_mergeh (ux,ux); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
550 ux1 = vec_mergel (ux,ux); |
23129 | 551 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
552 /* vx = (CRV*(v<<CSHIFT)+0x4000)>>15; */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
553 vx = vec_sl (V, lCSHIFT); |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
554 vx = vec_mradds (vx, lCRV, (vector signed short){0}); |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
555 vx0 = vec_mergeh (vx,vx); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
556 vx1 = vec_mergel (vx,vx); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
557 /* uvx = ((CGU*u) + (CGV*v))>>15 */ |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
558 uvx = vec_mradds (U, lCGU, (vector signed short){0}); |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
559 uvx = vec_mradds (V, lCGV, uvx); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
560 uvx0 = vec_mergeh (uvx,uvx); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
561 uvx1 = vec_mergel (uvx,uvx); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
562 R0 = vec_add (Y0,vx0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
563 G0 = vec_add (Y0,uvx0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
564 B0 = vec_add (Y0,ux0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
565 R1 = vec_add (Y1,vx1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
566 G1 = vec_add (Y1,uvx1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
567 B1 = vec_add (Y1,ux1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
568 R = vec_packclp (R0,R1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
569 G = vec_packclp (G0,G1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
570 B = vec_packclp (B0,B1); |
23129 | 571 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
572 out_argb(R,G,B,oute); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
573 R0 = vec_add (Y2,vx0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
574 G0 = vec_add (Y2,uvx0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
575 B0 = vec_add (Y2,ux0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
576 R1 = vec_add (Y3,vx1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
577 G1 = vec_add (Y3,uvx1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
578 B1 = vec_add (Y3,ux1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
579 R = vec_packclp (R0,R1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
580 G = vec_packclp (G0,G1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
581 B = vec_packclp (B0,B1); |
23129 | 582 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
583 out_argb(R,G,B,outo); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
584 y1i += 16; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
585 y2i += 16; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
586 ui += 8; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
587 vi += 8; |
23129 | 588 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
589 } |
23129 | 590 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
591 outo += (outstrides[0])>>4; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
592 oute += (outstrides[0])>>4; |
23129 | 593 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
594 ui += instrides_scl[1]; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
595 vi += instrides_scl[2]; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
596 y1i += instrides_scl[0]; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
597 y2i += instrides_scl[0]; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
598 } |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
599 return srcSliceH; |
18861 | 600 } |
601 | |
602 #endif | |
603 | |
604 | |
605 DEFCSP420_CVT (yuv2_rgba, out_rgba) | |
606 DEFCSP420_CVT (yuv2_argb, out_argb) | |
607 DEFCSP420_CVT (yuv2_rgb24, out_rgb24) | |
608 DEFCSP420_CVT (yuv2_bgr24, out_bgr24) | |
609 | |
610 | |
611 // uyvy|uyvy|uyvy|uyvy | |
612 // 0123 4567 89ab cdef | |
613 static | |
614 const vector unsigned char | |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
615 demux_u = {0x10,0x00,0x10,0x00, |
27313 | 616 0x10,0x04,0x10,0x04, |
617 0x10,0x08,0x10,0x08, | |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
618 0x10,0x0c,0x10,0x0c}, |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
619 demux_v = {0x10,0x02,0x10,0x02, |
27313 | 620 0x10,0x06,0x10,0x06, |
621 0x10,0x0A,0x10,0x0A, | |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
622 0x10,0x0E,0x10,0x0E}, |
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
623 demux_y = {0x10,0x01,0x10,0x03, |
27313 | 624 0x10,0x05,0x10,0x07, |
625 0x10,0x09,0x10,0x0B, | |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
626 0x10,0x0D,0x10,0x0F}; |
18861 | 627 |
628 /* | |
629 this is so I can play live CCIR raw video | |
630 */ | |
631 static int altivec_uyvy_rgb32 (SwsContext *c, | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
632 unsigned char **in, int *instrides, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
633 int srcSliceY, int srcSliceH, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
634 unsigned char **oplanes, int *outstrides) |
18861 | 635 { |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
636 int w = c->srcW; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
637 int h = srcSliceH; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
638 int i,j; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
639 vector unsigned char uyvy; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
640 vector signed short Y,U,V; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
641 vector signed short R0,G0,B0,R1,G1,B1; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
642 vector unsigned char R,G,B; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
643 vector unsigned char *out; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
644 ubyte *img; |
18861 | 645 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
646 img = in[0]; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
647 out = (vector unsigned char *)(oplanes[0]+srcSliceY*outstrides[0]); |
18861 | 648 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
649 for (i=0;i<h;i++) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
650 for (j=0;j<w/16;j++) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
651 uyvy = vec_ld (0, img); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
652 U = (vector signed short) |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
653 vec_perm (uyvy, (vector unsigned char){0}, demux_u); |
18861 | 654 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
655 V = (vector signed short) |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
656 vec_perm (uyvy, (vector unsigned char){0}, demux_v); |
18861 | 657 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
658 Y = (vector signed short) |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
659 vec_perm (uyvy, (vector unsigned char){0}, demux_y); |
18861 | 660 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
661 cvtyuvtoRGB (c, Y,U,V,&R0,&G0,&B0); |
18861 | 662 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
663 uyvy = vec_ld (16, img); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
664 U = (vector signed short) |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
665 vec_perm (uyvy, (vector unsigned char){0}, demux_u); |
18861 | 666 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
667 V = (vector signed short) |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
668 vec_perm (uyvy, (vector unsigned char){0}, demux_v); |
18861 | 669 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
670 Y = (vector signed short) |
27312
f058ded683db
Remove AltiVec vector declaration compiler compatibility macros.
diego
parents:
27247
diff
changeset
|
671 vec_perm (uyvy, (vector unsigned char){0}, demux_y); |
18861 | 672 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
673 cvtyuvtoRGB (c, Y,U,V,&R1,&G1,&B1); |
18861 | 674 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
675 R = vec_packclp (R0,R1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
676 G = vec_packclp (G0,G1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
677 B = vec_packclp (B0,B1); |
18861 | 678 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
679 // vec_mstbgr24 (R,G,B, out); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
680 out_rgba (R,G,B,out); |
18861 | 681 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
682 img += 32; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
683 } |
18861 | 684 } |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
685 return srcSliceH; |
18861 | 686 } |
687 | |
688 | |
689 | |
690 /* Ok currently the acceleration routine only supports | |
691 inputs of widths a multiple of 16 | |
692 and heights a multiple 2 | |
693 | |
694 So we just fall back to the C codes for this. | |
695 */ | |
696 SwsFunc yuv2rgb_init_altivec (SwsContext *c) | |
697 { | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
698 if (!(c->flags & SWS_CPU_CAPS_ALTIVEC)) |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
699 return NULL; |
18861 | 700 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
701 /* |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
702 and this seems not to matter too much I tried a bunch of |
26219 | 703 videos with abnormal widths and MPlayer crashes elsewhere. |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
704 mplayer -vo x11 -rawvideo on:w=350:h=240 raw-350x240.eyuv |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
705 boom with X11 bad match. |
23129 | 706 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
707 */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
708 if ((c->srcW & 0xf) != 0) return NULL; |
18861 | 709 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
710 switch (c->srcFormat) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
711 case PIX_FMT_YUV410P: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
712 case PIX_FMT_YUV420P: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
713 /*case IMGFMT_CLPL: ??? */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
714 case PIX_FMT_GRAY8: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
715 case PIX_FMT_NV12: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
716 case PIX_FMT_NV21: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
717 if ((c->srcH & 0x1) != 0) |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
718 return NULL; |
18861 | 719 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
720 switch(c->dstFormat){ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
721 case PIX_FMT_RGB24: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
722 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGB24\n"); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
723 return altivec_yuv2_rgb24; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
724 case PIX_FMT_BGR24: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
725 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space BGR24\n"); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
726 return altivec_yuv2_bgr24; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
727 case PIX_FMT_ARGB: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
728 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space ARGB\n"); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
729 return altivec_yuv2_argb; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
730 case PIX_FMT_ABGR: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
731 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space ABGR\n"); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
732 return altivec_yuv2_abgr; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
733 case PIX_FMT_RGBA: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
734 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGBA\n"); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
735 return altivec_yuv2_rgba; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
736 case PIX_FMT_BGRA: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
737 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space BGRA\n"); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
738 return altivec_yuv2_bgra; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
739 default: return NULL; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
740 } |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
741 break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
742 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
743 case PIX_FMT_UYVY422: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
744 switch(c->dstFormat){ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
745 case PIX_FMT_BGR32: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
746 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space UYVY -> RGB32\n"); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
747 return altivec_uyvy_rgb32; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
748 default: return NULL; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
749 } |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
750 break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
751 |
18861 | 752 } |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
753 return NULL; |
18861 | 754 } |
755 | |
756 void yuv2rgb_altivec_init_tables (SwsContext *c, const int inv_table[4],int brightness,int contrast, int saturation) | |
757 { | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
758 union { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
759 signed short tmp[8] __attribute__ ((aligned(16))); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
760 vector signed short vec; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
761 } buf; |
18861 | 762 |
25749 | 763 buf.tmp[0] = ((0xffffLL) * contrast>>8)>>9; //cy |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
764 buf.tmp[1] = -256*brightness; //oy |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
765 buf.tmp[2] = (inv_table[0]>>3) *(contrast>>16)*(saturation>>16); //crv |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
766 buf.tmp[3] = (inv_table[1]>>3) *(contrast>>16)*(saturation>>16); //cbu |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
767 buf.tmp[4] = -((inv_table[2]>>1)*(contrast>>16)*(saturation>>16)); //cgu |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
768 buf.tmp[5] = -((inv_table[3]>>1)*(contrast>>16)*(saturation>>16)); //cgv |
18861 | 769 |
770 | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
771 c->CSHIFT = (vector unsigned short)vec_splat_u16(2); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
772 c->CY = vec_splat ((vector signed short)buf.vec, 0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
773 c->OY = vec_splat ((vector signed short)buf.vec, 1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
774 c->CRV = vec_splat ((vector signed short)buf.vec, 2); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
775 c->CBU = vec_splat ((vector signed short)buf.vec, 3); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
776 c->CGU = vec_splat ((vector signed short)buf.vec, 4); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
777 c->CGV = vec_splat ((vector signed short)buf.vec, 5); |
18861 | 778 #if 0 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
779 { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
780 int i; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
781 char *v[6]={"cy","oy","crv","cbu","cgu","cgv"}; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
782 for (i=0; i<6; i++) |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
783 printf("%s %d ", v[i],buf.tmp[i] ); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
784 printf("\n"); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
785 } |
18861 | 786 #endif |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
787 return; |
18861 | 788 } |
789 | |
790 | |
791 void | |
792 altivec_yuv2packedX (SwsContext *c, | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
793 int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
794 int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
795 uint8_t *dest, int dstW, int dstY) |
18861 | 796 { |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
797 int i,j; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
798 vector signed short X,X0,X1,Y0,U0,V0,Y1,U1,V1,U,V; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
799 vector signed short R0,G0,B0,R1,G1,B1; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
800 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
801 vector unsigned char R,G,B; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
802 vector unsigned char *out,*nout; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
803 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
804 vector signed short RND = vec_splat_s16(1<<3); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
805 vector unsigned short SCL = vec_splat_u16(4); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
806 unsigned long scratch[16] __attribute__ ((aligned (16))); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
807 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
808 vector signed short *YCoeffs, *CCoeffs; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
809 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
810 YCoeffs = c->vYCoeffsBank+dstY*lumFilterSize; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
811 CCoeffs = c->vCCoeffsBank+dstY*chrFilterSize; |
18861 | 812 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
813 out = (vector unsigned char *)dest; |
18861 | 814 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
815 for (i=0; i<dstW; i+=16){ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
816 Y0 = RND; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
817 Y1 = RND; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
818 /* extract 16 coeffs from lumSrc */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
819 for (j=0; j<lumFilterSize; j++) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
820 X0 = vec_ld (0, &lumSrc[j][i]); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
821 X1 = vec_ld (16, &lumSrc[j][i]); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
822 Y0 = vec_mradds (X0, YCoeffs[j], Y0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
823 Y1 = vec_mradds (X1, YCoeffs[j], Y1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
824 } |
18861 | 825 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
826 U = RND; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
827 V = RND; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
828 /* extract 8 coeffs from U,V */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
829 for (j=0; j<chrFilterSize; j++) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
830 X = vec_ld (0, &chrSrc[j][i/2]); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
831 U = vec_mradds (X, CCoeffs[j], U); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
832 X = vec_ld (0, &chrSrc[j][i/2+2048]); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
833 V = vec_mradds (X, CCoeffs[j], V); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
834 } |
18861 | 835 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
836 /* scale and clip signals */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
837 Y0 = vec_sra (Y0, SCL); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
838 Y1 = vec_sra (Y1, SCL); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
839 U = vec_sra (U, SCL); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
840 V = vec_sra (V, SCL); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
841 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
842 Y0 = vec_clip_s16 (Y0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
843 Y1 = vec_clip_s16 (Y1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
844 U = vec_clip_s16 (U); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
845 V = vec_clip_s16 (V); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
846 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
847 /* now we have |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
848 Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
849 U= u0 u1 u2 u3 u4 u5 u6 u7 V= v0 v1 v2 v3 v4 v5 v6 v7 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
850 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
851 Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
852 U0= u0 u0 u1 u1 u2 u2 u3 u3 U1= u4 u4 u5 u5 u6 u6 u7 u7 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
853 V0= v0 v0 v1 v1 v2 v2 v3 v3 V1= v4 v4 v5 v5 v6 v6 v7 v7 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
854 */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
855 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
856 U0 = vec_mergeh (U,U); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
857 V0 = vec_mergeh (V,V); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
858 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
859 U1 = vec_mergel (U,U); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
860 V1 = vec_mergel (V,V); |
18861 | 861 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
862 cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
863 cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
864 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
865 R = vec_packclp (R0,R1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
866 G = vec_packclp (G0,G1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
867 B = vec_packclp (B0,B1); |
18861 | 868 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
869 switch(c->dstFormat) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
870 case PIX_FMT_ABGR: out_abgr (R,G,B,out); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
871 case PIX_FMT_BGRA: out_bgra (R,G,B,out); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
872 case PIX_FMT_RGBA: out_rgba (R,G,B,out); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
873 case PIX_FMT_ARGB: out_argb (R,G,B,out); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
874 case PIX_FMT_RGB24: out_rgb24 (R,G,B,out); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
875 case PIX_FMT_BGR24: out_bgr24 (R,G,B,out); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
876 default: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
877 { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
878 /* If this is reached, the caller should have called yuv2packedXinC |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
879 instead. */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
880 static int printed_error_message; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
881 if (!printed_error_message) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
882 av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n", |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
883 sws_format_name(c->dstFormat)); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
884 printed_error_message=1; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
885 } |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
886 return; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
887 } |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
888 } |
18861 | 889 } |
890 | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
891 if (i < dstW) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
892 i -= 16; |
18861 | 893 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
894 Y0 = RND; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
895 Y1 = RND; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
896 /* extract 16 coeffs from lumSrc */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
897 for (j=0; j<lumFilterSize; j++) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
898 X0 = vec_ld (0, &lumSrc[j][i]); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
899 X1 = vec_ld (16, &lumSrc[j][i]); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
900 Y0 = vec_mradds (X0, YCoeffs[j], Y0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
901 Y1 = vec_mradds (X1, YCoeffs[j], Y1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
902 } |
18861 | 903 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
904 U = RND; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
905 V = RND; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
906 /* extract 8 coeffs from U,V */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
907 for (j=0; j<chrFilterSize; j++) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
908 X = vec_ld (0, &chrSrc[j][i/2]); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
909 U = vec_mradds (X, CCoeffs[j], U); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
910 X = vec_ld (0, &chrSrc[j][i/2+2048]); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
911 V = vec_mradds (X, CCoeffs[j], V); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
912 } |
18861 | 913 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
914 /* scale and clip signals */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
915 Y0 = vec_sra (Y0, SCL); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
916 Y1 = vec_sra (Y1, SCL); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
917 U = vec_sra (U, SCL); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
918 V = vec_sra (V, SCL); |
18861 | 919 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
920 Y0 = vec_clip_s16 (Y0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
921 Y1 = vec_clip_s16 (Y1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
922 U = vec_clip_s16 (U); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
923 V = vec_clip_s16 (V); |
18861 | 924 |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
925 /* now we have |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
926 Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
927 U = u0 u1 u2 u3 u4 u5 u6 u7 V = v0 v1 v2 v3 v4 v5 v6 v7 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
928 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
929 Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
930 U0= u0 u0 u1 u1 u2 u2 u3 u3 U1= u4 u4 u5 u5 u6 u6 u7 u7 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
931 V0= v0 v0 v1 v1 v2 v2 v3 v3 V1= v4 v4 v5 v5 v6 v6 v7 v7 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
932 */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
933 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
934 U0 = vec_mergeh (U,U); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
935 V0 = vec_mergeh (V,V); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
936 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
937 U1 = vec_mergel (U,U); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
938 V1 = vec_mergel (V,V); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
939 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
940 cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
941 cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
942 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
943 R = vec_packclp (R0,R1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
944 G = vec_packclp (G0,G1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
945 B = vec_packclp (B0,B1); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
946 |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
947 nout = (vector unsigned char *)scratch; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
948 switch(c->dstFormat) { |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
949 case PIX_FMT_ABGR: out_abgr (R,G,B,nout); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
950 case PIX_FMT_BGRA: out_bgra (R,G,B,nout); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
951 case PIX_FMT_RGBA: out_rgba (R,G,B,nout); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
952 case PIX_FMT_ARGB: out_argb (R,G,B,nout); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
953 case PIX_FMT_RGB24: out_rgb24 (R,G,B,nout); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
954 case PIX_FMT_BGR24: out_bgr24 (R,G,B,nout); break; |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
955 default: |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
956 /* Unreachable, I think. */ |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
957 av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n", |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
958 sws_format_name(c->dstFormat)); |
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
959 return; |
18861 | 960 } |
961 | |
23157
ebc55c913d73
cosmetics attack, part III: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
962 memcpy (&((uint32_t*)dest)[i], scratch, (dstW-i)/4); |
18861 | 963 } |
964 | |
965 } |