From 8b2bc85f292a593ef9f96156752d1b963f78b629 Mon Sep 17 00:00:00 2001 From: David Conrad Date: Tue, 6 Jan 2009 22:29:26 +0000 Subject: [PATCH] add AltiVec implementation of weight_h264_pixels(16|8)x(16|8|4) Patch by David Conrad %lessen42 A gmail P com% Originally committed as revision 16458 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/ppc/h264_altivec.c | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/libavcodec/ppc/h264_altivec.c b/libavcodec/ppc/h264_altivec.c index 77eccd4116..ef6ecbadde 100644 --- a/libavcodec/ppc/h264_altivec.c +++ b/libavcodec/ppc/h264_altivec.c @@ -935,6 +935,50 @@ static void h264_h_loop_filter_luma_altivec(uint8_t *pix, int stride, int alpha, write16x4(pix-2, stride, line1, line2, line3, line4); } +static av_always_inline +void weight_h264_WxH_altivec(uint8_t *block, int stride, int log2_denom, int weight, int offset, int w, int h) +{ + int y, aligned; + vec_u8 vblock; + vec_s16 vtemp, vweight, voffset, v0, v1; + vec_u16 vlog2_denom; + DECLARE_ALIGNED_16(int32_t, temp[4]); + LOAD_ZERO; + + offset <<= log2_denom; + if(log2_denom) offset += 1<<(log2_denom-1); + temp[0] = log2_denom; + temp[1] = weight; + temp[2] = offset; + + vtemp = (vec_s16)vec_ld(0, temp); + vlog2_denom = (vec_u16)vec_splat(vtemp, 1); + vweight = vec_splat(vtemp, 3); + voffset = vec_splat(vtemp, 5); + aligned = !((unsigned long)block & 0xf); + + for (y=0; yweight_h264_pixels_tab[0] = ff_weight_h264_pixels16x16_altivec; + c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels16x8_altivec; + c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels8x16_altivec; + c->weight_h264_pixels_tab[3] = ff_weight_h264_pixels8x8_altivec; + c->weight_h264_pixels_tab[4] = ff_weight_h264_pixels8x4_altivec; c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels16x16_altivec; c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels16x8_altivec; c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels8x16_altivec;