History

ppc: dsputil: K&R formatting cosmetics

Diego Biurrun committed 12 years ago

Commit 30f3f951 parent 82ee14d3 files · +429 −391Browse files

Unified · Split

3 files
  1. libavcodec/ppc/dsputil_altivec.c +394 −355
  2. libavcodec/ppc/dsputil_altivec.h +7 −5
  3. libavcodec/ppc/dsputil_ppc.c +28 −31
libavcodec/ppc/dsputil_altivec.c+394−355
@@ -24,6 +24,7 @@ · 23 unmodified lines
24#if HAVE_ALTIVEC_H24#if HAVE_ALTIVEC_H
25#include <altivec.h>25#include <altivec.h>
26#endif26#endif
27
27#include "libavutil/attributes.h"28#include "libavutil/attributes.h"
28#include "libavutil/ppc/types_altivec.h"29#include "libavutil/ppc/types_altivec.h"
29#include "libavutil/ppc/util_altivec.h"30#include "libavutil/ppc/util_altivec.h"
@@ -31,11 +32,13 @@ · 1 unmodified line
31#include "libavcodec/dsputil.h"32#include "libavcodec/dsputil.h"
32#include "dsputil_altivec.h"33#include "dsputil_altivec.h"
33 34
34static int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)35static int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2,
36 int line_size, int h)
35{37{
36 int i;38 int i;
37 int s;39 int s;
38 const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);40 const vector unsigned char zero =
41 (const vector unsigned char) vec_splat_u8(0);
39 vector unsigned char perm1 = vec_lvsl(0, pix2);42 vector unsigned char perm1 = vec_lvsl(0, pix2);
40 vector unsigned char perm2 = vec_add(perm1, vec_splat_u8(1));43 vector unsigned char perm2 = vec_add(perm1, vec_splat_u8(1));
41 vector unsigned char pix2l, pix2r;44 vector unsigned char pix2l, pix2r;
@@ -44,13 +47,13 @@ static int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size · 2 unmodified lines
44 vector signed int sumdiffs;47 vector signed int sumdiffs;
45 48
46 s = 0;49 s = 0;
47 sad = (vector unsigned int)vec_splat_u32(0);50 sad = (vector unsigned int) vec_splat_u32(0);
48 for (i = 0; i < h; i++) {51 for (i = 0; i < h; i++) {
49 /* Read unaligned pixels into our vectors. The vectors are as follows:52 /* Read unaligned pixels into our vectors. The vectors are as follows:
50 * pix1v: pix1[0] - pix1[15]53 * pix1v: pix1[0] - pix1[15]
51 * pix2v: pix2[0] - pix2[15] pix2iv: pix2[1] - pix2[16] */54 * pix2v: pix2[0] - pix2[15] pix2iv: pix2[1] - pix2[16] */
52 pix1v = vec_ld( 0, pix1);55 pix1v = vec_ld(0, pix1);
53 pix2l = vec_ld( 0, pix2);56 pix2l = vec_ld(0, pix2);
54 pix2r = vec_ld(16, pix2);57 pix2r = vec_ld(16, pix2);
55 pix2v = vec_perm(pix2l, pix2r, perm1);58 pix2v = vec_perm(pix2l, pix2r, perm1);
56 pix2iv = vec_perm(pix2l, pix2r, perm2);59 pix2iv = vec_perm(pix2l, pix2r, perm2);
@@ -75,11 +78,13 @@ static int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size · 18 unmodified lines
75 return s;78 return s;
76}79}
77 80
78static int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)81static int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2,
82 int line_size, int h)
79{83{
80 int i;84 int i;
81 int s;85 int s;
82 const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);86 const vector unsigned char zero =
87 (const vector unsigned char) vec_splat_u8(0);
83 vector unsigned char perm = vec_lvsl(0, pix2);88 vector unsigned char perm = vec_lvsl(0, pix2);
84 vector unsigned char pix2l, pix2r;89 vector unsigned char pix2l, pix2r;
85 vector unsigned char pix1v, pix2v, pix3v, avgv, t5;90 vector unsigned char pix1v, pix2v, pix3v, avgv, t5;
@@ -88,7 +93,7 @@ static int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size · 2 unmodified lines
88 uint8_t *pix3 = pix2 + line_size;93 uint8_t *pix3 = pix2 + line_size;
89 94
90 s = 0;95 s = 0;
91 sad = (vector unsigned int)vec_splat_u32(0);96 sad = (vector unsigned int) vec_splat_u32(0);
92 97
93 /* Due to the fact that pix3 = pix2 + line_size, the pix3 of one98 /* Due to the fact that pix3 = pix2 + line_size, the pix3 of one
94 * iteration becomes pix2 in the next iteration. We can use this99 * iteration becomes pix2 in the next iteration. We can use this
@@ -97,7 +102,7 @@ static int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size · 2 unmodified lines
97 * Read unaligned pixels into our vectors. The vectors are as follows:102 * Read unaligned pixels into our vectors. The vectors are as follows:
98 * pix2v: pix2[0] - pix2[15]103 * pix2v: pix2[0] - pix2[15]
99 * Split the pixel vectors into shorts. */104 * Split the pixel vectors into shorts. */
100 pix2l = vec_ld( 0, pix2);105 pix2l = vec_ld(0, pix2);
101 pix2r = vec_ld(15, pix2);106 pix2r = vec_ld(15, pix2);
102 pix2v = vec_perm(pix2l, pix2r, perm);107 pix2v = vec_perm(pix2l, pix2r, perm);
103 108
@@ -105,9 +110,9 @@ static int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size · 1 unmodified line
105 /* Read unaligned pixels into our vectors. The vectors are as follows:110 /* Read unaligned pixels into our vectors. The vectors are as follows:
106 * pix1v: pix1[0] - pix1[15]111 * pix1v: pix1[0] - pix1[15]
107 * pix3v: pix3[0] - pix3[15] */112 * pix3v: pix3[0] - pix3[15] */
108 pix1v = vec_ld(0, pix1);113 pix1v = vec_ld(0, pix1);
109 114
110 pix2l = vec_ld( 0, pix3);115 pix2l = vec_ld(0, pix3);
111 pix2r = vec_ld(15, pix3);116 pix2r = vec_ld(15, pix3);
112 pix3v = vec_perm(pix2l, pix2r, perm);117 pix3v = vec_perm(pix2l, pix2r, perm);
113 118
@@ -123,7 +128,6 @@ static int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size · 9 unmodified lines
123 pix1 += line_size;128 pix1 += line_size;
124 pix2v = pix3v;129 pix2v = pix3v;
125 pix3 += line_size;130 pix3 += line_size;
126
127 }131 }
128 132
129 /* Sum up the four partial sums, and put the result into s. */133 /* Sum up the four partial sums, and put the result into s. */
@@ -133,13 +137,16 @@ static int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size · 3 unmodified lines
133 return s;137 return s;
134}138}
135 139
136static int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)140static int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2,
141 int line_size, int h)
137{142{
138 int i;143 int i;
139 int s;144 int s;
140 uint8_t *pix3 = pix2 + line_size;145 uint8_t *pix3 = pix2 + line_size;
141 const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);146 const vector unsigned char zero =
142 const vector unsigned short two = (const vector unsigned short)vec_splat_u16(2);147 (const vector unsigned char) vec_splat_u8(0);
148 const vector unsigned short two =
149 (const vector unsigned short) vec_splat_u16(2);
143 vector unsigned char avgv, t5;150 vector unsigned char avgv, t5;
144 vector unsigned char perm1 = vec_lvsl(0, pix2);151 vector unsigned char perm1 = vec_lvsl(0, pix2);
145 vector unsigned char perm2 = vec_add(perm1, vec_splat_u8(1));152 vector unsigned char perm2 = vec_add(perm1, vec_splat_u8(1));
@@ -152,7 +159,7 @@ static int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_siz · 6 unmodified lines
152 vector unsigned int sad;159 vector unsigned int sad;
153 vector signed int sumdiffs;160 vector signed int sumdiffs;
154 161
155 sad = (vector unsigned int)vec_splat_u32(0);162 sad = (vector unsigned int) vec_splat_u32(0);
156 163
157 s = 0;164 s = 0;
158 165
@@ -163,7 +170,7 @@ static int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_siz · 4 unmodified lines
163 * Read unaligned pixels into our vectors. The vectors are as follows:170 * Read unaligned pixels into our vectors. The vectors are as follows:
164 * pix2v: pix2[0] - pix2[15] pix2iv: pix2[1] - pix2[16]171 * pix2v: pix2[0] - pix2[15] pix2iv: pix2[1] - pix2[16]
165 * Split the pixel vectors into shorts. */172 * Split the pixel vectors into shorts. */
166 pix2l = vec_ld( 0, pix2);173 pix2l = vec_ld(0, pix2);
167 pix2r = vec_ld(16, pix2);174 pix2r = vec_ld(16, pix2);
168 pix2v = vec_perm(pix2l, pix2r, perm1);175 pix2v = vec_perm(pix2l, pix2r, perm1);
169 pix2iv = vec_perm(pix2l, pix2r, perm2);176 pix2iv = vec_perm(pix2l, pix2r, perm2);
@@ -172,16 +179,16 @@ static int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_siz · 2 unmodified lines
172 pix2lv = (vector unsigned short) vec_mergel(zero, pix2v);179 pix2lv = (vector unsigned short) vec_mergel(zero, pix2v);
173 pix2ihv = (vector unsigned short) vec_mergeh(zero, pix2iv);180 pix2ihv = (vector unsigned short) vec_mergeh(zero, pix2iv);
174 pix2ilv = (vector unsigned short) vec_mergel(zero, pix2iv);181 pix2ilv = (vector unsigned short) vec_mergel(zero, pix2iv);
175 t1 = vec_add(pix2hv, pix2ihv);182 t1 = vec_add(pix2hv, pix2ihv);
176 t2 = vec_add(pix2lv, pix2ilv);183 t2 = vec_add(pix2lv, pix2ilv);
177 184
178 for (i = 0; i < h; i++) {185 for (i = 0; i < h; i++) {
179 /* Read unaligned pixels into our vectors. The vectors are as follows:186 /* Read unaligned pixels into our vectors. The vectors are as follows:
180 * pix1v: pix1[0] - pix1[15]187 * pix1v: pix1[0] - pix1[15]
181 * pix3v: pix3[0] - pix3[15] pix3iv: pix3[1] - pix3[16] */188 * pix3v: pix3[0] - pix3[15] pix3iv: pix3[1] - pix3[16] */
182 pix1v = vec_ld(0, pix1);189 pix1v = vec_ld(0, pix1);
183 190
184 pix2l = vec_ld( 0, pix3);191 pix2l = vec_ld(0, pix3);
185 pix2r = vec_ld(16, pix3);192 pix2r = vec_ld(16, pix3);
186 pix3v = vec_perm(pix2l, pix2r, perm1);193 pix3v = vec_perm(pix2l, pix2r, perm1);
187 pix3iv = vec_perm(pix2l, pix2r, perm2);194 pix3iv = vec_perm(pix2l, pix2r, perm2);
@@ -228,22 +235,23 @@ static int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_siz · 40 unmodified lines
228 return s;235 return s;
229}236}
230 237
231static int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)238static int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2,
239 int line_size, int h)
232{240{
233 int i;241 int i;
234 int s;242 int s;
235 const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);243 const vector unsigned int zero =
244 (const vector unsigned int) vec_splat_u32(0);
236 vector unsigned char perm = vec_lvsl(0, pix2);245 vector unsigned char perm = vec_lvsl(0, pix2);
237 vector unsigned char t1, t2, t3,t4, t5;246 vector unsigned char t1, t2, t3, t4, t5;
238 vector unsigned int sad;247 vector unsigned int sad;
239 vector signed int sumdiffs;248 vector signed int sumdiffs;
240 249
241 sad = (vector unsigned int)vec_splat_u32(0);250 sad = (vector unsigned int) vec_splat_u32(0);
242
243 251
244 for (i = 0; i < h; i++) {252 for (i = 0; i < h; i++) {
245 /* Read potentially unaligned pixels into t1 and t2. */253 /* Read potentially unaligned pixels into t1 and t2. */
246 vector unsigned char pix2l = vec_ld( 0, pix2);254 vector unsigned char pix2l = vec_ld(0, pix2);
247 vector unsigned char pix2r = vec_ld(15, pix2);255 vector unsigned char pix2r = vec_ld(15, pix2);
248 t1 = vec_ld(0, pix1);256 t1 = vec_ld(0, pix1);
249 t2 = vec_perm(pix2l, pix2r, perm);257 t2 = vec_perm(pix2l, pix2r, perm);
@@ -268,19 +276,23 @@ static int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i · 18 unmodified lines
268 return s;276 return s;
269}277}
270 278
271static int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)279static int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2,
280 int line_size, int h)
272{281{
273 int i;282 int i;
274 int s;283 int s;
275 const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);284 const vector unsigned int zero =
276 const vector unsigned char permclear = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0};285 (const vector unsigned int) vec_splat_u32(0);
286 const vector unsigned char permclear =
287 (vector unsigned char)
288 { 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0 };
277 vector unsigned char perm1 = vec_lvsl(0, pix1);289 vector unsigned char perm1 = vec_lvsl(0, pix1);
278 vector unsigned char perm2 = vec_lvsl(0, pix2);290 vector unsigned char perm2 = vec_lvsl(0, pix2);
279 vector unsigned char t1, t2, t3,t4, t5;291 vector unsigned char t1, t2, t3, t4, t5;
280 vector unsigned int sad;292 vector unsigned int sad;
281 vector signed int sumdiffs;293 vector signed int sumdiffs;
282 294
283 sad = (vector unsigned int)vec_splat_u32(0);295 sad = (vector unsigned int) vec_splat_u32(0);
284 296
285 for (i = 0; i < h; i++) {297 for (i = 0; i < h; i++) {
286 /* Read potentially unaligned pixels into t1 and t2.298 /* Read potentially unaligned pixels into t1 and t2.
@@ -317,18 +329,19 @@ static int pix_norm1_altivec(uint8_t *pix, int line_size) · 30 unmodified lines
317{329{
318 int i;330 int i;
319 int s;331 int s;
320 const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);332 const vector unsigned int zero =
333 (const vector unsigned int) vec_splat_u32(0);
321 vector unsigned char perm = vec_lvsl(0, pix);334 vector unsigned char perm = vec_lvsl(0, pix);
322 vector unsigned char pixv;335 vector unsigned char pixv;
323 vector unsigned int sv;336 vector unsigned int sv;
324 vector signed int sum;337 vector signed int sum;
325 338
326 sv = (vector unsigned int)vec_splat_u32(0);339 sv = (vector unsigned int) vec_splat_u32(0);
327 340
328 s = 0;341 s = 0;
329 for (i = 0; i < 16; i++) {342 for (i = 0; i < 16; i++) {
330 /* Read the potentially unaligned pixels. */343 /* Read the potentially unaligned pixels. */
331 vector unsigned char pixl = vec_ld( 0, pix);344 vector unsigned char pixl = vec_ld(0, pix);
332 vector unsigned char pixr = vec_ld(15, pix);345 vector unsigned char pixr = vec_ld(15, pix);
333 pixv = vec_perm(pixl, pixr, perm);346 pixv = vec_perm(pixl, pixr, perm);
334 347
@@ -347,19 +360,23 @@ static int pix_norm1_altivec(uint8_t *pix, int line_size) · 12 unmodified lines
347 360
348/* Sum of Squared Errors for an 8x8 block, AltiVec-enhanced.361/* Sum of Squared Errors for an 8x8 block, AltiVec-enhanced.
349 * It's the sad8_altivec code above w/ squaring added. */362 * It's the sad8_altivec code above w/ squaring added. */
350static int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)363static int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2,
364 int line_size, int h)
351{365{
352 int i;366 int i;
353 int s;367 int s;
354 const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);368 const vector unsigned int zero =
355 const vector unsigned char permclear = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0};369 (const vector unsigned int) vec_splat_u32(0);
370 const vector unsigned char permclear =
371 (vector unsigned char)
372 { 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0 };
356 vector unsigned char perm1 = vec_lvsl(0, pix1);373 vector unsigned char perm1 = vec_lvsl(0, pix1);
357 vector unsigned char perm2 = vec_lvsl(0, pix2);374 vector unsigned char perm2 = vec_lvsl(0, pix2);
358 vector unsigned char t1, t2, t3,t4, t5;375 vector unsigned char t1, t2, t3, t4, t5;
359 vector unsigned int sum;376 vector unsigned int sum;
360 vector signed int sumsqr;377 vector signed int sumsqr;
361 378
362 sum = (vector unsigned int)vec_splat_u32(0);379 sum = (vector unsigned int) vec_splat_u32(0);
363 380
364 for (i = 0; i < h; i++) {381 for (i = 0; i < h; i++) {
365 /* Read potentially unaligned pixels into t1 and t2.382 /* Read potentially unaligned pixels into t1 and t2.
@@ -397,21 +414,23 @@ static int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, in · 31 unmodified lines
397 414
398/* Sum of Squared Errors for a 16x16 block, AltiVec-enhanced.415/* Sum of Squared Errors for a 16x16 block, AltiVec-enhanced.
399 * It's the sad16_altivec code above w/ squaring added. */416 * It's the sad16_altivec code above w/ squaring added. */
400static int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)417static int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2,
418 int line_size, int h)
401{419{
402 int i;420 int i;
403 int s;421 int s;
404 const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);422 const vector unsigned int zero =
423 (const vector unsigned int) vec_splat_u32(0);
405 vector unsigned char perm = vec_lvsl(0, pix2);424 vector unsigned char perm = vec_lvsl(0, pix2);
406 vector unsigned char t1, t2, t3,t4, t5;425 vector unsigned char t1, t2, t3, t4, t5;
407 vector unsigned int sum;426 vector unsigned int sum;
408 vector signed int sumsqr;427 vector signed int sumsqr;
409 428
410 sum = (vector unsigned int)vec_splat_u32(0);429 sum = (vector unsigned int) vec_splat_u32(0);
411 430
412 for (i = 0; i < h; i++) {431 for (i = 0; i < h; i++) {
413 /* Read potentially unaligned pixels into t1 and t2. */432 /* Read potentially unaligned pixels into t1 and t2. */
414 vector unsigned char pix2l = vec_ld( 0, pix2);433 vector unsigned char pix2l = vec_ld(0, pix2);
415 vector unsigned char pix2r = vec_ld(15, pix2);434 vector unsigned char pix2r = vec_ld(15, pix2);
416 t1 = vec_ld(0, pix1);435 t1 = vec_ld(0, pix1);
417 t2 = vec_perm(pix2l, pix2r, perm);436 t2 = vec_perm(pix2l, pix2r, perm);
@@ -439,9 +458,10 @@ static int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i · 21 unmodified lines
439 return s;458 return s;
440}459}
441 460
442static int pix_sum_altivec(uint8_t * pix, int line_size)461static int pix_sum_altivec(uint8_t *pix, int line_size)
443{462{
444 const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);463 const vector unsigned int zero =
464 (const vector unsigned int) vec_splat_u32(0);
445 vector unsigned char perm = vec_lvsl(0, pix);465 vector unsigned char perm = vec_lvsl(0, pix);
446 vector unsigned char t1;466 vector unsigned char t1;
447 vector unsigned int sad;467 vector unsigned int sad;
@@ -450,11 +470,11 @@ static int pix_sum_altivec(uint8_t * pix, int line_size) · 2 unmodified lines
450 int i;470 int i;
451 int s;471 int s;
452 472
453 sad = (vector unsigned int)vec_splat_u32(0);473 sad = (vector unsigned int) vec_splat_u32(0);
454 474
455 for (i = 0; i < 16; i++) {475 for (i = 0; i < 16; i++) {
456 /* Read the potentially unaligned 16 pixels into t1. */476 /* Read the potentially unaligned 16 pixels into t1. */
457 vector unsigned char pixl = vec_ld( 0, pix);477 vector unsigned char pixl = vec_ld(0, pix);
458 vector unsigned char pixr = vec_ld(15, pix);478 vector unsigned char pixr = vec_ld(15, pix);
459 t1 = vec_perm(pixl, pixr, perm);479 t1 = vec_perm(pixl, pixr, perm);
460 480
@@ -472,72 +492,72 @@ static int pix_sum_altivec(uint8_t * pix, int line_size) · 11 unmodified lines
472 return s;492 return s;
473}493}
474 494
475static void get_pixels_altivec(int16_t *restrict block, const uint8_t *pixels, int line_size)495static void get_pixels_altivec(int16_t *restrict block, const uint8_t *pixels,
496 int line_size)
476{497{
477 int i;498 int i;
478 vector unsigned char perm = vec_lvsl(0, pixels);499 vector unsigned char perm = vec_lvsl(0, pixels);
479 vector unsigned char bytes;500 vector unsigned char bytes;
480 const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);501 const vector unsigned char zero =
502 (const vector unsigned char) vec_splat_u8(0);
481 vector signed short shorts;503 vector signed short shorts;
482 504
483 for (i = 0; i < 8; i++) {505 for (i = 0; i < 8; i++) {
484 /* Read potentially unaligned pixels.506 /* Read potentially unaligned pixels.
485 * We're reading 16 pixels, and actually only want 8,507 * We're reading 16 pixels, and actually only want 8,
486 * but we simply ignore the extras. */508 * but we simply ignore the extras. */
487 // Read potentially unaligned pixels.
488 // We're reading 16 pixels, and actually only want 8,
489 // but we simply ignore the extras.
490 vector unsigned char pixl = vec_ld(0, pixels);509 vector unsigned char pixl = vec_ld(0, pixels);
491 vector unsigned char pixr = vec_ld(7, pixels);510 vector unsigned char pixr = vec_ld(7, pixels);
492 bytes = vec_perm(pixl, pixr, perm);511 bytes = vec_perm(pixl, pixr, perm);
493 512
494 // Convert the bytes into shorts.513 // Convert the bytes into shorts.
495 shorts = (vector signed short)vec_mergeh(zero, bytes);514 shorts = (vector signed short) vec_mergeh(zero, bytes);
496 515
497 // Save the data to the block, we assume the block is 16-byte aligned.516 // Save the data to the block, we assume the block is 16-byte aligned.
498 vec_st(shorts, i*16, (vector signed short*)block);517 vec_st(shorts, i * 16, (vector signed short *) block);
499 518
500 pixels += line_size;519 pixels += line_size;
501 }520 }
502}521}
503 522
504static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,523static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
505 const uint8_t *s2, int stride)524 const uint8_t *s2, int stride)
506{525{
507 int i;526 int i;
508 vector unsigned char perm1 = vec_lvsl(0, s1);527 vector unsigned char perm1 = vec_lvsl(0, s1);
509 vector unsigned char perm2 = vec_lvsl(0, s2);528 vector unsigned char perm2 = vec_lvsl(0, s2);
510 vector unsigned char bytes, pixl, pixr;529 vector unsigned char bytes, pixl, pixr;
511 const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);530 const vector unsigned char zero =
531 (const vector unsigned char) vec_splat_u8(0);
512 vector signed short shorts1, shorts2;532 vector signed short shorts1, shorts2;
513 533
514 for (i = 0; i < 4; i++) {534 for (i = 0; i < 4; i++) {
515 /* Read potentially unaligned pixels.535 /* Read potentially unaligned pixels.
516 * We're reading 16 pixels, and actually only want 8,536 * We're reading 16 pixels, and actually only want 8,
517 * but we simply ignore the extras. */537 * but we simply ignore the extras. */
518 pixl = vec_ld( 0, s1);538 pixl = vec_ld(0, s1);
519 pixr = vec_ld(15, s1);539 pixr = vec_ld(15, s1);
520 bytes = vec_perm(pixl, pixr, perm1);540 bytes = vec_perm(pixl, pixr, perm1);
521 541
522 // Convert the bytes into shorts.542 // Convert the bytes into shorts.
523 shorts1 = (vector signed short)vec_mergeh(zero, bytes);543 shorts1 = (vector signed short) vec_mergeh(zero, bytes);
524 544
525 // Do the same for the second block of pixels.545 // Do the same for the second block of pixels.
526 pixl = vec_ld( 0, s2);546 pixl = vec_ld(0, s2);
527 pixr = vec_ld(15, s2);547 pixr = vec_ld(15, s2);
528 bytes = vec_perm(pixl, pixr, perm2);548 bytes = vec_perm(pixl, pixr, perm2);
529 549
530 // Convert the bytes into shorts.550 // Convert the bytes into shorts.
531 shorts2 = (vector signed short)vec_mergeh(zero, bytes);551 shorts2 = (vector signed short) vec_mergeh(zero, bytes);
532 552
533 // Do the subtraction.553 // Do the subtraction.
534 shorts1 = vec_sub(shorts1, shorts2);554 shorts1 = vec_sub(shorts1, shorts2);
535 555
536 // Save the data to the block, we assume the block is 16-byte aligned.556 // Save the data to the block, we assume the block is 16-byte aligned.
537 vec_st(shorts1, 0, (vector signed short*)block);557 vec_st(shorts1, 0, (vector signed short *) block);
538 558
539 s1 += stride;559 s1 += stride;
540 s2 += stride;560 s2 += stride;
541 block += 8;561 block += 8;
542 562
543 /* The code below is a copy of the code above...563 /* The code below is a copy of the code above...
@@ -546,35 +566,35 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1, · 2 unmodified lines
546 /* Read potentially unaligned pixels.566 /* Read potentially unaligned pixels.
547 * We're reading 16 pixels, and actually only want 8,567 * We're reading 16 pixels, and actually only want 8,
548 * but we simply ignore the extras. */568 * but we simply ignore the extras. */
549 pixl = vec_ld( 0, s1);569 pixl = vec_ld(0, s1);
550 pixr = vec_ld(15, s1);570 pixr = vec_ld(15, s1);
551 bytes = vec_perm(pixl, pixr, perm1);571 bytes = vec_perm(pixl, pixr, perm1);
552 572
553 // Convert the bytes into shorts.573 // Convert the bytes into shorts.
554 shorts1 = (vector signed short)vec_mergeh(zero, bytes);574 shorts1 = (vector signed short) vec_mergeh(zero, bytes);
555 575
556 // Do the same for the second block of pixels.576 // Do the same for the second block of pixels.
557 pixl = vec_ld( 0, s2);577 pixl = vec_ld(0, s2);
558 pixr = vec_ld(15, s2);578 pixr = vec_ld(15, s2);
559 bytes = vec_perm(pixl, pixr, perm2);579 bytes = vec_perm(pixl, pixr, perm2);
560 580
561 // Convert the bytes into shorts.581 // Convert the bytes into shorts.
562 shorts2 = (vector signed short)vec_mergeh(zero, bytes);582 shorts2 = (vector signed short) vec_mergeh(zero, bytes);
563 583
564 // Do the subtraction.584 // Do the subtraction.
565 shorts1 = vec_sub(shorts1, shorts2);585 shorts1 = vec_sub(shorts1, shorts2);
566 586
567 // Save the data to the block, we assume the block is 16-byte aligned.587 // Save the data to the block, we assume the block is 16-byte aligned.
568 vec_st(shorts1, 0, (vector signed short*)block);588 vec_st(shorts1, 0, (vector signed short *) block);
569 589
570 s1 += stride;590 s1 += stride;
571 s2 += stride;591 s2 += stride;
572 block += 8;592 block += 8;
573 }593 }
574}594}
575 595
576 596static void clear_block_altivec(int16_t *block)
577static void clear_block_altivec(int16_t *block) {597{
578 LOAD_ZERO;598 LOAD_ZERO;
579 vec_st(zero_s16v, 0, block);599 vec_st(zero_s16v, 0, block);
580 vec_st(zero_s16v, 16, block);600 vec_st(zero_s16v, 16, block);
@@ -586,124 +606,128 @@ static void clear_block_altivec(int16_t *block) { · 5 unmodified lines
586 vec_st(zero_s16v, 112, block);606 vec_st(zero_s16v, 112, block);
587}607}
588 608
589 609static void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w)
590static void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w) {610{
591 register int i;611 register int i;
592 register vector unsigned char vdst, vsrc;612 register vector unsigned char vdst, vsrc;
593 613
594 /* dst and src are 16 bytes-aligned (guaranteed). */614 /* dst and src are 16 bytes-aligned (guaranteed). */
595 for (i = 0 ; (i + 15) < w ; i+=16) {615 for (i = 0; (i + 15) < w; i += 16) {
596 vdst = vec_ld(i, (unsigned char*)dst);616 vdst = vec_ld(i, (unsigned char *) dst);
597 vsrc = vec_ld(i, (unsigned char*)src);617 vsrc = vec_ld(i, (unsigned char *) src);
598 vdst = vec_add(vsrc, vdst);618 vdst = vec_add(vsrc, vdst);
599 vec_st(vdst, i, (unsigned char*)dst);619 vec_st(vdst, i, (unsigned char *) dst);
600 }620 }
601 /* If w is not a multiple of 16. */621 /* If w is not a multiple of 16. */
602 for (; (i < w) ; i++) {622 for (; (i < w); i++)
603 dst[i] = src[i];623 dst[i] = src[i];
604 }
605}624}
606 625
607static int hadamard8_diff8x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){626static int hadamard8_diff8x8_altivec(/* MpegEncContext */ void *s, uint8_t *dst,
627 uint8_t *src, int stride, int h)
628{
608 int sum;629 int sum;
609 register const vector unsigned char vzero =630 register const vector unsigned char vzero =
610 (const vector unsigned char)vec_splat_u8(0);631 (const vector unsigned char) vec_splat_u8(0);
611 register vector signed short temp0, temp1, temp2, temp3, temp4,632 register vector signed short temp0, temp1, temp2, temp3, temp4,
612 temp5, temp6, temp7;633 temp5, temp6, temp7;
613 {634 {
614 register const vector signed short vprod1 =(const vector signed short)635 register const vector signed short vprod1 =
615 { 1,-1, 1,-1, 1,-1, 1,-1 };636 (const vector signed short) { 1, -1, 1, -1, 1, -1, 1, -1 };
616 register const vector signed short vprod2 =(const vector signed short)637 register const vector signed short vprod2 =
617 { 1, 1,-1,-1, 1, 1,-1,-1 };638 (const vector signed short) { 1, 1, -1, -1, 1, 1, -1, -1 };
618 register const vector signed short vprod3 =(const vector signed short)639 register const vector signed short vprod3 =
619 { 1, 1, 1, 1,-1,-1,-1,-1 };640 (const vector signed short) { 1, 1, 1, 1, -1, -1, -1, -1 };
620 register const vector unsigned char perm1 = (const vector unsigned char)641 register const vector unsigned char perm1 =
621 {0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,642 (const vector unsigned char)
622 0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D};643 { 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,
623 register const vector unsigned char perm2 = (const vector unsigned char)644 0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D };
624 {0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03,645 register const vector unsigned char perm2 =
625 0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B};646 (const vector unsigned char)
626 register const vector unsigned char perm3 = (const vector unsigned char)647 { 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03,
627 {0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,648 0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B };
628 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};649 register const vector unsigned char perm3 =
629 650 (const vector unsigned char)
630#define ONEITERBUTTERFLY(i, res) \651 { 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
631 { \652 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
632 register vector unsigned char src1, src2, srcO; \653
633 register vector unsigned char dst1, dst2, dstO; \654#define ONEITERBUTTERFLY(i, res) \
634 register vector signed short srcV, dstV; \655 { \
635 register vector signed short but0, but1, but2, op1, op2, op3; \656 register vector unsigned char src1, src2, srcO; \
636 src1 = vec_ld(stride * i, src); \657 register vector unsigned char dst1, dst2, dstO; \
637 src2 = vec_ld((stride * i) + 15, src); \658 register vector signed short srcV, dstV; \
638 srcO = vec_perm(src1, src2, vec_lvsl(stride * i, src)); \659 register vector signed short but0, but1, but2, op1, op2, op3; \
639 dst1 = vec_ld(stride * i, dst); \660 src1 = vec_ld(stride * i, src); \
640 dst2 = vec_ld((stride * i) + 15, dst); \661 src2 = vec_ld((stride * i) + 15, src); \
641 dstO = vec_perm(dst1, dst2, vec_lvsl(stride * i, dst)); \662 srcO = vec_perm(src1, src2, vec_lvsl(stride * i, src)); \
642 /* Promote the unsigned chars to signed shorts. */ \663 dst1 = vec_ld(stride * i, dst); \
643 /* We're in the 8x8 function, we only care for the first 8. */ \664 dst2 = vec_ld((stride * i) + 15, dst); \
644 srcV = (vector signed short)vec_mergeh((vector signed char)vzero, \665 dstO = vec_perm(dst1, dst2, vec_lvsl(stride * i, dst)); \
645 (vector signed char)srcO); \666 /* Promote the unsigned chars to signed shorts. */ \
646 dstV = (vector signed short)vec_mergeh((vector signed char)vzero, \667 /* We're in the 8x8 function, we only care for the first 8. */ \
647 (vector signed char)dstO); \668 srcV = (vector signed short) vec_mergeh((vector signed char) vzero, \
648 /* subtractions inside the first butterfly */ \669 (vector signed char) srcO); \
649 but0 = vec_sub(srcV, dstV); \670 dstV = (vector signed short) vec_mergeh((vector signed char) vzero, \
650 op1 = vec_perm(but0, but0, perm1); \671 (vector signed char) dstO); \
651 but1 = vec_mladd(but0, vprod1, op1); \672 /* subtractions inside the first butterfly */ \
652 op2 = vec_perm(but1, but1, perm2); \673 but0 = vec_sub(srcV, dstV); \
653 but2 = vec_mladd(but1, vprod2, op2); \674 op1 = vec_perm(but0, but0, perm1); \
654 op3 = vec_perm(but2, but2, perm3); \675 but1 = vec_mladd(but0, vprod1, op1); \
655 res = vec_mladd(but2, vprod3, op3); \676 op2 = vec_perm(but1, but1, perm2); \
677 but2 = vec_mladd(but1, vprod2, op2); \
678 op3 = vec_perm(but2, but2, perm3); \
679 res = vec_mladd(but2, vprod3, op3); \
656 }680 }
657 ONEITERBUTTERFLY(0, temp0);681 ONEITERBUTTERFLY(0, temp0);
658 ONEITERBUTTERFLY(1, temp1);682 ONEITERBUTTERFLY(1, temp1);
659 ONEITERBUTTERFLY(2, temp2);683 ONEITERBUTTERFLY(2, temp2);
660 ONEITERBUTTERFLY(3, temp3);684 ONEITERBUTTERFLY(3, temp3);
661 ONEITERBUTTERFLY(4, temp4);685 ONEITERBUTTERFLY(4, temp4);
662 ONEITERBUTTERFLY(5, temp5);686 ONEITERBUTTERFLY(5, temp5);
663 ONEITERBUTTERFLY(6, temp6);687 ONEITERBUTTERFLY(6, temp6);
664 ONEITERBUTTERFLY(7, temp7);688 ONEITERBUTTERFLY(7, temp7);
665 }689 }
666#undef ONEITERBUTTERFLY690#undef ONEITERBUTTERFLY
667 {691 {
668 register vector signed int vsum;692 register vector signed int vsum;
669 register vector signed short line0 = vec_add(temp0, temp1);693 register vector signed short line0 = vec_add(temp0, temp1);
670 register vector signed short line1 = vec_sub(temp0, temp1);694 register vector signed short line1 = vec_sub(temp0, temp1);
671 register vector signed short line2 = vec_add(temp2, temp3);695 register vector signed short line2 = vec_add(temp2, temp3);
672 register vector signed short line3 = vec_sub(temp2, temp3);696 register vector signed short line3 = vec_sub(temp2, temp3);
673 register vector signed short line4 = vec_add(temp4, temp5);697 register vector signed short line4 = vec_add(temp4, temp5);
674 register vector signed short line5 = vec_sub(temp4, temp5);698 register vector signed short line5 = vec_sub(temp4, temp5);
675 register vector signed short line6 = vec_add(temp6, temp7);699 register vector signed short line6 = vec_add(temp6, temp7);
676 register vector signed short line7 = vec_sub(temp6, temp7);700 register vector signed short line7 = vec_sub(temp6, temp7);
677 701
678 register vector signed short line0B = vec_add(line0, line2);702 register vector signed short line0B = vec_add(line0, line2);
679 register vector signed short line2B = vec_sub(line0, line2);703 register vector signed short line2B = vec_sub(line0, line2);
680 register vector signed short line1B = vec_add(line1, line3);704 register vector signed short line1B = vec_add(line1, line3);
681 register vector signed short line3B = vec_sub(line1, line3);705 register vector signed short line3B = vec_sub(line1, line3);
682 register vector signed short line4B = vec_add(line4, line6);706 register vector signed short line4B = vec_add(line4, line6);
683 register vector signed short line6B = vec_sub(line4, line6);707 register vector signed short line6B = vec_sub(line4, line6);
684 register vector signed short line5B = vec_add(line5, line7);708 register vector signed short line5B = vec_add(line5, line7);
685 register vector signed short line7B = vec_sub(line5, line7);709 register vector signed short line7B = vec_sub(line5, line7);
686 710
687 register vector signed short line0C = vec_add(line0B, line4B);711 register vector signed short line0C = vec_add(line0B, line4B);
688 register vector signed short line4C = vec_sub(line0B, line4B);712 register vector signed short line4C = vec_sub(line0B, line4B);
689 register vector signed short line1C = vec_add(line1B, line5B);713 register vector signed short line1C = vec_add(line1B, line5B);
690 register vector signed short line5C = vec_sub(line1B, line5B);714 register vector signed short line5C = vec_sub(line1B, line5B);
691 register vector signed short line2C = vec_add(line2B, line6B);715 register vector signed short line2C = vec_add(line2B, line6B);
692 register vector signed short line6C = vec_sub(line2B, line6B);716 register vector signed short line6C = vec_sub(line2B, line6B);
693 register vector signed short line3C = vec_add(line3B, line7B);717 register vector signed short line3C = vec_add(line3B, line7B);
694 register vector signed short line7C = vec_sub(line3B, line7B);718 register vector signed short line7C = vec_sub(line3B, line7B);
695 719
696 vsum = vec_sum4s(vec_abs(line0C), vec_splat_s32(0));720 vsum = vec_sum4s(vec_abs(line0C), vec_splat_s32(0));
697 vsum = vec_sum4s(vec_abs(line1C), vsum);721 vsum = vec_sum4s(vec_abs(line1C), vsum);
698 vsum = vec_sum4s(vec_abs(line2C), vsum);722 vsum = vec_sum4s(vec_abs(line2C), vsum);
699 vsum = vec_sum4s(vec_abs(line3C), vsum);723 vsum = vec_sum4s(vec_abs(line3C), vsum);
700 vsum = vec_sum4s(vec_abs(line4C), vsum);724 vsum = vec_sum4s(vec_abs(line4C), vsum);
701 vsum = vec_sum4s(vec_abs(line5C), vsum);725 vsum = vec_sum4s(vec_abs(line5C), vsum);
702 vsum = vec_sum4s(vec_abs(line6C), vsum);726 vsum = vec_sum4s(vec_abs(line6C), vsum);
703 vsum = vec_sum4s(vec_abs(line7C), vsum);727 vsum = vec_sum4s(vec_abs(line7C), vsum);
704 vsum = vec_sums(vsum, (vector signed int)vzero);728 vsum = vec_sums(vsum, (vector signed int) vzero);
705 vsum = vec_splat(vsum, 3);729 vsum = vec_splat(vsum, 3);
706 vec_ste(vsum, 0, &sum);730 vec_ste(vsum, 0, &sum);
707 }731 }
708 return sum;732 return sum;
709}733}
@@ -726,7 +750,9 @@ static int hadamard8_diff8x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, u · 16 unmodified lines
726 * On the 970, the hand-made RA is still a win (around 690 vs. around 780),750 * On the 970, the hand-made RA is still a win (around 690 vs. around 780),
727 * but xlc goes to around 660 on the regular C code...751 * but xlc goes to around 660 on the regular C code...
728 */752 */
729static int hadamard8_diff16x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h) {753static int hadamard8_diff16x8_altivec(/* MpegEncContext */ void *s, uint8_t *dst,
754 uint8_t *src, int stride, int h)
755{
730 int sum;756 int sum;
731 register vector signed short757 register vector signed short
732 temp0 __asm__ ("v0"),758 temp0 __asm__ ("v0"),
@@ -747,186 +773,195 @@ static int hadamard8_diff16x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, · 14 unmodified lines
747 temp6S __asm__ ("v14"),773 temp6S __asm__ ("v14"),
748 temp7S __asm__ ("v15");774 temp7S __asm__ ("v15");
749 register const vector unsigned char vzero __asm__ ("v31") =775 register const vector unsigned char vzero __asm__ ("v31") =
750 (const vector unsigned char)vec_splat_u8(0);776 (const vector unsigned char) vec_splat_u8(0);
751 {777 {
752 register const vector signed short vprod1 __asm__ ("v16") =778 register const vector signed short vprod1 __asm__ ("v16") =
753 (const vector signed short){ 1,-1, 1,-1, 1,-1, 1,-1 };779 (const vector signed short) { 1, -1, 1, -1, 1, -1, 1, -1 };
754 register const vector signed short vprod2 __asm__ ("v17") =780
755 (const vector signed short){ 1, 1,-1,-1, 1, 1,-1,-1 };781 register const vector signed short vprod2 __asm__ ("v17") =
756 register const vector signed short vprod3 __asm__ ("v18") =782 (const vector signed short) { 1, 1, -1, -1, 1, 1, -1, -1 };
757 (const vector signed short){ 1, 1, 1, 1,-1,-1,-1,-1 };783
758 register const vector unsigned char perm1 __asm__ ("v19") =784 register const vector signed short vprod3 __asm__ ("v18") =
759 (const vector unsigned char)785 (const vector signed short) { 1, 1, 1, 1, -1, -1, -1, -1 };
760 {0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,786
761 0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D};787 register const vector unsigned char perm1 __asm__ ("v19") =
762 register const vector unsigned char perm2 __asm__ ("v20") =788 (const vector unsigned char)
763 (const vector unsigned char)789 { 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,
764 {0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03,790 0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D };
765 0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B};791
766 register const vector unsigned char perm3 __asm__ ("v21") =792 register const vector unsigned char perm2 __asm__ ("v20") =
767 (const vector unsigned char)793 (const vector unsigned char)
768 {0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,794 { 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03,
769 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};795 0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B };
770 796
771#define ONEITERBUTTERFLY(i, res1, res2) \797 register const vector unsigned char perm3 __asm__ ("v21") =
772 { \798 (const vector unsigned char)
773 register vector unsigned char src1 __asm__ ("v22"), \799 { 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
774 src2 __asm__ ("v23"), \800 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
775 dst1 __asm__ ("v24"), \801
776 dst2 __asm__ ("v25"), \802#define ONEITERBUTTERFLY(i, res1, res2) \
777 srcO __asm__ ("v22"), \803 { \
778 dstO __asm__ ("v23"); \804 register vector unsigned char \
779 \805 src1 __asm__ ("v22"), \
780 register vector signed short srcV __asm__ ("v24"), \806 src2 __asm__ ("v23"), \
781 dstV __asm__ ("v25"), \807 dst1 __asm__ ("v24"), \
782 srcW __asm__ ("v26"), \808 dst2 __asm__ ("v25"), \
783 dstW __asm__ ("v27"), \809 srcO __asm__ ("v22"), \
784 but0 __asm__ ("v28"), \810 dstO __asm__ ("v23"); \
785 but0S __asm__ ("v29"), \811 \
786 op1 __asm__ ("v30"), \812 register vector signed short \
787 but1 __asm__ ("v22"), \813 srcV __asm__ ("v24"), \
788 op1S __asm__ ("v23"), \814 dstV __asm__ ("v25"), \
789 but1S __asm__ ("v24"), \815 srcW __asm__ ("v26"), \
790 op2 __asm__ ("v25"), \816 dstW __asm__ ("v27"), \
791 but2 __asm__ ("v26"), \817 but0 __asm__ ("v28"), \
792 op2S __asm__ ("v27"), \818 but0S __asm__ ("v29"), \
793 but2S __asm__ ("v28"), \819 op1 __asm__ ("v30"), \
794 op3 __asm__ ("v29"), \820 but1 __asm__ ("v22"), \
795 op3S __asm__ ("v30"); \821 op1S __asm__ ("v23"), \
796 \822 but1S __asm__ ("v24"), \
797 src1 = vec_ld(stride * i, src); \823 op2 __asm__ ("v25"), \
798 src2 = vec_ld((stride * i) + 16, src); \824 but2 __asm__ ("v26"), \
799 srcO = vec_perm(src1, src2, vec_lvsl(stride * i, src)); \825 op2S __asm__ ("v27"), \
800 dst1 = vec_ld(stride * i, dst); \826 but2S __asm__ ("v28"), \
801 dst2 = vec_ld((stride * i) + 16, dst); \827 op3 __asm__ ("v29"), \
802 dstO = vec_perm(dst1, dst2, vec_lvsl(stride * i, dst)); \828 op3S __asm__ ("v30"); \
803 /* Promote the unsigned chars to signed shorts. */ \829 \
804 srcV = (vector signed short)vec_mergeh((vector signed char)vzero, \830 src1 = vec_ld(stride * i, src); \
805 (vector signed char)srcO); \831 src2 = vec_ld((stride * i) + 16, src); \
806 dstV = (vector signed short)vec_mergeh((vector signed char)vzero, \832 srcO = vec_perm(src1, src2, vec_lvsl(stride * i, src)); \
807 (vector signed char)dstO); \833 dst1 = vec_ld(stride * i, dst); \
808 srcW = (vector signed short)vec_mergel((vector signed char)vzero, \834 dst2 = vec_ld((stride * i) + 16, dst); \
809 (vector signed char)srcO); \835 dstO = vec_perm(dst1, dst2, vec_lvsl(stride * i, dst)); \
810 dstW = (vector signed short)vec_mergel((vector signed char)vzero, \836 /* Promote the unsigned chars to signed shorts. */ \
811 (vector signed char)dstO); \837 srcV = (vector signed short) vec_mergeh((vector signed char) vzero, \
812 /* subtractions inside the first butterfly */ \838 (vector signed char) srcO); \
813 but0 = vec_sub(srcV, dstV); \839 dstV = (vector signed short) vec_mergeh((vector signed char) vzero, \
814 but0S = vec_sub(srcW, dstW); \840 (vector signed char) dstO); \
815 op1 = vec_perm(but0, but0, perm1); \841 srcW = (vector signed short) vec_mergel((vector signed char) vzero, \
816 but1 = vec_mladd(but0, vprod1, op1); \842 (vector signed char) srcO); \
817 op1S = vec_perm(but0S, but0S, perm1); \843 dstW = (vector signed short) vec_mergel((vector signed char) vzero, \
818 but1S = vec_mladd(but0S, vprod1, op1S); \844 (vector signed char) dstO); \
819 op2 = vec_perm(but1, but1, perm2); \845 /* subtractions inside the first butterfly */ \
820 but2 = vec_mladd(but1, vprod2, op2); \846 but0 = vec_sub(srcV, dstV); \
821 op2S = vec_perm(but1S, but1S, perm2); \847 but0S = vec_sub(srcW, dstW); \
822 but2S = vec_mladd(but1S, vprod2, op2S); \848 op1 = vec_perm(but0, but0, perm1); \
823 op3 = vec_perm(but2, but2, perm3); \849 but1 = vec_mladd(but0, vprod1, op1); \
824 res1 = vec_mladd(but2, vprod3, op3); \850 op1S = vec_perm(but0S, but0S, perm1); \
825 op3S = vec_perm(but2S, but2S, perm3); \851 but1S = vec_mladd(but0S, vprod1, op1S); \
826 res2 = vec_mladd(but2S, vprod3, op3S); \852 op2 = vec_perm(but1, but1, perm2); \
853 but2 = vec_mladd(but1, vprod2, op2); \
854 op2S = vec_perm(but1S, but1S, perm2); \
855 but2S = vec_mladd(but1S, vprod2, op2S); \
856 op3 = vec_perm(but2, but2, perm3); \
857 res1 = vec_mladd(but2, vprod3, op3); \
858 op3S = vec_perm(but2S, but2S, perm3); \
859 res2 = vec_mladd(but2S, vprod3, op3S); \
827 }860 }
828 ONEITERBUTTERFLY(0, temp0, temp0S);861 ONEITERBUTTERFLY(0, temp0, temp0S);
829 ONEITERBUTTERFLY(1, temp1, temp1S);862 ONEITERBUTTERFLY(1, temp1, temp1S);
830 ONEITERBUTTERFLY(2, temp2, temp2S);863 ONEITERBUTTERFLY(2, temp2, temp2S);
831 ONEITERBUTTERFLY(3, temp3, temp3S);864 ONEITERBUTTERFLY(3, temp3, temp3S);
832 ONEITERBUTTERFLY(4, temp4, temp4S);865 ONEITERBUTTERFLY(4, temp4, temp4S);
833 ONEITERBUTTERFLY(5, temp5, temp5S);866 ONEITERBUTTERFLY(5, temp5, temp5S);
834 ONEITERBUTTERFLY(6, temp6, temp6S);867 ONEITERBUTTERFLY(6, temp6, temp6S);
835 ONEITERBUTTERFLY(7, temp7, temp7S);868 ONEITERBUTTERFLY(7, temp7, temp7S);
836 }869 }
837#undef ONEITERBUTTERFLY870#undef ONEITERBUTTERFLY
838 {871 {
839 register vector signed int vsum;872 register vector signed int vsum;
840 register vector signed short line0S, line1S, line2S, line3S, line4S,873 register vector signed short line0S, line1S, line2S, line3S, line4S,
841 line5S, line6S, line7S, line0BS,line2BS,874 line5S, line6S, line7S, line0BS, line2BS,
842 line1BS,line3BS,line4BS,line6BS,line5BS,875 line1BS, line3BS, line4BS, line6BS, line5BS,
843 line7BS,line0CS,line4CS,line1CS,line5CS,876 line7BS, line0CS, line4CS, line1CS, line5CS,
844 line2CS,line6CS,line3CS,line7CS;877 line2CS, line6CS, line3CS, line7CS;
845 878
846 register vector signed short line0 = vec_add(temp0, temp1);879 register vector signed short line0 = vec_add(temp0, temp1);
847 register vector signed short line1 = vec_sub(temp0, temp1);880 register vector signed short line1 = vec_sub(temp0, temp1);
848 register vector signed short line2 = vec_add(temp2, temp3);881 register vector signed short line2 = vec_add(temp2, temp3);
849 register vector signed short line3 = vec_sub(temp2, temp3);882 register vector signed short line3 = vec_sub(temp2, temp3);
850 register vector signed short line4 = vec_add(temp4, temp5);883 register vector signed short line4 = vec_add(temp4, temp5);
851 register vector signed short line5 = vec_sub(temp4, temp5);884 register vector signed short line5 = vec_sub(temp4, temp5);
852 register vector signed short line6 = vec_add(temp6, temp7);885 register vector signed short line6 = vec_add(temp6, temp7);
853 register vector signed short line7 = vec_sub(temp6, temp7);886 register vector signed short line7 = vec_sub(temp6, temp7);
854 887
855 register vector signed short line0B = vec_add(line0, line2);888 register vector signed short line0B = vec_add(line0, line2);
856 register vector signed short line2B = vec_sub(line0, line2);889 register vector signed short line2B = vec_sub(line0, line2);
857 register vector signed short line1B = vec_add(line1, line3);890 register vector signed short line1B = vec_add(line1, line3);
858 register vector signed short line3B = vec_sub(line1, line3);891 register vector signed short line3B = vec_sub(line1, line3);
859 register vector signed short line4B = vec_add(line4, line6);892 register vector signed short line4B = vec_add(line4, line6);
860 register vector signed short line6B = vec_sub(line4, line6);893 register vector signed short line6B = vec_sub(line4, line6);
861 register vector signed short line5B = vec_add(line5, line7);894 register vector signed short line5B = vec_add(line5, line7);
862 register vector signed short line7B = vec_sub(line5, line7);895 register vector signed short line7B = vec_sub(line5, line7);
863 896
864 register vector signed short line0C = vec_add(line0B, line4B);897 register vector signed short line0C = vec_add(line0B, line4B);
865 register vector signed short line4C = vec_sub(line0B, line4B);898 register vector signed short line4C = vec_sub(line0B, line4B);
866 register vector signed short line1C = vec_add(line1B, line5B);899 register vector signed short line1C = vec_add(line1B, line5B);
867 register vector signed short line5C = vec_sub(line1B, line5B);900 register vector signed short line5C = vec_sub(line1B, line5B);
868 register vector signed short line2C = vec_add(line2B, line6B);901 register vector signed short line2C = vec_add(line2B, line6B);
869 register vector signed short line6C = vec_sub(line2B, line6B);902 register vector signed short line6C = vec_sub(line2B, line6B);
870 register vector signed short line3C = vec_add(line3B, line7B);903 register vector signed short line3C = vec_add(line3B, line7B);
871 register vector signed short line7C = vec_sub(line3B, line7B);904 register vector signed short line7C = vec_sub(line3B, line7B);
872 905
873 vsum = vec_sum4s(vec_abs(line0C), vec_splat_s32(0));906 vsum = vec_sum4s(vec_abs(line0C), vec_splat_s32(0));
874 vsum = vec_sum4s(vec_abs(line1C), vsum);907 vsum = vec_sum4s(vec_abs(line1C), vsum);
875 vsum = vec_sum4s(vec_abs(line2C), vsum);908 vsum = vec_sum4s(vec_abs(line2C), vsum);
876 vsum = vec_sum4s(vec_abs(line3C), vsum);909 vsum = vec_sum4s(vec_abs(line3C), vsum);
877 vsum = vec_sum4s(vec_abs(line4C), vsum);910 vsum = vec_sum4s(vec_abs(line4C), vsum);
878 vsum = vec_sum4s(vec_abs(line5C), vsum);911 vsum = vec_sum4s(vec_abs(line5C), vsum);
879 vsum = vec_sum4s(vec_abs(line6C), vsum);912 vsum = vec_sum4s(vec_abs(line6C), vsum);
880 vsum = vec_sum4s(vec_abs(line7C), vsum);913 vsum = vec_sum4s(vec_abs(line7C), vsum);
881 914
882 line0S = vec_add(temp0S, temp1S);915 line0S = vec_add(temp0S, temp1S);
883 line1S = vec_sub(temp0S, temp1S);916 line1S = vec_sub(temp0S, temp1S);
884 line2S = vec_add(temp2S, temp3S);917 line2S = vec_add(temp2S, temp3S);
885 line3S = vec_sub(temp2S, temp3S);918 line3S = vec_sub(temp2S, temp3S);
886 line4S = vec_add(temp4S, temp5S);919 line4S = vec_add(temp4S, temp5S);
887 line5S = vec_sub(temp4S, temp5S);920 line5S = vec_sub(temp4S, temp5S);
888 line6S = vec_add(temp6S, temp7S);921 line6S = vec_add(temp6S, temp7S);
889 line7S = vec_sub(temp6S, temp7S);922 line7S = vec_sub(temp6S, temp7S);
890 923
891 line0BS = vec_add(line0S, line2S);924 line0BS = vec_add(line0S, line2S);
892 line2BS = vec_sub(line0S, line2S);925 line2BS = vec_sub(line0S, line2S);
893 line1BS = vec_add(line1S, line3S);926 line1BS = vec_add(line1S, line3S);
894 line3BS = vec_sub(line1S, line3S);927 line3BS = vec_sub(line1S, line3S);
895 line4BS = vec_add(line4S, line6S);928 line4BS = vec_add(line4S, line6S);
896 line6BS = vec_sub(line4S, line6S);929 line6BS = vec_sub(line4S, line6S);
897 line5BS = vec_add(line5S, line7S);930 line5BS = vec_add(line5S, line7S);
898 line7BS = vec_sub(line5S, line7S);931 line7BS = vec_sub(line5S, line7S);
899 932
900 line0CS = vec_add(line0BS, line4BS);933 line0CS = vec_add(line0BS, line4BS);
901 line4CS = vec_sub(line0BS, line4BS);934 line4CS = vec_sub(line0BS, line4BS);
902 line1CS = vec_add(line1BS, line5BS);935 line1CS = vec_add(line1BS, line5BS);
903 line5CS = vec_sub(line1BS, line5BS);936 line5CS = vec_sub(line1BS, line5BS);
904 line2CS = vec_add(line2BS, line6BS);937 line2CS = vec_add(line2BS, line6BS);
905 line6CS = vec_sub(line2BS, line6BS);938 line6CS = vec_sub(line2BS, line6BS);
906 line3CS = vec_add(line3BS, line7BS);939 line3CS = vec_add(line3BS, line7BS);
907 line7CS = vec_sub(line3BS, line7BS);940 line7CS = vec_sub(line3BS, line7BS);
908 941
909 vsum = vec_sum4s(vec_abs(line0CS), vsum);942 vsum = vec_sum4s(vec_abs(line0CS), vsum);
910 vsum = vec_sum4s(vec_abs(line1CS), vsum);943 vsum = vec_sum4s(vec_abs(line1CS), vsum);
911 vsum = vec_sum4s(vec_abs(line2CS), vsum);944 vsum = vec_sum4s(vec_abs(line2CS), vsum);
912 vsum = vec_sum4s(vec_abs(line3CS), vsum);945 vsum = vec_sum4s(vec_abs(line3CS), vsum);
913 vsum = vec_sum4s(vec_abs(line4CS), vsum);946 vsum = vec_sum4s(vec_abs(line4CS), vsum);
914 vsum = vec_sum4s(vec_abs(line5CS), vsum);947 vsum = vec_sum4s(vec_abs(line5CS), vsum);
915 vsum = vec_sum4s(vec_abs(line6CS), vsum);948 vsum = vec_sum4s(vec_abs(line6CS), vsum);
916 vsum = vec_sum4s(vec_abs(line7CS), vsum);949 vsum = vec_sum4s(vec_abs(line7CS), vsum);
917 vsum = vec_sums(vsum, (vector signed int)vzero);950 vsum = vec_sums(vsum, (vector signed int) vzero);
918 vsum = vec_splat(vsum, 3);951 vsum = vec_splat(vsum, 3);
919 vec_ste(vsum, 0, &sum);952 vec_ste(vsum, 0, &sum);
920 }953 }
921 return sum;954 return sum;
922}955}
923 956
924static int hadamard8_diff16_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){957static int hadamard8_diff16_altivec(/* MpegEncContext */ void *s, uint8_t *dst,
958 uint8_t *src, int stride, int h)
959{
925 int score;960 int score;
926 score = hadamard8_diff16x8_altivec(s, dst, src, stride, 8);961 score = hadamard8_diff16x8_altivec(s, dst, src, stride, 8);
927 if (h==16) {962 if (h == 16) {
928 dst += 8*stride;963 dst += 8 * stride;
929 src += 8*stride;964 src += 8 * stride;
930 score += hadamard8_diff16x8_altivec(s, dst, src, stride, 8);965 score += hadamard8_diff16x8_altivec(s, dst, src, stride, 8);
931 }966 }
932 return score;967 return score;
@@ -941,17 +976,21 @@ av_cold void ff_dsputil_init_altivec(DSPContext *c, AVCodecContext *avctx) · 8 unmodified lines
941 c->pix_abs[0][3] = sad16_xy2_altivec;976 c->pix_abs[0][3] = sad16_xy2_altivec;
942 c->pix_abs[0][0] = sad16_altivec;977 c->pix_abs[0][0] = sad16_altivec;
943 c->pix_abs[1][0] = sad8_altivec;978 c->pix_abs[1][0] = sad8_altivec;
944 c->sad[0]= sad16_altivec;979
945 c->sad[1]= sad8_altivec;980 c->sad[0] = sad16_altivec;
981 c->sad[1] = sad8_altivec;
982 c->sse[0] = sse16_altivec;
983 c->sse[1] = sse8_altivec;
984
946 c->pix_norm1 = pix_norm1_altivec;985 c->pix_norm1 = pix_norm1_altivec;
947 c->sse[1]= sse8_altivec;986 c->pix_sum = pix_sum_altivec;
948 c->sse[0]= sse16_altivec;987
949 c->pix_sum = pix_sum_altivec;
950 c->diff_pixels = diff_pixels_altivec;988 c->diff_pixels = diff_pixels_altivec;
951 c->add_bytes= add_bytes_altivec;989 c->add_bytes = add_bytes_altivec;
990
952 if (!high_bit_depth) {991 if (!high_bit_depth) {
953 c->get_pixels = get_pixels_altivec;992 c->get_pixels = get_pixels_altivec;
954 c->clear_block = clear_block_altivec;993 c->clear_block = clear_block_altivec;
955 }994 }
956 995
957 c->hadamard8_diff[0] = hadamard8_diff16_altivec;996 c->hadamard8_diff[0] = hadamard8_diff16_altivec;
libavcodec/ppc/dsputil_altivec.h+7−5
@@ -24,11 +24,13 @@ · 23 unmodified lines
24#define AVCODEC_PPC_DSPUTIL_ALTIVEC_H24#define AVCODEC_PPC_DSPUTIL_ALTIVEC_H
25 25
26#include <stdint.h>26#include <stdint.h>
27#include "libavcodec/dsputil.h"
28 27
29void ff_put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h);28#include "libavcodec/dsputil.h"
30 29
31void ff_avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h);30void ff_avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels,
31 ptrdiff_t line_size, int h);
32void ff_put_pixels16_altivec(uint8_t *block, const uint8_t *pixels,
33 ptrdiff_t line_size, int h);
32 34
33void ff_fdct_altivec(int16_t *block);35void ff_fdct_altivec(int16_t *block);
34void ff_gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h,36void ff_gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h,
@@ -36,7 +38,7 @@ void ff_gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h, · 1 unmodified line
36void ff_idct_put_altivec(uint8_t *dest, int line_size, int16_t *block);38void ff_idct_put_altivec(uint8_t *dest, int line_size, int16_t *block);
37void ff_idct_add_altivec(uint8_t *dest, int line_size, int16_t *block);39void ff_idct_add_altivec(uint8_t *dest, int line_size, int16_t *block);
38 40
39void ff_dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx);41void ff_dsputil_init_altivec(DSPContext *c, AVCodecContext *avctx);
40void ff_int_init_altivec(DSPContext* c, AVCodecContext *avctx);42void ff_int_init_altivec(DSPContext *c, AVCodecContext *avctx);
41 43
42#endif /* AVCODEC_PPC_DSPUTIL_ALTIVEC_H */44#endif /* AVCODEC_PPC_DSPUTIL_ALTIVEC_H */
libavcodec/ppc/dsputil_ppc.c+28−31
@@ -51,23 +51,23 @@ · 50 unmodified lines
51 */51 */
52static void clear_blocks_dcbz32_ppc(int16_t *blocks)52static void clear_blocks_dcbz32_ppc(int16_t *blocks)
53{53{
54 register int misal = ((unsigned long)blocks & 0x00000010);54 register int misal = ((unsigned long) blocks & 0x00000010);
55 register int i = 0;55 register int i = 0;
56
56 if (misal) {57 if (misal) {
57 ((unsigned long*)blocks)[0] = 0L;58 ((unsigned long *) blocks)[0] = 0L;
58 ((unsigned long*)blocks)[1] = 0L;59 ((unsigned long *) blocks)[1] = 0L;
59 ((unsigned long*)blocks)[2] = 0L;60 ((unsigned long *) blocks)[2] = 0L;
60 ((unsigned long*)blocks)[3] = 0L;61 ((unsigned long *) blocks)[3] = 0L;
61 i += 16;62 i += 16;
62 }63 }
63 for ( ; i < sizeof(int16_t)*6*64-31 ; i += 32) {64 for (; i < sizeof(int16_t) * 6 * 64 - 31; i += 32)
64 __asm__ volatile("dcbz %0,%1" : : "b" (blocks), "r" (i) : "memory");65 __asm__ volatile ("dcbz %0,%1" :: "b" (blocks), "r" (i) : "memory");
65 }
66 if (misal) {66 if (misal) {
67 ((unsigned long*)blocks)[188] = 0L;67 ((unsigned long *) blocks)[188] = 0L;
68 ((unsigned long*)blocks)[189] = 0L;68 ((unsigned long *) blocks)[189] = 0L;
69 ((unsigned long*)blocks)[190] = 0L;69 ((unsigned long *) blocks)[190] = 0L;
70 ((unsigned long*)blocks)[191] = 0L;70 ((unsigned long *) blocks)[191] = 0L;
71 i += 16;71 i += 16;
72 }72 }
73}73}
@@ -77,23 +77,23 @@ static void clear_blocks_dcbz32_ppc(int16_t *blocks) · 3 unmodified lines
77#if HAVE_DCBZL77#if HAVE_DCBZL
78static void clear_blocks_dcbz128_ppc(int16_t *blocks)78static void clear_blocks_dcbz128_ppc(int16_t *blocks)
79{79{
80 register int misal = ((unsigned long)blocks & 0x0000007f);80 register int misal = ((unsigned long) blocks & 0x0000007f);
81 register int i = 0;81 register int i = 0;
82
82 if (misal) {83 if (misal) {
83 /* We could probably also optimize this case,84 /* We could probably also optimize this case,
84 * but there's not much point as the machines85 * but there's not much point as the machines
85 * aren't available yet (2003-06-26). */86 * aren't available yet (2003-06-26). */
86 memset(blocks, 0, sizeof(int16_t)*6*64);87 memset(blocks, 0, sizeof(int16_t) * 6 * 64);
88 } else {
89 for (; i < sizeof(int16_t) * 6 * 64; i += 128)
90 __asm__ volatile ("dcbzl %0,%1" :: "b" (blocks), "r" (i) : "memory");
87 }91 }
88 else
89 for ( ; i < sizeof(int16_t)*6*64 ; i += 128) {
90 __asm__ volatile("dcbzl %0,%1" : : "b" (blocks), "r" (i) : "memory");
91 }
92}92}
93#else93#else
94static void clear_blocks_dcbz128_ppc(int16_t *blocks)94static void clear_blocks_dcbz128_ppc(int16_t *blocks)
95{95{
96 memset(blocks, 0, sizeof(int16_t)*6*64);96 memset(blocks, 0, sizeof(int16_t) * 6 * 64);
97}97}
98#endif98#endif
99 99
@@ -110,9 +110,8 @@ static long check_dcbzl_effect(void) · 10 unmodified lines
110 register long i = 0;110 register long i = 0;
111 long count = 0;111 long count = 0;
112 112
113 if (!fakedata) {113 if (!fakedata)
114 return 0L;114 return 0L;
115 }
116 115
117 fakedata_middle = (fakedata + 512);116 fakedata_middle = (fakedata + 512);
118 117
@@ -120,12 +119,11 @@ static long check_dcbzl_effect(void) · 1 unmodified line
120 119
121 /* Below the constraint "b" seems to mean "address base register"120 /* Below the constraint "b" seems to mean "address base register"
122 * in gcc-3.3 / RS/6000 speaks. Seems to avoid using r0, so.... */121 * in gcc-3.3 / RS/6000 speaks. Seems to avoid using r0, so.... */
123 __asm__ volatile("dcbzl %0, %1" : : "b" (fakedata_middle), "r" (zero));122 __asm__ volatile ("dcbzl %0, %1" :: "b" (fakedata_middle), "r" (zero));
124 123
125 for (i = 0; i < 1024 ; i ++) {124 for (i = 0; i < 1024; i++)
126 if (fakedata[i] == (char)0)125 if (fakedata[i] == (char) 0)
127 count++;126 count++;
128 }
129 127
130 av_free(fakedata);128 av_free(fakedata);
131 129
@@ -134,7 +132,7 @@ static long check_dcbzl_effect(void) · 2 unmodified lines
134#else132#else
135static long check_dcbzl_effect(void)133static long check_dcbzl_effect(void)
136{134{
137 return 0;135 return 0;
138}136}
139#endif137#endif
140 138
@@ -144,7 +142,7 @@ av_cold void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx) · 3 unmodified lines
144 142
145 // common optimizations whether AltiVec is available or not143 // common optimizations whether AltiVec is available or not
146 if (!high_bit_depth) {144 if (!high_bit_depth) {
147 switch (check_dcbzl_effect()) {145 switch (check_dcbzl_effect()) {
148 case 32:146 case 32:
149 c->clear_blocks = clear_blocks_dcbz32_ppc;147 c->clear_blocks = clear_blocks_dcbz32_ppc;
150 break;148 break;
@@ -153,7 +151,7 @@ av_cold void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx) · 2 unmodified lines
153 break;151 break;
154 default:152 default:
155 break;153 break;
156 }154 }
157 }155 }
158 156
159 if (PPC_ALTIVEC(av_get_cpu_flags())) {157 if (PPC_ALTIVEC(av_get_cpu_flags())) {
@@ -172,11 +170,10 @@ av_cold void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx) · 12 unmodified lines
172 if (avctx->bits_per_raw_sample <= 8) {170 if (avctx->bits_per_raw_sample <= 8) {
173 if ((avctx->idct_algo == FF_IDCT_AUTO) ||171 if ((avctx->idct_algo == FF_IDCT_AUTO) ||
174 (avctx->idct_algo == FF_IDCT_ALTIVEC)) {172 (avctx->idct_algo == FF_IDCT_ALTIVEC)) {
175 c->idct_put = ff_idct_put_altivec;173 c->idct_put = ff_idct_put_altivec;
176 c->idct_add = ff_idct_add_altivec;174 c->idct_add = ff_idct_add_altivec;
177 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;175 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
178 }176 }
179 }177 }
180
181 }178 }
182}179}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t