diff mbox series

[FFmpeg-devel,1/4] avcodec/mpeg12enc: Always initialize MPEG-2 intra VLC table lengths

Message ID 20201124144122.1994769-1-andreas.rheinhardt@gmail.com
State Accepted
Commit ef3c1670d488d1cffc98115a5e67b07ee921e47d
Headers show
Series [FFmpeg-devel,1/4] avcodec/mpeg12enc: Always initialize MPEG-2 intra VLC table lengths | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 24, 2020, 2:41 p.m. UTC
The MPEG-1/2 encoders initialize several tables once during the first
time one of the encoders is initialized; the table for MPEG-2 intra VLC
lengths is only initialized if it is used for this encoder instance.
This implies that if the first MPEG-1/2 encoder to be initialized does
not use it, it will never be initialized even if a later encoder
instance makes use of them. Fix this by initializing this table
unconditionally.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/mpeg12enc.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Michael Niedermayer Nov. 24, 2020, 9:03 p.m. UTC | #1
On Tue, Nov 24, 2020 at 03:41:19PM +0100, Andreas Rheinhardt wrote:
> The MPEG-1/2 encoders initialize several tables once during the first
> time one of the encoders is initialized; the table for MPEG-2 intra VLC
> lengths is only initialized if it is used for this encoder instance.
> This implies that if the first MPEG-1/2 encoder to be initialized does
> not use it, it will never be initialized even if a later encoder
> instance makes use of them. Fix this by initializing this table
> unconditionally.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/mpeg12enc.c | 1 -
>  1 file changed, 1 deletion(-)

LGTM

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 46c3424de9..eee4af0adc 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -1055,7 +1055,6 @@  av_cold void ff_mpeg1_encode_init(MpegEncContext *s)
         }
 
         init_uni_ac_vlc(&ff_rl_mpeg1, uni_mpeg1_ac_vlc_len);
-        if (s->intra_vlc_format)
             init_uni_ac_vlc(&ff_rl_mpeg2, uni_mpeg2_ac_vlc_len);
 
         /* build unified dc encoding tables */