[FFmpeg-devel] [PATCH 1/2] Altivec: Add helper function to load from a constant misalignment

Guillaume POIRIER poirierg
Mon Jun 28 13:59:51 CEST 2010


Hi,

On Sun, Jun 27, 2010 at 5:03 AM, David Conrad <lessen42 at gmail.com> wrote:
> ---
> ?libavcodec/ppc/util_altivec.h | ? 13 +++++++++++++
> ?1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/libavcodec/ppc/util_altivec.h b/libavcodec/ppc/util_altivec.h
> index 62f228a..cb638df 100644
> --- a/libavcodec/ppc/util_altivec.h
> +++ b/libavcodec/ppc/util_altivec.h
> @@ -32,6 +32,8 @@
> ?#include <altivec.h>
> ?#endif
>
> +#include "types_altivec.h"
> +
> ?// used to build registers permutation vectors (vcprm)
> ?// the 's' are for words in the _s_econd vector
> ?#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);
> ?}
>
> +/**
> + * 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);
> +}
> +

Ok for me.

Guillaume

-- 
"I am the Jesus Christ of politics. I sacrifice myself for everyone."

 -- Silvio Berlusconi



More information about the ffmpeg-devel mailing list