1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-26 06:01:30 +02:00
Commit Graph

11 Commits

Author SHA1 Message Date
Andreas Rheinhardt
2935d29e8e 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@gmail.com>
2020-12-08 17:51:44 +01:00
Andreas Rheinhardt
71753c5235 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@gmail.com>
2020-12-08 17:51:44 +01:00
Andreas Rheinhardt
26cc9db744 avcodec/on2avc: Unify initializing quad and pair VLCs
Up until now, quad VLCs are initialized with codes of type uint32_t,
pair VLCs with codes of type uint16_t. There were two separate loops in
the decoder's init function for each type of VLC. This commit unifies
this: The type of the codes are now passed in as void * and the actual
size of the codes is obtained from a table. This approach also allows to
use the smallest type for each VLC code table: some quad tables actually
fitted in uint16_t. This allows to remove about 7KB from the binary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-21 07:47:55 +02:00
James Almer
318778de9e Merge commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3'
* commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3':
  Mark some arrays that never change as const.

Merged-by: James Almer <jamrial@gmail.com>
2017-09-26 16:02:40 -03:00
Anton Khirnov
fd9212f2ed Mark some arrays that never change as const. 2017-02-01 10:42:59 +01:00
Timothy Gu
180f9a0958 all: Make header guard names consistent 2016-01-31 15:44:11 -08:00
Reimar Döffinger
97bcb05889 Add missing "const" to pointer arrays.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-05-10 21:57:28 +02:00
Michael Niedermayer
417ae6281b Merge commit '7cade8ea2bb19e78dae42b29720535a70fb2ae84'
* commit '7cade8ea2bb19e78dae42b29720535a70fb2ae84':
  on2avc: change a comment at #endif to match actual define

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-23 23:03:20 +02:00
Kostya Shishkov
7cade8ea2b on2avc: change a comment at #endif to match actual define 2014-04-23 20:54:29 +02:00
Michael Niedermayer
56efd98a65 Merge commit 'e2834567d73bd1e46478ba67ac133cb8ef5f50fd'
* commit 'e2834567d73bd1e46478ba67ac133cb8ef5f50fd':
  On2 AVC decoder

Conflicts:
	Changelog
	configure
	libavcodec/avcodec.h
	libavcodec/codec_desc.c
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-23 20:47:13 +02:00
Kostya Shishkov
e2834567d7 On2 AVC decoder 2014-04-23 19:57:44 +02:00