Status: Untriaged
Owner: ----
Labels: Type-Bug Pri-2
Components: libvpx
New issue 1642 by linjie.j...@
gmail.com: libvpxenc: dynamic resolution encode support when total size is enlarged but width is smaller
https://bugs.chromium.org/p/webm/issues/detail?id=1642I'm trying to enable multi-resolution encoding support for libvpxenc in ffmpeg.
Some issure occurs when it comes to resolution changing from small to large.
1. I'm trying to use vpx_codec_enc_config_set to set mew width/height for encoder
Patch could be accessed here:
https://github.com/fulinjie/ffmpeg/commit/9df64d2d567345dbc48d0708a56d7df0a82f4501It works for resolution changes from large to small, however, when the situation comes to changing from small to large, some issues may happen.
Assumes that there is one case that resolution changes from 495x168 to 328x307, the total size is enlarged but the col size becomes smaller.
In vp9_change_config, (cm->mi_alloc_size < new_mi_size) is met so the context buf is freed:
https://chromium.googlesource.com/webm/libvpx/+/refs/heads/master/vp9/encoder/vp9_encoder.c#2022However, when it tried to alloc new context buf in alloc_compressor_data(), (cm->above_context_alloc_cols < cm->mi_cols) is not met
since 495 is large that 328. So cm->above_context won't be allocated and leads to a failure.
https://chromium.googlesource.com/webm/libvpx/+/refs/heads/master/vp9/common/vp9_alloccommon.c#132And this leads to encoding failure.
Also checked the unit test code in resize_test.cc which is pointed in
https://patchwork.ffmpeg.org/patch/14162/,
width/height are changed all together, so above cases are not tested.
[error message]:
[graph 0 input from stream 0:0 @ 0x721940] w:495 h:168 pixfmt:p010le tb:1/1000 fr:1000/1 sar:0/1 sws_param:flags=2
Incompatible pixel format 'p010le' for codec 'libvpx-vp9', auto-selecting format 'yuv420p'
[auto_scaler_0 @ 0x7248c0] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x7260c0] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scaler_0 @ 0x7248c0] w:495 h:168 fmt:p010le sar:0/1 -> w:495 h:168 fmt:yuv420p sar:0/1 flags:0x4
[libvpx-vp9 @ 0x6a0f40] v1.8.0-649-ge46820c
[libvpx-vp9 @ 0x6a0f40] --prefix=/opt/X11R7/libvpx --enable-shared --enable-debug --disable-examples
Output #0, ivf, to 'out.ivf':
Metadata:
encoder : Lavf58.30.100
Stream #0:0: Video: vp9 (libvpx-vp9), 1 reference frame (VP90 / 0x30395056), yuv420p, 495x168, q=-1--1, 200 kb/s, 1k fps, 1k tbn, 1k tbc
Metadata:
encoder : Lavc58.55.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[New Thread 0x7fffbfb5d700 (LWP 26728)]
Automatically inserted bitstream filter 'vp9_superframe'; args=''
[Thread 0x7fffc07f8700 (LWP 26727) exited]
[Thread 0x7fffc0ff9700 (LWP 26726) exited]
[Thread 0x7fffc17fa700 (LWP 26725) exited]
[Thread 0x7fffc1ffb700 (LWP 26724) exited]
[Thread 0x7fffc27fc700 (LWP 26723) exited]
[Thread 0x7fffc2ffd700 (LWP 26722) exited]
[Thread 0x7fffc37fe700 (LWP 26721) exited]
[Thread 0x7fffc3fff700 (LWP 26720) exited]
[New Thread 0x7fffc07f8700 (LWP 26729)]
[New Thread 0x7fffc0ff9700 (LWP 26730)]
[New Thread 0x7fffc17fa700 (LWP 26731)]
[New Thread 0x7fffc1ffb700 (LWP 26732)]
[New Thread 0x7fffc3fff700 (LWP 26733)]
[New Thread 0x7fffc37fe700 (LWP 26734)]
[New Thread 0x7fffc2ffd700 (LWP 26735)]
[New Thread 0x7fffc27fc700 (LWP 26736)]
[graph 0 input from stream 0:0 @ 0x7374c0] w:328 h:307 pixfmt:p010le tb:1/1000 fr:1000/1 sar:0/1 sws_param:flags=2
[auto_scaler_0 @ 0x738580] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x735e80] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scaler_0 @ 0x738580] w:328 h:307 fmt:p010le sar:0/1 -> w:328 h:307 fmt:yuv420p sar:0/1 flags:0x4
Thread 1 "ffmpeg_g" received signal SIGSEGV, Segmentation fault.
#0 __memset_avx2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:186
#1 0x00007ffff2d55bd6 in init_encode_frame_mb_context (cpi=0x7fffe83ee020) at ../vp9/encoder/vp9_encodeframe.c:4520
#2 encode_frame_internal (cpi=cpi@entry=0x7fffe83ee020) at ../vp9/encoder/vp9_encodeframe.c:5993
#3 0x00007ffff2d56659 in vp9_encode_frame (cpi=cpi@entry=0x7fffe83ee020) at ../vp9/encoder/vp9_encodeframe.c:6228
#4 0x00007ffff2d8c06e in encode_without_recode_loop (dest=0x14ab810 "", size=0x7fffffffc8e8, cpi=0x7fffe83ee020) at ../vp9/encoder/vp9_encoder.c:4047
#5 encode_frame_to_data_rate (cpi=cpi@entry=0x7fffe83ee020, size=size@entry=0x7fffffffc8e8, dest=dest@entry=0x14ab810 "", frame_flags=frame_flags@entry=0x7fffffffc8c4)
at ../vp9/encoder/vp9_encoder.c:5094
#6 0x00007ffff2d9078b in Pass0Encode (frame_flags=<optimized out>, dest=<optimized out>, size=<optimized out>, cpi=<optimized out>) at ../vp9/encoder/vp9_encoder.c:5296
#7 vp9_get_compressed_data (cpi=cpi@entry=0x7fffe83ee020, frame_flags=frame_flags@entry=0x7fffffffc8c4, size=size@entry=0x7fffffffc8e8, dest=dest@entry=0x14ab810 "",
time_stamp=time_stamp@entry=0x7fffffffc8d8, time_end=time_end@entry=0x7fffffffc8e0, flush=0) at ../vp9/encoder/vp9_encoder.c:7459
#8 0x00007ffff2d13505 in encoder_encode (ctx=0x76bfb0, img=0x6a1440, pts_val=<optimized out>, duration=1, enc_flags=<optimized out>, deadline=<optimized out>) at ../vp9/vp9_cx_iface.c:1227
#9 0x00007ffff2c05d27 in vpx_codec_encode (ctx=0x6a1408, img=0x6a1440, pts=4, duration=1, flags=0, deadline=<optimized out>) at ../vpx/src/vpx_encoder.c:215
What version are you using? On what operating system?
- mainline version of libvpx, commit id:e46820c693d0dc01685841cfc704c16dbac48e80
- ubuntu
Can you reproduce using the vpxdec or vpxenc tools? What command line are
you using?
It's a transcode pipeline, is it possible to make use of either of these two tools to realize?
--
You received this message because:
1. The project was configured to send all issue notifications to this address
You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings