[FFmpeg-cvslog] avcodec/huffyuvdec: don't prepare unnecessary joint tables

Christophe Gisquet git at videolan.org
Sat Aug 26 20:29:04 EEST 2023


ffmpeg | branch: master | Christophe Gisquet <christophe.gisquet at gmail.com> | Sat Jun 11 09:31:13 2016 +0200| [8028b8260e6d0a4a469529ec5c5d504782a5f875] | committer: Paul B Mahol

avcodec/huffyuvdec: don't prepare unnecessary joint tables

The number of planes can be lower than 4.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8028b8260e6d0a4a469529ec5c5d504782a5f875
---

 libavcodec/huffyuvdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 8ba67bbdeb..f040a27095 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -168,8 +168,9 @@ static int generate_joint_tables(HYuvDecContext *s)
     len = (uint8_t *)(bits + (1 << VLC_BITS));
 
     if (s->bitstream_bpp < 24 || s->version > 2) {
+        int count = 1 + s->alpha + 2 * s->chroma;
         int p, i, y, u;
-        for (p = 0; p < 4; p++) {
+        for (p = 0; p < count; p++) {
             int p0 = s->version > 2 ? p : 0;
             for (i = y = 0; y < s->vlc_n; y++) {
                 int len0  = s->len[p0][y];



More information about the ffmpeg-cvslog mailing list