From 6f7fe4723b9bfbb52341568906e6168966f486b3 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 2 Aug 2011 13:45:28 +0200 Subject: [PATCH] Correct chroma vector calculation for RealVideo 3. Old version divided it wrong, which resulted in chroma drift (visible on FATE sample too as dirty trails left by clouds). Signed-off-by: Ronald S. Bultje --- libavcodec/rv34.c | 4 ++-- tests/ref/fate/rv30 | 56 ++++++++++++++++++++++++++--------------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 9162da5..1aec571 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -737,8 +737,8 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, my = (s->current_picture_ptr->f.motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24); lx = (s->current_picture_ptr->f.motion_val[dir][mv_pos][0] + (3 << 24)) % 3; ly = (s->current_picture_ptr->f.motion_val[dir][mv_pos][1] + (3 << 24)) % 3; - chroma_mx = (s->current_picture_ptr->f.motion_val[dir][mv_pos][0] + 1) >> 1; - chroma_my = (s->current_picture_ptr->f.motion_val[dir][mv_pos][1] + 1) >> 1; + chroma_mx = s->current_picture_ptr->f.motion_val[dir][mv_pos][0] / 2; + chroma_my = s->current_picture_ptr->f.motion_val[dir][mv_pos][1] / 2; umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24); umy = (chroma_my + (3 << 24)) / 3 - (1 << 24); uvmx = chroma_coeffs[(chroma_mx + (3 << 24)) % 3]; diff --git a/tests/ref/fate/rv30 b/tests/ref/fate/rv30 index 5b43588..6c99871 100644 --- a/tests/ref/fate/rv30 +++ b/tests/ref/fate/rv30 @@ -16,31 +16,31 @@ 0, 112500, 126720, 0xe572dfc9 0, 120000, 126720, 0xbc3cc34f 0, 127500, 126720, 0xcf8cb0e2 -0, 135000, 126720, 0x6d1c630d -0, 142500, 126720, 0x4338e469 -0, 150000, 126720, 0x9d82ea38 -0, 157500, 126720, 0x55e0b559 -0, 165000, 126720, 0x5eefb5ef -0, 172500, 126720, 0x4b10b746 -0, 180000, 126720, 0x8b07a1db -0, 187500, 126720, 0x8c639b34 -0, 195000, 126720, 0x63eb0b9f -0, 202500, 126720, 0x31c80c83 -0, 210000, 126720, 0x78495352 -0, 217500, 126720, 0x63d609c4 -0, 225000, 126720, 0xcd2a62d8 -0, 232500, 126720, 0x4aea732d -0, 240000, 126720, 0xe3bb352c -0, 247500, 126720, 0x4b9036ad -0, 255000, 126720, 0x88b66e2d -0, 262500, 126720, 0x4a8a1b16 -0, 270000, 126720, 0x2e014eac -0, 277500, 126720, 0x83212c67 -0, 285000, 126720, 0x4937e897 -0, 292500, 126720, 0x2d38babe -0, 300000, 126720, 0xbcb43c09 -0, 307500, 126720, 0x955ffaf4 -0, 315000, 126720, 0x3337d4a2 -0, 322500, 126720, 0xe8f58c33 -0, 330000, 126720, 0x3a7f771f -0, 337500, 126720, 0xb67c39b9 +0, 135000, 126720, 0x75ae61b6 +0, 142500, 126720, 0x554fe3e4 +0, 150000, 126720, 0x72ecea95 +0, 157500, 126720, 0x5d00b5fe +0, 165000, 126720, 0xe39bba0d +0, 172500, 126720, 0x9c21bad8 +0, 180000, 126720, 0x72f2a47d +0, 187500, 126720, 0x4f639ebe +0, 195000, 126720, 0x534a10cc +0, 202500, 126720, 0xfdca11d3 +0, 210000, 126720, 0x0c735615 +0, 217500, 126720, 0x0eaf0c1b +0, 225000, 126720, 0xce5e6794 +0, 232500, 126720, 0x14cf7974 +0, 240000, 126720, 0xbc513f2a +0, 247500, 126720, 0xbc303fae +0, 255000, 126720, 0xd9f67585 +0, 262500, 126720, 0x3378251f +0, 270000, 126720, 0xb3ed5911 +0, 277500, 126720, 0xc15a3577 +0, 285000, 126720, 0x0a24f256 +0, 292500, 126720, 0xfab9c45d +0, 300000, 126720, 0x45464610 +0, 307500, 126720, 0xfe2e057d +0, 315000, 126720, 0x23efdc35 +0, 322500, 126720, 0x4d888b2e +0, 330000, 126720, 0xdd0d74df +0, 337500, 126720, 0x08382b8e -- 2.7.4