From e8b562087db87a426aa895d6c3664bc26949eb54 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Mon, 9 Jan 2006 03:38:37 +0000 Subject: [PATCH] tweak h264_biweight Originally committed as revision 4835 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/dsputil.c | 9 ++++----- libavcodec/dsputil.h | 2 +- libavcodec/h264.c | 12 ++++++------ libavcodec/i386/h264dsp_mmx.c | 8 ++++---- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index c7ae725c6f..882bf66520 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -2489,7 +2489,7 @@ H264_MC(avg_, 16) #define op_scale2(x) dst[x] = clip_uint8( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1)) #define H264_WEIGHT(W,H) \ static void weight_h264_pixels ## W ## x ## H ## _c(uint8_t *block, int stride, int log2_denom, int weight, int offset){ \ - int attribute_unused x, y; \ + int y; \ offset <<= log2_denom; \ if(log2_denom) offset += 1<<(log2_denom-1); \ for(y=0; y> 1; \ - offset = ((offset << 1) + 1) << log2_denom; \ +static void biweight_h264_pixels ## W ## x ## H ## _c(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset){ \ + int y; \ + offset = ((offset + 1) | 1) << log2_denom; \ for(y=0; yuse_weight == 2){ int weight0 = h->implicit_weight[refn0][refn1]; int weight1 = 64 - weight0; - luma_weight_avg( dest_y, tmp_y, s-> linesize, 5, weight0, weight1, 0, 0); - chroma_weight_avg(dest_cb, tmp_cb, s->uvlinesize, 5, weight0, weight1, 0, 0); - chroma_weight_avg(dest_cr, tmp_cr, s->uvlinesize, 5, weight0, weight1, 0, 0); + luma_weight_avg( dest_y, tmp_y, s-> linesize, 5, weight0, weight1, 0); + chroma_weight_avg(dest_cb, tmp_cb, s->uvlinesize, 5, weight0, weight1, 0); + chroma_weight_avg(dest_cr, tmp_cr, s->uvlinesize, 5, weight0, weight1, 0); }else{ luma_weight_avg(dest_y, tmp_y, s->linesize, h->luma_log2_weight_denom, h->luma_weight[0][refn0], h->luma_weight[1][refn1], - h->luma_offset[0][refn0], h->luma_offset[1][refn1]); + h->luma_offset[0][refn0] + h->luma_offset[1][refn1]); chroma_weight_avg(dest_cb, tmp_cb, s->uvlinesize, h->chroma_log2_weight_denom, h->chroma_weight[0][refn0][0], h->chroma_weight[1][refn1][0], - h->chroma_offset[0][refn0][0], h->chroma_offset[1][refn1][0]); + h->chroma_offset[0][refn0][0] + h->chroma_offset[1][refn1][0]); chroma_weight_avg(dest_cr, tmp_cr, s->uvlinesize, h->chroma_log2_weight_denom, h->chroma_weight[0][refn0][1], h->chroma_weight[1][refn1][1], - h->chroma_offset[0][refn0][1], h->chroma_offset[1][refn1][1]); + h->chroma_offset[0][refn0][1] + h->chroma_offset[1][refn1][1]); } }else{ int list = list1 ? 1 : 0; diff --git a/libavcodec/i386/h264dsp_mmx.c b/libavcodec/i386/h264dsp_mmx.c index d51b21ad3c..982e62b609 100644 --- a/libavcodec/i386/h264dsp_mmx.c +++ b/libavcodec/i386/h264dsp_mmx.c @@ -971,10 +971,10 @@ static inline void ff_h264_weight_WxH_mmx2(uint8_t *dst, int stride, int log2_de } } -static inline void ff_h264_biweight_WxH_mmx2(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offsetd, int offsets, int w, int h) +static inline void ff_h264_biweight_WxH_mmx2(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset, int w, int h) { int x, y; - int offset = ((offsets + offsetd + 1) | 1) << log2_denom; + offset = ((offset + 1) | 1) << log2_denom; asm volatile( "movd %0, %%mm3 \n\t" "movd %1, %%mm4 \n\t" @@ -1010,8 +1010,8 @@ static inline void ff_h264_biweight_WxH_mmx2(uint8_t *dst, uint8_t *src, int str } #define H264_WEIGHT(W,H) \ -static void ff_h264_biweight_ ## W ## x ## H ## _mmx2(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offsetd, int offsets){ \ - ff_h264_biweight_WxH_mmx2(dst, src, stride, log2_denom, weightd, weights, offsetd, offsets, W, H); \ +static void ff_h264_biweight_ ## W ## x ## H ## _mmx2(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset){ \ + ff_h264_biweight_WxH_mmx2(dst, src, stride, log2_denom, weightd, weights, offset, W, H); \ } \ static void ff_h264_weight_ ## W ## x ## H ## _mmx2(uint8_t *dst, int stride, int log2_denom, int weight, int offset){ \ ff_h264_weight_WxH_mmx2(dst, stride, log2_denom, weight, offset, W, H); \