Re: [FFmpeg-devel] Bundling ffmpeg into windows application

2020-11-10 Thread Tobias Rapp
On 11.11.2020 06:50, Brian D. Pemberton wrote: Hi, I am thinking about writing an app that bundles or includes FFmpeg to do some video processing. Is this allowed? If so, where can I read about the constraints or requirements of doing this? Also, is there anything I should know upfront to

Re: [FFmpeg-devel] [PATCH] aviobuf: Increase the default SHORT_SEEK_THRESHOLD to 32 KB

2020-11-10 Thread Martin Storsjö
On Thu, 5 Nov 2020, Martin Storsjö wrote: The previous threshold, 4 KB, maybe was reasonable when it was set (in 2010), but in today's settings and with typical network speeds and data sizes, it's pretty small. 32 KB probably is a more reasonable default now, regardless of input. This changes

[FFmpeg-devel] Bundling ffmpeg into windows application

2020-11-10 Thread Brian D. Pemberton
Hi, I am thinking about writing an app that bundles or includes FFmpeg to do some video processing. Is this allowed? If so, where can I read about the constraints or requirements of doing this? Also, is there anything I should know upfront to prepare my app licensing standpoint ahead of time?

Re: [FFmpeg-devel] [PATCH] avcodec/cbs_av1: infer ref_order_hint when not coded in the bitstream

2020-11-10 Thread Mark Thompson
On 31/10/2020 14:40, James Almer wrote: Signed-off-by: James Almer --- libavcodec/cbs_av1_syntax_template.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c index f351b1de24..dc3d8d1048

Re: [FFmpeg-devel] [PATCH] avcodec/cbs_av1: add a range check to tg_end

2020-11-10 Thread Mark Thompson
On 27/10/2020 21:25, James Almer wrote: Section 6.10.1 of the AV1 spec states: It is a requirement of bitstream conformance that the value of tg_start is equal to the value of TileNum at the point that tile_group_obu is invoked. It is a requirement of bitstream conformance that the value of

Re: [FFmpeg-devel] [PATCH] Moves yuv2yuvX_sse3 to yasm, unrolls main loop and other small optimizations for ~20% speedup.

2020-11-10 Thread Carl Eugen Hoyos
Am Fr., 6. Nov. 2020 um 09:04 Uhr schrieb Alan Kelly : > > The function was re-written in asm, this code is heavily derived from the > original code, the algorithm remains unchanged, the implementation is > optimized. Would you agree to adding the copyright from swscale.c: > * Copyright (C)

Re: [FFmpeg-devel] [PATCH 1/4] avformat/nutenc: don't use header_count to store different variables

2020-11-10 Thread Andreas Rheinhardt
Andriy Gelman: > On Mon, 09. Nov 00:04, Andreas Rheinhardt wrote: >> Andriy Gelman: >>> From: Andriy Gelman >>> >>> Currently, header_count is used to store both the elision header count >>> and the header repetition count (number of times headers have been written >>> to output). Fix this by

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Paul B Mahol
On Tue, Nov 10, 2020 at 5:35 PM Michael Niedermayer wrote: > On Tue, Nov 10, 2020 at 01:37:26PM +0100, Paul B Mahol wrote: > > Big disagree, please keep this log intact. > > i agree, for people writing alot of codecs like paul is doing this av_log > is helpful > > It can be made less verbose,

Re: [FFmpeg-devel] [PATCH] Moves yuv2yuvX_sse3 to yasm, unrolls main loop and other small optimizations for ~20% speedup.

2020-11-10 Thread Michael Niedermayer
On Tue, Nov 10, 2020 at 09:43:47AM +0100, Alan Kelly wrote: > --- > yuv2yuvX.asm: Ports yuv2yuvX to asm, unrolls main loop and adds > other small optimizations for ~20% speed-up. Copyright updated to > include the original from swscale.c > swscale.c: Removes yuv2yuvX_sse3 and calls new

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Michael Niedermayer
On Tue, Nov 10, 2020 at 01:37:26PM +0100, Paul B Mahol wrote: > Big disagree, please keep this log intact. i agree, for people writing alot of codecs like paul is doing this av_log is helpful Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not

Re: [FFmpeg-devel] [PATCH 7/7] avcodec/cri: check for available input in unpack_10bit()

2020-11-10 Thread Michael Niedermayer
On Tue, Nov 10, 2020 at 01:46:10AM +0100, Andreas Rheinhardt wrote: > Michael Niedermayer: > > Fixes: Timeout (>20sec -> 56ms) > > Fixes: > > 26995/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CRI_fuzzer-5107217080254464 > > > > Found-by: continuous fuzzing process > >

Re: [FFmpeg-devel] [PATCH] libavformat/avidec: Extract more metadata from the header

2020-11-10 Thread Michael Niedermayer
On Fri, Nov 06, 2020 at 03:10:17PM -0800, Thierry Foucu wrote: > --- > libavformat/avidec.c | 17 + > 1 file changed, 17 insertions(+) will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a

Re: [FFmpeg-devel] [PATCH v2 1/4] avcodec/av1dec: expose skip mode frame index

2020-11-10 Thread Timo Rothenpieler
On 10.11.2020 15:19, James Almer wrote: On 11/10/2020 10:42 AM, Timo Rothenpieler wrote: Signed-off-by: Timo Rothenpieler Co-authored-by: James Almer ---   libavcodec/av1dec.c | 80 +   libavcodec/av1dec.h |  3 ++   2 files changed, 83 insertions(+)

Re: [FFmpeg-devel] [PATCH v2 1/4] avcodec/av1dec: expose skip mode frame index

2020-11-10 Thread James Almer
On 11/10/2020 10:42 AM, Timo Rothenpieler wrote: Signed-off-by: Timo Rothenpieler Co-authored-by: James Almer --- libavcodec/av1dec.c | 80 + libavcodec/av1dec.h | 3 ++ 2 files changed, 83 insertions(+) diff --git a/libavcodec/av1dec.c

Re: [FFmpeg-devel] [PATCH] avcodec/cbs_av1: add a range check to tg_end

2020-11-10 Thread James Almer
On 10/27/2020 6:25 PM, James Almer wrote: Section 6.10.1 of the AV1 spec states: It is a requirement of bitstream conformance that the value of tg_start is equal to the value of TileNum at the point that tile_group_obu is invoked. It is a requirement of bitstream conformance that the value of

[FFmpeg-devel] [PATCH v2 2/4] avcodec/av1dec: expose coded_lossless

2020-11-10 Thread Timo Rothenpieler
Signed-off-by: Timo Rothenpieler Co-authored-by: James Almer --- libavcodec/av1dec.c | 33 + libavcodec/av1dec.h | 2 ++ 2 files changed, 35 insertions(+) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 1afed66499..87fd6bb2e3 100644 ---

[FFmpeg-devel] [PATCH v2 1/4] avcodec/av1dec: expose skip mode frame index

2020-11-10 Thread Timo Rothenpieler
Signed-off-by: Timo Rothenpieler Co-authored-by: James Almer --- libavcodec/av1dec.c | 80 + libavcodec/av1dec.h | 3 ++ 2 files changed, 83 insertions(+) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 56712279aa..1afed66499 100644 ---

Re: [FFmpeg-devel] [PATCH] avcodec/cbs_av1: infer ref_order_hint when not coded in the bitstream

2020-11-10 Thread James Almer
On 10/31/2020 11:40 AM, James Almer wrote: Signed-off-by: James Almer --- libavcodec/cbs_av1_syntax_template.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c index

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Andreas Rheinhardt
Andreas Rheinhardt: > Paul B Mahol: >> Than how one is supposed to guess correct size to put when this log is gone? >> > The developer who wants to make VLCs static just has to use a huge array > (in order not to run into the abort) and get the value of the final > offset parameter (either via

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Paul B Mahol
Big disagree, please keep this log intact. Thanks. On Tue, Nov 10, 2020 at 1:31 PM Andreas Rheinhardt < andreas.rheinha...@gmail.com> wrote: > Paul B Mahol: > > Than how one is supposed to guess correct size to put when this log is > gone? > > > The developer who wants to make VLCs static just

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Andreas Rheinhardt
Paul B Mahol: > Than how one is supposed to guess correct size to put when this log is gone? > The developer who wants to make VLCs static just has to use a huge array (in order not to run into the abort) and get the value of the final offset parameter (either via av_log or via a debugger); or

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Paul B Mahol
Than how one is supposed to guess correct size to put when this log is gone? On Tue, Nov 10, 2020 at 1:15 PM Andreas Rheinhardt < andreas.rheinha...@gmail.com> wrote: > Paul B Mahol: > > On Tue, Nov 10, 2020 at 12:31 PM Andreas Rheinhardt < > > andreas.rheinha...@gmail.com> wrote: > > > >> Paul

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Andreas Rheinhardt
Paul B Mahol: > On Tue, Nov 10, 2020 at 12:31 PM Andreas Rheinhardt < > andreas.rheinha...@gmail.com> wrote: > >> Paul B Mahol: >>> Because it is a bad idea. >> >> And I still like to hear a reason for this. >> >> > Code is there so correct intended size is always allocated. > No. There are two

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Paul B Mahol
On Tue, Nov 10, 2020 at 12:31 PM Andreas Rheinhardt < andreas.rheinha...@gmail.com> wrote: > Paul B Mahol: > > Because it is a bad idea. > > And I still like to hear a reason for this. > > Code is there so correct intended size is always allocated. > > No need to change code that worked for

Re: [FFmpeg-devel] [PATCH 1/7] avformat/sbgdec: Check that end is not before start

2020-11-10 Thread Nicolas George
Michael Niedermayer (12020-11-10): > Fixes: signed integer overflow: -9223372036854775808 + -5279949906739200 > cannot be represented in type 'long' > Fixes: > 26908/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6329610851319808 > > Found-by: continuous fuzzing process >

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Andreas Rheinhardt
Paul B Mahol: > Because it is a bad idea. And I still like to hear a reason for this. > No need to change code that worked for ages. > It allows to remove useless tables and it simplifies making more VLCs that should be static static. > On Tue, Nov 10, 2020 at 12:26 PM Andreas Rheinhardt < >

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Paul B Mahol
Because it is a bad idea. No need to change code that worked for ages. On Tue, Nov 10, 2020 at 12:26 PM Andreas Rheinhardt < andreas.rheinha...@gmail.com> wrote: > Paul B Mahol: > > I do not think this is a good direction. > > > > Why? > > > On Tue, Nov 10, 2020 at 11:50 AM Andreas Rheinhardt <

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Andreas Rheinhardt
Paul B Mahol: > I do not think this is a good direction. > Why? > On Tue, Nov 10, 2020 at 11:50 AM Andreas Rheinhardt < > andreas.rheinha...@gmail.com> wrote: > >> 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

Re: [FFmpeg-devel] [PATCH 004/114] avcodec/bitstream: Allow static VLC tables to be bigger than needed

2020-11-10 Thread Paul B Mahol
I do not think this is a good direction. On Tue, Nov 10, 2020 at 11:50 AM Andreas Rheinhardt < andreas.rheinha...@gmail.com> wrote: > 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;

[FFmpeg-devel] [PATCH 114/114] avcodec/qdmc: Avoid code duplication when initializing VLC

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/qdmc.c | 60 --- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c index 2c870fcc1b..5aa13d8e8e 100644 --- a/libavcodec/qdmc.c +++ b/libavcodec/qdmc.c

[FFmpeg-devel] [PATCH 112/114] avcodec/qdmc: Make tables used to initialize VLCs smaller

2020-11-10 Thread Andreas Rheinhardt
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 --- libavcodec/qdmc.c |

[FFmpeg-devel] [PATCH 113/114] avcodec/qdmc: Apply offset when creating VLC

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/qdmc.c | 56 ++- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c index 8b50fbf30a..2c870fcc1b 100644 --- a/libavcodec/qdmc.c +++ b/libavcodec/qdmc.c

[FFmpeg-devel] [PATCH 111/114] avcodec/qdmc: Don't check for errors for complete VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/qdmc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c index ff1cc86c6b..f4e507fa60 100644 --- a/libavcodec/qdmc.c +++ b/libavcodec/qdmc.c @@ -370,8 +370,6 @@ static int qdmc_get_vlc(GetBitContext *gb,

[FFmpeg-devel] [PATCH 110/114] avcodec/magicyuv: Optimize creating Huffman tables

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 108/114] avcodec/hqx: Don't check for errors for complete VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/hqx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c index 44c6c1883c..aa4ff22a8f 100644 --- a/libavcodec/hqx.c +++ b/libavcodec/hqx.c @@ -122,8 +122,6 @@ static int decode_block(GetBitContext *gb, VLC

[FFmpeg-devel] [PATCH 109/114] avcodec/utvideodec: Avoid implicit qsort when creating Huffman tables

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 103/114] avcodec/intrax8: Remove VLC offsets table

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/intrax8.c | 24 ++-- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c index bd00a3e027..71a50cc063 100644 --- a/libavcodec/intrax8.c +++ b/libavcodec/intrax8.c @@ -50,18

[FFmpeg-devel] [PATCH 107/114] avcodec/hqx: Inline constants

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/hqx.c| 4 ++-- libavcodec/hqx.h| 1 + libavcodec/hqxvlc.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c index e2b895ac40..44c6c1883c 100644 --- a/libavcodec/hqx.c +++

[FFmpeg-devel] [PATCH 106/114] avcodec/atrac3: Use symbols table

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 104/114] avcodec/intrax8: Avoid code duplication when initializing VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/intrax8.c | 46 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c index 71a50cc063..9b7958e5f2 100644 --- a/libavcodec/intrax8.c +++

[FFmpeg-devel] [PATCH 098/114] avcodec/vp3: Apply VLC offset during init

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 102/114] avcodec/intrax8: Replace always-false check by assert

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/intrax8.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c index f385423dc1..bd00a3e027 100644 --- a/libavcodec/intrax8.c +++ b/libavcodec/intrax8.c @@ -115,11 +115,7 @@ static

[FFmpeg-devel] [PATCH 097/114] avcodec/atrac9tab: Add missing static to internal table

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/atrac9tab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/atrac9tab.h b/libavcodec/atrac9tab.h index 1882bf9f43..b169035aad 100644 --- a/libavcodec/atrac9tab.h +++ b/libavcodec/atrac9tab.h @@ -104,7 +104,7 @@

[FFmpeg-devel] [PATCH 100/114] avcodec/vp3: Use symbols table for VP3 motion vectors

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 095/114] avcodec/atrac9dec: Make VLCs static

2020-11-10 Thread Andreas Rheinhardt
Also remove code duplication and use a named constant for the number of VLC bits while just at it. Signed-off-by: Andreas Rheinhardt --- libavcodec/atrac9dec.c | 69 +- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/libavcodec/atrac9dec.c

[FFmpeg-devel] [PATCH 096/114] avcodec/atrac9dec: Replace av_free() by av_freep() in close function

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/atrac9dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c index d2dbffe92a..585c68f33a 100644 --- a/libavcodec/atrac9dec.c +++ b/libavcodec/atrac9dec.c @@ -831,7 +831,7 @@

[FFmpeg-devel] [PATCH 101/114] avcodec/vp3: Remove code duplication when initializing Theora VLCs

2020-11-10 Thread Andreas Rheinhardt
theora_init_huffman_tables() does essentially the same as ff_init_vlcs_from_lengths(). Signed-off-by: Andreas Rheinhardt --- libavcodec/vp3.c | 20 +--- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index

[FFmpeg-devel] [PATCH 093/114] avcodec/atrac9tab: Unify tables used to initialize VLCs

2020-11-10 Thread Andreas Rheinhardt
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 --- libavcodec/atrac9dec.c | 19 ++- libavcodec/atrac9tab.h | 310 ++--- 2

[FFmpeg-devel] [PATCH 094/114] avcodec/atrac9dec: Don't create VLCs that are never used

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 090/114] avcodec/atrac9dec: Use least max_depth in call to get_vlc2()

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/atrac9dec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c index a1af3c22ef..ecf95f1777 100644 --- a/libavcodec/atrac9dec.c +++ b/libavcodec/atrac9dec.c @@ -272,7 +272,7 @@

[FFmpeg-devel] [PATCH 088/114] avcodec/rv34: Avoid offsets table for initialization of static VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/rv34.c | 66 +-- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 09fa962b2f..00fbcef8ec 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c

[FFmpeg-devel] [PATCH 089/114] avcodec/atrac9dec: Don't confuse max_depth of VLC with max codelength

2020-11-10 Thread Andreas Rheinhardt
The whole point of VLCs with their tables is to read more than one bit at a time; therefore max_depth, the number of times one has to (maximally) read further bits is given by ceil(max_code_length / table_bits) which in the case of ATRAC9's coefficient VLCs gives an upper bound of two. Instead the

[FFmpeg-devel] [PATCH 091/114] avcodec/atrac9dec: Don't use unnecessarily large VLC tables

2020-11-10 Thread Andreas Rheinhardt
Using more bits for a VLC than the longest code has has no advantage. Signed-off-by: Andreas Rheinhardt --- libavcodec/atrac9dec.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c index ecf95f1777..0477b304d2

[FFmpeg-devel] [PATCH 087/114] avcodec/vc1: Avoid code duplication when initializing VLCs

2020-11-10 Thread Andreas Rheinhardt
This has been achieved by switching those VLCs that still used ff_init_vlc_sparse() to ff_init_vlc_lengths() even though the codes tables used uint8_t in these cases. But it allows to use one auxiliary function to initialize the VLCs and by using tables that interleave symbols and lengths said

[FFmpeg-devel] [PATCH 086/114] avcodec/vc1: Make tables used to initialize VLCs smaller

2020-11-10 Thread Andreas Rheinhardt
By switching to ff_init_vlc_from_lengths() from ff_init_vlc_sparse() one can replace codes of type uint16_t by symbols of type uint8_t, saving space. Signed-off-by: Andreas Rheinhardt --- libavcodec/vc1.c | 27 +-- libavcodec/vc1data.c | 488 ---

[FFmpeg-devel] [PATCH 085/114] avcodec/vc1: Don't check for errors for complete VLC

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/vc1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 9eb02f88b3..305cc8c075 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -614,7 +614,7 @@ static void rotate_luts(VC1Context

[FFmpeg-devel] [PATCH 084/114] avcodec/vc1: Use symbols table to parse macroblock mode

2020-11-10 Thread Andreas Rheinhardt
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 VLCs used to parse the macroblock mode (MBMODE) element for frame P and B pictures. MBMODE consists of four pieces of information

[FFmpeg-devel] [PATCH 083/114] avcodec/vc1: Use symbols table to decode MV differentials

2020-11-10 Thread Andreas Rheinhardt
The VC1 decoder currently follows the spec very closely when decoding MV differentials: The spec uses tables with contiguous indexes and derives four values from it using a pseudo-code procedure: Two flags and two values with a range of 0..5 each; the latter are obtained as the result resp. the

[FFmpeg-devel] [PATCH 081/114] avcodec/vc1: Use symbols table to decode AC coefficients

2020-11-10 Thread Andreas Rheinhardt
The VC1 decoder currently follows the spec very closely when decoding AC coefficients: The spec uses tables with contiguous indexes. The last of each of these is an escape code; the other codes encode three other variables via tables: run, length and whether this is the last coefficient. This

[FFmpeg-devel] [PATCH 082/114] avcodec/vc1_block: Use local variables inside macro

2020-11-10 Thread Andreas Rheinhardt
This makes it clearer which variables are really just temporary variables of the macro and which are actually used externally. Signed-off-by: Andreas Rheinhardt --- libavcodec/vc1_block.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git

[FFmpeg-devel] [PATCH 078/114] avcodec/vc1: Use a symbols table to decode interlaced MV vector VLCs

2020-11-10 Thread Andreas Rheinhardt
The VC1 decoder currently follows the spec very closely when decoding interlaced MV vector variable-length codes: The spec uses tables with contiguous indexes. The last of these is an escape code, for every other two values are encoded via (index + 1) / 9 and (index + 1) % 9. The decoder did

[FFmpeg-devel] [PATCH 080/114] avcodec/vc1_block: Don't use 0 for NULL

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/vc1_block.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c index 714b3cdea0..3c9d1d4b8d 100644 --- a/libavcodec/vc1_block.c +++ b/libavcodec/vc1_block.c @@

[FFmpeg-devel] [PATCH 077/114] avcodec/vc1: Use symbols table for VLC for Block-level Transform Type

2020-11-10 Thread Andreas Rheinhardt
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 for the Block-level Transform Type and therefore this commit implements this; switching from ff_init_vlc_sparse() to

[FFmpeg-devel] [PATCH 079/114] avcodec/vc1_block, msmpeg4dec: Don't check for errors for complete VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/msmpeg4dec.c | 5 - libavcodec/vc1_block.c | 12 2 files changed, 17 deletions(-) diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index 49df06a9d7..b3964457d6 100644 --- a/libavcodec/msmpeg4dec.c +++

[FFmpeg-devel] [PATCH 073/114] avcodec/atrac3plus: Combine symbols tables

2020-11-10 Thread Andreas Rheinhardt
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 ---

[FFmpeg-devel] [PATCH 076/114] avcodec/vc1: Already offset subblock VLC tables during init

2020-11-10 Thread Andreas Rheinhardt
Offseting by +1 is possible without adding dummy elements to the beginning of the codes and lengths tables by switching to ff_init_vlc_from_lengths() as this allows one to set the symbols arbitrarily without incurring any penalty. Signed-off-by: Andreas Rheinhardt --- I wonder whether the tables

[FFmpeg-devel] [PATCH 074/114] avcodec/atrac3plus: Combine codebooks into one array

2020-11-10 Thread Andreas Rheinhardt
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;

[FFmpeg-devel] [PATCH 075/114] avcodec/atrac3plus: Run-length encode length tables to make them smaller

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 071/114] avcodec/atrac3plus: Make tables used to initialize VLCs smaller

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 072/114] avcodec/atrac3plus: Simplify getting offset of VLC in VLC_TYPE buf

2020-11-10 Thread Andreas Rheinhardt
The earlier code used several different offset parameters that were initialized to magic values. This is unnecessary. Signed-off-by: Andreas Rheinhardt --- libavcodec/atrac3plus.c | 25 ++--- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git

[FFmpeg-devel] [PATCH 069/114] avcodec/truemotion2: Simplify creating VLC table

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 068/114] avcodec/mpeg4videodec: Make studio VLCs static

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4video.h| 4 -- libavcodec/mpeg4videodec.c | 87 -- 2 files changed, 36 insertions(+), 55 deletions(-) diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h index 3de598465f..e919db87a5 100644

[FFmpeg-devel] [PATCH 067/114] avcodec/mpeg4video: Make tables used to initialize VLCs smaller

2020-11-10 Thread Andreas Rheinhardt
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. Signed-off-by: Andreas Rheinhardt ---

[FFmpeg-devel] [PATCH 070/114] avcodec/atrac3plus: Simplify creating VLCs

2020-11-10 Thread Andreas Rheinhardt
Use ff_init_vlc_from_lengths() to offload the computation of the codes. Signed-off-by: Andreas Rheinhardt --- libavcodec/atrac3plus.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c index 6b046a887e..8ae5d6b8f9 100644

[FFmpeg-devel] [PATCH 062/114] avcodec/sheervideo: Add av_cold to build_vlc()

2020-11-10 Thread Andreas Rheinhardt
It is an init function even when called from decode_frame(). Signed-off-by: Andreas Rheinhardt --- libavcodec/sheervideo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c index 976c21c445..3e60ef26a5 100644 ---

[FFmpeg-devel] [PATCH 064/114] avcodec/g2meet: Use least max_depth in get_vlc2()

2020-11-10 Thread Andreas Rheinhardt
The longest AC codes of the standard JPEG tables are 16 bits long; for the DC tables, the maximum is 11, so using max_depth of two is sufficient. Signed-off-by: Andreas Rheinhardt --- libavcodec/g2meet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/g2meet.c

[FFmpeg-devel] [PATCH 066/114] avcodec/indeo2: Make tables used to initialize VLCs smaller

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 065/114] avcodec/mjpegdec: Simplify creating VLC table

2020-11-10 Thread Andreas Rheinhardt
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 --- libavcodec/mjpegdec.c | 15 +-- 1 file changed, 5 insertions(+), 10

[FFmpeg-devel] [PATCH 063/114] avcodec/sheervideo: Simplify creating VLC table

2020-11-10 Thread Andreas Rheinhardt
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 --- libavcodec/sheervideo.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-)

[FFmpeg-devel] [PATCH 061/114] avcodec/mss4: Make VLCs static

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/mss4.c | 73 +++ 1 file changed, 29 insertions(+), 44 deletions(-) diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c index 9c257dc873..9b343c9b2b 100644 --- a/libavcodec/mss4.c +++ b/libavcodec/mss4.c

[FFmpeg-devel] [PATCH 060/114] avcodec/mss4: Don't duplicate standard JPEG tables

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- configure | 2 +- libavcodec/mss4.c | 58 +-- 2 files changed, 7 insertions(+), 53 deletions(-) diff --git a/configure b/configure index 8a9e9b3cd7..4b47832cd7 100755 --- a/configure +++ b/configure @@

[FFmpeg-devel] [PATCH 059/114] avcodec/mss4: Simplify creating VLC tables

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 058/114] avcodec/rv40: Avoid code duplication when initializing VLCs

2020-11-10 Thread Andreas Rheinhardt
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 --- libavcodec/rv40.c | 52 +++--- libavcodec/rv40vlc2.h | 383

[FFmpeg-devel] [PATCH 055/114] avcodec/rv40: Make the tables used to initialize VLCs smaller

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 056/114] avcodec/rv40: Make better use of VLC symbols table

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 057/114] avcodec/rv40: Avoid offset table when initializing static VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/rv40.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c index 81e08af5f1..7ed599cd69 100644 --- a/libavcodec/rv40.c +++ b/libavcodec/rv40.c @@ -41,11 +41,6 @@ static VLC

[FFmpeg-devel] [PATCH 053/114] avcodec/qdm2: Avoid offsets table when initializing VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/qdm2_tablegen.h | 40 ++ 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/libavcodec/qdm2_tablegen.h b/libavcodec/qdm2_tablegen.h index b60989e343..e492f7bb60 100644 ---

[FFmpeg-devel] [PATCH 054/114] avcodec/rv40vlc2: Make VLC smaller

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/rv40vlc2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rv40vlc2.h b/libavcodec/rv40vlc2.h index 15119a145b..4cdc7a4193 100644 --- a/libavcodec/rv40vlc2.h +++ b/libavcodec/rv40vlc2.h @@ -33,7 +33,7 @@ * codes

[FFmpeg-devel] [PATCH 047/114] avcodec/mobiclip: Avoid code duplication when initializing VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/mobiclip.c | 106 -- 1 file changed, 51 insertions(+), 55 deletions(-) diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c index cb17832898..e4a2594954 100644 --- a/libavcodec/mobiclip.c +++

[FFmpeg-devel] [PATCH 051/114] avcodec/qdm2: Apply offsets when initializing VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/qdm2.c | 2 +- libavcodec/qdm2_tablegen.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 657b2da64d..bdfe710840 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@

[FFmpeg-devel] [PATCH 052/114] avcodec/qdm2: Initialize array of VLCs in a loop

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/qdm2_tablegen.h | 12 +++- libavcodec/qdm2data.h | 28 ++-- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/libavcodec/qdm2_tablegen.h b/libavcodec/qdm2_tablegen.h index aaa7356caf..b60989e343

[FFmpeg-devel] [PATCH 046/114] avcodec/mobiclip: Avoid redundant codes table to initialize VLCs

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 045/114] avcodec/mpc8: Avoid code duplication when initializing VLCs

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 044/114] avcodec/mpc8: Reduce the size of some VLCs

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 050/114] avcodec/qdm2_tablegen: Avoid code duplication when creating VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/qdm2_tablegen.h | 159 +++-- 1 file changed, 27 insertions(+), 132 deletions(-) diff --git a/libavcodec/qdm2_tablegen.h b/libavcodec/qdm2_tablegen.h index 309bb4b53c..0e57902fc9 100644 ---

[FFmpeg-devel] [PATCH 048/114] avcodec/mobiclip: Reindentation

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/mobiclip.c | 132 +- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c index e4a2594954..2d3225f464 100644 --- a/libavcodec/mobiclip.c +++

[FFmpeg-devel] [PATCH 049/114] avcodec/qdm2: Make tables used to initialize VLCs smaller

2020-11-10 Thread Andreas Rheinhardt
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

[FFmpeg-devel] [PATCH 043/114] avcodec/mpc8: Reduce the size of the length tables to initialize VLCs

2020-11-10 Thread Andreas Rheinhardt
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.

[FFmpeg-devel] [PATCH 041/114] avcodec/mpc8: Reduce size of tables used to initialize VLCs

2020-11-10 Thread Andreas Rheinhardt
By switching to ff_init_vlc_from_lengths() one can make a table of codes of type uint8_t superfluous, saving space. Other VLCs (for which there was no dedicated symbols table and where the codes where already of type uint8_t) have been made to use ff_init_vlc_from_lengths(), too, because it

[FFmpeg-devel] [PATCH 042/114] avcodec/mpc8: Apply offsets when initializing VLCs

2020-11-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt --- libavcodec/mpc8.c | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index 339ee515b8..31b7ad14ac 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -39,9 +39,6 @@ static

  1   2   >