annotate libswscale/yuv2rgb_altivec.c @ 26030:a93e46adb54c

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