summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2016-06-11 09:31:13 +0200
committerPaul B Mahol <onemda@gmail.com>2023-08-26 19:22:25 +0200
commit8028b8260e6d0a4a469529ec5c5d504782a5f875 (patch)
tree16dcf305f5771c192746f8640b093a05fc166ef0
parent67d392b97941bb51fb7af3a3c9387f5ab895fa46 (diff)
avcodec/huffyuvdec: don't prepare unnecessary joint tables
The number of planes can be lower than 4.
-rw-r--r--libavcodec/huffyuvdec.c3
1 files changed, 2 insertions, 1 deletions
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];