diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2008-10-30 06:08:47 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2008-10-30 06:08:47 +0000 |
commit | 5f621dd28aa8c7c71edc97c2867cacde346af353 (patch) | |
tree | c99efa2d5fa0c1b825ebfb9a08f740a3c66d9dc2 /libavcodec/rv34.c | |
parent | 1fcb9be39a778275850910671c36a6f42e9fd4cc (diff) | |
download | ffmpeg-streaming-5f621dd28aa8c7c71edc97c2867cacde346af353.zip ffmpeg-streaming-5f621dd28aa8c7c71edc97c2867cacde346af353.tar.gz |
Correct motion vector scaling in B-frames for RV3/4
Originally committed as revision 15747 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/rv34.c')
-rw-r--r-- | libavcodec/rv34.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index de1ce52..3baa471 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -474,13 +474,12 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int 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; } /** |