Mercurial > libavcodec.hg
comparison ppc/util_altivec.h @ 12010:8499462c732f libavcodec
Altivec: Add helper function to load from a constant misalignment
author | conrad |
---|---|
date | Tue, 29 Jun 2010 06:42:12 +0000 |
parents | 7dd2a45249a9 |
children |
comparison
equal
deleted
inserted
replaced
12009:8c82dfce2f24 | 12010:8499462c732f |
---|---|
29 #include "config.h" | 29 #include "config.h" |
30 | 30 |
31 #if HAVE_ALTIVEC_H | 31 #if HAVE_ALTIVEC_H |
32 #include <altivec.h> | 32 #include <altivec.h> |
33 #endif | 33 #endif |
34 | |
35 #include "types_altivec.h" | |
34 | 36 |
35 // used to build registers permutation vectors (vcprm) | 37 // used to build registers permutation vectors (vcprm) |
36 // the 's' are for words in the _s_econd vector | 38 // the 's' are for words in the _s_econd vector |
37 #define WORD_0 0x00,0x01,0x02,0x03 | 39 #define WORD_0 0x00,0x01,0x02,0x03 |
38 #define WORD_1 0x04,0x05,0x06,0x07 | 40 #define WORD_1 0x04,0x05,0x06,0x07 |
100 register vector unsigned char second = vec_ld(offset+15, src); | 102 register vector unsigned char second = vec_ld(offset+15, src); |
101 register vector unsigned char mask = vec_lvsl(offset, src); | 103 register vector unsigned char mask = vec_lvsl(offset, src); |
102 return vec_perm(first, second, mask); | 104 return vec_perm(first, second, mask); |
103 } | 105 } |
104 | 106 |
107 /** | |
108 * loads vector known misalignment | |
109 * @param perm_vec the align permute vector to combine the two loads from lvsl | |
110 */ | |
111 static inline vec_u8 load_with_perm_vec(int offset, uint8_t *src, vec_u8 perm_vec) | |
112 { | |
113 vec_u8 a = vec_ld(offset, src); | |
114 vec_u8 b = vec_ld(offset+15, src); | |
115 return vec_perm(a, b, perm_vec); | |
116 } | |
117 | |
105 #endif /* AVCODEC_PPC_UTIL_ALTIVEC_H */ | 118 #endif /* AVCODEC_PPC_UTIL_ALTIVEC_H */ |