[FFmpeg-devel] [PATCH] avcodec/cfhd: add x86 SIMD

Moritz Barsnick barsnick at gmx.net
Fri Aug 21 13:36:55 EEST 2020


On Thu, Aug 20, 2020 at 12:53:05 +0200, Moritz Barsnick wrote:

> Alas, with the patchset, the following command quickly terminates with
> Illegal instruction in ff_cfhd_horiz_filter_clip10_sse2 ():

The same on this CPU, obviously, because it also doesn't support
SSE4.1:

[barsnick at paradise ffmpeg]$ hwinfo --cpu
01: None 00.0: 10103 CPU
  [Created at cpu.462]
  Unique ID: rdCR.j8NaKXDZtZ6
  Hardware Class: cpu                                                                                                           Arch: X86-64                                                                                                                  Vendor: "GenuineIntel"
  Model: 6.28.10 "Intel(R) Atom(TM) CPU D525   @ 1.80GHz"
  Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,t
m,pbe,syscall,nx,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,nopl,cpuid,aperfmperf,pni,dtes64,monitor,ds_cpl,tm2,ssse3,cx16
,xtpr,pdcm,movbe,lahf_lm,dtherm
  Clock: 1800 MHz
  BogoMips: 3599.75
  Cache: 512 kb
  Units/Processor: 4
  Config Status: cfg=new, avail=yes, need=no, active=unknown
[... x4]


Additionally, with bigger_res.mov, I get a double-free:

Compiler: gcc-10.2.1
Assembler: nasm-2.14.02
glibc-2.31

[barsnick at paradise ffmpeg]$ gdb -ex r --args ./ffmpeg_g -i bigger_res.mov -map 0:v -f null -                                  GNU gdb (GDB) Fedora 9.1-5.fc32
[...]
Reading symbols from ./ffmpeg_g...
Starting program: /home/barsnick/Development/ffmpeg-stuff/ffmpeg/ffmpeg_g -i bigger_res.mov -map 0:v -f null -
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
ffmpeg version N-98786-g9ed82ca732 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10 (GCC)
  configuration: --disable-doc --disable-everything --disable-network --disable-vdpau --enable-indev=lavfi --enable-muxer=null
 --enable-demuxer='avi,mov' --enable-encoder='wrapped_avframe,rawvideo,pcm_s16le' --enable-decoder='rawvideo,pcm_f64le,cfhd,pc
m_s16le' --enable-filter='color,testsrc,anoisesrc,null,aresample,scale' --enable-protocol='pipe,file'
  libavutil      56. 58.100 / 56. 58.100
  libavcodec     58.100.100 / 58.100.100
  libavformat    58. 51.100 / 58. 51.100
  libavdevice    58. 11.101 / 58. 11.101
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
double free or corruption (out)

Program received signal SIGABRT, Aborted.
0x00007ffff7c939e5 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.31-4.fc32.x86_64 zlib-1.2.11-21.fc32.x86_64
(gdb) bt
#0  0x00007ffff7c939e5 in raise () from /lib64/libc.so.6
#1  0x00007ffff7c7c895 in abort () from /lib64/libc.so.6
#2  0x00007ffff7cd7857 in __libc_message () from /lib64/libc.so.6
#3  0x00007ffff7cded7c in malloc_printerr () from /lib64/libc.so.6
#4  0x00007ffff7ce03c0 in _int_free () from /lib64/libc.so.6
#5  0x0000000000404ea0 in free_buffers (s=0x5fc6c0) at libavcodec/cfhd.c:222
#6  cfhd_close (avctx=<optimized out>) at libavcodec/cfhd.c:1331
#7  0x000000000040585b in avcodec_close (avctx=0x5ee180) at libavcodec/utils.c:1143
#8  0x0000000000485453 in avformat_find_stream_info (ic=<optimized out>, options=<optimized out>) at libavformat/utils.c:4212
#9  0x000000000041954d in open_input_file (o=o at entry=0x7fffffffd480, filename=<optimized out>) at fftools/ffmpeg_opt.c:1186
#10 0x000000000041cbb8 in open_files (open_file=0x4189e0 <open_input_file>, inout=0x58a603 "input", l=0x5eb058)
    at fftools/ffmpeg_opt.c:3303
#11 ffmpeg_parse_options (argc=argc at entry=8, argv=argv at entry=0x7fffffffd9a8) at fftools/ffmpeg_opt.c:3343
#12 0x0000000000411c18 in main (argc=8, argv=0x7fffffffd9a8) at fftools/ffmpeg.c:4850
(gdb) disass $pc-32,$pc+32
Dump of assembler code from 0x7ffff7c939c5 to 0x7ffff7c93a05:
   0x00007ffff7c939c5 <raise+293>:      add    %dh,%al
   0x00007ffff7c939c7 <raise+295>:      (bad)
   0x00007ffff7c939c8 <raise+296>:      pushq  0x3d(%rdi)
   0x00007ffff7c939cb <raise+299>:      mov    %eax,%r8d
   0x00007ffff7c939ce <raise+302>:      mov    $0x8,%r10d
   0x00007ffff7c939d4 <raise+308>:      xor    %edx,%edx
   0x00007ffff7c939d6 <raise+310>:      mov    %r9,%rsi
   0x00007ffff7c939d9 <raise+313>:      mov    $0x2,%edi
   0x00007ffff7c939de <raise+318>:      mov    $0xe,%eax
   0x00007ffff7c939e3 <raise+323>:      syscall
=> 0x00007ffff7c939e5 <raise+325>:      mov    0x108(%rsp),%rax
   0x00007ffff7c939ed <raise+333>:      sub    %fs:0x28,%rax
   0x00007ffff7c939f6 <raise+342>:      jne    0x7ffff7c93a1c <raise+380>
   0x00007ffff7c939f8 <raise+344>:      mov    %r8d,%eax
   0x00007ffff7c939fb <raise+347>:      add    $0x118,%rsp
   0x00007ffff7c93a02 <raise+354>:      retq
   0x00007ffff7c93a03 <raise+355>:      nopl   0x0(%rax,%rax,1)
End of assembler dump.
(gdb) up 5
#5  0x0000000000404ea0 in free_buffers (s=0x5fc6c0) at libavcodec/cfhd.c:222
222             av_freep(&s->plane[i].idwt_buf);
(gdb) p &s->plane[i].idwt_buf
$1 = (int16_t **) 0x606ba8
(gdb) p s->plane[i].idwt_buf
$2 = (int16_t *) 0x0

No benchmarks here. :-(

If you're still interested in benchmarks, my next try will be on
Haswell.

Cheers,
Moritz


More information about the ffmpeg-devel mailing list