PR #21505 opened by Timo Rothenpieler (BtbN) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21505 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21505.patch
The calculation can yield bigger values than the lookup table provides. So just use actual popcount instead. Fixes #21503 >From 7379539685ec900b372d87ad25a23e82b8b45f17 Mon Sep 17 00:00:00 2001 From: Timo Rothenpieler <[email protected]> Date: Sun, 18 Jan 2026 18:52:52 +0100 Subject: [PATCH] avcodec/prores_raw: use av_popcount instead of limited lookup table The calculation can yield bigger values than the lookup table provides. So just use actual popcount instead. Fixes #21503 --- libavcodec/prores_raw.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/prores_raw.c b/libavcodec/prores_raw.c index 8be566ed36..eb1a9af14f 100644 --- a/libavcodec/prores_raw.c +++ b/libavcodec/prores_raw.c @@ -93,10 +93,6 @@ static uint16_t get_value(GetBitContext *gb, int16_t codebook) #define TODCCODEBOOK(x) ((x + 1) >> 1) -static const uint8_t align_tile_w[16] = { - 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, -}; - #define DC_CB_MAX 12 const uint8_t ff_prores_raw_dc_cb[DC_CB_MAX + 1] = { 0x010, 0x021, 0x032, 0x033, 0x033, 0x033, 0x044, 0x044, 0x044, 0x044, 0x044, 0x044, 0x076, @@ -432,7 +428,7 @@ static int decode_frame(AVCodecContext *avctx, s->nb_tw = (w + 15) >> 4; s->nb_th = (h + 15) >> 4; - s->nb_tw = (s->nb_tw >> align) + align_tile_w[~(-1 * (1 << align)) & s->nb_tw]; + s->nb_tw = (s->nb_tw >> align) + av_popcount(~(-1 * (1 << align)) & s->nb_tw); s->nb_tiles = s->nb_tw * s->nb_th; av_log(avctx, AV_LOG_DEBUG, "%dx%d | nb_tiles: %d\n", s->nb_tw, s->nb_th, s->nb_tiles); -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
