[FFmpeg-devel] [PATCH 1/7] proresdec2: port and fix for cached reader

Michael Niedermayer michael at niedermayer.cc
Sat Sep 9 00:00:29 EEST 2023


On Fri, Sep 08, 2023 at 10:15:02AM +0200, Christophe Gisquet wrote:
> Summary of changes
> - move back to regular, non-macro, get_bits API
> - reduce the lookup to switch the coding method
> - shorter reads wherever possible, in particular for the end of bitstream
>   (16 bits instead of 32, as per the above)
> 
> There are cases that really need longer lengths (larger EG codes) of up
> to 27 bits.
> 
> Win64: 6.10 -> 4.87 (~20% speedup)
> 
> Reference for an hypothetical 32bits version of the cached reader:
> Win32: 11.4 -> 9.8  (14%, because iDCT is not SIMDed)
> ---
>  libavcodec/proresdec2.c | 53 ++++++++++++++++++-----------------------
>  1 file changed, 23 insertions(+), 30 deletions(-)

causes assertion failure:

Assertion n <= 32 failed at libavcodec/bitstream_template.h:338/0

Thread 36 "read_thread" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff56ffd700 (LWP 12751)]
__GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007fffefd097f1 in __GI_abort () at abort.c:79
#2  0x0000555556035277 in bits_peek_be (bc=0x7fff56ffb270, n=4294967295) at libavcodec/bitstream_template.h:338
#3  0x0000555556036b35 in decode_ac_coeffs (avctx=0x7fff28002680, gb=0x7fff56ffb270, out=0x7fff56ffb2a0, blocks_per_slice=32) at libavcodec/proresdec2.c:590
#4  0x000055555603715c in decode_slice_chroma (avctx=0x7fff28002680, slice=0x7fff28055c20, dst=0x7fff9450b940, dst_stride=7680, buf=0x7fff2803d072 "#\a`\002g\240", <incomplete sequence \323>, buf_size=43, qmat=0x7fff56ffc450, log2_blocks_per_mb=2) at libavcodec/proresdec2.c:674
#5  0x0000555556037ae2 in decode_slice_thread (avctx=0x7fff28002680, arg=0x0, jobnr=145, threadnr=0) at libavcodec/proresdec2.c:807
#6  0x0000555555c815a0 in avcodec_default_execute2 (c=0x7fff28002680, func=0x555556037465 <decode_slice_thread>, arg=0x0, ret=0x0, count=510) at libavcodec/avcodec.c:74
#7  0x0000555556037d1e in decode_picture (avctx=0x7fff28002680) at libavcodec/proresdec2.c:846
#8  0x0000555556037fda in decode_frame (avctx=0x7fff28002680, frame=0x7fff28007440, got_frame=0x7fff56ffc5f0, avpkt=0x7fff28007dc0) at libavcodec/proresdec2.c:912
#9  0x0000555555d732ec in decode_simple_internal (avctx=0x7fff28002680, frame=0x7fff28007440, discarded_samples=0x7fff56ffc650) at libavcodec/decode.c:433
#10 0x0000555555d73843 in decode_simple_receive_frame (avctx=0x7fff28002680, frame=0x7fff28007440) at libavcodec/decode.c:607
#11 0x0000555555d739b3 in decode_receive_frame_internal (avctx=0x7fff28002680, frame=0x7fff28007440) at libavcodec/decode.c:635
#12 0x0000555555d73d78 in avcodec_send_packet (avctx=0x7fff28002680, avpkt=0x7fff28007208) at libavcodec/decode.c:732
#13 0x0000555555a6ef78 in try_decode_frame (s=0x7fff28000c80, st=0x7fff28002240, pkt=0x7fff28007208, options=0x7fff280071c0) at libavformat/demux.c:2075
#14 0x0000555555a71d92 in avformat_find_stream_info (ic=0x7fff28000c80, options=0x7fff280071c0) at libavformat/demux.c:2771
#15 0x0000555555699823 in read_thread (arg=0x7fffd45ca040) at fftools/ffplay.c:2806
#16 0x00007ffff5deed6c in ?? () from /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0
#17 0x00007ffff5e640f9 in ?? () from /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0
#18 0x00007ffff00c16db in start_thread (arg=0x7fff56ffd700) at pthread_create.c:463
#19 0x00007fffefdea61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The day soldiers stop bringing you their problems is the day you have stopped 
leading them. They have either lost confidence that you can help or concluded 
you do not care. Either case is a failure of leadership. - Colin Powell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230908/f9d93e1c/attachment.sig>


More information about the ffmpeg-devel mailing list