[libav-devel] [PATCH 8/8] hevcdsp: add x86 SIMD for MC

James Almer jamrial at gmail.com
Thu Aug 20 18:51:20 CEST 2015


On 20/08/15 3:35 AM, Anton Khirnov wrote:
> Quoting James Almer (2015-08-20 00:34:58)
>> On 19/08/15 4:43 PM, Anton Khirnov wrote:
>>> ---
>>>  libavcodec/hevc.c             |   6 +-
>>>  libavcodec/hevc.h             |   2 +-
>>>  libavcodec/hevcdsp.c          |  24 +-
>>>  libavcodec/hevcdsp.h          |   5 +-
>>>  libavcodec/hevcdsp_template.c |   8 +-
>>>  libavcodec/x86/Makefile       |   3 +-
>>>  libavcodec/x86/hevc_mc.asm    | 816 ++++++++++++++++++++++++++++++++++++++++++
>>>  libavcodec/x86/hevcdsp_init.c | 405 +++++++++++++++++++++
>>>  8 files changed, 1258 insertions(+), 11 deletions(-)
>>>  create mode 100644 libavcodec/x86/hevc_mc.asm
>>
>> I'm getting segmentation faults with quite a few of samples.
>> For example http://www.elecard.com/assets/files/other/clips/bbb_1080p_c.ts
> 
> Cannot reproduce here. Can you give me more details (system, where
> exactly does it crash, etc.)?
> 

Mingw-w64 GCC 5.2.0. It also crashes with checkasm after patch 7/8, but in a different place.
With checkasm i get:

Program received signal SIGSEGV, Segmentation fault.
0x000000000046ae00 in put_hevc_qpel_pixels_4_8 ()
    at /home/jamrial/libav/libavcodec/hevcdsp_template.c:41
41      }
(gdb) disass $pc-32,$pc+32
Dump of assembler code from 0x46ade0 to 0x46ae20:
   0x000000000046ade0 <put_hevc_qpel_pixels_4_8+0>:     mov    0x28(%rsp),%r11d
   0x000000000046ade5 <put_hevc_qpel_pixels_4_8+5>:     xor    %r10d,%r10d
   0x000000000046ade8 <put_hevc_qpel_pixels_4_8+8>:     and    $0xfffffffffffffffe,%rdx
   0x000000000046adec <put_hevc_qpel_pixels_4_8+12>:    test   %r11d,%r11d
   0x000000000046adef <put_hevc_qpel_pixels_4_8+15>:    jle    0x46ae3c <put_hevc_qpel_pixels_4_8+92>
   0x000000000046adf1 <put_hevc_qpel_pixels_4_8+17>:    nopl   0x0(%rax,%rax,1)
   0x000000000046adf6 <put_hevc_qpel_pixels_4_8+22>:    nopw   %cs:0x0(%rax,%rax,1)
=> 0x000000000046ae00 <put_hevc_qpel_pixels_4_8+32>:    movzbl (%r8),%eax
   0x000000000046ae04 <put_hevc_qpel_pixels_4_8+36>:    inc    %r10d
   0x000000000046ae07 <put_hevc_qpel_pixels_4_8+39>:    shl    $0x6,%eax
   0x000000000046ae0a <put_hevc_qpel_pixels_4_8+42>:    mov    %ax,(%rcx)
   0x000000000046ae0d <put_hevc_qpel_pixels_4_8+45>:    movzbl 0x1(%r8),%eax
   0x000000000046ae12 <put_hevc_qpel_pixels_4_8+50>:    shl    $0x6,%eax
   0x000000000046ae15 <put_hevc_qpel_pixels_4_8+53>:    mov    %ax,0x2(%rcx)
   0x000000000046ae19 <put_hevc_qpel_pixels_4_8+57>:    movzbl 0x2(%r8),%eax
   0x000000000046ae1e <put_hevc_qpel_pixels_4_8+62>:    shl    $0x6,%eax
End of assembler dump.
(gdb) info all-registers
rax            0x2c80   11392
rbx            0xed56bb2dcb3c7736       -1344681633365854410
rcx            0xdeadbeef00224c50       -2401053092609897392
rdx            0xdeadbeef00000020       -2401053092612145120
rsi            0x75b6ba21077c48ad       8482171599221180589
rdi            0x21f86d66c8ca00ce       2447826685698638030
rbp            0x8bda43d3fd1a7e06       0x8bda43d3fd1a7e06
rsp            0x2192b8 0x2192b8
r8             0xdeadbeef00219af3       -2401053092609942797
r9             0xdeadbeef00000010       -2401053092612145136
r10            0x1      1
r11            0x10     16
r12            0xb64a9c9e5d318408       -5311260606547786744
r13            0xdf9a54b303f1d3a3       -2334460328996121693
r14            0x4a75479abd64e097       5365273261009854615
r15            0x249214109d5d1c88       2635190793557318792
rip            0x46ae00 0x46ae00 <put_hevc_qpel_pixels_4_8+32>



With bbb_1080p_c.ts i get:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1044.0x6ac]
0x0000000000a91391 in ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop ()
(gdb) disass $pc-32,$pc+32
Dump of assembler code from 0xa91371 to 0xa913b1:
   0x0000000000a91371 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+31>:      pop    %rax
   0x0000000000a91372 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+32>:      adc    %ah,0x41(%rsi)
   0x0000000000a91375 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+35>:      paddsw 0x10(%rcx),%mm3
   0x0000000000a91379 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+39>:      paddsw %xmm0,%xmm3
   0x0000000000a9137d <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+43>:      psraw  $0x7,%xmm3
   0x0000000000a91382 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+48>:      packuswb %xmm3,%xmm3
   0x0000000000a91386 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+52>:      movq   %xmm3,0x8(%rcx)
   0x0000000000a9138b <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+57>:      movdqa 0x20(%r8),%xmm3
=> 0x0000000000a91391 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+63>:      paddsw 0x20(%r9),%xmm3
   0x0000000000a91397 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+69>:      paddsw %xmm0,%xmm3
   0x0000000000a9139b <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+73>:      psraw  $0x7,%xmm3
   0x0000000000a913a0 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+78>:      packuswb %xmm3,%xmm3
   0x0000000000a913a4 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+82>:      movq   %xmm3,0x10(%rcx)
   0x0000000000a913a9 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+87>:      movdqa 0x30(%r8),%xmm3
   0x0000000000a913af <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+93>:      paddsw 0x30(%r9),%xmm3
End of assembler dump.
(gdb) info all-registers
rax            0x66857c0        107501504
rbx            0x200    512
rcx            0x9aaef20        162197280
rdx            0x780    1920
rsi            0x3c0    960
rdi            0x8157ad0        135625424
rbp            0x666b920        0x666b920
rsp            0x8157a28        0x8157a28
r8             0x815dfe0        135651296
r9             0x815ffe0        135659488
r10            0x80     128
r11            0x40003ffffffff76        288234774198222710
r12            0x7      7
r13            0x40     64
r14            0x40     64
r15            0x6672828        107423784
rip            0xa91391 0xa91391 <ff_hevc_put_unweighted_pred_avg_64_8_sse2.loop+63>



More information about the libav-devel mailing list