diff options
author | shahriman AMS <shahriman_ams@yahoo.com> | 2011-11-08 08:47:30 +0000 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-11-09 10:51:22 +0100 |
commit | 6475a6e1ca47ebf33fd5e89eafa6baabe9f0d792 (patch) | |
tree | 21a66d4aa9134f850c4e2bf8d5e0dd1e979ce886 /libavcodec/vc1dec.c | |
parent | 055a141e440b90d1406d9e75699c09b8cc1e823b (diff) | |
download | ffmpeg-6475a6e1ca47ebf33fd5e89eafa6baabe9f0d792.tar.gz |
vc1dec: take ME precision into account while scaling MV predictors.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/vc1dec.c')
-rw-r--r-- | libavcodec/vc1dec.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 60cca333fe..5220104b94 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1422,29 +1422,36 @@ static av_always_inline int scaleforsame(VC1Context *v, int i, int n /* MV */, int dim, int dir) { int brfd, scalesame; + int hpel = 1 - v->s.quarter_sample; + n >>= hpel; if (v->s.pict_type != AV_PICTURE_TYPE_B || v->second_field || !dir) { if (dim) - return scaleforsame_y(v, i, n, dir); + n = scaleforsame_y(v, i, n, dir) << hpel; else - return scaleforsame_x(v, n, dir); + n = scaleforsame_x(v, n, dir) << hpel; + return n; } brfd = FFMIN(v->brfd, 3); scalesame = vc1_b_field_mvpred_scales[0][brfd]; - return n * scalesame >> 8; + n = (n * scalesame >> 8) << hpel; + return n; } static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, int dim, int dir) { int refdist, scaleopp; + int hpel = 1 - v->s.quarter_sample; + n >>= hpel; if (v->s.pict_type == AV_PICTURE_TYPE_B && !v->second_field && dir == 1) { if (dim) - return scaleforopp_y(v, n, dir); + n = scaleforopp_y(v, n, dir) << hpel; else - return scaleforopp_x(v, n); + n = scaleforopp_x(v, n) << hpel; + return n; } if (v->s.pict_type != AV_PICTURE_TYPE_B) refdist = FFMIN(v->refdist, 3); @@ -1452,7 +1459,8 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, refdist = dir ? v->brfd : v->frfd; scaleopp = vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist]; - return n * scaleopp >> 8; + n = (n * scaleopp >> 8) << hpel; + return n; } /** Predict and set motion vector |