Message ID | 20200313143001.1577-1-porschegt23@foxmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] libavcodec/mpegutils: remove useless mv The function which add motion info, but do not need motionless vectors, its useless. And, when u export mvs , loop oper will spend many times for useless vectors. | expand |
Context | Check | Description |
---|---|---|
andriy/ffmpeg-patchwork | fail | Make fate failed |
On Fri, Mar 13, 2020 at 10:30:01PM +0800, numberwolf wrote: > Signed-off-by: numberwolf <porschegt23@foxmail.com> > --- > libavcodec/mpegutils.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) breaks fate --- ./tests/ref/fate/filter-codecview-mvs 2020-02-28 20:37:13.372518075 +0100 +++ tests/data/fate/filter-codecview-mvs 2020-03-14 01:48:19.010902899 +0100 @@ -19,47 +19,47 @@ 0, 13, 13, 1, 276480, 0x5f7a0d4f 0, 14, 14, 1, 276480, 0x5f7a0d4f 0, 15, 15, 1, 276480, 0x5f7a0d4f -0, 16, 16, 1, 276480, 0xc3b80edf +0, 16, 16, 1, 276480, 0x5f7a0d4f 0, 17, 17, 1, 276480, 0x5f7a0d4f 0, 18, 18, 1, 276480, 0x5f7a0d4f 0, 19, 19, 1, 276480, 0x5f7a0d4f -0, 20, 20, 1, 276480, 0xc3b80edf +0, 20, 20, 1, 276480, 0x5f7a0d4f 0, 21, 21, 1, 276480, 0x5f7a0d4f 0, 22, 22, 1, 276480, 0x5f7a0d4f 0, 23, 23, 1, 276480, 0x5f7a0d4f -0, 24, 24, 1, 276480, 0xc3b80edf +0, 24, 24, 1, 276480, 0x5f7a0d4f 0, 25, 25, 1, 276480, 0x5f7a0d4f 0, 26, 26, 1, 276480, 0x5f7a0d4f 0, 27, 27, 1, 276480, 0x5f7a0d4f -0, 28, 28, 1, 276480, 0xc3b80edf +0, 28, 28, 1, 276480, 0x5f7a0d4f 0, 29, 29, 1, 276480, 0x5f7a0d4f 0, 30, 30, 1, 276480, 0x5f7a0d4f 0, 31, 31, 1, 276480, 0x5f7a0d4f -0, 32, 32, 1, 276480, 0xc3b80edf +0, 32, 32, 1, 276480, 0x5f7a0d4f 0, 33, 33, 1, 276480, 0x75641594 0, 34, 34, 1, 276480, 0x32ee3526 0, 35, 35, 1, 276480, 0xcb53479a -0, 36, 36, 1, 276480, 0xe1be6e26 +0, 36, 36, 1, 276480, 0x7ca9658e 0, 37, 37, 1, 276480, 0x5ce39368 0, 38, 38, 1, 276480, 0x4ec1e418 0, 39, 39, 1, 276480, 0x23c418ae -0, 40, 40, 1, 276480, 0x036a5515 +0, 40, 40, 1, 276480, 0x2a7a4bb5 0, 41, 41, 1, 276480, 0x7946efbd 0, 42, 42, 1, 276480, 0xd9aa1382 0, 43, 43, 1, 276480, 0x3863f9c8 -0, 44, 44, 1, 276480, 0x33e47330 -0, 45, 45, 1, 276480, 0xff6e8038 -0, 46, 46, 1, 276480, 0xed3ff087 +0, 44, 44, 1, 276480, 0x71a269d0 +0, 45, 45, 1, 276480, 0xd5b67f70 +0, 46, 46, 1, 276480, 0x3e85f0bf 0, 47, 47, 1, 276480, 0xe7834514 -0, 48, 48, 1, 276480, 0x4d5d909d +0, 48, 48, 1, 276480, 0xc016f386 0, 49, 49, 1, 276480, 0x82eea962 0, 50, 50, 1, 276480, 0x8075bca3 -0, 51, 51, 1, 276480, 0xd5dc3185 -0, 52, 52, 1, 276480, 0x859e0490 +0, 51, 51, 1, 276480, 0x272a31bd +0, 52, 52, 1, 276480, 0x72d1a9e1 0, 53, 53, 1, 276480, 0x6ceebf3e 0, 54, 54, 1, 276480, 0xada5d62d 0, 55, 55, 1, 276480, 0x991a7628 -0, 56, 56, 1, 276480, 0xe169042a +0, 56, 56, 1, 276480, 0x52f794d3 0, 57, 57, 1, 276480, 0x226e52c4 -0, 58, 58, 1, 276480, 0xa3fe775c +0, 58, 58, 1, 276480, 0x53cf76cc 0, 59, 59, 1, 276480, 0x6b80e99f Test filter-codecview-mvs failed. Look at tests/data/fate/filter-codecview-mvs.err for details. tests/Makefile:250: recipe for target 'fate-filter-codecview-mvs' failed make: *** [fate-filter-codecview-mvs] Error 1 [...]
diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c index c0ee3aa..148d3e7 100644 --- a/libavcodec/mpegutils.c +++ b/libavcodec/mpegutils.c @@ -34,6 +34,12 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type, int motion_x, int motion_y, int motion_scale, int direction) { + int src_x = dst_x + motion_x / motion_scale; + int src_y = dst_y + motion_y / motion_scale; + + if (src_x == dst_x && src_y == dst_y) { + return 0; + } mb->w = IS_8X8(mb_type) || IS_8X16(mb_type) ? 8 : 16; mb->h = IS_8X8(mb_type) || IS_16X8(mb_type) ? 8 : 16; mb->motion_x = motion_x; @@ -41,8 +47,8 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type, mb->motion_scale = motion_scale; mb->dst_x = dst_x; mb->dst_y = dst_y; - mb->src_x = dst_x + motion_x / motion_scale; - mb->src_y = dst_y + motion_y / motion_scale; + mb->src_x = src_x; + mb->src_y = src_y; mb->source = direction ? 1 : -1; mb->flags = 0; // XXX: does mb_type contain extra information that could be exported here? return 1;
Signed-off-by: numberwolf <porschegt23@foxmail.com> --- libavcodec/mpegutils.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)