From 53a9a34e23b730edd82e1d703c75f30d2a532bb6 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 9 Feb 2026 17:57:30 +0100 Subject: [PATCH] avcodec/snow: Reduce sizeof(SnowContext) Each SubBand currently contains an array of 519 uint8_t[32], yet most of these are unused: For both the decoder and the encoder, at most 34 contexts are actually used: The only variable index is context+2, where context is the result of av_log2() and therefore in the 0..31 range. There are also several accesses using compile-time indices, the highest of which is 30. FATE passes with 31 contexts and maybe these are enough, but I don't know. Reducing the number to 34 reduces sizeof(SnowContext) from 2141664B to 155104B here (on x64). Signed-off-by: Andreas Rheinhardt --- libavcodec/snow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/snow.h b/libavcodec/snow.h index 82417c3324..f8f45b8763 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -92,7 +92,7 @@ typedef struct SubBand{ int stride_line; ///< Stride measured in lines, not pixels. x_and_coeff * x_coeff; struct SubBand *parent; - uint8_t state[/*7*2*/ 7 + 512][32]; + uint8_t state[34][32]; }SubBand; typedef struct Plane{