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