Mercurial > libavcodec.hg
changeset 8086:ae146e429003 libavcodec
Correct motion vector scaling in B-frames for RV3/4
author | kostya |
---|---|
date | Thu, 30 Oct 2008 06:08:47 +0000 |
parents | 17b40776c5ce |
children | 661cd381d996 |
files | rv34.c |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rv34.c Wed Oct 29 23:44:40 2008 +0000 +++ b/rv34.c Thu Oct 30 06:08:47 2008 +0000 @@ -474,13 +474,12 @@ static int calc_add_mv(RV34DecContext *r, int dir, int val) { int refdist = GET_PTS_DIFF(r->next_pts, r->last_pts); - int dist = dir ? GET_PTS_DIFF(r->next_pts, r->cur_pts) : GET_PTS_DIFF(r->cur_pts, r->last_pts); + int dist = dir ? -GET_PTS_DIFF(r->next_pts, r->cur_pts) : GET_PTS_DIFF(r->cur_pts, r->last_pts); + int mul; if(!refdist) return 0; - if(!dir) - return (val * dist + refdist - 1) / refdist; - else - return -(val * dist / refdist); + mul = (dist << 14) / refdist; + return (val * mul + 0x2000) >> 14; } /**