aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/rv40dsp.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2011-08-10 11:26:39 +0200
committerRonald S. Bultje <rsbultje@gmail.com>2011-08-11 16:07:58 -0700
commitb86ab38137be34376c90d45d08d49dbd28f2a72f (patch)
tree81d8adb7d44ff7e650d72212f94dab9a18528877 /libavcodec/rv40dsp.c
parente5ec68699e418b5c6044195fb998ee5287f2bb6f (diff)
downloadffmpeg-b86ab38137be34376c90d45d08d49dbd28f2a72f.tar.gz
Add weighted motion compensation for RV40 B-frames
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/rv40dsp.c')
-rw-r--r--libavcodec/rv40dsp.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
index 132f063dfa..ca620ab7d7 100644
--- a/libavcodec/rv40dsp.c
+++ b/libavcodec/rv40dsp.c
@@ -285,6 +285,23 @@ static void OPNAME ## rv40_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*a
RV40_CHROMA_MC(put_, op_put)
RV40_CHROMA_MC(avg_, op_avg)
+#define RV40_WEIGHT_FUNC(size) \
+static void rv40_weight_func_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, int stride)\
+{\
+ int i, j;\
+\
+ for (j = 0; j < size; j++) {\
+ for (i = 0; i < size; i++)\
+ dst[i] = (((w2 * src1[i]) >> 9) + ((w1 * src2[i]) >> 9) + 0x10) >> 5;\
+ src1 += stride;\
+ src2 += stride;\
+ dst += stride;\
+ }\
+}
+
+RV40_WEIGHT_FUNC(16)
+RV40_WEIGHT_FUNC(8)
+
av_cold void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) {
c->put_pixels_tab[0][ 0] = dsp->put_h264_qpel_pixels_tab[0][0];
c->put_pixels_tab[0][ 1] = put_rv40_qpel16_mc10_c;
@@ -356,6 +373,9 @@ av_cold void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) {
c->avg_chroma_pixels_tab[0] = avg_rv40_chroma_mc8_c;
c->avg_chroma_pixels_tab[1] = avg_rv40_chroma_mc4_c;
+ c->rv40_weight_pixels_tab[0] = rv40_weight_func_16;
+ c->rv40_weight_pixels_tab[1] = rv40_weight_func_8;
+
if (HAVE_MMX)
ff_rv40dsp_init_x86(c, dsp);
}