annotate libswscale/swscale_altivec_template.c @ 26096:e6a565ec1a3b

New S3 VIDIX driver. Provides support for S3 Trio and S3 Virge chipsets. This deprecates the old Savage driver that worked with latest chips only. (synchronized with vidix.sf.net r326 and r327)
author ben
date Fri, 29 Feb 2008 20:01:28 +0000
parents 4ffa92294ee7
children 65b8334df960
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19200
07769a1d06a9 Fix compile error due to extra "FF" at beginning of file in the FF{MIN,MAX}
pacman
parents: 19181
diff changeset
1 /*
20094
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
2 * AltiVec-enhanced yuv2yuvX
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
3 *
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
4 * Copyright (C) 2004 Romain Dolbeau <romain@dolbeau.org>
26067
4ffa92294ee7 Fix outdated comment.
diego
parents: 25751
diff changeset
5 * based on the equivalent C code in swscale.c
20094
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
6 *
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
7 * This file is part of FFmpeg.
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
8 *
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
9 * 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
10 * 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
11 * 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
12 * (at your option) any later version.
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
13 *
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
14 * 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
15 * 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
16 * 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
17 * GNU General Public License for more details.
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
18 *
aca9e9783f67 Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents: 20006
diff changeset
19 * 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
20 * along with FFmpeg; if not, write to the Free Software
23702
5159b5f8784e license header consistency cosmetics
diego
parents: 23140
diff changeset
21 * 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
22 */
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
23
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
24 #define vzero vec_splat_s32(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
25
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
26 static inline void
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
27 altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW) {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
28 register int i;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
29 vector unsigned int altivec_vectorShiftInt19 =
25750
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
30 vec_add(vec_splat_u32(10), vec_splat_u32(9));
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
31 if ((unsigned long)dest % 16) {
25217
416818170e48 Fix some spelling typos
diego
parents: 24123
diff changeset
32 /* badly aligned store, we force store alignment */
416818170e48 Fix some spelling typos
diego
parents: 24123
diff changeset
33 /* and will handle load misalignment on val w/ vec_perm */
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
34 vector unsigned char perm1;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
35 vector signed int v1;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
36 for (i = 0 ; (i < dstW) &&
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
37 (((unsigned long)dest + i) % 16) ; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
38 int t = val[i] >> 19;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
39 dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
40 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
41 perm1 = vec_lvsl(i << 2, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
42 v1 = vec_ld(i << 2, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
43 for ( ; i < (dstW - 15); i+=16) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
44 int offset = i << 2;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
45 vector signed int v2 = vec_ld(offset + 16, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
46 vector signed int v3 = vec_ld(offset + 32, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
47 vector signed int v4 = vec_ld(offset + 48, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
48 vector signed int v5 = vec_ld(offset + 64, val);
25750
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
49 vector signed int v12 = vec_perm(v1, v2, perm1);
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
50 vector signed int v23 = vec_perm(v2, v3, perm1);
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
51 vector signed int v34 = vec_perm(v3, v4, perm1);
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
52 vector signed int v45 = vec_perm(v4, v5, perm1);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
53
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
54 vector signed int vA = vec_sra(v12, altivec_vectorShiftInt19);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
55 vector signed int vB = vec_sra(v23, altivec_vectorShiftInt19);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
56 vector signed int vC = vec_sra(v34, altivec_vectorShiftInt19);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
57 vector signed int vD = vec_sra(v45, altivec_vectorShiftInt19);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
58 vector unsigned short vs1 = vec_packsu(vA, vB);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
59 vector unsigned short vs2 = vec_packsu(vC, vD);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
60 vector unsigned char vf = vec_packsu(vs1, vs2);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
61 vec_st(vf, i, dest);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
62 v1 = v5;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
63 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
64 } else { // dest is properly aligned, great
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
65 for (i = 0; i < (dstW - 15); i+=16) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
66 int offset = i << 2;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
67 vector signed int v1 = vec_ld(offset, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
68 vector signed int v2 = vec_ld(offset + 16, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
69 vector signed int v3 = vec_ld(offset + 32, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
70 vector signed int v4 = vec_ld(offset + 48, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
71 vector signed int v5 = vec_sra(v1, altivec_vectorShiftInt19);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
72 vector signed int v6 = vec_sra(v2, altivec_vectorShiftInt19);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
73 vector signed int v7 = vec_sra(v3, altivec_vectorShiftInt19);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
74 vector signed int v8 = vec_sra(v4, altivec_vectorShiftInt19);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
75 vector unsigned short vs1 = vec_packsu(v5, v6);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
76 vector unsigned short vs2 = vec_packsu(v7, v8);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
77 vector unsigned char vf = vec_packsu(vs1, vs2);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
78 vec_st(vf, i, dest);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
79 }
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
80 }
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
81 for ( ; i < dstW ; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
82 int t = val[i] >> 19;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
83 dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
84 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
85 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
86
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
87 static inline void
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
88 yuv2yuvX_altivec_real(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
89 int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
90 uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
91 {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
92 const vector signed int vini = {(1 << 18), (1 << 18), (1 << 18), (1 << 18)};
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
93 register int i, j;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
94 {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
95 int __attribute__ ((aligned (16))) val[dstW];
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
96
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
97 for (i = 0; i < (dstW -7); i+=4) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
98 vec_st(vini, i << 2, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
99 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
100 for (; i < dstW; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
101 val[i] = (1 << 18);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
102 }
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
103
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
104 for (j = 0; j < lumFilterSize; j++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
105 vector signed short l1, vLumFilter = vec_ld(j << 1, lumFilter);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
106 vector unsigned char perm, perm0 = vec_lvsl(j << 1, lumFilter);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
107 vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
108 vLumFilter = vec_splat(vLumFilter, 0); // lumFilter[j] is loaded 8 times in vLumFilter
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
109
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
110 perm = vec_lvsl(0, lumSrc[j]);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
111 l1 = vec_ld(0, lumSrc[j]);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
112
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
113 for (i = 0; i < (dstW - 7); i+=8) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
114 int offset = i << 2;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
115 vector signed short l2 = vec_ld((i << 1) + 16, lumSrc[j]);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
116
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
117 vector signed int v1 = vec_ld(offset, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
118 vector signed int v2 = vec_ld(offset + 16, val);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
119
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
120 vector signed short ls = vec_perm(l1, l2, perm); // lumSrc[j][i] ... lumSrc[j][i+7]
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
121
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
122 vector signed int i1 = vec_mule(vLumFilter, ls);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
123 vector signed int i2 = vec_mulo(vLumFilter, ls);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
124
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
125 vector signed int vf1 = vec_mergeh(i1, i2);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
126 vector signed int vf2 = vec_mergel(i1, i2); // lumSrc[j][i] * lumFilter[j] ... lumSrc[j][i+7] * lumFilter[j]
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
127
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
128 vector signed int vo1 = vec_add(v1, vf1);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
129 vector signed int vo2 = vec_add(v2, vf2);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
130
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
131 vec_st(vo1, offset, val);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
132 vec_st(vo2, offset + 16, val);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
133
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
134 l1 = l2;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
135 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
136 for ( ; i < dstW; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
137 val[i] += lumSrc[j][i] * lumFilter[j];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
138 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
139 }
25750
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
140 altivec_packIntArrayToCharArray(val, dest, dstW);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
141 }
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
142 if (uDest != 0) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
143 int __attribute__ ((aligned (16))) u[chrDstW];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
144 int __attribute__ ((aligned (16))) v[chrDstW];
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
145
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
146 for (i = 0; i < (chrDstW -7); i+=4) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
147 vec_st(vini, i << 2, u);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
148 vec_st(vini, i << 2, v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
149 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
150 for (; i < chrDstW; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
151 u[i] = (1 << 18);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
152 v[i] = (1 << 18);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
153 }
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
154
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
155 for (j = 0; j < chrFilterSize; j++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
156 vector signed short l1, l1_V, vChrFilter = vec_ld(j << 1, chrFilter);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
157 vector unsigned char perm, perm0 = vec_lvsl(j << 1, chrFilter);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
158 vChrFilter = vec_perm(vChrFilter, vChrFilter, perm0);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
159 vChrFilter = vec_splat(vChrFilter, 0); // chrFilter[j] is loaded 8 times in vChrFilter
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
160
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
161 perm = vec_lvsl(0, chrSrc[j]);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
162 l1 = vec_ld(0, chrSrc[j]);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
163 l1_V = vec_ld(2048 << 1, chrSrc[j]);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
164
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
165 for (i = 0; i < (chrDstW - 7); i+=8) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
166 int offset = i << 2;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
167 vector signed short l2 = vec_ld((i << 1) + 16, chrSrc[j]);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
168 vector signed short l2_V = vec_ld(((i + 2048) << 1) + 16, chrSrc[j]);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
169
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
170 vector signed int v1 = vec_ld(offset, u);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
171 vector signed int v2 = vec_ld(offset + 16, u);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
172 vector signed int v1_V = vec_ld(offset, v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
173 vector signed int v2_V = vec_ld(offset + 16, v);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
174
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
175 vector signed short ls = vec_perm(l1, l2, perm); // chrSrc[j][i] ... chrSrc[j][i+7]
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
176 vector signed short ls_V = vec_perm(l1_V, l2_V, perm); // chrSrc[j][i+2048] ... chrSrc[j][i+2055]
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
177
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
178 vector signed int i1 = vec_mule(vChrFilter, ls);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
179 vector signed int i2 = vec_mulo(vChrFilter, ls);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
180 vector signed int i1_V = vec_mule(vChrFilter, ls_V);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
181 vector signed int i2_V = vec_mulo(vChrFilter, ls_V);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
182
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
183 vector signed int vf1 = vec_mergeh(i1, i2);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
184 vector signed int vf2 = vec_mergel(i1, i2); // chrSrc[j][i] * chrFilter[j] ... chrSrc[j][i+7] * chrFilter[j]
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
185 vector signed int vf1_V = vec_mergeh(i1_V, i2_V);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
186 vector signed int vf2_V = vec_mergel(i1_V, i2_V); // chrSrc[j][i] * chrFilter[j] ... chrSrc[j][i+7] * chrFilter[j]
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
187
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
188 vector signed int vo1 = vec_add(v1, vf1);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
189 vector signed int vo2 = vec_add(v2, vf2);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
190 vector signed int vo1_V = vec_add(v1_V, vf1_V);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
191 vector signed int vo2_V = vec_add(v2_V, vf2_V);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
192
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
193 vec_st(vo1, offset, u);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
194 vec_st(vo2, offset + 16, u);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
195 vec_st(vo1_V, offset, v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
196 vec_st(vo2_V, offset + 16, v);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
197
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
198 l1 = l2;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
199 l1_V = l2_V;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
200 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
201 for ( ; i < chrDstW; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
202 u[i] += chrSrc[j][i] * chrFilter[j];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
203 v[i] += chrSrc[j][i + 2048] * chrFilter[j];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
204 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
205 }
25750
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
206 altivec_packIntArrayToCharArray(u, uDest, chrDstW);
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
207 altivec_packIntArrayToCharArray(v, vDest, chrDstW);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
208 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
209 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
210
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
211 static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc, int16_t *filter, int16_t *filterPos, int filterSize) {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
212 register int i;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
213 int __attribute__ ((aligned (16))) tempo[4];
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
214
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
215 if (filterSize % 4) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
216 for (i=0; i<dstW; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
217 register int j;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
218 register int srcPos = filterPos[i];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
219 register int val = 0;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
220 for (j=0; j<filterSize; j++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
221 val += ((int)src[srcPos + j])*filter[filterSize*i + j];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
222 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
223 dst[i] = av_clip(val>>7, 0, (1<<15)-1);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
224 }
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
225 }
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
226 else
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
227 switch (filterSize) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
228 case 4:
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
229 {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
230 for (i=0; i<dstW; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
231 register int srcPos = filterPos[i];
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
232
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
233 vector unsigned char src_v0 = vec_ld(srcPos, src);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
234 vector unsigned char src_v1, src_vF;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
235 vector signed short src_v, filter_v;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
236 vector signed int val_vEven, val_s;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
237 if ((((int)src + srcPos)% 16) > 12) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
238 src_v1 = vec_ld(srcPos + 16, src);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
239 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
240 src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
241
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
242 src_v = // vec_unpackh sign-extends...
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
243 (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
244 // now put our elements in the even slots
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
245 src_v = vec_mergeh(src_v, (vector signed short)vzero);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
246
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
247 filter_v = vec_ld(i << 3, filter);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
248 // the 3 above is 2 (filterSize == 4) + 1 (sizeof(short) == 2)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
249
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
250 // the neat trick : we only care for half the elements,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
251 // high or low depending on (i<<3)%16 (it's 0 or 8 here),
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
252 // and we're going to use vec_mule, so we chose
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
253 // carefully how to "unpack" the elements into the even slots
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
254 if ((i << 3) % 16)
25750
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
255 filter_v = vec_mergel(filter_v, (vector signed short)vzero);
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
256 else
25750
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
257 filter_v = vec_mergeh(filter_v, (vector signed short)vzero);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
258
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
259 val_vEven = vec_mule(src_v, filter_v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
260 val_s = vec_sums(val_vEven, vzero);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
261 vec_st(val_s, 0, tempo);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
262 dst[i] = av_clip(tempo[3]>>7, 0, (1<<15)-1);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
263 }
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
264 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
265 break;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
266
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
267 case 8:
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
268 {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
269 for (i=0; i<dstW; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
270 register int srcPos = filterPos[i];
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
271
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
272 vector unsigned char src_v0 = vec_ld(srcPos, src);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
273 vector unsigned char src_v1, src_vF;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
274 vector signed short src_v, filter_v;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
275 vector signed int val_v, val_s;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
276 if ((((int)src + srcPos)% 16) > 8) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
277 src_v1 = vec_ld(srcPos + 16, src);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
278 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
279 src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
280
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
281 src_v = // vec_unpackh sign-extends...
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
282 (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
283 filter_v = vec_ld(i << 4, filter);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
284 // the 4 above is 3 (filterSize == 8) + 1 (sizeof(short) == 2)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
285
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
286 val_v = vec_msums(src_v, filter_v, (vector signed int)vzero);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
287 val_s = vec_sums(val_v, vzero);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
288 vec_st(val_s, 0, tempo);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
289 dst[i] = av_clip(tempo[3]>>7, 0, (1<<15)-1);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
290 }
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
291 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
292 break;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
293
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
294 case 16:
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
295 {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
296 for (i=0; i<dstW; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
297 register int srcPos = filterPos[i];
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
298
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
299 vector unsigned char src_v0 = vec_ld(srcPos, src);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
300 vector unsigned char src_v1 = vec_ld(srcPos + 16, src);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
301 vector unsigned char src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
302
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
303 vector signed short src_vA = // vec_unpackh sign-extends...
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
304 (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
305 vector signed short src_vB = // vec_unpackh sign-extends...
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
306 (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
307
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
308 vector signed short filter_v0 = vec_ld(i << 5, filter);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
309 vector signed short filter_v1 = vec_ld((i << 5) + 16, filter);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
310 // the 5 above are 4 (filterSize == 16) + 1 (sizeof(short) == 2)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
311
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
312 vector signed int val_acc = vec_msums(src_vA, filter_v0, (vector signed int)vzero);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
313 vector signed int val_v = vec_msums(src_vB, filter_v1, val_acc);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
314
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
315 vector signed int val_s = vec_sums(val_v, vzero);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
316
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
317 vec_st(val_s, 0, tempo);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
318 dst[i] = av_clip(tempo[3]>>7, 0, (1<<15)-1);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
319 }
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
320 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
321 break;
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
322
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
323 default:
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
324 {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
325 for (i=0; i<dstW; i++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
326 register int j;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
327 register int srcPos = filterPos[i];
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
328
20584
200ec2faa4e1 Do not mix declarations and statements.
diego
parents: 20094
diff changeset
329 vector signed int val_s, val_v = (vector signed int)vzero;
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
330 vector signed short filter_v0R = vec_ld(i * 2 * filterSize, filter);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
331 vector unsigned char permF = vec_lvsl((i * 2 * filterSize), filter);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
332
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
333 vector unsigned char src_v0 = vec_ld(srcPos, src);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
334 vector unsigned char permS = vec_lvsl(srcPos, src);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
335
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
336 for (j = 0 ; j < filterSize - 15; j += 16) {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
337 vector unsigned char src_v1 = vec_ld(srcPos + j + 16, src);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
338 vector unsigned char src_vF = vec_perm(src_v0, src_v1, permS);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
339
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
340 vector signed short src_vA = // vec_unpackh sign-extends...
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
341 (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
342 vector signed short src_vB = // vec_unpackh sign-extends...
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
343 (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
344
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
345 vector signed short filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
346 vector signed short filter_v2R = vec_ld((i * 2 * filterSize) + (j * 2) + 32, filter);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
347 vector signed short filter_v0 = vec_perm(filter_v0R, filter_v1R, permF);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
348 vector signed short filter_v1 = vec_perm(filter_v1R, filter_v2R, permF);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
349
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
350 vector signed int val_acc = vec_msums(src_vA, filter_v0, val_v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
351 val_v = vec_msums(src_vB, filter_v1, val_acc);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
352
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
353 filter_v0R = filter_v2R;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
354 src_v0 = src_v1;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
355 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
356
25751
147deb141e07 Remove some useless parentheses.
benoit
parents: 25750
diff changeset
357 if (j < filterSize-7) {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
358 // loading src_v0 is useless, it's already done above
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
359 //vector unsigned char src_v0 = vec_ld(srcPos + j, src);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
360 vector unsigned char src_v1, src_vF;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
361 vector signed short src_v, filter_v1R, filter_v;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
362 if ((((int)src + srcPos)% 16) > 8) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
363 src_v1 = vec_ld(srcPos + j + 16, src);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
364 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
365 src_vF = vec_perm(src_v0, src_v1, permS);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
366
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
367 src_v = // vec_unpackh sign-extends...
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
368 (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
369 // loading filter_v0R is useless, it's already done above
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
370 //vector signed short filter_v0R = vec_ld((i * 2 * filterSize) + j, filter);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
371 filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
372 filter_v = vec_perm(filter_v0R, filter_v1R, permF);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
373
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
374 val_v = vec_msums(src_v, filter_v, val_v);
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
375 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
376
20584
200ec2faa4e1 Do not mix declarations and statements.
diego
parents: 20094
diff changeset
377 val_s = vec_sums(val_v, vzero);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
378
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
379 vec_st(val_s, 0, tempo);
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
380 dst[i] = av_clip(tempo[3]>>7, 0, (1<<15)-1);
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
381 }
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
382
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
383 }
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
384 }
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
385 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
386
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
387 static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
388 int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
389 uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY;
25750
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
390 // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
391 uint8_t *ysrc = src[0];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
392 uint8_t *usrc = src[1];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
393 uint8_t *vsrc = src[2];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
394 const int width = c->srcW;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
395 const int height = srcSliceH;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
396 const int lumStride = srcStride[0];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
397 const int chromStride = srcStride[1];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
398 const int dstStride = dstStride_a[0];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
399 const vector unsigned char yperm = vec_lvsl(0, ysrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
400 const int vertLumPerChroma = 2;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
401 register unsigned int y;
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
402
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
403 if (width&15) {
25750
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
404 yv12toyuy2(ysrc, usrc, vsrc, dst, c->srcW, srcSliceH, lumStride, chromStride, dstStride);
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
405 return srcSliceH;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
406 }
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
407
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
408 /* this code assume:
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
409
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
410 1) dst is 16 bytes-aligned
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
411 2) dstStride is a multiple of 16
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
412 3) width is a multiple of 16
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
413 4) lum&chrom stride are multiple of 8
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
414 */
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
415
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
416 for (y=0; y<height; y++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
417 int i;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
418 for (i = 0; i < width - 31; i+= 32) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
419 const unsigned int j = i >> 1;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
420 vector unsigned char v_yA = vec_ld(i, ysrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
421 vector unsigned char v_yB = vec_ld(i + 16, ysrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
422 vector unsigned char v_yC = vec_ld(i + 32, ysrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
423 vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
424 vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
425 vector unsigned char v_uA = vec_ld(j, usrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
426 vector unsigned char v_uB = vec_ld(j + 16, usrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
427 vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc));
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
428 vector unsigned char v_vA = vec_ld(j, vsrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
429 vector unsigned char v_vB = vec_ld(j + 16, vsrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
430 vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc));
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
431 vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
432 vector unsigned char v_uv_b = vec_mergel(v_u, v_v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
433 vector unsigned char v_yuy2_0 = vec_mergeh(v_y1, v_uv_a);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
434 vector unsigned char v_yuy2_1 = vec_mergel(v_y1, v_uv_a);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
435 vector unsigned char v_yuy2_2 = vec_mergeh(v_y2, v_uv_b);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
436 vector unsigned char v_yuy2_3 = vec_mergel(v_y2, v_uv_b);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
437 vec_st(v_yuy2_0, (i << 1), dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
438 vec_st(v_yuy2_1, (i << 1) + 16, dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
439 vec_st(v_yuy2_2, (i << 1) + 32, dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
440 vec_st(v_yuy2_3, (i << 1) + 48, dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
441 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
442 if (i < width) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
443 const unsigned int j = i >> 1;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
444 vector unsigned char v_y1 = vec_ld(i, ysrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
445 vector unsigned char v_u = vec_ld(j, usrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
446 vector unsigned char v_v = vec_ld(j, vsrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
447 vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
448 vector unsigned char v_yuy2_0 = vec_mergeh(v_y1, v_uv_a);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
449 vector unsigned char v_yuy2_1 = vec_mergel(v_y1, v_uv_a);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
450 vec_st(v_yuy2_0, (i << 1), dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
451 vec_st(v_yuy2_1, (i << 1) + 16, dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
452 }
25751
147deb141e07 Remove some useless parentheses.
benoit
parents: 25750
diff changeset
453 if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
454 usrc += chromStride;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
455 vsrc += chromStride;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
456 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
457 ysrc += lumStride;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
458 dst += dstStride;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
459 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
460
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
461 return srcSliceH;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
462 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
463
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
464 static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
465 int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
466 uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY;
25750
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
467 // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
468 uint8_t *ysrc = src[0];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
469 uint8_t *usrc = src[1];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
470 uint8_t *vsrc = src[2];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
471 const int width = c->srcW;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
472 const int height = srcSliceH;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
473 const int lumStride = srcStride[0];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
474 const int chromStride = srcStride[1];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
475 const int dstStride = dstStride_a[0];
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
476 const int vertLumPerChroma = 2;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
477 const vector unsigned char yperm = vec_lvsl(0, ysrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
478 register unsigned int y;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
479
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
480 if (width&15) {
25750
06bf0eb70a55 Cosmetics: whitespaces
benoit
parents: 25749
diff changeset
481 yv12touyvy(ysrc, usrc, vsrc, dst, c->srcW, srcSliceH, lumStride, chromStride, dstStride);
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
482 return srcSliceH;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
483 }
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
484
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
485 /* this code assume:
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
486
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
487 1) dst is 16 bytes-aligned
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
488 2) dstStride is a multiple of 16
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
489 3) width is a multiple of 16
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
490 4) lum&chrom stride are multiple of 8
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
491 */
23129
9528d1ebe68f cosmetics: Remove trailing whitespace.
diego
parents: 22321
diff changeset
492
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
493 for (y=0; y<height; y++) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
494 int i;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
495 for (i = 0; i < width - 31; i+= 32) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
496 const unsigned int j = i >> 1;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
497 vector unsigned char v_yA = vec_ld(i, ysrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
498 vector unsigned char v_yB = vec_ld(i + 16, ysrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
499 vector unsigned char v_yC = vec_ld(i + 32, ysrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
500 vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
501 vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
502 vector unsigned char v_uA = vec_ld(j, usrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
503 vector unsigned char v_uB = vec_ld(j + 16, usrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
504 vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc));
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
505 vector unsigned char v_vA = vec_ld(j, vsrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
506 vector unsigned char v_vB = vec_ld(j + 16, vsrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
507 vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc));
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
508 vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
509 vector unsigned char v_uv_b = vec_mergel(v_u, v_v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
510 vector unsigned char v_uyvy_0 = vec_mergeh(v_uv_a, v_y1);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
511 vector unsigned char v_uyvy_1 = vec_mergel(v_uv_a, v_y1);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
512 vector unsigned char v_uyvy_2 = vec_mergeh(v_uv_b, v_y2);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
513 vector unsigned char v_uyvy_3 = vec_mergel(v_uv_b, v_y2);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
514 vec_st(v_uyvy_0, (i << 1), dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
515 vec_st(v_uyvy_1, (i << 1) + 16, dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
516 vec_st(v_uyvy_2, (i << 1) + 32, dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
517 vec_st(v_uyvy_3, (i << 1) + 48, dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
518 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
519 if (i < width) {
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
520 const unsigned int j = i >> 1;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
521 vector unsigned char v_y1 = vec_ld(i, ysrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
522 vector unsigned char v_u = vec_ld(j, usrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
523 vector unsigned char v_v = vec_ld(j, vsrc);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
524 vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
525 vector unsigned char v_uyvy_0 = vec_mergeh(v_uv_a, v_y1);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
526 vector unsigned char v_uyvy_1 = vec_mergel(v_uv_a, v_y1);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
527 vec_st(v_uyvy_0, (i << 1), dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
528 vec_st(v_uyvy_1, (i << 1) + 16, dst);
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
529 }
25751
147deb141e07 Remove some useless parentheses.
benoit
parents: 25750
diff changeset
530 if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
531 usrc += chromStride;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
532 vsrc += chromStride;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
533 }
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
534 ysrc += lumStride;
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
535 dst += dstStride;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
536 }
23140
4d3870361b73 cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents: 23129
diff changeset
537 return srcSliceH;
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
538 }