Browse Source

Altivec: Add helper function to load from a constant misalignment

Originally committed as revision 23883 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/n0.8
David Conrad 15 years ago
parent
commit
7bf4e9d7f7
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      libavcodec/ppc/util_altivec.h

+ 13
- 0
libavcodec/ppc/util_altivec.h View File

@@ -32,6 +32,8 @@
#include <altivec.h> #include <altivec.h>
#endif #endif


#include "types_altivec.h"

// used to build registers permutation vectors (vcprm) // used to build registers permutation vectors (vcprm)
// the 's' are for words in the _s_econd vector // the 's' are for words in the _s_econd vector
#define WORD_0 0x00,0x01,0x02,0x03 #define WORD_0 0x00,0x01,0x02,0x03
@@ -102,4 +104,15 @@ static inline vector unsigned char unaligned_load(int offset, uint8_t *src)
return vec_perm(first, second, mask); return vec_perm(first, second, mask);
} }


/**
* loads vector known misalignment
* @param perm_vec the align permute vector to combine the two loads from lvsl
*/
static inline vec_u8 load_with_perm_vec(int offset, uint8_t *src, vec_u8 perm_vec)
{
vec_u8 a = vec_ld(offset, src);
vec_u8 b = vec_ld(offset+15, src);
return vec_perm(a, b, perm_vec);
}

#endif /* AVCODEC_PPC_UTIL_ALTIVEC_H */ #endif /* AVCODEC_PPC_UTIL_ALTIVEC_H */

Loading…
Cancel
Save