Crash in the motion estimation with merange=128

Issue #41 resolved
Peter Kovář created an issue
ffmpeg_g -y -r 50 -start_number 07111 -i /Video/SGI/vqeg.its.bldrdoc.gov/HDTV/SVT_MultiFormat/2160p50_CgrLevels_Master_SVTdec05_/1_CrowdRun_2160p50_CgrLevels_MASTER_SVTdec05_/%05d.sgi -c:v libx265 -x265-params me=2:**merange=128**:b-adapt=2:bframes=4:bitrate=16000 -s 1920x1080 ~/Video/HEVC/1_CrowdRun_1080p50_CgrLevels_MASTER_SVTdec05.hevc

ffmpeg version N-61460-g33fb2ba Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar 14 2014 17:55:44 with gcc 4.8.2 (GCC) 20140120 (Red Hat 4.8.2-14)
  configuration: --enable-libx264 --enable-libx265 --enable-libdc1394 --enable-libvorbis --enable-libtheora --disable-static --enable-shared --enable-pic --enable-gpl --enable-version3 --enable-nonfree --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --samples=/usr/src/FFmpeg/tests/ref/fate --enable-debug --disable-doc
  libavutil      52. 66.101 / 52. 66.101
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 34.101 / 55. 34.101
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, image2, from '/Video/SGI/vqeg.its.bldrdoc.gov/HDTV/SVT_MultiFormat/2160p50_CgrLevels_Master_SVTdec05_/1_CrowdRun_2160p50_CgrLevels_MASTER_SVTdec05_/%05d.sgi':
  Duration: 00:00:19.64, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: sgi, rgb48be, 3840x2160 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
[New Thread 0x7fffed894700 (LWP 3876)]
[New Thread 0x7fffed093700 (LWP 3877)]
[New Thread 0x7fffec892700 (LWP 3878)]
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
x265 [info]: Main profile, Level-4.1 (Main tier)
[New Thread 0x7fffec091700 (LWP 3879)]
[New Thread 0x7fffeb890700 (LWP 3880)]
x265 [info]: WPP streams / pool / frames         : 17 / 2 / 1
x265 [info]: CU size                             : 64
x265 [info]: Max RQT depth inter / intra         : 1 / 1
x265 [info]: ME / range / subpel / merge         : umh / 128 / 2 / 2
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / refs          : 1 / 1 / 3
x265 [info]: Rate Control / AQ-Strength / CUTree : ABR-16000 kbps / 1.0 / 1
x265 [info]: tools: rect amp rd=3 lft sao-lcu sign-hide 
[New Thread 0x7fffe9a13700 (LWP 3881)]
Output #0, hevc, to '/home/peter.kovar/Video/HEVC/1_CrowdRun_1080p50_CgrLevels_MASTER_SVTdec05.hevc':
  Metadata:
    encoder         : Lavf55.34.101
    Stream #0:0: Video: hevc (libx265), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 50 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (sgi -> libx265)
Press [q] to stop, [?] for help
**frame=  209** fps=0.3 q=0.0 size=    7450kB time=00:00:03.74 bitrate=16317.4kbits/s    
Program received signal SIGSEGV, Segmentation fault.

Dump of assembler code for function x265_pixel_sad_8x4_mmx2:
   0x00007ffff35d97f0 <+0>:     pxor   %mm0,%mm0
   0x00007ffff35d97f3 <+3>:     movq   (%rdi),%mm1
   0x00007ffff35d97f6 <+6>:     movq   (%rdi,%rsi,1),%mm2
=> 0x00007ffff35d97fa <+10>:    psadbw (%rdx),%mm1
   0x00007ffff35d97fd <+13>:    psadbw (%rdx,%rcx,1),%mm2
   0x00007ffff35d9801 <+17>:    lea    (%rdi,%rsi,2),%rdi

Attached is the backtrace.

This happens with the motion estimation range equal to 128. Without this parameter encoder runs whole sequence without any faults.

Question: how could I better describe this bug?

Comments (4)

  1. Steve Borho

    Does this crash occur with other ME methods (something other than UMH). Our port of x264's UMH is probably our least tested search method.

  2. Steve Borho

    It is crashing on this line of UMH:

        CROSS(cross_start, merange, merange >> 1);
    

    So it is testing the edges of the motion search range. the CROSS macro should be clipping MVs to mvmin and mvmax but there is likely a bug there.

    It's too bad we're not reporting the version number when libx265 is used as a library.

  3. Log in to comment