mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-18 21:30:55 +00:00
Correct motion vector scaling in B-frames for RV3/4
Originally committed as revision 15747 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
1fcb9be39a
commit
5f621dd28a
@ -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)
|
static int calc_add_mv(RV34DecContext *r, int dir, int val)
|
||||||
{
|
{
|
||||||
int refdist = GET_PTS_DIFF(r->next_pts, r->last_pts);
|
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(!refdist) return 0;
|
||||||
if(!dir)
|
mul = (dist << 14) / refdist;
|
||||||
return (val * dist + refdist - 1) / refdist;
|
return (val * mul + 0x2000) >> 14;
|
||||||
else
|
|
||||||
return -(val * dist / refdist);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user