[FFmpeg-devel] [PATCH] mpeg2dec: fix decoding field pictures

Michael Niedermayer michael at niedermayer.cc
Fri Feb 9 02:55:07 EET 2018


On Fri, Feb 09, 2018 at 02:03:24AM +0900, Nekopanda wrote:
> - Fix field selection for skipped macroblocks
> 
> For B field pictures, the spec says,
> 
> > The prediction shall be made from the field of the same parity as the field being predicted.
> 
> I did it.
> 
> - 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.
> ---
>  libavcodec/mpeg12dec.c        |  2 ++
>  libavcodec/mpegvideo_motion.c | 30 ++++++++++++++++--------------
>  2 files changed, 18 insertions(+), 14 deletions(-)

How did you find this bug ?

do you have a testcase / file which shows artifacts without this change ?

assuming the change is correct then the patch needs to update several fate
checksums. As is it would break make fate

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180209/7b1b6b7e/attachment.sig>


More information about the ffmpeg-devel mailing list