diff mbox series

[FFmpeg-devel,2/8] avcodec/smacker: Don't warn for Huffmann tables with one element

Message ID 20200731112241.8948-2-andreas.rheinhardt@gmail.com
State Accepted
Commit 2cef0316747499f3d845d778fbf7e1d1d27d55fb
Headers show
Series [FFmpeg-devel,1/8] avcodec/smacker: Remove write-only and unused variables | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt July 31, 2020, 11:22 a.m. UTC
The Huffmann tables used by Smacker can consist of exactly one leaf only
in which case the length of the corresponding code is zero; there is
then exactly one value encoded. Our VLC can't handle this and therefore
this case needs to be treated separately; it has been implemented in
commit 48cbdaea157671d456750e00fde37c6d7595fad6. Yet said commit also
made the decoder emit an error message (despite not erroring out) in this
case, although it seems that this is rather a limitation of our VLC API.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/smacker.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Paul B Mahol Aug. 19, 2020, 7:16 p.m. UTC | #1
On 7/31/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> The Huffmann tables used by Smacker can consist of exactly one leaf only
> in which case the length of the corresponding code is zero; there is
> then exactly one value encoded. Our VLC can't handle this and therefore
> this case needs to be treated separately; it has been implemented in
> commit 48cbdaea157671d456750e00fde37c6d7595fad6. Yet said commit also
> made the decoder emit an error message (despite not erroring out) in this
> case, although it seems that this is rather a limitation of our VLC API.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---

Probably OK
diff mbox series

Patch

diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index e53183318e..3c9f118fb7 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -229,8 +229,7 @@  static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
                 goto error;
             }
         }
-    }
-    if (!vlc[0].table) {
+    } else {
         av_log(smk->avctx, AV_LOG_ERROR, "Skipping low bytes tree\n");
     }
     if(get_bits1(gb)){
@@ -250,8 +249,7 @@  static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
                 goto error;
             }
         }
-    }
-    if (!vlc[1].table) {
+    } else {
         av_log(smk->avctx, AV_LOG_ERROR, "Skipping high bytes tree\n");
     }