[FFmpeg-cvslog] New commits on branch master
Git System
git at videolan.org
Tue Dec 8 19:42:06 EET 2020
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa4532a1f767c092656836de62797d71ff42cde0
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 23 05:12:02 2020 +0100
avcodec/wmadec: Apply VLC offset during init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e5b416daddd0435571c3483621c6953c56e7cf9a
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 23 05:09:57 2020 +0100
avcodec/wmadec: Reduce the size of tables used to initialize VLC
By switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() one
can replace a table of codes of type uint16_t by a table of symbols of
type uint8_t, saving space.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=14be39e44a7dd5f378e93a9fea0e1ca1e6eba9d6
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 23 04:57:03 2020 +0100
avcodec/ivi: Make initializing VLCs thread-safe
This automatically makes indeo4/5 init-threadsafe.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee4c129c11a195fa604e4d940e92c36b7425dafa
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 23 04:33:33 2020 +0100
avcodec/dsddec: Inline constant
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4f5bd6177da43263a47239d96ec1776ccf46368e
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 23 04:20:07 2020 +0100
avcodec/dsd: Make initializing DSD tables thread-safe
This automatically makes the DSD formats as well as DST and WavPack
init-threadsafe.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd5d66af744462a97237fa0474e77924c71729ec
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 23 04:09:56 2020 +0100
avcodec/wavpack: Fix leak on init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=480761c82fcbf7e3571618b2226d2441a2ea45b8
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 23 03:21:34 2020 +0100
avcodec/h261enc: Remove unused function parameter
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0f28626c0ce64f3c7e9e59df0c139e9cffbdbfa
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 23 03:49:35 2020 +0100
avcodec/asvdec: Reindentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=103e8edd5eda20e343102bba65fb04aad73a232c
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 23 03:49:05 2020 +0100
avcodec/asvdec: Make decoders init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e11a7866dc8d1849c4b485f446205d522dbd938
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 23 02:45:27 2020 +0100
avcodec/sinewin: Fix wrong number of elements of array declaration
There are actually only 14 elements in each ff_sine_windows array.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7184b811690a816861976af2acac18df05512001
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 23:42:40 2020 +0100
avcodec/aactab: Make AAC encoder and decoders actually init-threadsafe
Commit 1a29804558c13ef512d9ef73a9b0d782af4fa5f2 guarded several
initializations of static data in the AAC decoders with an AVOnce and
set the FF_CODEC_CAP_INIT_THREADSAFE flag, believing the former to be
sufficient for the latter. It wasn't, because several of these static
tables are shared with other components, so that there might be data
races if they are initialized from multiple threads. This affected
initializing the ff_sine_* tables as well as initializing the
ff_aac_pow*sf_tab tables (shared between both decoders and encoder) as
well as ff_aac_kbd_* tables (shared between encoder and floating point
decoder).
Commit 3d62e7a30fa552be52d12b31e3e0f79153aff891 set the
FF_CODEC_CAP_INIT_THREADSAFE flag for the AAC encoder. More explicitly,
this commit used the same AVOnce to guard initializing ff_aac_pow*sf_tab
in the encoder and to guard initializing the static data of each
decoder; the ensuing catastrophe was "fixed" in commit
ec0719264cb9a9d5cbaf225da48929aea24997a3 by using a single AVOnce
for each codec again. But the codec cap has not been removed and
therefore the encoder claimed to be init-threadsafe, but wasn't, because
of the same tables as above.
The ff_sine_* tables as well as ff_aac_pow*sf_tab tables have already
been fixed; this commit deals with the ff_aac_kbd_* tables, making the
encoder as well as the floating-point decoder init-threadsafe (the
fixed-point decoder is it already).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86b8c25455d8dfa752e1f2000c775e547b9fa433
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 23:33:03 2020 +0100
avcodec/aac: Share common init code of float decoder and encoder
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fc5d22abe40e0ab5b603b69752288565c92de670
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 20:09:02 2020 +0100
avcodec/aacdec, aactab: Move kbd tables to their only user
The floating point kbd tables for 120 and 960 samples are only used by
the floating point decoder whereas the fixed point kbd tables for 128
and 1024 samples are only used by the fixed point AAC decoder. So move
these tables to their only users. This ensures that they are not
accidentally used somewhere else without ensuring that initializing
these tables stays thread-safe (as it is now because the only place from
where they are initialized is guarded by an AVOnce).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c9404b8d27b8f2c187709d5c4fa51e75c918a0b
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 20:00:30 2020 +0100
avcodec/aactab: Remove declaration of inexistent array
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=665a3dbd369ae928f793f70e7b32a58c0cdfbd2b
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 18:12:58 2020 +0100
avcodec/nellymoserenc: Make encoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a56bfa71f751a2b25da8d060a019c1c75ca9d7b
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 18:04:02 2020 +0100
avcodec/nellymoserenc: Cleanup generically on init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35f61eb3507ebb746cba1cc14ca8a280b9f258ed
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 17:57:38 2020 +0100
avcodec/nellymoserdec: Make decoder init-threadsafe
Easy now that initializing the ff_sine_* tables is thread-safe.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=285db1d53b2df27a8cc4221222a1bb0bd6024a7d
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 17:51:00 2020 +0100
avcodec/atrac3plus: Make decoders init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7fd865834748b4d7edf47133c9d9887349cb6161
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 17:32:26 2020 +0100
avcodec/atrac1: Mark decoder as init-threadsafe
Possible because ff_init_ff_sine_windows() is now threadsafe.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3719122065863f701026632f610175980d42b05a
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 17:29:21 2020 +0100
avcodec/sinewin_tablegen: Make initializing ff_sine_windows thread-safe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cdea393093ebe10ac2222739d480aeb2f6a0bcc8
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 14:27:45 2020 +0100
avcodec/aacdec, sinewin: Move 120 and 960 point sine tables to aacdec
The floating point AAC decoder is the only user of these tables, so it
makes sense to move them there. Furthermore, initializing the ordinary
power-of-two sinetables is currently not thread-safe and if the 120- and
960-point sinetables were not moved, one would have to choose whether
to guard initializing these two tables with their own AVOnces or not.
Doing so would add unnecessary AVOnces as the AAC decoder already guards
initializing its static data by an AVOnce; not doing so would be fragile
if a second user of these tables were to be added.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7688f94e90ee254382ee9c8cde81eed6408cf0f2
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 14:02:06 2020 +0100
avcodec/sinewin_tablegen: Use better check in assert
There are no ff_sine_windows for 2^i, 0 <= i < 5, so one should check
for the index being >= 5.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=11fd96c1dc57669479f7e825e76ef1a334fb8fb3
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 13:38:44 2020 +0100
avcodec/atrac3: Make decoders init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=94a55f28aa2cd0c5afb5ee621cfcca746781079c
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 22 13:30:07 2020 +0100
avcodec/atrac: Make generating tables thread-safe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5d1c697bd0844a676eeb7761b130b6dd951edee
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Nov 18 13:13:45 2020 +0100
avcodec/mpegaudio_tablegen: Make exponential LUT shared
Both the fixed as well as the floating point mpegaudio decoders use
LUTs of type int8_t and uint32_t with 32K entries each; these tables
are completely the same, yet they are not shared. This commit makes
them shared. When both fixed as well as floating point decoders are
enabled, this saves 160KiB from the bss segment for a normal build
(translating into 160KiB less memory usage if both a shared as well as
a floating point decoder have actually been used) and 160KiB from the
binary for a build with hardcoded tables.
It also means that the code to create said LUTs is no longer duplicated
(for a normal build).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed33bbe678730ef1ffde77f20eb4c6afb7a6902c
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Nov 18 02:19:53 2020 +0100
avcodec/mpegaudiodec: Hardcode tables to save space
The csa_tables (which always consist of 32 entries of four byte each,
but the type depends upon whether the decoder is fixed or
floating-point) are currently initialized once during decoder
initialization; yet it turns out that this is actually no benefit: The
code used to initialize these tables takes up 153 (fixed point) and 122
(floating point) bytes when compiled with GCC 9.3 with -O3 on x64, so it
is better to just hardcode these tables.
Essentially the same applies to the is_tables: They have a size of 128B
each and the code to initialize them occupies 149 (fixed point) resp.
140 (floating point) bytes. So hardcode them, too.
To make the origin of the tables clear, references to the code used to
create them have been added.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=12e941df89aa0e2aa8c6b90bfef9d4127ae7063c
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 23:42:58 2020 +0100
avcodec/mpegaudio_tablegen: Don't inappropriately use static array
Each invocation of this function is only entered once, so using a static
array makes no sense (and given that the whole array is reinitialized at
the beginning of this function, it wouldn't even make sense if the
function were called multiple times).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=22140374c8980420a3b5c65fcc11d90a04d35946
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 23:20:03 2020 +0100
avcodec/mpegaudio_tablegen: Avoid write-only buffers
The mpegaudio_tablegen header contains code to initialize several
tables; it is included in both the fixed as well as the floating point
mpegaudio decoders and some of these tables are only used by the fixed
resp. floating point decoders; yet both types are always initialized,
leaving the compiler to figure out that one of them is unused.
GCC 9.3 fails at this (even with -O3):
$ readelf -s mpegaudiodec_fixed.o|grep _float
28: 0000000000001660 32768 OBJECT LOCAL DEFAULT 4 expval_table_float
An actually unused table (expval_table_fixed/float) of size 32KiB is kept
and initialized (the reason for this is probably that this table is read
from, namely to initialize another table: exp_table_fixed/float; of course
the float resp. fixed tables are not used in the fixed resp. floating point
decoder).
Therefore #ifdef the unneeded tables away.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=73bc26acb87e0e0ff74bc26bc9d7c54eceeb0145
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 22:25:35 2020 +0100
avcodec/mpegaudiodec: Share fixed and floating point data and init code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9d475393e837d757195039b39302026cba1128c
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 21:37:21 2020 +0100
avcodec/mpegaudiodec_template: Apply shift during init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c778f2266dcea9c462006a63a43598ec655060d6
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 18:44:18 2020 +0100
avcodec/mpegaudiodec: Make decoders init-threadsafe
Simple now that ff_mpadsp_init() and ff_mpa_synth_init_* are thread-safe.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b29a3f3e0f6128f3effa854a3a7bfed62feeeb1c
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 17:34:04 2020 +0100
avcodec/mpegaudiodec: Combine tables used to initialize VLCs
Up until now, there were several indiviual tables which were accessed
via pointers to them; by combining the tables, one can avoid said
pointers, saving space.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db234dbf73fe97611a75163bbb3b7c22ff953696
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 15:53:43 2020 +0100
avcodec/mpegaudiodec: Reduce the size of tables used to initialize VLCs
By switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() one
can replace tables of codes of type uint16_t by tables of symbols of
type uint8_t; this saves about 1.3KB for both the fixed and floating
point decoders (if enabled).
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=12ace68ab0f07b8049dd9807dd9ea302187bd44b
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 15:16:01 2020 +0100
avcodec/mpegaudiotab: Avoid unused entry in table
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=117575ae2622d3a42af43f76a1940239c8088292
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 15:03:02 2020 +0100
avcodec/mpegaudiodec_template: Avoid VLC size tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c6a67e6c40e7b6ab089ecd53886786c86f8ec5e
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 16 14:58:06 2020 +0100
avcodec/mv30: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90c4958640cb0a4eb495a16e01926d379c1ceaed
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 16 14:56:13 2020 +0100
avcodec/mv30: Reduce the size of tables used to initialize VLCs
By switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() one
can remove the array of codes of type uint16_t here; given that the
symbols are the default ones (0,1,2,...), no explicit symbols table
needs to be added.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ecd6879b33d6af11c28ff2387c43d2e151e8831
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 16 14:46:18 2020 +0100
avcodec/imm4: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dc4c9744ebb4e637372b8dd49d536c5b688dd413
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 16 14:43:01 2020 +0100
avcodec/imm4: Reduce the size of tables used to initialize VLCs
By switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() one
can remove arrays of codes in cases where there were already symbols
tables.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c14656c17012cf3b47b0c9b40769ddc72dafdb16
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 16 13:40:08 2020 +0100
avcodec/imm4: Make better use of symbols table
Also inline the VLC's number of bits while at it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d9e6e9360d6b79f4517ec79bcc2d8511cd064e6c
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Nov 19 15:57:23 2020 +0100
avcodec/aacdec_template: Use VLC symbols table
Expressions like array[get_vlc2()] can be optimized by using a symbols
table if the array is always the same for a given VLC. This requirement
is fulfilled for several VLCs used by the AAC decoders.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=097277f31aa2f589b5658715683fb0706b1695ad
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Nov 19 15:11:07 2020 +0100
avcodec/aacdec_template: Avoid code duplication when initializing VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b7c4c554f06670fda0565690667d3bc1c058d5d
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 8 11:56:23 2020 +0100
avcodec/qdmc: Avoid code duplication when initializing VLC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b21d9339fe68b2765c73ce7933a476f9a9d3c2da
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 8 11:05:15 2020 +0100
avcodec/qdmc: Apply offset when creating VLC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb0ae037d024e96093ccbf8cb366dd1fbbdf9644
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 8 10:48:24 2020 +0100
avcodec/qdmc: Make tables used to initialize VLCs smaller
This is possible by switching to ff_init_vlc_from_lengths() which allows
to replace tables of codes of size uint16_t or uint32_t by tables of
symbols of size uint8_t; in case there already were symbols tables the
savings are even bigger.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=240a25f94fb71a38d0ab9034681e4276f08e1750
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 9 05:11:31 2020 +0100
avcodec/magicyuv: Optimize creating Huffman tables
MagicYUV transmits its Huffman trees by providing the length of the code
corresponding to each symbol; then the decoder has to assemble the table
in such a way that (i) longer codes are to the left of the tree and (ii)
for codes of the same length the symbols are ascending from left to right.
Up until now the decoder did this as follows: It counted the number of
codes of each length and derived the first code of a given length via
(ii). Then the array of lengths is traversed a second time to create
the codes; there is one running counter for each length to do so. This
process creates a default symbol table (that is omitted).
This commit changes this as follows: Everything is indexed by the
position in the tree (with codes to the left first); given (i), we can
calculate the ranges occupied by the codes of each length; and with (ii)
we can derive the actual symbols of each code; the running counters for
each length are now used for the symbols and not for the codes.
Doing so allows us to switch to ff_init_vlc_from_lengths(); this has the
advantage that the codes table needs only be traversed once and that the
codes need not be sorted any more (right now, the codes that are so long
that they will be put into subtables need to be sorted so that codes
that end up in the same subtable are contiguous).
For a sample produced by our encoder (natural content, 4000 frames,
YUV420p, ten iterations, GCC 9.3) this decreased the amount of
decicycles for each call to build_huffman() from 1336049 to 1309401.
Notice that our encoder restricts the code lengths to 12 and our decoder
only uses subtables when the code is longer than 12 bits, so the sorting
that can be avoided does not happen at the moment. If one reduces the
decoder's tables to nine bits, the performance improvement becomes more
apparent: The amount of decicycles for build_huffman() decreased from
1165210 to 654055.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c638d1d126fa1462bdcd30883061be9dd6f29dcd
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 8 05:15:56 2020 +0100
avcodec/utvideodec: Avoid implicit qsort when creating Huffman tables
The Huffman trees used by Ut Video have two important characteristics:
(i) Longer codes are on the left of the tree and (ii) for codes of the
same length, the symbol is descending from left to right in the tree.
Therefore all the information that needs to be transmitted is how long
the code corresponding to a given symbol is; and this is also all that
is transmitted.
Before 341914495e5c2f60bc920b0c6f660e5948a47f5a, the decoder used qsort
to sort the (length, symbol) pairs by ascending length and for equal
lengths by ascending symbol. Since said commit, the decoder uses
a first pass over the lengths table to count how many symbols of each
length there are; with (i) one can then easily calculate the code of
the left-most code with a given length in the tree and from there one
can calculate the codes for all entries, using one running counter for
each possible length. This eliminated the explicit qsort in
build_huff().
Yet ff_init_vlc_sparse() sorts the table itself as it has to ensure that
all the entries that will be placed in the same subtable are contiguous.
The tables created now are non-contiguous (they are ordered by symbol
and codes of different length aren't ordered at all; only codes of the
same length are ordered according to (ii)).
This commit therefore modifies the algorithm used to automatically create
tables whose codes are sorted from left to right in the tree. The key to
do so is the observation that the counts obtained in the first pass can
be used to contain the range of the codes of each length in the second
pass: If counts[i] is the count of codes with length i, then the first
counts[32] codes are of length 32, the next counts[31] codes are of
length 31 etc. So one knows the index of the lowest symbol whose code
has length 32 (if any): It is counts[32] - 1 due to (ii), whereas the
index of the lowest symbol whose code has length 31 (if any) is
counts[32] + counts[31] - 1; the index of the second-to-lowest symbol of
length 32 (if existing) is counts[32] - 2 etc.
If one follows the algorithm outlined above, one can switch to
ff_init_vlc_from_lengths() which has no implicit qsort; it also means
that one can offload the computation of the codes.
This turned out to be beneficial for performance: For the sample from
ticket #4044 it decreased the decicycles spent on one call to
build_huff() from 508480 to 340688 (GCC 9.3, looping 10 times over the
file to get enough runs and then repeating this ten times); for another
sample (YUV420p, natural content, 5500 frames, also ten iterations)
the time went down from 382346 to 275533 decicycles.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d503c91f306585c3cd2188c239cfe247dd9a33e
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sat Nov 7 09:46:17 2020 +0100
avcodec/atrac3: Use symbols table
Expressions like array[get_vlc2()] can be optimized by using a symbols
table if the array is always the same for a given VLC. This requirement
is fulfilled for several VLCs used by ATRAC3, therefore this commit
implements this. This comes without any additional costs when using
ff_init_vlc_from_lengths() as one can then remove the codes tables.
While at it, remove the arrays of pointers to the individual arrays and
put all lengths+symbol pairs in one big array.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=abf1a4f05cc8c051c51bc8bd8e3bb059075a0bf6
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Fri Nov 6 13:50:56 2020 +0100
avcodec/intrax8: Reduce the size of tables used to initialize VLCs
By switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() one
can replace an array of codes of type uint16_t with an array of symbols
of type uint8_t, saving space.
Also remove some more code duplication while at it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1a1f1171217d1461a0a158f2bdee8a1d8d541a4
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Fri Nov 6 13:43:03 2020 +0100
avcodec/intrax8: Avoid code duplication when initializing VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ba69ee8801dbb8641ea575c33d3b083e251e757b
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Fri Nov 6 13:30:20 2020 +0100
avcodec/intrax8: Remove VLC offsets table
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=420476ec7819ae15efb6d294767c454601715d74
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Fri Nov 6 11:03:34 2020 +0100
avcodec/vp3: Remove code duplication when initializing Theora VLCs
theora_init_huffman_tables() does essentially the same as
ff_init_vlcs_from_lengths().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=802fc678b262ea5d3523169184a9ec9503bf7807
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Fri Nov 6 10:48:55 2020 +0100
avcodec/vp3: Use symbols table for VP3 motion vectors
Expressions like array[get_vlc2()] can be optimized by using a symbols
table if the array is always the same for a given VLC. This requirement
is fulfilled for the VLC used for VP3 motion vectors. The reason it
hasn't been done before is probably that the array in this case
contained entries in the range -31..31; but this is no problem with
ff_init_vlc_from_lengths(): Just apply an offset of 31 to the symbols
before storing them in the table used to initialize VP3 motion vectors
and apply an offset of -31 when initializing the actual VLC.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4cb4345f7895d1a169941df087152bf18f78a2f6
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Fri Nov 6 10:35:12 2020 +0100
avcodec/vp3: Make tables used to initialize VLCs smaller
This is possible by switching to ff_init_vlc_from_lengths() because it
allows to replace codes of type uint16_t by symbols of type uint8_t; in
some cases (like here) it also allows to replace explicitly coded
codes by implicitly coded symbols.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=22241d12c7bc7f317832d8101ebed8d2db78a41f
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Fri Nov 6 10:14:22 2020 +0100
avcodec/vp3: Apply VLC offset during init
By switching to ff_init_vlc_from_lengths() one can apply both positive
as well as negative offsets for free; in this case it even saves space
because one replaces codes tables that don't fit into an uint8_t by
symbols tables that fit into an uint8_t or can even be completely
avoided as they are trivial.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=984fdfd042aeec7d48cd906661b2192568874730
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Nov 5 03:25:47 2020 +0100
avcodec/atrac9dec: Make VLCs static
Also remove code duplication and use a named constant for the number of
VLC bits while just at it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=76a4356a75fd1bb79101ac00bfb73303c369dfc8
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Nov 5 02:29:26 2020 +0100
avcodec/atrac9dec: Don't create VLCs that are never used
The ATRAC9 decoder creates VLCs with parameters contained in
HuffmanCodebooks; some of these HuffmanCodebooks are empty and yet
VLCs (that were completely unused*) were created from them. Said VLC
contained a single table with 512 VLC_TYPE[2] entries, each of which
indicated that this is an invalid code. This commit stops creating said
VLCs.
*: read_coeffs_coarse() uses the HuffmanCodebook
at9_huffman_coeffs[cb][prec][cbi]. prec is c->precision_coarse[i] + 1
and every precision_coarse entry is in the 1..15 range after
calc_precision(), so prec is >= 2 (all codebooks with prec < 2 are
empty). The remaining empty codebooks are those with cb == 1 and cbi ==
0, yet this is impossible, too: cb is given by c->codebookset[i] and
this is always 0 if i < 8 (because those are never set to anything else
in calc_codebook_idx()) and cbi is given by at9_q_unit_to_codebookidx[i]
which is never zero if i >= 8.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b52e0d9504d1b45bc64489262facc8e48adb9bc2
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Nov 4 20:41:35 2020 +0100
avcodec/atrac9tab: Unify tables used to initialize VLCs
Using separate tables has the downside that one needs a big number of
pointers to the separate tables (currently 77); unifying them avoids
this.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ac9d78dd2977e9e9021749e215d7208c2a56f39
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Nov 4 08:25:47 2020 +0100
avcodec/atrac9dec: Make tables used to initialize VLCs smaller
The ATRAC9 decoder uses VLCs which are currently initialized with
static length tables of type uint8_t and code tables of type uint16_t.
Furthermore, in one case the actually desired symbols are in the range
-16..15 and in order to achieve this an ad-hoc symbols table of type
int16_t is calculated.
This commit modifies this process by replacing the codes tables by
symbols tables and switching to ff_init_vlc_from_lengths(); the signed
symbols are stored in the table after having been shifted by 16 to fit
into an uint8_t and are shifted back when the VLC is created. This makes
all symbols fit into an uint8_t, saving space. Furthermore, the earlier
tables had holes in them (entries with length zero that were inserted
because the actually used symbols were not contiguous); these holes are
unnecessary in the new approach, leading to further saving.
Finally, given that now both lengths as well as symbols are of the same
type, they can be combined; this saves a pointer for each VLC.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f697622f687c22392194d6939914c9a6a01ce69e
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 11:13:56 2020 +0100
avcodec/rv34: Make initializing static VLC tables thread-safe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=88c75592bdf42c9caf90722739c13dd3db36a381
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Nov 4 03:27:18 2020 +0100
avcodec/rv34: Avoid offsets table for initialization of static VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=def1b6be6b25c0e8aac650016be37872c931320d
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Nov 16 15:09:01 2020 +0100
avcodec/vc1: Make ff_vc1_init_common() thread-safe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=58fc810d42fde26ed6c1f2996122e98ab7005849
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 23:19:18 2020 +0100
avcodec/atrac3plus: Run-length encode length tables to make them smaller
This is very beneficial for the scale factor tables where 4*64+4*15
bytes of length information can be replaced by eight codebooks of 12
bytes each; furthermore the number of codes as well as the maximum
length of a code can be easily derived from said codebooks, making
tables containing said information superfluous. This and combining the
symbols into one big array also made an array of pointers to the tables
redundant.
For the wordlen and code table tables the benefits are not that big
(given these tables don't contain that many elements), but all in all
using codebooks is also advantageouos for them. Therefore it has been
done.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7dbeb77c3c30ac4904928978938b209ff6e1ab1
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 20:44:12 2020 +0100
avcodec/atrac3plus: Combine codebooks into one array
ATRAC3+ uses VLCs whose code lengths are ascending from left to right in
the tree; ergo it is possible (and done) to run-length encode the
lengths into so-called codebooks. These codebooks were variable-sized:
The first byte contained the minimum length of a code, the second the
maximum length; this was followed by max - min + 1 bytes containing the
actual numbers. The minimal min was 1, the maximal max 12.
While one saves a few bytes by only containing the range that is
actually used, this is more than offset by the fact that there needs
to be a pointer to each of these codebooks.
Furthermore, since 5f8de7b74147e2a347481d7bc900ebecba6f340f the content
of the Atrac3pSpecCodeTab structure (containing data for spectrum
decoding) can be cleanly separated into fields that are only used during
initialization and fields used during actual decoding: The pointers to
the codebooks and the field indicating whether an earlier codebook should
be reused constitute the former category. Therefore the new codebooks are
not placed into the Atrac3pSpecCodeTab (which is now unused during
init), but in an array of its own. The information whether an earlier
codebook should be reused is encoded in the first number of each
spectrum codebook: If it is negative, an earlier codebook (given by the
number) should be reused.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1cf374c973796bb0f8e7f6d5a41d94e8b00cc9f5
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 18:52:17 2020 +0100
avcodec/atrac3plus: Combine symbols tables
This allows to remove lots of pointers (130) to small symbol tables;
it has the downside that some of the default tables must now be coded
explicitly, but this costs only 6 + 4 + 8 + 16 + 8 bytes and is therefore
dwarfed by the gains.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd964dad1eaab7e86620f0c7a39e670bcc9318ec
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 17:59:12 2020 +0100
avcodec/atrac3plus: Simplify getting offset of VLC in VLC_TYPE buf
The earlier code used several different offset parameters that were
initialized to magic values. This is unnecessary.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e27466d7e59f0a485f3720f33cd9c54d69fff138
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 17:01:53 2020 +0100
avcodec/atrac3plus: Make tables used to initialize VLCs smaller
The ATRAC3+ decoder currently uses ff_init_vlc_sparse() to initialize
several VLCs; sometimes a symbols table is used, sometimes not; some of
the codes tables are uint16_t, some are uint8_t. Because of these two
latter facts it makes sense to switch to ff_init_vlc_from_lengths()
because it allows to remove the codes at the cost of adding symbols
tables of type uint8_t in the cases where there were none before.
Notice that sometimes the same codes and lengths tables were reused with
two different symbols tables; this could have been preserved (meaning
one could use a lengths table twice), but hasn't, because this allows
to use only one pointer to both the symbols and lengths instead of two
pointers.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfc473ef10ec9a924d1cd6d1c462697b31fb444d
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 16:21:32 2020 +0100
avcodec/atrac3plus: Simplify creating VLCs
Use ff_init_vlc_from_lengths() to offload the computation of the codes.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7a7295a8ce87e8b8d9f3dade5f7e05342ffba881
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 14:23:33 2020 +0100
avcodec/truemotion2: Simplify creating VLC table
ff_init_vlc_from_lengths() can be used to offload the computation
of the codes; it also allows to omit the check whether the codes
are already properly ordered (they are). In this case, this also allows
to avoid the allocation of the buffer for the codes.
This improves performance: The amount of decicycles for one call to
tm2_build_huff_tables() when decoding tm20.avi from the FATE-suite
decreased from 46239 to 40035. This test consisted of looping 50 times
over the file and iterating the test ten times.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1ba4d479e4c785a8a4f85fb576ee166100a8cda
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Nov 4 01:37:39 2020 +0100
avcodec/mpeg4videodec: Make studio VLCs static
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3aa81a634a3d559288afcadce5ca3b1c57e57098
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 05:36:35 2020 +0100
avcodec/mpeg4video: Make tables used to initialize VLCs smaller
Switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths()
allows to replace codes which are so long that they need to be stored
in an uint16_t by symbols which fit into an uint8_t; and even these can
be avoided in case of the sprite trajectory VLC.
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d71ac319f74a85add9c62c31461b4dd4dcfcabd
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 15 22:48:35 2020 +0100
avcodec/indeo2: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f25dde0e278b0f70cfbcdb281a80de1b1e75f611
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 04:16:25 2020 +0100
avcodec/indeo2: Make tables used to initialize VLCs smaller
Switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths()
allows to replace codes which are so long that they need to be stored
in an uint16_t by symbols which fit into an uint8_t; furthermore, it is
also easily possible to already incorporate the offset (the real range
of Indeo 2 symbols starts at one, not zero) into the symbols.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd7c3ac84d9e1ec8cfaa1af6b6b3447f40c4b860
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 03:01:05 2020 +0100
avcodec/mjpegdec: Simplify creating VLC table
ff_init_vlc_from_lengths() can be used to offload the computation
of the codes; it also allows to omit the check whether the codes
are already properly ordered (they are).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d4a4a6747d53a5707f1a13861dc2cc4e7e19e332
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 01:21:06 2020 +0100
avcodec/sheervideo: Simplify creating VLC table
ff_init_vlc_from_lengths() can be used to offload the computation
of the codes; it also needn't check whether the codes are already
properly ordered (they are).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f31bf4a1f93920fe67447a11632817efa978d92d
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Nov 4 00:04:08 2020 +0100
avcodec/mss4: Make VLCs static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=313e572440b76d84900372ad84ff955b89461aba
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 01:08:15 2020 +0100
avcodec/mss4: Don't duplicate standard JPEG tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=70bbb4cce80ec2255b023b8f9e964dcf5d2ea9f6
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 1 00:26:32 2020 +0100
avcodec/mss4: Simplify creating VLC tables
The lengths of the codes used by the mss4 decoder are ascending from
left to right and therefore the lengths can be run-length encoded and
the codes can be easily derived from them. And this is how it is indeed
done. Yet some things can nevertheless be improved:
a) The number of entries of the current VLC is implicitly contained in
the run-length table and needn't be externally prescribed.
b) The maximum length of a code is just the length of the last code
(given that the lengths are ascending), so there is no point in setting
max_bits in the loop itself.
c) One can offload the actual calculation of the codes to
ff_init_vlc_from_lengths().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e7f15f777dfef0904da3e066de198fd3632eba53
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Nov 5 01:59:08 2020 +0100
avcodec/rv40: Avoid code duplication when initializing VLCs
Besides removing code duplication the method for determining the offset
of each VLC table in the VLC_TYPE buffer also has the advantage of not
wasting space for skipped AIC mode 1 VLCs.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=477fc65d33a085d923af3101946ddfe42bba1341
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Nov 5 00:42:56 2020 +0100
avcodec/rv40: Avoid offset table when initializing static VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fcde452a47d8987208df0cdaae1dd6025d7fbf3e
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sat Oct 31 22:44:12 2020 +0100
avcodec/rv40: Make better use of VLC symbols table
RealVideo 4.0 has a VLC that encodes two intra types per code; each
intra type is in the range 0..8 (inclusive) and up until now the VLC
used symbols in the range 0..80; one type was encoded as the remainder
when dividing the symbol by 9 whereas the other type was encoded as
symbol / 9. This is suboptimal; a better way would be to use the high
and low nibble to encode each symbol. But an even better way is to use
16bit symbols so that the two intra types can be directly written as
a 16bit value.
This commit implements this; in order to avoid huge tables the symbols
are stored as uint8_t with high and low nibbles encoding one type each;
they are only unpacked to uint16_t during initialization.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=47a72391d0745f5e558c1eecf97525b03161e136
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sat Oct 31 21:35:13 2020 +0100
avcodec/rv40: Make the tables used to initialize VLCs smaller
After permuting the codes, symbols and lengths tables used to initialize
the VLC so that the codes are ordered from left to right in the Huffman
tree, the codes become redundant as they can be easily computed from the
lengths at runtime; in this case one has to use explicit symbol tables,
but all the symbols used here fit into an uint8_t, whereas some codes
needed uint16_t. This saves about 1.6KB.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5f2b30ba06310b90a178ca46dfb51db277431532
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 15 22:09:31 2020 +0100
avcodec/qdm2: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=03112cdcd110a94aff4ddee8b2fddde0f7a36690
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 3 23:16:47 2020 +0100
avcodec/qdm2: Avoid offsets table when initializing VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bcdf67c7fa49fec946cd681d1a5b46d5bde6f562
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sat Oct 31 19:26:39 2020 +0100
avcodec/qdm2: Initialize array of VLCs in a loop
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=760217f469df4bb9f73535abb39c4282cc8b4e02
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sat Oct 31 18:23:47 2020 +0100
avcodec/qdm2: Apply offsets when initializing VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=682b0e42e4a09d2d745293385a557fb5f316cb95
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sat Oct 31 17:33:28 2020 +0100
avcodec/qdm2: Make tables used to initialize VLCs smaller
After permuting the codes, symbols and lengths tables used to initialize
the VLCs so that the codes are ordered from left to right in the Huffman
tree, the codes become redundant as they can be easily computed from the
lengths at runtime (or at compile time with --enable-hardcoded-tables);
in this case one has to use explicit symbol tables, but all the symbols
used here fit into an uint8_t, whereas some codes needed uint16_t.
Furthermore, the codes had holes because the range of the symbols was not
contiguous; these have also been removed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f782dd316a3f23f6d4f77f5c2d2d1e0c0879ba00
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sat Oct 31 12:37:01 2020 +0100
avcodec/mobiclip: Reindentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee1ddd308be9dc9d2c323d176d03939c30ad4b9d
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 15 21:39:19 2020 +0100
avcodec/mobiclip: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=866c2ef183cded8de150402d3ec06449a87d961b
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sat Oct 31 12:34:13 2020 +0100
avcodec/mobiclip: Avoid code duplication when initializing VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a58be262931a803e89c5afc296bac7e308e13f49
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sat Oct 31 01:23:34 2020 +0100
avcodec/mobiclip: Avoid redundant codes table to initialize VLCs
If both codes, lengths and symbols tables are ordered so that the codes
are sorted from left to right in the tree, the codes can be easily
derived from the lengths and therefore become redundant. This is
exploited in this commit to remove the codes tables for the mobiclip
decoder; notice that tables for the run-length VLC were already ordered
correctly.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2a8da6dfb6ef7e7bcea4f71181e6c6a5a2db41d
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 15 21:31:31 2020 +0100
avcodec/mpc8: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3dee5fa19e65a2ed808aae25aef75d959846c29d
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 15 21:21:48 2020 +0100
avcodec/mpc7: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33aaf86192f5ad15e3252c1691dafdcf63885692
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 15 11:42:24 2020 +0100
avcodec/imc: Make imc/iac decoders init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=83ff99adc4bf04c4ba2e3436ce2d18a5098132d1
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Fri Oct 30 11:43:06 2020 +0100
avcodec/mpc8: Avoid code duplication when initializing VLCs
Up until now, VLCs that were part of an array of VLCs were often not
initialized in a loop, but separately. The probable reason for this
was that these VLCs differed slightly in the parameters to be used for
them (i.e. the number of codes or the number of bits to be used
differs), so that one would have to provide these parameters e.g. via
arrays.
Yet these problems have actually largely been solved by now: The length
information is contained in a run-length encoded form that is the same
for all VLCs and both the number of codes as well as the number of bits
to use for each VLC can be easily derived from them.
There is just one problem to be solved: When the underlying tables have
a different number of elements, putting them into an array of arrays
would be wasteful; using an array of pointers to the arrays would
also be wasteful. Therefore this commit combines the tables into bigger
tables. (Given that all the length tables have the same layout this
applies only to the symbols tables.)
Finally, the array containing the offset of the VLC's buffer in the big
buffer has also been removed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c8e85c66074cdd687c0c63754c15911e46abc9b
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Fri Oct 30 02:27:15 2020 +0100
avcodec/mpc8: Reduce the size of some VLCs
Several of the quantisation VLCs come in pairs and up until now the
number of bits used for each VLC was set to the same value for both VLCs
in such a pair even when one of the two required only a lower number.
This is a waste given that the get_vlc2() call is compatible with these
two VLCs using a different number of bits (it uses vlc->bits).
Given that the code lengths are descending it is easily possible to know
the length of the longest code for a given VLC: It is the length of the
first one. With this information one can easily use the least amount of
bits.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e55ade2c01472ededea03257e93e2e073d320a2e
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Fri Oct 30 02:10:36 2020 +0100
avcodec/mpc8: Reduce the size of the length tables to initialize VLCs
After permuting both length, code as well as symbol tables so that
the codes are ordered from left to right in the tree, it became apparent
that the length of the codes decreases from left to right. Therefore one
can run-length encode the lengths to save space. This commit implements
this.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9d779a3db7c223326d21e34fb415de88fb92e34
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Oct 29 23:54:07 2020 +0100
avcodec/mpc8: Apply offsets when initializing VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=906911f599ea4e24df5f3cd92e6292339261154a
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Oct 29 23:34:18 2020 +0100
avcodec/mpc8: Reduce size of tables used to initialize VLCs
By switching to ff_init_vlc_from_lengths() one can make a table of
codes of type uint8_t superfluous, saving space.
Other VLCs (those without dedicated symbols table and with codes of
type uint8_t) have been made to use ff_init_vlc_from_lengths(), too,
because it reduces codesize (ff_init_vlc_from_lengths() has two
parameters less than ff_init_vlc_sparse()) and because it allows to
use the offset parameter in future commits.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dc7b3c79c33095e54085c30abe8dea34ab6f001f
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 3 22:41:51 2020 +0100
avcodec/mpc7: Avoid offsets table when creating VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=355bce51f72eab7b3258da8870f11e61d08b8583
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Oct 29 20:21:59 2020 +0100
avcodec/mpc7: Apply offsets when creating VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=354ba64f40d3d6a185765a22497eefe71aeaba99
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Oct 29 20:13:56 2020 +0100
avcodec/mpc7: Reduce size of tables used to initialize VLCs
By switching to ff_init_vlc_from_lengths() one can replace tables of
codes of type uint16_t with tables of symbols of type uint8_t, saving
space.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=949367b0ec660d2496a62f7acc359bac651bdc02
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Oct 29 11:12:32 2020 +0100
avcodec/motionpixels: Simplify creating VLC tables
By using ff_init_vlc_from_lengths(), we do not have to keep track of the
codes themselves, but can offload this to ff_init_vlc_from_lengths().
Furthermore, the old code presumed sizeof(int) == 4; this is no longer
so.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9dc000679c55ff2c013bdea17b2235228b1ac3f
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Oct 28 14:35:19 2020 +0100
avcodec/mimic: Make VLC static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34cb6d2360bb603c34eae8f488033bd6b4fbd279
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Oct 28 14:17:40 2020 +0100
avcodec/mimic: Reduce size of tables used to initialize VLCs
By switching to ff_init_vlc_from_lengths() one can replace a table of
codes of type uint32_t with a table of symbols of type uint8_t saving
space. The old tables also had holes in it (because of the symbols) which
are now superfluous, saving ever more space.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e804eb0ef6f163e5f939113afbd0cc73e4dac16e
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Oct 28 13:15:15 2020 +0100
avcodec/rv10: Simplify handling of skip VLC entries
The VLC tables to be used for parsing RealVideo 1.0 DC coefficients are
weird: The luma table contains a block of 2^11 codes beginning with the
same prefix and length that all have the same symbol (i.e. value only
depends upon the prefix); the same goes for the chroma block (except
it's only 2^9 codes). Up until now, these entries (which generally could
be parsed like ordinary entries with subtables) have been treated
specially: They have been treated like open ends of the tree, so that
get_vlc2() returned a value < 0 upon encountering them; afterwards it
was checked whether the right prefix was used and if so, the appropriate
number of bytes was skipped.
But there is actually an easy albeit slightly hacky way to support them
directly without pointless subtables: Just modify the VLC table so that
all the entries sharing the right prefix have a length that equals the
length of the whole entry.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1320d336eff2d08f82aa98301fced00178aaea0a
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Oct 28 10:48:09 2020 +0100
avcodec/rv10: Make VLC tables smaller
These tables were huge (14 bits) because one needed 14 bits in order to
find out whether a code is valid and in the VLC table or a valid code that
required hacky workarounds due to RealVideo 1.0 using multiple codes
for the same symbol and the code predating the introduction of symbols
tables for VLCs.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=daf8b10eeb9c789cad5c2c263493249950c6f55f
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Wed Oct 28 09:12:08 2020 +0100
avcodec/rv10: Use symbol table more effectively
The RealVideo 1.0 decoder uses VLCs to parse DC coefficients. But the
values returned from get_vlc2() are not directly used; instead
-(val - 128) (which is in the range -127..128) is. This transformation
is unnecessary as it can effectively be done when initializing the VLC
by modifying the symbols table used. There is just one minor
complication: The chroma table is incomplete and in order to distinguish
an error from get_vlc2() (due to an invalid code) the ordinary return
range is modified to 0..255. This is possible because the only caller of
this function is (on success) only interested in the return value modulo
256.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df3269f5f74ff8ab976d00927a55a2940cc2255f
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Oct 27 23:26:17 2020 +0100
avcodec/rv10: Reduce number of exceptions when reading VLC value
RealVideo 1.0 uses an insane way to encode DC coefficients: There are
several symbols that (for no good reason whatsoever) have multiple
encodings, leading to longer codes than necessary.
More specifically, the tree for the 256 luma symbols contains 255 codes
belonging to 255 different symbols on the left; going further right,
the tree consists of two blocks of 128 codes each of length 14 encoding
consecutive numbers (including two encodings for the symbol missing among
the 255 codes on the left); this is followed by two blocks of codes of
length 16 each containing 256 elements with consecutive symbols (i.e.
each of the blocks allows to encode all symbols). The rest of the tree
consists of 2^11 codes that all encode the same symbol.
The tree for the 256 chroma symbols is similar, but is missing the
blocks of length 256 and there are only 2^9 consecutive codes that
encode the same symbol; furthermore, the chroma tree is incomplete:
The right-most node has no right child.
All of this caused problems when parsing these codes; the reason is that
the code for this predates commit b613bacca9c256f1483c46847f713e47a0e9a5f6
which added support for explicit symbol tables and thereby removed the
requirement that different codes have different symbols. In order to
address this, the trees used for parsing were incomplete: They contained
the 255 codes on the left and one code for the remaining symbol. Whenever
a code not in these trees was encountered, it was dealt with in
special cases (one for each of the blocks mentioned above).
This commit reduces the number of special cases: Using a symbols table
allows to treat the blocks of consecutive symbols like ordinary codes;
only the blocks encoding a single symbol are still treated specially
(in order not to waste memory on tables for them).
In order to not increment the size of the tables used to initialize the
VLCs both the symbols as well as the lengths are now run-length encoded.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e730b1558367614ef396df596425a462a56739df
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Oct 27 20:36:32 2020 +0100
avcodec/rv10: Reduce the size of the tables used to initialize VLCs
This can be achieved by switching to ff_init_vlc_from_lengths() which
allows to replace two uint16_t tables for codes with uint8_t tables for
the symbols by permuting the tables so that the codes are ordered from
left to right in the tree in which case they can be easily computed from
the lengths at runtime.
And after doing so, it became apparent that the tables for the symbols
are actually the same for luma and chroma, so that one can even omit one
of them.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7eef70a001b210146a817a732a63e1451699a99e
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Oct 27 15:32:27 2020 +0100
avcodec/cook: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ff0179b196106b97f8b53b3e4685837e57196cb
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Oct 27 15:21:27 2020 +0100
avcodec/cook: Avoid big length tables for VLC initialization
Permuting the tables used to initialize the Cook VLCs so that the code
tables are ordered from left to right in the tree revealed that the
length of the codes are ascending from left to right. Therefore one can
run-length encode them to avoid the big length tables; this saves a bit
more than 1KB.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f4cfc48dd8eabd8f78a2bcb5ed121bc936fd4cc
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Oct 27 14:27:36 2020 +0100
avcodec/cook: Apply offset when initializing VLC table
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=530d86b90d5f776844a936d5fcf1393cc0cd439c
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Oct 27 14:15:58 2020 +0100
avcodec/cook: Make tables to initialize VLCs smaller
Up until now, the Cook decoder used tables for the lengths of codes and
tables of the codes itself to initialize VLCs; the tables for the codes
were of type uint16_t because the codes were so long. It did not use
explicit symbol tables. This commit instead reorders the tables so that
the code tables are sorted from left to right in the tree. Then the
codes can be easily derived from the lengths and therefore be omitted.
This comes at the price of explicitly coding the symbols, but this is
nevertheless a net win because most of the symbols tables can be coded
on one byte. Furthermore, Cook actually does not use a contiguous range
of symbols for its main VLC tables and the old code compensated for that
by adding holes (codes of length zero) to the tables (that are skipped by
ff_init_vlc_sparse()). This is no longer necessary with the new
approach. All in all, this saves about 1.7KB.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8887232c770f0b191e559945a05e3b99ca8d8561
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Nov 15 12:19:55 2020 +0100
avcodec/wnv1: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a772b1397f1384831b58ac8eb60781fe7362442
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Mon Oct 26 00:28:46 2020 +0100
avcodec/wnv1: Apply offset during init, not later every time
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a8646a7b3fc9833c4cb3dfc236264e60ea8bcec7
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 23:11:42 2020 +0100
avcodec/wnv1: Make array for initializing VLC smaller
This is possible by switching to ff_init_vlc_from_lengths() which allows
to replace the table for the codes (which need an uint16_t) by a table
of symbols which fit into an uint8_t. Also switch to an ordinary
INIT_VLC macro while just at it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f86dcd007ffac5ab8098e6e222418179fe0ce17a
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 3 21:48:28 2020 +0100
avcodec/clearvideo: Make VLC tables static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e67e4d43bdd2fb1b38cd460a7760359ab2d3dcca
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 3 21:07:55 2020 +0100
avcodec/clearvideo: Apply VLC offset during init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=222cc6ea26287bad018f73ae97212847182e5f1b
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 22:42:29 2020 +0100
avcodec/clearvideo: Use minimal max_depth in get_vlc2()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c880889cfd0534fa4c29f117ae93e69d8a347d32
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 22:39:29 2020 +0100
avcodec/clearvideo: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ef9652bab2921126a88111cebfbd645050a5e373
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 17 08:46:53 2020 +0100
avcodec/clearvideo: Improve handling of VLC escape values
Both the motion vector as well as the bias VLCs have an escape code;
for the motion vectors, this value depended on the specific VLC table,
whereas all the bias VLCs used the same value; the escape value has not
been inlined in the latter case.
But for both kinds of VLCs there are lots of values that are unused for
all the VLCs of each kind and each of these can be used as common escape
value, thus allowing to inline the escape value. This commit implements
this.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1d3ec27bd54ceb5108ad9f9ed430266ccc4cbc71
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 22:17:28 2020 +0100
avcodec/clearvideo: Avoid huge VLC length tables
After the motion vector and bias values tables have been reordered so
that the codes are ordered from left to right, it emerged that the
length of these entries are actually ascending for every table.
Therefore it is possible to encode them in a run-length style and create
the actual length tables during runtime. This commit implements this.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e97081a62471c41522ddb2af534ed7ce9b3a6893
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 21:07:20 2020 +0100
avcodec/clearvideo: Avoid code duplication when initializing VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c82a559e6fcccf5a96a10602704329c57c84f471
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 17:54:44 2020 +0100
avcodec/clearvideo: Avoid code tables for initializing VLCs
The ClearVideo decoder uses VLC tables that are initialized at runtime
from static length, symbol and codes tables. Yet the code tables can be
omitted by subjecting all of these tables to the permutation that orders
the codes from left to right in the tree. After this is done, the codes
can be easily computed at runtime from the lengths and therefore
omitted. This saves about 10KB.
Only one minor complication is encountered when doing so: The tree
corresponding to the AC VLC codes is incomplete; but this can be
handled by adding an entry with negative length.
Furthermore, there are also VLCs that are only initialized with lengths
and codes tables with codes of type uint16_t. These have also been
switched to ff_init_vlc_from_lengths() as this means that one can
replace the uint16_t codes tables with uint8_t symbols tables.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c055d8f0263ba051eedd93b357c9d9570df686d9
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 3 20:28:54 2020 +0100
avcodec/imc: Avoid offsets table when creating VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=200e8e80aa3405d811023547b6b116f6400e37ac
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 15:35:00 2020 +0100
avcodec/imc: Make Huffman tables smaller
The IMC decoder uses Huffman tables which are created at runtime from
length tables of type uint8_t and code tables of type uint16_t together
with an implicit symbols table (i.e. symbol[i] == i). This commit
changes this: All three tables are subjected to the same permutation to
order the codes from left to right in the tree; afterwards the codes can
be omitted because they are easily computable at runtime from the
lengths, whereas the symbols need to be explicitly coded now. But said
symbols fit into an uint8_t, so one saves space.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b0094be719652948650e724cdb828ec63b95569f
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 14:21:16 2020 +0100
avcodec/on2avc: Apply offset when initializing VLC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2935d29e8e0c737dfb82c2b62ebeb1521200caa9
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 14:04:59 2020 +0100
avcodec/on2avcdata: Combine tables for codebooks
Using one big table for the codebook symbols and lengths makes it
possible to remove the pointers to the individual tables.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=71753c5235d7a3461404847aeaf3df9fae8bacf1
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 12:48:41 2020 +0100
avcodec/on2avc: Use smaller tables for VLCs
The On2 audio decoder uses huge tables to initialize VLC tables. These
tables (mostly) use symbols tables in addition to the codes tables and
the lengths tables. This commit makes the codes tables redundant and
removes them: If all tables are permuted so that the codes are ordered
from left to right in the Huffman tree, the codes become redundant and
can be easily calculated at runtime from the lengths
(via ff_init_vlc_from_lengths()); this also avoids sorting the codes in
ff_init_vlc_sparse()*.
The symbols tables are always 16bit, the codes tables are 32bit, 16bit
or (rarely) 8bit, the lengths tables are always 8bit. Even though some
symbols tables have been used twice (which is no longer possible now
because different permutations need to be performed on the code tables
sharing the same symbol table in order to order them from left to right),
this nevertheless saves about 28KB.
*: If the initializations of the VLCs are repeated 2048 times
(interleaved with calls to free the VLCs which have not been timed), the
number of decicycles spent on each round of initializations improves
from 27669656 to 7356159.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fefe2cbbf2a50039bc6f212a5d1ab92781662665
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 10:24:31 2020 +0100
avcodec/smacker: Improve creating Huffman VLC tables
The Smacker Huffman tables are already stored in a tree-like structure;
in particular, they are naturally ordered from left to right in the
tree and are therefore suitable to be initialized by
ff_init_vlc_from_lengths() which avoids traversing the data twice in
order to sort only the codes that are so long that they need into a
subtable.
This improves performance (and reduces codesize): For the sample from
ticket #2425 the number of decicycles for parsing and creating the VLCs
in smka_decode_frame() decreased from 412322 to 359152 (tested with
10 runs each looping 20 times over the file).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09062eece2e8f188330adab9ddd873341dcf9862
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 00:56:42 2020 +0200
avcodec/cllc: Improve creating VLCs
One can offload the computation of the codes to
ff_init_vlc_from_lengths(); this also improves performance: The number
of decicycles for one call to read_code_table() decreased from 198343
to 148338 with the sample sample-cllc-rgb.avi from the FATE suite; it
has been looped 100 times and the test repeated ten times to test it
sufficiently often.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4df5144102fb45f74ea46cc9c2a5750a7882dfdd
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 3 20:11:18 2020 +0100
avcodec/tscc2: Make VLC tables static
Also use a named constant for the number of bits of the VLC tables.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b629deab3d42e6db5216d6c6ee054d2d70a4071e
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Tue Nov 3 19:20:15 2020 +0100
avcodec/bitstream: Allow static VLC tables to be bigger than needed
Right now the allocated size of the VLC table of a static VLC has to
exactly match the size actually used for the VLC: If it is not enough,
abort is called; if it is more than enough, an error message is
emitted. This is no problem when one wants to initialize an individual
VLC via one of the INIT_VLC macros as one just hardcodes the needed
size. Yet it is an obstacle when one wants to initialize several VLCs
in a loop as one then needs to add an array for the sizes/offsets of
the VLC tables (unless max_depth of all arrays is one in which case
the sizes are derivable from the number of bits used).
Yet said size array is not necessary if one disables the warning for too
big buffers. The reason is that the amount of entries needed for the
table is of course generated as a byproduct of initializing the VLC.
To this end a flag that disables the warning has been added.
So one can proceed as follows:
static VLC vlcs[NUM];
static VLC_TYPE vlc_table[BUF_SIZE][2];
for (int i = 0, offset = 0; i < NUM; i++) {
vlcs[i].table = &vlc_table[offset];
vlcs[i].table_allocated = BUF_SIZE - offset;
init_vlc(); /* With INIT_VLC_STATIC_OVERLONG flag */
offset += vlcs[i].table_size;
}
Of course, BUF_SIZE should be equal to the number of entries actually
needed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e127af3c2b591dacd0c4c678a82d60bcce69755f
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Oct 29 17:59:14 2020 +0100
avcodec/tscc2: Combine tables for initializing VLCs
Using one big table for the symbols and lengths makes it
possible to remove the pointers to the individual tables.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2e55e3aa1a1c204dc93c09018779265ac017971
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Thu Oct 29 16:13:03 2020 +0100
avcodec/tscc2: Reduce the size of the tables used to initialize VLCs
After permuting both the codes, lengths and symbols tables so that
the codes tables are ordered from left to right in the tree, the codes
tables can be easily computed from the lengths tables at runtime and
therefore omitted. This saves about 2KB from the binary.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
URL: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f55da066ec82da220b729bd7bc5a9a836baeb68d
Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Date: Sun Oct 25 00:54:21 2020 +0200
avcodec/bitstream: Add second function to create VLCs
When using ff_init_vlc_sparse() to create a VLC, three input tables are
used: A table for lengths, one for codes and one for symbols; the latter
one can be omitted, then a default one will be used. These input tables
will be traversed twice, once to get the long codes (which will be put
into subtables) and once for the small codes. The long codes are then
sorted so that entries that should be in the same subtable are
contiguous.
This commit adds an alternative to ff_init_vlc_sparse():
ff_init_vlc_from_lengths(). It is based upon the observation that if
lengths, codes and symbols tables are permuted (in the same way) so that
the codes are ordered from left to right in the corresponding tree and
if said tree is complete (i.e. every non-leaf node has two children),
the codes can be easily computed from the lengths and are therefore
redundant. This means that if one initializes such a VLC with explicitly
coded lengths, codes and symbols, the codes can be avoided; and even if
one has no explicitly coded symbols, it might still be beneficial to
remove the codes even when one has to add a new symbol table, because
codes are typically longer than symbols so that the latter often fit
into a smaller type, saving space.
Furthermore, given that the codes here are by definition ordered from
left to right, it is unnecessary to sort them again; for the same
reason, one does not have to traverse the input twice. This function
proved to be faster than ff_init_vlc_sparse() whenever it has been
benchmarked.
This function is usable for static tables (they can simply be permuted
once) as well as in scenarios where the tables are naturally ordered
from left to right in the tree; the latter e.g. happens with Smacker,
Theora and several other formats.
In order to make it also usable for (static) tables with incomplete trees,
negative lengths are used to indicate that there is an open end of a
certain length.
Finally, ff_init_vlc_from_lengths() has one downside compared to
ff_init_vlc_sparse(): The latter uses tables that can be reused by
encoders. Of course, one could calculate the needed table at runtime
if one so wishes, but it is nevertheless an obstacle.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
More information about the ffmpeg-cvslog
mailing list