avcodec/mpeg2dec: Fix motion vector rounding for chroma components
authorNekopanda <pianoyayaninth-at-yahoo.co.jp@ffmpeg.org>
Sun, 11 Feb 2018 08:15:54 +0000 (17:15 +0900)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 11 Feb 2018 11:04:47 +0000 (12:04 +0100)
commitf4d5d7e8de189ab448a5e662245b57ceb8f20df6
treee554291fd25a5ac8e4659ab2a25a91a60c79ce01
parent570023eab3e2962b4ad8345a157c1e18ca1a6eca
avcodec/mpeg2dec: Fix motion vector rounding for chroma components

In 16x8 motion compensation, for lower 16x8 region, the input to mpeg_motion() for motion_y was "motion_y + 16", which causes wrong rounding. For 4:2:0, chroma scaling for y is dividing by two and rounding toward zero. When motion_y < 0 and motion_y + 16 > 0, the rounding direction of "motion_y" and "motion_y + 16" is different and rounding "motion_y + 16" would be incorrect.

We should input "motion_y" as is to round correctly. I add "is_16x8" flag to do that.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mpegvideo_motion.c
tests/ref/fate/filter-mcdeint-fast
tests/ref/fate/filter-mcdeint-medium
tests/ref/fate/filter-w3fdif-complex
tests/ref/fate/filter-w3fdif-simple
tests/ref/fate/filter-yadif-mode0
tests/ref/fate/filter-yadif-mode1
tests/ref/fate/filter-yadif10
tests/ref/fate/filter-yadif16
tests/ref/fate/mpeg2-field-enc
tests/ref/fate/mpeg2-ticket6677