flaccidware / webm

Automatically exported from code.google.com/p/webm
0 stars 0 forks source link

vp9_spatial_svc_encoder fails with encoder multi-threading #1018

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Set the number of columns tiles at line 633 of vp9_spatial_svc_encoder.c:
vpx_codec_control(&codec, VP9E_SET_TILE_COLUMNS, 2);

Build with:
./configure --enable-experimental --enable-spatial-svc --enable-debug

Run with 1280x720 clip:
examples/vp9_spatial_svc_encoder -f 1000 -w 1280 -h 720 -t 1/30 -sl 2 -r 
640/1280,1280/1280 -k 500 -b 1000 --rc-end-usage=1 --lag-in-frames=0  
--temporal-layering-mode=2 --speed=6 --passes=1 input_file out.ivf

Result:
Program received signal SIGSEGV, Segmentation fault.
__memcpy_sse2_unaligned () at 
../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:35
35  ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S: No such file or 
directory.
(gdb) bt
#0  __memcpy_sse2_unaligned () at 
../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:35
#1  0x0000000000511921 in vp9_encode_tiles_mt (cpi=cpi@entry=0x7ffff7434020) at 
vp9/encoder/vp9_ethread.c:123
#2  0x000000000050c474 in encode_frame_internal (cpi=cpi@entry=0x7ffff7434020) 
at vp9/encoder/vp9_encodeframe.c:3963
#3  0x000000000050cb76 in vp9_encode_frame (cpi=cpi@entry=0x7ffff7434020) at 
vp9/encoder/vp9_encodeframe.c:4126
#4  0x0000000000440378 in encode_without_recode_loop (cpi=0x7ffff7434020) at 
vp9/encoder/vp9_encoder.c:3126
#5  encode_frame_to_data_rate (cpi=cpi@entry=0x7ffff7434020, 
size=size@entry=0x7fffffffc920, dest=dest@entry=0x7ffff421f798 "", 
frame_flags=frame_flags@entry=0x7fffffffc8f0)
    at vp9/encoder/vp9_encoder.c:3612
#6  0x00000000004429fb in Pass0Encode (frame_flags=<optimized out>, 
dest=<optimized out>, size=<optimized out>, cpi=<optimized out>) at 
vp9/encoder/vp9_encoder.c:3753
#7  vp9_get_compressed_data (cpi=cpi@entry=0x7ffff7434020, 
frame_flags=frame_flags@entry=0x7fffffffc8f0, size=size@entry=0x7fffffffc920, 
dest=dest@entry=0x7ffff421f798 "", 
    time_stamp=time_stamp@entry=0x7fffffffc900, time_end=time_end@entry=0x7fffffffc910, flush=0) at vp9/encoder/vp9_encoder.c:4197
#8  0x000000000043a76a in encoder_encode (ctx=0x7bf1a0, img=0x7fffffffccc0, 
pts=<optimized out>, duration=<optimized out>, flags=<optimized out>, 
deadline=<optimized out>)
    at vp9/vp9_cx_iface.c:1026
#9  0x0000000000407959 in vpx_codec_encode (ctx=ctx@entry=0x7fffffffcc80, 
img=<optimized out>, pts=0, duration=1, flags=flags@entry=0, 
deadline=<optimized out>) at vpx/src/vpx_encoder.c:223
#10 0x0000000000406ce1 in vpx_svc_encode (svc_ctx=svc_ctx@entry=0x7fffffffcc20, 
codec_ctx=codec_ctx@entry=0x7fffffffcc80, rawimg=rawimg@entry=0x7fffffffccc0, 
pts=pts@entry=0, 
    duration=duration@entry=1, deadline=<optimized out>) at vpx/src/svc_encodeframe.c:523
#11 0x0000000000402247 in main (argc=<optimized out>, argv=<optimized out>) at 
examples/vp9_spatial_svc_encoder.c:645

Original issue reported on code.google.com by marpan@google.com on 8 Jun 2015 at 10:17

GoogleCodeExporter commented 9 years ago
I reproduced the crash.

By modifying that line, the number of tiles is set to 4 ( # of threads is not 
set). The multi-tile encoding doesn't work.

Original comment by yunqingw...@google.com on 9 Jun 2015 at 3:33

GoogleCodeExporter commented 9 years ago
I set #threads in vpx_svc_init() of vpx/src/svc_encodeframe.c, i.e.,
//if (svc_ctx->threads)
//    enc_cfg->g_threads = svc_ctx->threads;
enc_cfg->g_threads = 4;

See also unittest being added here that fails: 
https://chromium-review.googlesource.com/#/c/276190/

Original comment by marpan@google.com on 9 Jun 2015 at 3:26

GoogleCodeExporter commented 9 years ago
https://chromium.googlesource.com/webm/libvpx/+/2c838ede68b423424acf8576a65c64b8
80b670db
https://chromium.googlesource.com/webm/libvpx/+/c98273c9e7a0d06572a11ad754b7f33b
0666921c
The above 2 patches fixed the crash in multi-tile and multi-thread encoding in 
spacial SVC case.

Although no crash is seen now, I still notice mismatch while using 
multi-threads in SVC. Further investigation needs to be done.

Original comment by yunqingw...@google.com on 15 Jun 2015 at 11:13

GoogleCodeExporter commented 9 years ago

Original comment by marpan@google.com on 16 Jun 2015 at 12:00