1 //----------------------------------------------------------------------------- 2 // 3 // ImageLib Sources 4 // Last modified: 17/04/2005 5 // by Meloni Dario 6 // 7 // Description: Common altivec function. 8 // 9 //----------------------------------------------------------------------------- 10 11 #ifdef HAVE_CONFIG_H 12 #include <config.h> 13 #endif //HAVE_CONFIG_H 14 15 #ifdef ALTIVEC_GCC 16 #include "altivec_common.h" 17 18 // from http://developer.apple.com/hardware/ve/alignment.html 19 /*vector unsigned char load_unaligned( unsigned char *buffer ) { 20 vector unsigned char MSQ, LSQ; 21 vector unsigned char mask; 22 MSQ = vec_ld(0, buffer); // most significant quadword 23 LSQ = vec_ld(15, buffer); // least significant quadword 24 mask = vec_lvsl(0, buffer); // create the permute mask 25 return vec_perm(MSQ, LSQ, mask);// align the data 26 }*/ 27 fill_vector_f(float value)28vector float fill_vector_f( float value ) { 29 vector_t vec; 30 vec.sf[0] = value; 31 vector float temp = vec_ld(0,vec.sf); 32 return vec_splat(temp,0); 33 } 34 round16(unsigned int v)35inline unsigned int round16( unsigned int v ) { 36 return ((int)((v/16)*10)%10) > 0 ? (v/16) : (v/16)+1; 37 } 38 39 40 #endif 41