# HG changeset patch # User gpoirier # Date 1231280966 0 # Node ID 16a315fdad0bf76b32580e5d3db68b8b477826e9 # Parent 1d9421a599ae609ae8b7a2da3822e0479c514f9c add AltiVec implementation of weight_h264_pixels(16|8)x(16|8|4) Patch by David Conrad %lessen42 A gmail P com% diff -r 1d9421a599ae -r 16a315fdad0b ppc/h264_altivec.c --- a/ppc/h264_altivec.c Tue Jan 06 22:01:57 2009 +0000 +++ b/ppc/h264_altivec.c Tue Jan 06 22:29:26 2009 +0000 @@ -935,6 +935,50 @@ 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;