* [FFmpeg-devel] [PR] Fix shadowing (PR #22247)
@ 2026-02-22 3:03 mkver via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: mkver via ffmpeg-devel @ 2026-02-22 3:03 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: mkver
PR #22247 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22247
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22247.patch
This PR fixes some of the shadowing issues in the codebase; the intention is to enable -Wshadow when all of them are fixed.
>From 399799e2f7c6efc9e3b8b511996a5715972ef80f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 13:48:15 +0100
Subject: [PATCH 01/83] avutil/slicethread: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavutil/slicethread.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libavutil/slicethread.c b/libavutil/slicethread.c
index 7650fc66ad..0a2d6662e1 100644
--- a/libavutil/slicethread.c
+++ b/libavutil/slicethread.c
@@ -153,7 +153,6 @@ int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,
for (i = 0; i < nb_workers; i++) {
WorkerContext *w = &ctx->workers[i];
- int ret;
w->ctx = ctx;
ret = pthread_mutex_init(&w->mutex, NULL);
if (ret) {
--
2.52.0
>From 08139e781de599737d9d01414a031f07501aecc6 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 13:48:34 +0100
Subject: [PATCH 02/83] swscale/x86/swscale: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libswscale/x86/swscale.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index 85faf92c56..98f608f60b 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -90,7 +90,6 @@ void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
const int16_t **chrUSrcPtr = (const int16_t **)(void*) chrUPlane->line + firstChrSrcY - chrUPlane->sliceY;
const int16_t **alpSrcPtr = (CONFIG_SWSCALE_ALPHA && hasAlpha) ? (const int16_t **)(void*) alpPlane->line + firstLumSrcY - alpPlane->sliceY : NULL;
- int i;
if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->opts.src_h) {
const int16_t **tmpY = (const int16_t **) lumPlane->tmp;
@@ -131,7 +130,7 @@ void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
if (flags & SWS_ACCURATE_RND) {
int s= APCK_SIZE / 8;
- for (i=0; i<vLumFilterSize; i+=2) {
+ for (int i = 0; i < vLumFilterSize; i += 2) {
*(const void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ];
*(const void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)];
lumMmxFilter[s*i+APCK_COEF/4 ]=
@@ -144,7 +143,7 @@ void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ];
}
}
- for (i=0; i<vChrFilterSize; i+=2) {
+ for (int i = 0; i < vChrFilterSize; i += 2) {
*(const void**)&chrMmxFilter[s*i ]= chrUSrcPtr[i ];
*(const void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrUSrcPtr[i+(vChrFilterSize>1)];
chrMmxFilter[s*i+APCK_COEF/4 ]=
@@ -152,7 +151,7 @@ void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
+ (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1] * (1 << 16) : 0);
}
} else {
- for (i=0; i<vLumFilterSize; i++) {
+ for (int i = 0; i < vLumFilterSize; ++i) {
*(const void**)&lumMmxFilter[4*i+0]= lumSrcPtr[i];
lumMmxFilter[4*i+2]=
lumMmxFilter[4*i+3]=
@@ -163,7 +162,7 @@ void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2];
}
}
- for (i=0; i<vChrFilterSize; i++) {
+ for (int i = 0; i < vChrFilterSize; ++i) {
*(const void**)&chrMmxFilter[4*i+0]= chrUSrcPtr[i];
chrMmxFilter[4*i+2]=
chrMmxFilter[4*i+3]=
--
2.52.0
>From ec5e550897ce3534e2c360b8203a49162990aca9 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 13:48:53 +0100
Subject: [PATCH 03/83] avutil/aes: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavutil/aes.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavutil/aes.c b/libavutil/aes.c
index de7144fab8..273ffcc711 100644
--- a/libavutil/aes.c
+++ b/libavutil/aes.c
@@ -123,7 +123,7 @@ static inline void mix(av_aes_block state[2], uint32_t multbl[][256], int s1, in
state[0].u32[3] = mix_core(multbl, src[3][0], src[s1 - 1][1], src[1][2], src[s3 - 1][3]);
}
-static inline void aes_crypt(AVAES *a, int s, const uint8_t *sbox,
+static inline void aes_crypt(AVAES *a, int s, const uint8_t *sbox_arg,
uint32_t multbl[][256])
{
int r;
@@ -133,7 +133,7 @@ static inline void aes_crypt(AVAES *a, int s, const uint8_t *sbox,
addkey(&a->state[1], &a->state[0], &a->round_key[r]);
}
- subshift(&a->state[0], s, sbox);
+ subshift(&a->state[0], s, sbox_arg);
}
static void aes_encrypt(AVAES *a, uint8_t *dst, const uint8_t *src,
@@ -176,12 +176,12 @@ void av_aes_crypt(AVAES *a, uint8_t *dst, const uint8_t *src,
static void init_multbl2(uint32_t tbl[][256], const int c[4],
const uint8_t *log8, const uint8_t *alog8,
- const uint8_t *sbox)
+ const uint8_t *sbox_arg)
{
int i;
for (i = 0; i < 256; i++) {
- int x = sbox[i];
+ int x = sbox_arg[i];
if (x) {
int k, l, m, n;
x = log8[x];
--
2.52.0
>From 8b8dff7028276fe323a2a331ed4a13c45b2977db Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 13:49:07 +0100
Subject: [PATCH 04/83] avutil/channel_layout: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavutil/channel_layout.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index cfa8e05d56..2d7f70bf94 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -271,7 +271,7 @@ static int parse_channel_list(AVChannelLayout *ch_layout, const char *str)
while (*str) {
char *channel, *chname;
- int ret = av_opt_get_key_value(&str, "@", "+", AV_OPT_FLAG_IMPLICIT_KEY, &channel, &chname);
+ ret = av_opt_get_key_value(&str, "@", "+", AV_OPT_FLAG_IMPLICIT_KEY, &channel, &chname);
if (ret < 0) {
av_freep(&map);
return ret;
@@ -345,7 +345,7 @@ int av_channel_layout_from_string(AVChannelLayout *channel_layout,
channel_layout->nb_channels = (order + 1) * (order + 1);
if (*endptr) {
- int ret = av_channel_layout_from_string(&extra, endptr + 1);
+ ret = av_channel_layout_from_string(&extra, endptr + 1);
if (ret < 0)
return ret;
if (extra.nb_channels >= INT_MAX - channel_layout->nb_channels) {
@@ -953,10 +953,10 @@ int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrde
if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM) {
int64_t mask;
int nb_channels = channel_layout->nb_channels;
- int order = av_channel_layout_ambisonic_order(channel_layout);
- if (order < 0)
+ int amb_order = av_channel_layout_ambisonic_order(channel_layout);
+ if (amb_order < 0)
return AVERROR(ENOSYS);
- mask = masked_description(channel_layout, (order + 1) * (order + 1));
+ mask = masked_description(channel_layout, (amb_order + 1) * (amb_order + 1));
if (mask < 0)
return AVERROR(ENOSYS);
lossy = has_channel_names(channel_layout);
--
2.52.0
>From 910f94f1676e50d18f4e9fae1d932637ed818d7f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 13:50:02 +0100
Subject: [PATCH 05/83] avformat/hlsenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/hlsenc.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index dcf5da9bb8..8c4064fc75 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1211,9 +1211,9 @@ static int parse_playlist(AVFormatContext *s, const char *url, VariantStream *vs
}
} else if (av_strstart(line, "#EXT-X-PROGRAM-DATE-TIME:", &ptr)) {
struct tm program_date_time;
- int y,M,d,h,m,s;
+ int y,M,d,h,m,sec;
double ms;
- if (sscanf(ptr, "%d-%d-%dT%d:%d:%d.%lf", &y, &M, &d, &h, &m, &s, &ms) != 7) {
+ if (sscanf(ptr, "%d-%d-%dT%d:%d:%d.%lf", &y, &M, &d, &h, &m, &sec, &ms) != 7) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
@@ -1223,7 +1223,7 @@ static int parse_playlist(AVFormatContext *s, const char *url, VariantStream *vs
program_date_time.tm_mday = d;
program_date_time.tm_hour = h;
program_date_time.tm_min = m;
- program_date_time.tm_sec = s;
+ program_date_time.tm_sec = sec;
program_date_time.tm_isdst = -1;
discont_program_date_time = mktime(&program_date_time);
@@ -2749,18 +2749,17 @@ static int hls_write_trailer(struct AVFormatContext *s)
}
if (hls->segment_type == SEGMENT_TYPE_FMP4) {
- int range_length = 0;
if (!vs->init_range_length) {
uint8_t *buffer = NULL;
av_write_frame(oc, NULL); /* Flush any buffered data */
- range_length = avio_close_dyn_buf(oc->pb, &buffer);
- avio_write(vs->out, buffer, range_length);
+ int init_range_length = avio_close_dyn_buf(oc->pb, &buffer);
+ avio_write(vs->out, buffer, init_range_length);
av_freep(&buffer);
- vs->init_range_length = range_length;
+ vs->init_range_length = init_range_length;
avio_open_dyn_buf(&oc->pb);
vs->packets_written = 0;
- vs->start_pos = range_length;
+ vs->start_pos = init_range_length;
byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
if (!byterange_mode) {
ff_format_io_close(s, &vs->out);
@@ -2859,7 +2858,6 @@ static int hls_init(AVFormatContext *s)
const char *pattern;
VariantStream *vs = NULL;
const char *vtt_pattern = hls->flags & HLS_SINGLE_FILE ? ".vtt" : "%d.vtt";
- char *p = NULL;
int http_base_proto = ff_is_http_proto(s->url);
int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
double initial_program_date_time = av_gettime() / 1000000.0;
@@ -2984,7 +2982,7 @@ static int hls_init(AVFormatContext *s)
if (ret < 0)
return ret;
} else {
- p = strrchr(vs->m3u8_name, '.');
+ char *p = strrchr(vs->m3u8_name, '.');
if (p)
*p = '\0';
@@ -3034,7 +3032,7 @@ static int hls_init(AVFormatContext *s)
vs->fmp4_init_filename = expanded;
}
- p = strrchr(vs->m3u8_name, '/');
+ char *p = strrchr(vs->m3u8_name, '/');
if (p) {
char tmp = *(++p);
*p = '\0';
@@ -3058,7 +3056,7 @@ static int hls_init(AVFormatContext *s)
if (!vs->vtt_oformat)
return AVERROR_MUXER_NOT_FOUND;
- p = strrchr(vs->m3u8_name, '.');
+ char *p = strrchr(vs->m3u8_name, '.');
if (p)
*p = '\0';
--
2.52.0
>From 9a069a617f4a0bb16dafdc56674fae35f7d0334d Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 13:51:12 +0100
Subject: [PATCH 06/83] avformat/dump: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/dump.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 734a6e0bbf..decc1e9096 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -792,19 +792,19 @@ static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed,
dump_sidedata(NULL, tile_grid->coded_side_data, tile_grid->nb_coded_side_data,
tile_grid->width, tile_grid->height, (AVRational) {0,1},
" ", AV_LOG_INFO);
- for (int i = 0; i < tile_grid->nb_tiles; i++) {
+ for (unsigned j = 0; j < tile_grid->nb_tiles; ++j) {
const AVStream *st = NULL;
- if (tile_grid->offsets[i].idx < stg->nb_streams)
- st = stg->streams[tile_grid->offsets[i].idx];
+ if (tile_grid->offsets[j].idx < stg->nb_streams)
+ st = stg->streams[tile_grid->offsets[j].idx];
if (st && !printed[st->index]) {
- dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE);
+ dump_stream_format(ic, st->index, j, index, is_output, AV_LOG_VERBOSE);
printed[st->index] = 1;
}
}
- for (int i = 0; i < stg->nb_streams; i++) {
- const AVStream *st = stg->streams[i];
+ for (unsigned j = 0; j < stg->nb_streams; ++j) {
+ const AVStream *st = stg->streams[j];
if (!printed[st->index]) {
- dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_INFO);
+ dump_stream_format(ic, st->index, j, index, is_output, AV_LOG_INFO);
printed[st->index] = 1;
}
}
@@ -830,9 +830,9 @@ static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed,
if (ptr)
av_log(NULL, AV_LOG_INFO, "%s", ptr);
av_log(NULL, AV_LOG_INFO, "\n");
- for (int i = 0; i < stg->nb_streams; i++) {
- const AVStream *st = stg->streams[i];
- dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE);
+ for (unsigned j = 0; j < stg->nb_streams; ++j) {
+ const AVStream *st = stg->streams[j];
+ dump_stream_format(ic, st->index, j, index, is_output, AV_LOG_VERBOSE);
printed[st->index] = 1;
}
break;
--
2.52.0
>From 22abfeb08b9e091fefdb1783fe4f8187c0762f33 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 13:51:25 +0100
Subject: [PATCH 07/83] avformat/apetag: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/apetag.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index 0989fcb094..84645607de 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -81,7 +81,7 @@ static int ape_tag_read_field(AVFormatContext *s)
av_dict_set(&st->metadata, key, filename, 0);
if ((id = ff_guess_image2_codec(filename)) != AV_CODEC_ID_NONE) {
- int ret = ff_add_attached_pic(s, st, s->pb, NULL, size);
+ ret = ff_add_attached_pic(s, st, s->pb, NULL, size);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Error reading cover art.\n");
return ret;
--
2.52.0
>From 60e3a87a585e8f443f0e87f08e47fcf3562ffbee Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 13:51:36 +0100
Subject: [PATCH 08/83] avformat/aiffdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/aiffdec.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index ff47d8dc7b..248f8d612f 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -366,12 +366,12 @@ static int aiff_read_header(AVFormatContext *s)
size--;
if (len == 11 && size > 11) {
- uint8_t chunk[11];
+ uint8_t buf[11];
- ret = avio_read(pb, chunk, 11);
+ ret = avio_read(pb, buf, 11);
if (ret > 0)
size -= ret;
- if (!memcmp(chunk, "VADPCMCODES", sizeof(chunk))) {
+ if (!memcmp(buf, "VADPCMCODES", sizeof(buf))) {
if ((ret = ff_get_extradata(s, st->codecpar, pb, size)) < 0)
return ret;
size -= ret;
--
2.52.0
>From 465998c8ac7b8d2e4c5bcbd959439b535b3e8e82 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 13:55:11 +0100
Subject: [PATCH 09/83] avformat/avienc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/avienc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 2a3cff1210..8745bd0e3b 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -513,7 +513,7 @@ static int avi_write_header(AVFormatContext *s)
AVRational dar = av_mul_q(st->sample_aspect_ratio,
(AVRational) { par->width,
par->height });
- int num, den, fields, i;
+ int num, den, fields;
av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
if (par->field_order == AV_FIELD_TT || par->field_order == AV_FIELD_BB ||
par->field_order == AV_FIELD_TB || par->field_order == AV_FIELD_BT) {
@@ -534,15 +534,15 @@ static int avi_write_header(AVFormatContext *s)
avio_wl32(pb, par->height);
avio_wl32(pb, fields); // fields per frame
- for (i = 0; i < fields; i++) {
+ for (int j = 0; j < fields; ++j) {
int start_line;
// OpenDML v1.02 is not very specific on what value to use for
// start_line when frame data is not coming from a capturing device,
// so just use 0/1 depending on the field order for interlaced frames
if (par->field_order == AV_FIELD_TT || par->field_order == AV_FIELD_TB) {
- start_line = (i == 0) ? 0 : 1;
+ start_line = (j == 0) ? 0 : 1;
} else if (par->field_order == AV_FIELD_BB || par->field_order == AV_FIELD_BT) {
- start_line = (i == 0) ? 1 : 0;
+ start_line = (j == 0) ? 1 : 0;
} else {
start_line = 0;
}
--
2.52.0
>From e99f964ee955400019b0ffdd5542ff3742390d24 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:01:00 +0100
Subject: [PATCH 10/83] avformat/yuv4mpegdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/yuv4mpegdec.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
index 5c21858908..7e31780a20 100644
--- a/libavformat/yuv4mpegdec.c
+++ b/libavformat/yuv4mpegdec.c
@@ -36,7 +36,6 @@ static int yuv4_read_header(AVFormatContext *s)
char header[MAX_YUV4_HEADER + 10]; // Include headroom for
// the longest option
char *tokstart, *tokend, *header_end;
- int i;
AVIOContext *pb = s->pb;
int width = -1, height = -1, raten = 0,
rated = 0, aspectn = 0, aspectd = 0;
@@ -47,25 +46,25 @@ static int yuv4_read_header(AVFormatContext *s)
AVStream *st;
int64_t data_offset;
- for (i = 0; i < MAX_YUV4_HEADER; i++) {
+ for (int i = 0;;) {
header[i] = avio_r8(pb);
if (header[i] == '\n') {
header[i + 1] = 0x20; // Add a space after last option.
// Makes parsing "444" vs "444alpha" easier.
header[i + 2] = 0;
+ header_end = &header[i + 1]; // Include space
break;
}
- }
- if (i == MAX_YUV4_HEADER) {
- av_log(s, AV_LOG_ERROR, "Header too large.\n");
- return AVERROR(EINVAL);
+ if (++i == MAX_YUV4_HEADER) {
+ av_log(s, AV_LOG_ERROR, "Header too large.\n");
+ return AVERROR(EINVAL);
+ }
}
if (strncmp(header, Y4M_MAGIC, strlen(Y4M_MAGIC))) {
av_log(s, AV_LOG_ERROR, "Invalid magic number for yuv4mpeg.\n");
return AVERROR(EINVAL);
}
- header_end = &header[i + 1]; // Include space
for (tokstart = &header[strlen(Y4M_MAGIC) + 1];
tokstart < header_end; tokstart++) {
if (*tokstart == 0x20)
@@ -117,6 +116,7 @@ static int yuv4_read_header(AVFormatContext *s)
{ "mono9", AV_PIX_FMT_GRAY9, AVCHROMA_LOC_UNSPECIFIED },
{ "mono", AV_PIX_FMT_GRAY8, AVCHROMA_LOC_UNSPECIFIED },
};
+ size_t i;
for (i = 0; i < FF_ARRAY_ELEMS(pix_fmt_array); i++) {
if (av_strstart(tokstart, pix_fmt_array[i].name, NULL)) {
pix_fmt = pix_fmt_array[i].pix_fmt;
--
2.52.0
>From f4c0159381891774cac329637e3ccc9070928121 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:04:53 +0100
Subject: [PATCH 11/83] avformat/webpenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/webpenc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
index ce0d046aa9..5d0eed5a8e 100644
--- a/libavformat/webpenc.c
+++ b/libavformat/webpenc.c
@@ -163,7 +163,6 @@ static int webp_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_write(s->pb, pkt->data, pkt->size);
w->wrote_webp_header = 1; // for good measure
} else {
- int ret;
if ((ret = flush(s, 0, pkt->pts)) < 0)
return ret;
av_packet_ref(w->last_pkt, pkt);
--
2.52.0
>From 3a2c91dbfedfe6ec4f85ebc8dcdc81db0c3ae018 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:06:35 +0100
Subject: [PATCH 12/83] avformat/webmdashenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/webmdashenc.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index 3d9badc0d3..1bfb0feca1 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -307,8 +307,8 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
{
WebMDashMuxContext *w = s->priv_data;
AdaptationSet *as = &w->as[as_index];
- const AVStream *st = s->streams[as->streams[0]];
- AVCodecParameters *par = st->codecpar;
+ const AVStream *st0 = s->streams[as->streams[0]];
+ AVCodecParameters *par = st0->codecpar;
AVDictionaryEntry *lang;
AVIOContext *pb = s->pb;
int i;
@@ -332,7 +332,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
par->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio");
avio_printf(pb, " codecs=\"%s\"", get_codec_name(par->codec_id));
- lang = av_dict_get(st->metadata, "language", NULL, 0);
+ lang = av_dict_get(st0->metadata, "language", NULL, 0);
if (lang)
avio_printf(pb, " lang=\"%s\"", lang->value);
@@ -358,7 +358,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
if (w->is_live) {
AVDictionaryEntry *filename =
- av_dict_get(st->metadata, FILENAME, NULL, 0);
+ av_dict_get(st0->metadata, FILENAME, NULL, 0);
char *underscore_pos, *period_pos;
int ret;
if (!filename)
@@ -477,7 +477,6 @@ static int parse_adaptation_sets(AVFormatContext *s)
static int webm_dash_manifest_write_header(AVFormatContext *s)
{
- int i;
double start = 0.0;
int ret;
WebMDashMuxContext *w = s->priv_data;
@@ -505,7 +504,7 @@ static int webm_dash_manifest_write_header(AVFormatContext *s)
}
avio_printf(s->pb, " >\n");
- for (i = 0; i < w->nb_as; i++) {
+ for (int i = 0; i < w->nb_as; ++i) {
ret = write_adaptation_set(s, i);
if (ret < 0) {
goto fail;
--
2.52.0
>From 83e4fe0b1330fd5dacaa40456fb2311c2e31b16e Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:08:31 +0100
Subject: [PATCH 13/83] avformat/vorbiscomment: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
| 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c
index e57cfa5e62..1ef88ed6e4 100644
--- a/libavformat/vorbiscomment.c
+++ b/libavformat/vorbiscomment.c
@@ -57,7 +57,7 @@ int ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string,
return len;
}
-int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m,
+int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *dict,
const char *vendor_string,
AVChapter **chapters, unsigned int nb_chapters)
{
@@ -73,11 +73,11 @@ int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m,
cm_count += av_dict_count(chapters[i]->metadata) + 1;
}
}
- if (m) {
- int count = av_dict_count(m) + cm_count;
+ if (dict) {
+ int count = av_dict_count(dict) + cm_count;
const AVDictionaryEntry *tag = NULL;
avio_wl32(pb, count);
- while ((tag = av_dict_iterate(m, tag))) {
+ while ((tag = av_dict_iterate(dict, tag))) {
int64_t len1 = strlen(tag->key);
int64_t len2 = strlen(tag->value);
if (len1+1+len2 > UINT32_MAX)
--
2.52.0
>From a5730c7457c1dcd39cd83e3fad7a41b965dc2033 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:09:33 +0100
Subject: [PATCH 14/83] avformat/vividas: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/vividas.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index b708d71c65..bc562ad924 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -417,7 +417,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s,
}
for (j = 0; j < num_data; j++) {
- int ret = avio_read(pb, &p[offset], data_len[j]);
+ ret = avio_read(pb, &p[offset], data_len[j]);
if (ret < data_len[j]) {
st->codecpar->extradata_size = 0;
av_freep(&st->codecpar->extradata);
--
2.52.0
>From c2b59ad153761bc48efd9dd9c42bba0860f35a57 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:10:10 +0100
Subject: [PATCH 15/83] avformat/tee: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/tee.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/tee.c b/libavformat/tee.c
index 8980b42274..3a2ee92c3c 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -65,7 +65,7 @@ static const char *const slave_bsfs_spec_sep = "/";
static const char *const slave_select_sep = ",";
#define OFFSET(x) offsetof(TeeContext, x)
-static const AVOption options[] = {
+static const AVOption tee_options[] = {
{"use_fifo", "Use fifo pseudo-muxer to separate actual muxers from encoder",
OFFSET(use_fifo), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
{"fifo_options", "fifo pseudo-muxer options", OFFSET(fifo_options),
@@ -76,7 +76,7 @@ static const AVOption options[] = {
static const AVClass tee_muxer_class = {
.class_name = "Tee muxer",
.item_name = av_default_item_name,
- .option = options,
+ .option = tee_options,
.version = LIBAVUTIL_VERSION_INT,
};
--
2.52.0
>From 06ab8f6836632b3da2b45e146359aaafce89950d Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:11:52 +0100
Subject: [PATCH 16/83] avformat/tcp: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index ce9f69a50b..09dc8a9679 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -167,7 +167,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
}
p = strchr(uri, '?');
if (p) {
- int ret = ff_parse_opts_from_query_string(s, p, 1);
+ ret = ff_parse_opts_from_query_string(s, p, 1);
if (ret < 0)
return ret;
}
--
2.52.0
>From 9ac78f13768023a9385429dd053acd0009859f03 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:12:29 +0100
Subject: [PATCH 17/83] avformat/srtpproto: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/srtpproto.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/srtpproto.c b/libavformat/srtpproto.c
index 02cf156327..cf6064625c 100644
--- a/libavformat/srtpproto.c
+++ b/libavformat/srtpproto.c
@@ -37,7 +37,7 @@ typedef struct SRTPProtoContext {
#define D AV_OPT_FLAG_DECODING_PARAM
#define E AV_OPT_FLAG_ENCODING_PARAM
-static const AVOption options[] = {
+static const AVOption srtp_options[] = {
{ "srtp_out_suite", "", offsetof(SRTPProtoContext, out_suite), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
{ "srtp_out_params", "", offsetof(SRTPProtoContext, out_params), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
{ "srtp_in_suite", "", offsetof(SRTPProtoContext, in_suite), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
@@ -48,7 +48,7 @@ static const AVOption options[] = {
static const AVClass srtp_context_class = {
.class_name = "srtp",
.item_name = av_default_item_name,
- .option = options,
+ .option = srtp_options,
.version = LIBAVUTIL_VERSION_INT,
};
--
2.52.0
>From 357eff31844369fadcf0ac54b18074be9a91816d Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:14:45 +0100
Subject: [PATCH 18/83] avformat/smacker: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/smacker.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 774aad6790..e50d147cac 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -177,34 +177,34 @@ static int smacker_read_header(AVFormatContext *s)
if (rate) {
AVStream *ast = avformat_new_stream(s, NULL);
- AVCodecParameters *par;
if (!ast)
return AVERROR(ENOMEM);
+ AVCodecParameters *const apar = ast->codecpar;
+
smk->indexes[i] = ast->index;
- par = ast->codecpar;
- par->codec_type = AVMEDIA_TYPE_AUDIO;
+ apar->codec_type = AVMEDIA_TYPE_AUDIO;
if (aflag & SMK_AUD_BINKAUD) {
- par->codec_id = AV_CODEC_ID_BINKAUDIO_RDFT;
+ apar->codec_id = AV_CODEC_ID_BINKAUDIO_RDFT;
} else if (aflag & SMK_AUD_USEDCT) {
- par->codec_id = AV_CODEC_ID_BINKAUDIO_DCT;
+ apar->codec_id = AV_CODEC_ID_BINKAUDIO_DCT;
} else if (aflag & SMK_AUD_PACKED) {
- par->codec_id = AV_CODEC_ID_SMACKAUDIO;
- par->codec_tag = MKTAG('S', 'M', 'K', 'A');
+ apar->codec_id = AV_CODEC_ID_SMACKAUDIO;
+ apar->codec_tag = MKTAG('S', 'M', 'K', 'A');
} else {
- par->codec_id = AV_CODEC_ID_PCM_U8;
+ apar->codec_id = AV_CODEC_ID_PCM_U8;
}
- av_channel_layout_default(&par->ch_layout,
+ av_channel_layout_default(&apar->ch_layout,
!!(aflag & SMK_AUD_STEREO) + 1);
- par->sample_rate = rate;
- par->bits_per_coded_sample = (aflag & SMK_AUD_16BITS) ? 16 : 8;
- if (par->bits_per_coded_sample == 16 &&
- par->codec_id == AV_CODEC_ID_PCM_U8)
- par->codec_id = AV_CODEC_ID_PCM_S16LE;
+ apar->sample_rate = rate;
+ apar->bits_per_coded_sample = (aflag & SMK_AUD_16BITS) ? 16 : 8;
+ if (apar->bits_per_coded_sample == 16 &&
+ apar->codec_id == AV_CODEC_ID_PCM_U8)
+ apar->codec_id = AV_CODEC_ID_PCM_S16LE;
else
smk->duration_size[i] = 4;
- avpriv_set_pts_info(ast, 64, 1, par->sample_rate * par->ch_layout.nb_channels
- * par->bits_per_coded_sample / 8);
+ avpriv_set_pts_info(ast, 64, 1, apar->sample_rate * apar->ch_layout.nb_channels
+ * apar->bits_per_coded_sample / 8);
}
}
--
2.52.0
>From 61922a4325788d12e64fe9758b280e58db81bd3d Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:16:07 +0100
Subject: [PATCH 19/83] avformat/rmenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/rmenc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index 0d001224cb..faa6cb9bdc 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -72,7 +72,6 @@ static int rv10_write_header(AVFormatContext *ctx,
{
RMMuxContext *rm = ctx->priv_data;
AVIOContext *s = ctx->pb;
- StreamInfo *stream;
const char *desc, *mimetype;
int nb_packets, packet_total_size, packet_max_size, size, packet_avg_size, i;
int bit_rate, v, duration, flags;
@@ -142,9 +141,9 @@ static int rv10_write_header(AVFormatContext *ctx,
}
for(i=0;i<ctx->nb_streams;i++) {
+ StreamInfo *const stream = &rm->streams[i];
int codec_data_size;
- stream = &rm->streams[i];
if (stream->par->codec_type == AVMEDIA_TYPE_AUDIO) {
desc = "The Audio Stream";
--
2.52.0
>From a94e9f28ee2f1b1e0b6df7684424da3c55d00d0b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:18:24 +0100
Subject: [PATCH 20/83] avformat/rmdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/rmdec.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 2909698cda..a862faf175 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -1200,7 +1200,7 @@ static int ivr_probe(const AVProbeData *p)
static int ivr_read_header(AVFormatContext *s)
{
unsigned tag, type, len, tlen, value;
- int i, j, n, count, nb_streams = 0, ret;
+ int i, n, count, nb_streams = 0, ret;
uint8_t key[256], val[256];
AVIOContext *pb = s->pb;
AVStream *st;
@@ -1254,7 +1254,7 @@ static int ivr_read_header(AVFormatContext *s)
av_log(s, AV_LOG_DEBUG, "%s = '%s'\n", key, val);
} else if (type == 4) {
av_log(s, AV_LOG_DEBUG, "%s = '0x", key);
- for (j = 0; j < len; j++) {
+ for (unsigned j = 0; j < len; ++j) {
if (avio_feof(pb))
return AVERROR_INVALIDDATA;
av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb));
@@ -1307,10 +1307,8 @@ static int ivr_read_header(AVFormatContext *s)
if (ret < 0)
return ret;
} else if (type == 4) {
- int j;
-
av_log(s, AV_LOG_DEBUG, "%s = '0x", key);
- for (j = 0; j < len; j++) {
+ for (unsigned j = 0; j < len; ++j) {
if (avio_feof(pb))
return AVERROR_INVALIDDATA;
av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb));
--
2.52.0
>From 302765004c59ee9d4d614ddd203272f2a620d976 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:19:43 +0100
Subject: [PATCH 21/83] avformat/rawdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/rawdec.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index d0c829dc42..a1b41260a7 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -161,12 +161,11 @@ const FFInputFormat ff_data_demuxer = {
#if CONFIG_MJPEG_DEMUXER
static int mjpeg_probe(const AVProbeData *p)
{
- int i;
int state = -1;
int nb_invalid = 0;
int nb_frames = 0;
- for (i = 0; i < p->buf_size - 1; i++) {
+ for (int i = 0; i < p->buf_size - 1; ++i) {
int c;
if (p->buf[i] != 0xFF)
continue;
@@ -211,9 +210,8 @@ static int mjpeg_probe(const AVProbeData *p)
if (nb_invalid*4 + 1 < nb_frames) {
static const char ct_jpeg[] = "\r\nContent-Type: image/jpeg\r\n";
- int i;
- for (i=0; i<FFMIN(p->buf_size - (int)sizeof(ct_jpeg), 100); i++)
+ for (int i = 0; i < FFMIN(p->buf_size - (int)sizeof(ct_jpeg), 100); ++i)
if (!memcmp(p->buf + i, ct_jpeg, sizeof(ct_jpeg) - 1))
return AVPROBE_SCORE_EXTENSION;
--
2.52.0
>From e0f33b35e4e2165476add517910c0832c9369c01 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:22:22 +0100
Subject: [PATCH 22/83] avformat/matroskaenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/matroskaenc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 2c85672389..cb19584b2b 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2552,11 +2552,11 @@ static int64_t get_metadata_duration(AVFormatContext *s)
}
for (unsigned i = 0; i < s->nb_streams; i++) {
- int64_t us;
+ int64_t stream_duration_us;
duration = av_dict_get(s->streams[i]->metadata, "DURATION", NULL, 0);
- if (duration && (av_parse_time(&us, duration->value, 1) == 0))
- max = FFMAX(max, us);
+ if (duration && (av_parse_time(&stream_duration_us, duration->value, 1) == 0))
+ max = FFMAX(max, stream_duration_us);
}
av_log(s, AV_LOG_DEBUG, "get_metadata_duration returned: %" PRId64 "\n", max);
--
2.52.0
>From 277135c7251e70c749d7a1c07608212587450a7f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:26:17 +0100
Subject: [PATCH 23/83] avformat/matroskadec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/matroskadec.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 503b99b286..0ce95ab008 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1280,8 +1280,8 @@ static int ebml_parse(MatroskaDemuxContext *matroska,
MatroskaLevel *level = matroska->num_levels ? &matroska->levels[matroska->num_levels - 1] : NULL;
if (!matroska->current_id) {
- uint64_t id;
- res = ebml_read_num(matroska, pb, 4, &id, 0);
+ uint64_t id64;
+ res = ebml_read_num(matroska, pb, 4, &id64, 0);
if (res < 0) {
if (pb->eof_reached && res == AVERROR_EOF) {
if (matroska->is_live)
@@ -1300,7 +1300,7 @@ static int ebml_parse(MatroskaDemuxContext *matroska,
}
return res;
}
- matroska->current_id = id | 1 << 7 * res;
+ matroska->current_id = id64 | 1 << 7 * res;
pos_alt = pos + res;
} else {
pos_alt = pos;
@@ -3046,7 +3046,7 @@ static int mkv_parse_video(MatroskaTrack *track, AVStream *st,
if (track->video.stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB &&
track->video.stereo_mode != MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_CYAN_RED &&
track->video.stereo_mode != MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_GREEN_MAG) {
- int ret = mkv_stereo3d_conv(st, track->video.stereo_mode);
+ ret = mkv_stereo3d_conv(st, track->video.stereo_mode);
if (ret < 0)
return ret;
}
@@ -4754,8 +4754,8 @@ static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range)
// Store cue point timestamps as a comma separated list
// for checking subsegment alignment in the muxer.
av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
- for (int i = 0; i < sti->nb_index_entries; i++)
- av_bprintf(&bprint, "%" PRId64",", sti->index_entries[i].timestamp);
+ for (int j = 0; j < sti->nb_index_entries; j++)
+ av_bprintf(&bprint, "%" PRId64",", sti->index_entries[j].timestamp);
if (!av_bprint_is_complete(&bprint)) {
av_bprint_finalize(&bprint, NULL);
return AVERROR(ENOMEM);
--
2.52.0
>From 3529c8cc6b64b0350154c9da8517e73589495798 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:29:42 +0100
Subject: [PATCH 24/83] avformat/nsvdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/nsvdec.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 9b945a7c12..8acffb28fd 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -380,7 +380,6 @@ static int nsv_parse_NSVs_header(AVFormatContext *s)
uint32_t vtag, atag;
uint16_t vwidth, vheight;
AVRational framerate;
- int i;
AVStream *st;
NSVStream *nst;
@@ -388,25 +387,25 @@ static int nsv_parse_NSVs_header(AVFormatContext *s)
atag = avio_rl32(pb);
vwidth = avio_rl16(pb);
vheight = avio_rl16(pb);
- i = avio_r8(pb);
+ int framerate_code = avio_r8(pb);
- av_log(s, AV_LOG_TRACE, "NSV NSVs framerate code %2x\n", i);
- if(i&0x80) { /* odd way of giving native framerates from docs */
- int t=(i & 0x7F)>>2;
+ av_log(s, AV_LOG_TRACE, "NSV NSVs framerate code %2x\n", framerate_code);
+ if (framerate_code & 0x80) { /* odd way of giving native framerates from docs */
+ int t = (framerate_code & 0x7F)>>2;
if(t<16) framerate = (AVRational){1, t+1};
else framerate = (AVRational){t-15, 1};
- if(i&1){
+ if (framerate_code & 1) {
framerate.num *= 1000;
framerate.den *= 1001;
}
- if((i&3)==3) framerate.num *= 24;
- else if((i&3)==2) framerate.num *= 25;
+ if ((framerate_code & 3) == 3) framerate.num *= 24;
+ else if ((framerate_code & 3) == 2) framerate.num *= 25;
else framerate.num *= 30;
}
else
- framerate= (AVRational){i, 1};
+ framerate = (AVRational){framerate_code, 1};
nsv->avsync = avio_rl16(pb);
nsv->framerate = framerate;
@@ -420,7 +419,6 @@ static int nsv_parse_NSVs_header(AVFormatContext *s)
nsv->vwidth = vwidth;
nsv->vheight = vwidth;
if (vtag != T_NONE) {
- int i;
st = avformat_new_stream(s, NULL);
if (!st)
goto fail;
@@ -441,7 +439,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s)
st->start_time = 0;
st->duration = av_rescale(nsv->duration, framerate.num, 1000*framerate.den);
- for(i=0;i<nsv->index_entries;i++) {
+ for (int i = 0; i < nsv->index_entries; ++i) {
if(nsv->nsvs_timestamps) {
av_add_index_entry(st, nsv->nsvs_file_offset[i], nsv->nsvs_timestamps[i],
0, 0, AVINDEX_KEYFRAME);
--
2.52.0
>From 3962987860cc0425b70009494a5c59926c898f08 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:39:20 +0100
Subject: [PATCH 25/83] avformat/nutenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/nutenc.c | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 55efb114c3..06f9f2a2dc 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -172,12 +172,10 @@ static void build_frame_code(AVFormatContext *s)
int end = 254;
int keyframe_0_esc = s->nb_streams > 2;
int pred_table[10];
- FrameCode *ft;
- ft = &nut->frame_code[start];
- ft->flags = FLAG_CODED;
- ft->size_mul = 1;
- ft->pts_delta = 1;
+ nut->frame_code[start].flags = FLAG_CODED;
+ nut->frame_code[start].size_mul = 1;
+ nut->frame_code[start].pts_delta = 1;
start++;
if (keyframe_0_esc) {
@@ -231,8 +229,8 @@ static void build_frame_code(AVFormatContext *s)
if (par->block_align > 0) {
frame_bytes = par->block_align;
} else {
- int frame_size = av_get_audio_frame_duration2(par, 0);
- frame_bytes = frame_size * (int64_t)par->bit_rate / (8 * par->sample_rate);
+ int frame_samples = av_get_audio_frame_duration2(par, 0);
+ frame_bytes = frame_samples * (int64_t)par->bit_rate / (8 * par->sample_rate);
}
for (pts = 0; pts < 2; pts++) {
@@ -965,9 +963,8 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
NUTContext *nut = s->priv_data;
StreamContext *nus = &nut->stream[pkt->stream_index];
AVIOContext *bc = s->pb, *dyn_bc, *sm_bc = NULL;
- FrameCode *fc;
int64_t coded_pts;
- int best_length, frame_code, flags, needed_flags, i, header_idx;
+ int best_length, frame_code, needed_flags, header_idx;
int best_header_idx;
int key_frame = !!(pkt->flags & AV_PKT_FLAG_KEY);
int store_sp = 0;
@@ -1014,7 +1011,7 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
int64_t sp_pos = INT64_MAX;
ff_nut_reset_ts(nut, *nus->time_base, pkt->dts);
- for (i = 0; i < s->nb_streams; i++) {
+ for (unsigned i = 0; i < s->nb_streams; ++i) {
AVStream *st = s->streams[i];
FFStream *const sti = ffstream(st);
int64_t dts_tb = av_rescale_rnd(pkt->dts,
@@ -1054,15 +1051,15 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
if ((1ll<<60) % nut->sp_count == 0)
for (unsigned i = 0; i < s->nb_streams; i++) {
- StreamContext *nus = &nut->stream[i];
- av_reallocp_array(&nus->keyframe_pts, 2*nut->sp_count, sizeof(*nus->keyframe_pts));
- if (!nus->keyframe_pts) {
+ StreamContext *nus2 = &nut->stream[i];
+ av_reallocp_array(&nus2->keyframe_pts, 2*nut->sp_count, sizeof(*nus2->keyframe_pts));
+ if (!nus2->keyframe_pts) {
ret = AVERROR(ENOMEM);
goto fail;
}
for (int j = nut->sp_count == 1 ? 0 : nut->sp_count;
j < 2 * nut->sp_count; j++)
- nus->keyframe_pts[j] = AV_NOPTS_VALUE;
+ nus2->keyframe_pts[j] = AV_NOPTS_VALUE;
}
}
}
@@ -1076,7 +1073,7 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
best_length = INT_MAX;
frame_code = -1;
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; ++i) {
int length = 0;
FrameCode *fc = &nut->frame_code[i];
int flags = fc->flags;
@@ -1132,8 +1129,8 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
}
av_assert0(frame_code != -1);
- fc = &nut->frame_code[frame_code];
- flags = fc->flags;
+ FrameCode *fc = &nut->frame_code[frame_code];
+ int flags = fc->flags;
needed_flags = get_needed_flags(nut, nus, fc, pkt);
header_idx = fc->header_idx;
--
2.52.0
>From a7dbacb85088b56048b56162deba2c46454b9982 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:41:50 +0100
Subject: [PATCH 26/83] avformat/bonk: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/bonk.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavformat/bonk.c b/libavformat/bonk.c
index 44de8e2087..cec89b8c17 100644
--- a/libavformat/bonk.c
+++ b/libavformat/bonk.c
@@ -63,8 +63,7 @@ static int bonk_read_header(AVFormatContext *s)
const int b = avio_r8(s->pb);
if (!b) {
uint32_t t;
- int ret = ffio_ensure_seekback(s->pb, 3);
-
+ ret = ffio_ensure_seekback(s->pb, 3);
if (ret < 0)
return ret;
--
2.52.0
>From 10e0ed10ac34c382ca966fbb2e75627baa071f4c Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:43:52 +0100
Subject: [PATCH 27/83] avformat/oggenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/oggenc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 605c9d20e1..754432cb81 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -274,12 +274,12 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
page->granule = granule;
{
- AVStream *st = s->streams[page->stream_index];
+ AVRational time_base = s->streams[page->stream_index]->time_base;
- int64_t start = av_rescale_q(page->start_granule, st->time_base,
+ int64_t start = av_rescale_q(page->start_granule, time_base,
AV_TIME_BASE_Q);
int64_t next = av_rescale_q(ogg_granule_to_timestamp(oggstream, page->granule),
- st->time_base, AV_TIME_BASE_Q);
+ time_base, AV_TIME_BASE_Q);
if (page->segments_count == 255) {
ogg_buffer_page(s, oggstream);
--
2.52.0
>From 56b907f658a642398d13c11d162f59dbf921940b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:52:33 +0100
Subject: [PATCH 28/83] avformat/movenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/movenc.c | 43 +++++++++++++++++++++----------------------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index fe6b259561..0f69d9edca 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6612,7 +6612,7 @@ static int mov_flush_fragment(AVFormatContext *s, int force)
if (mov->frag_interleave) {
for (i = 0; i < mov->nb_tracks; i++) {
MOVTrack *track = &mov->tracks[i];
- int ret;
+
if ((ret = mov_flush_fragment_interleaving(s, track)) < 0)
return ret;
}
@@ -6779,7 +6779,6 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
}
if (mov->flags & FF_MOV_FLAG_FRAGMENT || mov->mode == MODE_AVIF) {
- int ret;
if (mov->moov_written || mov->flags & FF_MOV_FLAG_EMPTY_MOOV) {
if (mov->frag_interleave && mov->fragments > 0) {
if (trk->entry - trk->entries_flushed >= mov->frag_interleave) {
@@ -7428,15 +7427,15 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
* handled.
*/
for (i = 0; i < mov->nb_tracks; i++) {
- MOVTrack *trk = &mov->tracks[i];
+ MOVTrack *trk2 = &mov->tracks[i];
int ret;
- if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT &&
- trk->track_duration < pkt->dts &&
- (trk->entry == 0 || !trk->last_sample_is_subtitle_end)) {
- ret = mov_write_subtitle_end_packet(s, i, trk->track_duration);
+ if (trk2->par->codec_id == AV_CODEC_ID_MOV_TEXT &&
+ trk2->track_duration < pkt->dts &&
+ (trk2->entry == 0 || !trk2->last_sample_is_subtitle_end)) {
+ ret = mov_write_subtitle_end_packet(s, i, trk2->track_duration);
if (ret < 0) return ret;
- trk->last_sample_is_subtitle_end = 1;
+ trk2->last_sample_is_subtitle_end = 1;
}
}
@@ -7776,7 +7775,7 @@ static uint32_t rgb_to_yuv(uint32_t rgb)
static int mov_create_dvd_sub_decoder_specific_info(MOVTrack *track,
AVStream *st)
{
- int i, width = 720, height = 480;
+ int width = 720, height = 480;
int have_palette = 0, have_size = 0;
uint32_t palette[16];
char *cur = track->extradata[track->last_stsd_index];
@@ -7811,7 +7810,7 @@ static int mov_create_dvd_sub_decoder_specific_info(MOVTrack *track,
track->extradata[track->last_stsd_index] = av_malloc(16*4 + AV_INPUT_BUFFER_PADDING_SIZE);
if (!track->extradata[track->last_stsd_index])
return AVERROR(ENOMEM);
- for (i = 0; i < 16; i++) {
+ for (int i = 0; i < 16; ++i) {
AV_WB32(track->extradata[track->last_stsd_index] + i * 4, palette[i]);
}
memset(track->extradata[track->last_stsd_index] + 16*4, 0, AV_INPUT_BUFFER_PADDING_SIZE);
@@ -7906,7 +7905,7 @@ static int mov_init(AVFormatContext *s)
{
MOVMuxContext *mov = s->priv_data;
int has_iamf = 0;
- int i, ret;
+ int ret;
mov->fc = s;
mov->pkt = ffformatcontext(s)->pkt;
@@ -8042,13 +8041,13 @@ static int mov_init(AVFormatContext *s)
}
#if CONFIG_IAMFENC
- for (i = 0; i < s->nb_stream_groups; i++) {
+ for (unsigned i = 0; i < s->nb_stream_groups; ++i) {
AVStreamGroup *stg = s->stream_groups[i];
if (stg->type != AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT)
continue;
- for (int j = 0; j < stg->nb_streams; j++) {
+ for (unsigned j = 0; j < stg->nb_streams; ++j) {
AVStream *st = stg->streams[j];
if (st->priv_data) {
@@ -8065,7 +8064,7 @@ static int mov_init(AVFormatContext *s)
}
#endif
- for (i = 0; i < s->nb_streams; i++) {
+ for (unsigned i = 0; i < s->nb_streams; ++i) {
AVStream *st = s->streams[i];
if (st->priv_data)
continue;
@@ -8085,7 +8084,7 @@ static int mov_init(AVFormatContext *s)
mov->chapter_track = mov->nb_tracks++;
if (mov->flags & FF_MOV_FLAG_RTP_HINT) {
- for (i = 0; i < s->nb_streams; i++)
+ for (unsigned i = 0; i < s->nb_streams; ++i)
if (rtp_hinting_needed(s->streams[i]))
mov->nb_tracks++;
}
@@ -8100,7 +8099,7 @@ static int mov_init(AVFormatContext *s)
NULL, 0);
/* +1 tmcd track for each video stream with a timecode */
- for (i = 0; i < s->nb_streams; i++) {
+ for (unsigned i = 0; i < s->nb_streams; ++i) {
AVStream *st = s->streams[i];
AVDictionaryEntry *t = global_tcr;
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
@@ -8114,7 +8113,7 @@ static int mov_init(AVFormatContext *s)
/* check if there is already a tmcd track to remux */
if (mov->nb_meta_tmcd) {
- for (i = 0; i < s->nb_streams; i++) {
+ for (unsigned i = 0; i < s->nb_streams; ++i) {
AVStream *st = s->streams[i];
if (st->codecpar->codec_tag == MKTAG('t','m','c','d')) {
av_log(s, AV_LOG_WARNING, "You requested a copy of the original timecode track "
@@ -8133,7 +8132,7 @@ static int mov_init(AVFormatContext *s)
if (!mov->tracks)
return AVERROR(ENOMEM);
- for (i = 0; i < mov->nb_tracks; i++) {
+ for (int i = 0; i < mov->nb_tracks; ++i) {
MOVTrack *track = &mov->tracks[i];
track->stsd_count = 1;
@@ -8182,7 +8181,7 @@ static int mov_init(AVFormatContext *s)
st->priv_data = &mov->tracks[i++];
}
- for (i = 0; i < s->nb_streams; i++) {
+ for (unsigned i = 0; i < s->nb_streams; i++) {
AVStream *st= s->streams[i];
MOVTrack *track = st->priv_data;
AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0);
@@ -8280,7 +8279,7 @@ static int mov_init(AVFormatContext *s)
} else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
track->timescale = st->codecpar->sample_rate;
if (!st->codecpar->frame_size && !av_get_bits_per_sample(st->codecpar->codec_id)) {
- av_log(s, AV_LOG_WARNING, "track %d: codec frame size is not set\n", i);
+ av_log(s, AV_LOG_WARNING, "track %u: codec frame size is not set\n", i);
track->audio_vbr = 1;
}else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS ||
st->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV ||
@@ -8303,11 +8302,11 @@ static int mov_init(AVFormatContext *s)
if (track->mode != MODE_MOV &&
track->par->codec_id == AV_CODEC_ID_MP3 && track->timescale < 16000) {
if (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {
- av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not standard, to mux anyway set strict to -1\n",
+ av_log(s, AV_LOG_ERROR, "track %u: muxing mp3 at %dhz is not standard, to mux anyway set strict to -1\n",
i, track->par->sample_rate);
return AVERROR(EINVAL);
} else {
- av_log(s, AV_LOG_WARNING, "track %d: muxing mp3 at %dhz is not standard in MP4\n",
+ av_log(s, AV_LOG_WARNING, "track %u: muxing mp3 at %dhz is not standard in MP4\n",
i, track->par->sample_rate);
}
}
--
2.52.0
>From 16e4363f18018932e0be6661fda18525bfec1e8c Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 14:55:06 +0100
Subject: [PATCH 29/83] avformat/dhav: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/dhav.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavformat/dhav.c b/libavformat/dhav.c
index 614934dc68..4a1428544d 100644
--- a/libavformat/dhav.c
+++ b/libavformat/dhav.c
@@ -482,8 +482,7 @@ static int dhav_read_seek(AVFormatContext *s, int stream_index,
return -1;
for (int n = 0; n < s->nb_streams; n++) {
- AVStream *st = s->streams[n];
- DHAVStream *dst = st->priv_data;
+ DHAVStream *const dst = s->streams[n]->priv_data;
dst->pts = pts;
dst->last_time = AV_NOPTS_VALUE;
--
2.52.0
>From f4c1ea1f53d2f52fc3f7685939797f3278bcf7f3 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:02:24 +0100
Subject: [PATCH 30/83] avformat/mp3dec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/mp3dec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 5b153c7c9e..696f3f57cb 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -439,8 +439,8 @@ static int mp3_read_header(AVFormatContext *s)
return off;
// the seek index is relative to the end of the xing vbr headers
- for (int i = 0; i < sti->nb_index_entries; i++)
- sti->index_entries[i].pos += off;
+ for (int j = 0; j < sti->nb_index_entries; ++j)
+ sti->index_entries[j].pos += off;
/* the parameters will be extracted from the compressed bitstream */
return 0;
--
2.52.0
>From fa68bd8e1131804cbe47eb6fa9e79ffe7abc916d Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:02:43 +0100
Subject: [PATCH 31/83] avformat/mpegtsenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/mpegtsenc.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 96cdea955e..3578c3fd46 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1878,15 +1878,13 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
const int64_t max_audio_delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE) / 2;
int64_t dts = pkt->dts, pts = pkt->pts;
int opus_samples = 0;
- size_t side_data_size;
- uint8_t *side_data = NULL;
int stream_id = -1;
- side_data = av_packet_get_side_data(pkt,
- AV_PKT_DATA_MPEGTS_STREAM_ID,
- &side_data_size);
- if (side_data)
- stream_id = side_data[0];
+ uint8_t *stream_id_p = av_packet_get_side_data(pkt,
+ AV_PKT_DATA_MPEGTS_STREAM_ID,
+ NULL);
+ if (stream_id_p)
+ stream_id = stream_id_p[0];
if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) {
ts->first_pcr += dts * SYSTEM_CLOCK_FREQUENCY_DIVISOR;
--
2.52.0
>From 2e37dc3d340b4fb3a94e0a110dda124a715d1029 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:12:07 +0100
Subject: [PATCH 32/83] avformat/mpegts: Factor DVB sub handling out, fix
shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/mpegts.c | 127 ++++++++++++++++++++++---------------------
1 file changed, 65 insertions(+), 62 deletions(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index a9094ab55b..e7f5b65009 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1148,6 +1148,67 @@ static int read_sl_header(PESContext *pes, SLConfigDescr *sl,
return (get_bits_count(&gb) + 7) >> 3;
}
+static void mpegts_handle_dvb_teletext_subtitles(PESContext *const pes)
+{
+ AVProgram *p = NULL;
+ int pcr_found = 0;
+
+ while ((p = av_find_program_from_stream(pes->stream, p, pes->st->index))) {
+ if (p->pcr_pid == 1 || p->discard == AVDISCARD_ALL)
+ continue;
+ MpegTSFilter *f = pes->ts->pids[p->pcr_pid];
+ if (!f)
+ continue;
+
+ AVStream *st = NULL;
+ if (f->type == MPEGTS_PES) {
+ PESContext *pcrpes = f->u.pes_filter.opaque;
+ if (pcrpes)
+ st = pcrpes->st;
+ } else if (f->type == MPEGTS_PCR) {
+ for (unsigned i = 0; i < p->nb_stream_indexes; ++i) {
+ AVStream *pst = pes->stream->streams[p->stream_index[i]];
+ if (pst->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
+ st = pst;
+ }
+ }
+ if (f->last_pcr != -1 && !f->discard) {
+ // teletext packets do not always have correct timestamps,
+ // the standard says they should be handled after 40.6 ms at most,
+ // and the pcr error to this packet should be no more than 100 ms.
+ // TODO: we should interpolate the PCR, not just use the last one
+ int64_t pcr = f->last_pcr / SYSTEM_CLOCK_FREQUENCY_DIVISOR;
+ pcr_found = 1;
+ if (st) {
+ const FFStream *const sti = ffstream(st);
+ FFStream *const pes_sti = ffstream(pes->st);
+
+ pes_sti->pts_wrap_reference = sti->pts_wrap_reference;
+ pes_sti->pts_wrap_behavior = sti->pts_wrap_behavior;
+ }
+ if (pes->dts == AV_NOPTS_VALUE || pes->dts < pcr) {
+ pes->pts = pes->dts = pcr;
+ } else if (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT &&
+ pes->dts > pcr + 3654 + 9000) {
+ pes->pts = pes->dts = pcr + 3654 + 9000;
+ } else if (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE &&
+ pes->dts > pcr + 10*90000) { //10sec
+ pes->pts = pes->dts = pcr + 3654 + 9000;
+ }
+ break;
+ }
+ }
+
+ if (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT && !pcr_found) {
+ av_log(pes->stream, AV_LOG_VERBOSE,
+ "Forcing DTS/PTS to be unset for a "
+ "non-trustworthy PES packet for PID %d as "
+ "PCR hasn't been received yet.\n",
+ pes->pid);
+ pes->dts = pes->pts = AV_NOPTS_VALUE;
+ }
+}
+
static AVBufferRef *buffer_pool_get(MpegTSContext *ts, int size)
{
int index = av_log2(size + AV_INPUT_BUFFER_PADDING_SIZE);
@@ -1336,68 +1397,10 @@ skip:
p += 5;
buf_size -= 5;
}
- if ( pes->ts->fix_teletext_pts
- && ( pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT
- || pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE)
- ) {
- AVProgram *p = NULL;
- int pcr_found = 0;
- while ((p = av_find_program_from_stream(pes->stream, p, pes->st->index))) {
- if (p->pcr_pid != -1 && p->discard != AVDISCARD_ALL) {
- MpegTSFilter *f = pes->ts->pids[p->pcr_pid];
- if (f) {
- AVStream *st = NULL;
- if (f->type == MPEGTS_PES) {
- PESContext *pcrpes = f->u.pes_filter.opaque;
- if (pcrpes)
- st = pcrpes->st;
- } else if (f->type == MPEGTS_PCR) {
- int i;
- for (i = 0; i < p->nb_stream_indexes; i++) {
- AVStream *pst = pes->stream->streams[p->stream_index[i]];
- if (pst->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
- st = pst;
- }
- }
- if (f->last_pcr != -1 && !f->discard) {
- // teletext packets do not always have correct timestamps,
- // the standard says they should be handled after 40.6 ms at most,
- // and the pcr error to this packet should be no more than 100 ms.
- // TODO: we should interpolate the PCR, not just use the last one
- int64_t pcr = f->last_pcr / SYSTEM_CLOCK_FREQUENCY_DIVISOR;
- pcr_found = 1;
- if (st) {
- const FFStream *const sti = ffstream(st);
- FFStream *const pes_sti = ffstream(pes->st);
-
- pes_sti->pts_wrap_reference = sti->pts_wrap_reference;
- pes_sti->pts_wrap_behavior = sti->pts_wrap_behavior;
- }
- if (pes->dts == AV_NOPTS_VALUE || pes->dts < pcr) {
- pes->pts = pes->dts = pcr;
- } else if (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT &&
- pes->dts > pcr + 3654 + 9000) {
- pes->pts = pes->dts = pcr + 3654 + 9000;
- } else if (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE &&
- pes->dts > pcr + 10*90000) { //10sec
- pes->pts = pes->dts = pcr + 3654 + 9000;
- }
- break;
- }
- }
- }
- }
-
- if (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT &&
- !pcr_found) {
- av_log(pes->stream, AV_LOG_VERBOSE,
- "Forcing DTS/PTS to be unset for a "
- "non-trustworthy PES packet for PID %d as "
- "PCR hasn't been received yet.\n",
- pes->pid);
- pes->dts = pes->pts = AV_NOPTS_VALUE;
- }
- }
+ if (pes->ts->fix_teletext_pts &&
+ (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT ||
+ pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE))
+ mpegts_handle_dvb_teletext_subtitles(pes);
}
break;
case MPEGTS_PAYLOAD:
--
2.52.0
>From 88e5ffc7e2c9f523e2a0e75a7e157fa3a63b5355 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:16:17 +0100
Subject: [PATCH 33/83] avformat/mpegenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/mpegenc.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index c41aa1095c..9aea361f74 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -1011,8 +1011,6 @@ static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr)
static int output_packet(AVFormatContext *ctx, int flush)
{
MpegMuxContext *s = ctx->priv_data;
- AVStream *st;
- StreamInfo *stream;
int i, avail_space = 0, es_size, trailer_size;
int best_i = -1;
int best_score = INT_MIN;
@@ -1093,8 +1091,7 @@ retry:
av_assert0(best_i >= 0);
- st = ctx->streams[best_i];
- stream = st->priv_data;
+ StreamInfo *stream = ctx->streams[best_i]->priv_data;
av_assert0(av_fifo_can_read(stream->fifo) > 0);
@@ -1243,7 +1240,7 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
av_fifo_write(stream->fifo, buf, size);
for (;;) {
- int ret = output_packet(ctx, 0);
+ ret = output_packet(ctx, 0);
if (ret <= 0)
return ret;
}
--
2.52.0
>From 4f820d4dca62e59260a78381e413fa28e53783d7 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:24:48 +0100
Subject: [PATCH 34/83] avformat/mpc8: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/mpc8.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 6b6db1b283..1540524c1f 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -297,7 +297,7 @@ static int mpc8_read_header(AVFormatContext *s)
avio_skip(pb, size);
if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
- int64_t pos = avio_tell(s->pb);
+ pos = avio_tell(s->pb);
c->apetag_start = ff_ape_parse_tag(s);
avio_seek(s->pb, pos, SEEK_SET);
}
--
2.52.0
>From d112e32c740d972bd51ff6d90471662078e4fda4 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:34:21 +0100
Subject: [PATCH 35/83] avformat/avidec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/avidec.c | 50 +++++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 26 deletions(-)
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 8fb6931e5d..d7f8610628 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -377,15 +377,15 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
{
uint64_t tag_end = avio_tell(s->pb) + size;
while (avio_tell(s->pb) < tag_end && !avio_feof(s->pb)) {
- uint16_t tag = avio_rl16(s->pb);
- uint16_t size = avio_rl16(s->pb);
+ uint16_t tag2 = avio_rl16(s->pb);
+ uint16_t size2 = avio_rl16(s->pb);
const char *name = NULL;
char buffer[64] = { 0 };
uint64_t remaining = tag_end - avio_tell(s->pb);
- size = FFMIN(size, remaining);
- size -= avio_read(s->pb, buffer,
- FFMIN(size, sizeof(buffer) - 1));
- switch (tag) {
+ size2 = FFMIN(size2, remaining);
+ size2 -= avio_read(s->pb, buffer,
+ FFMIN(size2, sizeof(buffer) - 1));
+ switch (tag2) {
case 0x03:
name = "maker";
break;
@@ -400,7 +400,7 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
}
if (name)
av_dict_set(&s->metadata, name, buffer, 0);
- avio_skip(s->pb, size);
+ avio_skip(s->pb, size2);
}
break;
}
@@ -513,7 +513,6 @@ static int avi_read_header(AVFormatContext *s)
int codec_type, stream_index, frame_period;
unsigned int size;
int i;
- AVStream *st;
AVIStream *ast = NULL;
int avih_width = 0, avih_height = 0;
int amv_file_format = 0;
@@ -599,7 +598,7 @@ static int avi_read_header(AVFormatContext *s)
avio_skip(pb, size - 10 * 4);
break;
- case MKTAG('s', 't', 'r', 'h'):
+ case MKTAG('s', 't', 'r', 'h'): {
/* stream header */
tag1 = avio_rl32(pb);
@@ -608,18 +607,17 @@ static int avi_read_header(AVFormatContext *s)
if (tag1 == MKTAG('p', 'a', 'd', 's')) {
avio_skip(pb, size - 8);
break;
- } else {
- stream_index++;
- st = avformat_new_stream(s, NULL);
- if (!st)
- return AVERROR(ENOMEM);
-
- st->id = stream_index;
- ast = av_mallocz(sizeof(AVIStream));
- if (!ast)
- return AVERROR(ENOMEM);
- st->priv_data = ast;
}
+ stream_index++;
+ AVStream *const st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ st->id = stream_index;
+ ast = av_mallocz(sizeof(AVIStream));
+ if (!ast)
+ return AVERROR(ENOMEM);
+ st->priv_data = ast;
if (amv_file_format)
tag1 = stream_index ? MKTAG('a', 'u', 'd', 's')
: MKTAG('v', 'i', 'd', 's');
@@ -758,6 +756,7 @@ static int avi_read_header(AVFormatContext *s)
ast->frame_offset = ast->cum_len;
avio_skip(pb, size - 12 * 4);
break;
+ }
case MKTAG('s', 't', 'r', 'f'):
/* stream header */
if (!size && (codec_type == AVMEDIA_TYPE_AUDIO ||
@@ -767,12 +766,11 @@ static int avi_read_header(AVFormatContext *s)
avio_skip(pb, size);
} else {
uint64_t cur_pos = avio_tell(pb);
- FFStream *sti;
unsigned esize;
if (cur_pos < list_end)
size = FFMIN(size, list_end - cur_pos);
- st = s->streams[stream_index];
- sti = ffstream(st);
+ AVStream *const st = s->streams[stream_index];
+ FFStream *const sti = ffstream(st);
if (st->codecpar->codec_type != AVMEDIA_TYPE_UNKNOWN) {
avio_skip(pb, size);
break;
@@ -972,7 +970,7 @@ static int avi_read_header(AVFormatContext *s)
uint64_t cur_pos = avio_tell(pb);
if (cur_pos < list_end)
size = FFMIN(size, list_end - cur_pos);
- st = s->streams[stream_index];
+ AVStream *const st = s->streams[stream_index];
if (size<(1<<30)) {
if (st->codecpar->extradata) {
@@ -1002,9 +1000,9 @@ static int avi_read_header(AVFormatContext *s)
break;
case MKTAG('v', 'p', 'r', 'p'):
if (stream_index < (unsigned)s->nb_streams && size > 9 * 4) {
+ AVStream *const st = s->streams[stream_index];
AVRational active, active_aspect;
- st = s->streams[stream_index];
avio_rl32(pb);
avio_rl32(pb);
avio_rl32(pb);
@@ -1497,7 +1495,7 @@ resync:
FFStream *const sti = ffstream(st);
AVIStream *ast = st->priv_data;
int dv_demux = CONFIG_DV_DEMUXER && avi->dv_demux;
- int size, err;
+ int size;
if (get_subtitle_pkt(s, st, pkt))
return 0;
--
2.52.0
>From fce55f0da1af4c48d4c3808ba722924aee409250 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:38:20 +0100
Subject: [PATCH 36/83] avformat/avio: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/avio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/avio.c b/libavformat/avio.c
index b146ac9f19..c685e0ab71 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -57,7 +57,7 @@ static void *urlcontext_child_next(void *obj, void *prev)
#define OFFSET(x) offsetof(URLContext,x)
#define E AV_OPT_FLAG_ENCODING_PARAM
#define D AV_OPT_FLAG_DECODING_PARAM
-static const AVOption options[] = {
+static const AVOption urlcontext_options[] = {
{"protocol_whitelist", "List of protocols that are allowed to be used", OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
{"protocol_blacklist", "List of protocols that are not allowed to be used", OFFSET(protocol_blacklist), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
{"rw_timeout", "Timeout for IO operations (in microseconds)", offsetof(URLContext, rw_timeout), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_DECODING_PARAM },
@@ -67,7 +67,7 @@ static const AVOption options[] = {
static const AVClass url_context_class = {
.class_name = "URLContext",
.item_name = urlcontext_to_name,
- .option = options,
+ .option = urlcontext_options,
.version = LIBAVUTIL_VERSION_INT,
.child_next = urlcontext_child_next,
.child_class_iterate = ff_urlcontext_child_class_iterate,
--
2.52.0
>From d5316682ab9afc2dd8c7dcfbb6a1f6df0e8e8a13 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:38:32 +0100
Subject: [PATCH 37/83] avformat/aviobuf: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/aviobuf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 373a48eea5..cc71638f0c 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -392,10 +392,10 @@ static inline int put_str16(AVIOContext *s, const char *str, const int be)
while (*q) {
uint32_t ch;
- uint16_t tmp;
+ uint16_t tmp16;
GET_UTF8(ch, *q++, goto invalid;)
- PUT_UTF16(ch, tmp, be ? avio_wb16(s, tmp) : avio_wl16(s, tmp);
+ PUT_UTF16(ch, tmp16, be ? avio_wb16(s, tmp16) : avio_wl16(s, tmp16);
ret += 2;)
continue;
invalid:
--
2.52.0
>From 6fe54ef79548ae1046b0c4e348c253c62b6b6ab6 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:43:34 +0100
Subject: [PATCH 38/83] avformat/dovi_isom: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/dovi_isom.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/dovi_isom.c b/libavformat/dovi_isom.c
index 269374cff9..952bd56acf 100644
--- a/libavformat/dovi_isom.c
+++ b/libavformat/dovi_isom.c
@@ -57,9 +57,9 @@ int ff_isom_parse_dvcc_dvvc(void *logctx, AVStream *st,
// Has enough remaining data
if (size >= 5) {
- uint8_t buf = *buf_ptr++;
- dovi->dv_bl_signal_compatibility_id = (buf >> 4) & 0x0f; // 4 bits
- dovi->dv_md_compression = (buf >> 2) & 0x03; // 2 bits
+ uint8_t byte = *buf_ptr++;
+ dovi->dv_bl_signal_compatibility_id = (byte >> 4) & 0x0f; // 4 bits
+ dovi->dv_md_compression = (byte >> 2) & 0x03; // 2 bits
} else {
// 0 stands for None
// Dolby Vision V1.2.93 profiles and levels
--
2.52.0
>From 08347b977a401381658242b3e44ed08d85269f81 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:53:51 +0100
Subject: [PATCH 39/83] avformat/dsfdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/dsfdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/dsfdec.c b/libavformat/dsfdec.c
index 17e109e345..87a5fd0272 100644
--- a/libavformat/dsfdec.c
+++ b/libavformat/dsfdec.c
@@ -175,7 +175,7 @@ static int dsf_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t packet_size = dsf->audio_size - data_pos;
int64_t skip_size = dsf->data_size - data_pos - packet_size;
uint8_t *dst;
- int ch, ret;
+ int ch;
if (packet_size <= 0 || skip_size <= 0)
return AVERROR_INVALIDDATA;
--
2.52.0
>From 1e3734d598876e9e9fe52d96be2a42002192bbae Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:54:07 +0100
Subject: [PATCH 40/83] avcodec/cbs_av1_syntax_template: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/cbs_av1_syntax_template.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
index 5518544a4d..4a46568b53 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -595,7 +595,7 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,
int max_tile_width_sb, max_tile_height_sb, max_tile_area_sb;
int min_log2_tile_cols, max_log2_tile_cols, max_log2_tile_rows;
int min_log2_tiles, min_log2_tile_rows;
- int i, err;
+ int err;
mi_cols = 2 * ((priv->frame_width + 7) >> 3);
mi_rows = 2 * ((priv->frame_height + 7) >> 3);
@@ -627,8 +627,8 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,
tile_width_sb = (sb_cols + (1 << current->tile_cols_log2) - 1) >>
current->tile_cols_log2;
- for (int off = 0, i = 0; off < sb_cols; off += tile_width_sb)
- current->tile_start_col_sb[i++] = off;
+ for (int off = 0, j = 0; off < sb_cols; off += tile_width_sb)
+ current->tile_start_col_sb[j++] = off;
current->tile_cols = (sb_cols + tile_width_sb - 1) / tile_width_sb;
@@ -639,11 +639,12 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,
tile_height_sb = (sb_rows + (1 << current->tile_rows_log2) - 1) >>
current->tile_rows_log2;
- for (int off = 0, i = 0; off < sb_rows; off += tile_height_sb)
- current->tile_start_row_sb[i++] = off;
+ for (int off = 0, j = 0; off < sb_rows; off += tile_height_sb)
+ current->tile_start_row_sb[j++] = off;
current->tile_rows = (sb_rows + tile_height_sb - 1) / tile_height_sb;
+ int i;
for (i = 0; i < current->tile_cols - 1; i++)
infer(width_in_sbs_minus_1[i], tile_width_sb - 1);
infer(width_in_sbs_minus_1[i],
@@ -654,7 +655,7 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,
sb_rows - (current->tile_rows - 1) * tile_height_sb - 1);
} else {
- int widest_tile_sb, start_sb, size_sb, max_width, max_height;
+ int widest_tile_sb, start_sb, size_sb, max_width, max_height, i;
widest_tile_sb = 0;
--
2.52.0
>From ca53322e1ff74168916aebcd164a8123a7b0484b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:56:23 +0100
Subject: [PATCH 41/83] avformat/iamf_reader: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/iamf_reader.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavformat/iamf_reader.c b/libavformat/iamf_reader.c
index 418ab5d1c1..516e284adf 100644
--- a/libavformat/iamf_reader.c
+++ b/libavformat/iamf_reader.c
@@ -241,15 +241,15 @@ static int parameter_block_obu(AVFormatContext *s, IAMFDemuxContext *c,
av_assert0(audio_element && audio_element->celement);
element = audio_element->celement;
- for (int i = 0; i < element->nb_layers; i++) {
- const AVIAMFLayer *layer = element->layers[i];
+ for (unsigned j = 0; j < element->nb_layers; ++j) {
+ const AVIAMFLayer *layer = element->layers[j];
if (layer->flags & AV_IAMF_LAYER_FLAG_RECON_GAIN) {
unsigned int recon_gain_flags = ffio_read_leb(pb);
unsigned int bitcount = 7 + 5 * !!(recon_gain_flags & 0x80);
recon_gain_flags = (recon_gain_flags & 0x7F) | ((recon_gain_flags & 0xFF00) >> 1);
- for (int j = 0; j < bitcount; j++) {
- if (recon_gain_flags & (1 << j))
- recon->recon_gain[i][j] = avio_r8(pb);
+ for (unsigned k = 0; k < bitcount; ++k) {
+ if (recon_gain_flags & (1 << k))
+ recon->recon_gain[j][k] = avio_r8(pb);
}
}
}
--
2.52.0
>From 3e97204d783a1107fe3f4fca2bd7ae9493cf213f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:57:25 +0100
Subject: [PATCH 42/83] avformat/iamf_writer: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/iamf_writer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/iamf_writer.c b/libavformat/iamf_writer.c
index fcf7929830..0ae0136f82 100644
--- a/libavformat/iamf_writer.c
+++ b/libavformat/iamf_writer.c
@@ -934,8 +934,8 @@ static int iamf_write_mixing_presentation(const IAMFContext *iamf,
avio_wb16(dyn_bc, rescale_rational(sub_mix->default_mix_gain, 1 << 8));
ffio_write_leb(dyn_bc, sub_mix->nb_layouts); // nb_layouts
- for (int i = 0; i < sub_mix->nb_layouts; i++) {
- const AVIAMFSubmixLayout *submix_layout = sub_mix->layouts[i];
+ for (unsigned j = 0; j < sub_mix->nb_layouts; ++j) {
+ const AVIAMFSubmixLayout *submix_layout = sub_mix->layouts[j];
int layout, info_type;
int dialogue = submix_layout->dialogue_anchored_loudness.num &&
submix_layout->dialogue_anchored_loudness.den;
--
2.52.0
>From 9462481890f3bc5e75acd382a64f414423938910 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 15:59:13 +0100
Subject: [PATCH 43/83] avformat/oggparseopus: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/oggparseopus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c
index ae4ff22c53..43840c003e 100644
--- a/libavformat/oggparseopus.c
+++ b/libavformat/oggparseopus.c
@@ -181,7 +181,7 @@ static int opus_packet(AVFormatContext *avf, int idx)
for (; seg < os->nsegs; seg++) {
next_pkt += os->segments[seg];
if (os->segments[seg] < 255 && next_pkt != last_pkt) {
- int d = opus_duration(last_pkt, next_pkt - last_pkt);
+ d = opus_duration(last_pkt, next_pkt - last_pkt);
if (d > 0)
duration += d;
last_pkt = next_pkt;
--
2.52.0
>From 961f617ac1acd2aa0274782b6a9839999e689ee6 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 16:03:21 +0100
Subject: [PATCH 44/83] avformat/rtpdec_xiph: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/rtpdec_xiph.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
index 23924f2363..98e4db48f9 100644
--- a/libavformat/rtpdec_xiph.c
+++ b/libavformat/rtpdec_xiph.c
@@ -187,7 +187,7 @@ static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data,
if (fragmented == 3) {
// end of xiph data packet
- int ret = ff_rtp_finalize_packet(pkt, &data->fragment, st->index);
+ ret = ff_rtp_finalize_packet(pkt, &data->fragment, st->index);
if (ret < 0) {
av_log(ctx, AV_LOG_ERROR,
"Error occurred when getting fragment buffer.");
--
2.52.0
>From a48b6ed63f8c1e890b8cc999b010057eb615861b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 16:03:49 +0100
Subject: [PATCH 45/83] avformat/rtpenc_mpegts: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/rtpenc_mpegts.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c
index f9ff7e99cd..806786f978 100644
--- a/libavformat/rtpenc_mpegts.c
+++ b/libavformat/rtpenc_mpegts.c
@@ -61,7 +61,7 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
const AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL);
const AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
int i, ret = AVERROR(ENOMEM);
- AVStream *st;
+ AVStream *new_st;
AVDictionary *mpegts_muxer_options = NULL;
AVDictionary *rtp_muxer_options = NULL;
@@ -107,14 +107,14 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
goto fail;
}
rtp_ctx->oformat = rtp_format;
- st = avformat_new_stream(rtp_ctx, NULL);
- if (!st) {
+ new_st = avformat_new_stream(rtp_ctx, NULL);
+ if (!new_st) {
ret = AVERROR(ENOMEM);
goto fail;
}
- st->time_base.num = 1;
- st->time_base.den = 90000;
- st->codecpar->codec_id = AV_CODEC_ID_MPEG2TS;
+ new_st->time_base.num = 1;
+ new_st->time_base.den = 90000;
+ new_st->codecpar->codec_id = AV_CODEC_ID_MPEG2TS;
rtp_ctx->pb = s->pb;
av_dict_copy(&rtp_muxer_options, chain->rtp_muxer_options, 0);
ret = avformat_write_header(rtp_ctx, &rtp_muxer_options);
--
2.52.0
>From 20cf42d03cef5af09229b8bd9db249f3ded25527 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 16:25:29 +0100
Subject: [PATCH 46/83] avformat/asfdec_f: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/asfdec_f.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index 3b46fe01f6..1e9ecfe91f 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -671,7 +671,6 @@ static int asf_read_marker(AVFormatContext *s)
for (i = 0; i < count; i++) {
int64_t pres_time;
- int name_len;
if (avio_feof(pb))
return AVERROR_INVALIDDATA;
@@ -1138,7 +1137,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
ASFContext *asf = s->priv_data;
ASFStream *asf_st = 0;
for (;;) {
- int ret;
+ int read;
if (avio_feof(pb))
return AVERROR_EOF;
if (asf->packet_size_left < FRAME_HEADER_SIZE ||
@@ -1279,28 +1278,28 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
asf_st->pkt_clean = 1;
}
- ret = avio_read(pb, asf_st->pkt.data + asf->packet_frag_offset,
- asf->packet_frag_size);
- if (ret != asf->packet_frag_size) {
- if (ret < 0 || asf->packet_frag_offset + ret == 0)
- return ret < 0 ? ret : AVERROR_EOF;
+ read = avio_read(pb, asf_st->pkt.data + asf->packet_frag_offset,
+ asf->packet_frag_size);
+ if (read != asf->packet_frag_size) {
+ if (read < 0 || asf->packet_frag_offset + read == 0)
+ return read < 0 ? read : AVERROR_EOF;
if (asf_st->ds_span > 1) {
// scrambling, we can either drop it completely or fill the remainder
// TODO: should we fill the whole packet instead of just the current
// fragment?
- memset(asf_st->pkt.data + asf->packet_frag_offset + ret, 0,
- asf->packet_frag_size - ret);
- ret = asf->packet_frag_size;
+ memset(asf_st->pkt.data + asf->packet_frag_offset + read, 0,
+ asf->packet_frag_size - read);
+ read = asf->packet_frag_size;
} else {
// no scrambling, so we can return partial packets
- av_shrink_packet(&asf_st->pkt, asf->packet_frag_offset + ret);
+ av_shrink_packet(&asf_st->pkt, asf->packet_frag_offset + read);
}
}
if (s->key && s->keylen == 20)
ff_asfcrypt_dec(s->key, asf_st->pkt.data + asf->packet_frag_offset,
- ret);
- asf_st->frag_offset += ret;
+ read);
+ asf_st->frag_offset += read;
/* test if whole packet is read */
if (asf_st->frag_offset == asf_st->pkt.size) {
// workaround for macroshit radio DVR-MS files
@@ -1578,11 +1577,11 @@ static int asf_read_seek(AVFormatContext *s, int stream_index,
/* Try using the protocol's read_seek if available */
if (s->pb) {
- int64_t ret = avio_seek_time(s->pb, stream_index, pts, flags);
- if (ret >= 0)
+ int64_t ret64 = avio_seek_time(s->pb, stream_index, pts, flags);
+ if (ret64 >= 0)
asf_reset_header(s);
- if (ret != AVERROR(ENOSYS))
- return ret;
+ if (ret64 != AVERROR(ENOSYS))
+ return ret64;
}
/* explicitly handle the case of seeking to 0 */
--
2.52.0
>From 842b8008c0780f33fbad6332aea1151b29669f40 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 16:27:47 +0100
Subject: [PATCH 47/83] avformat/lafdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/lafdec.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/libavformat/lafdec.c b/libavformat/lafdec.c
index e641d4b6ee..f9d90595ae 100644
--- a/libavformat/lafdec.c
+++ b/libavformat/lafdec.c
@@ -199,13 +199,8 @@ again:
uint8_t val = s->header[i];
for (int j = 0; j < 8 && cur_st < ctx->nb_streams; j++, cur_st++) {
- StreamParams *stp = &s->p[st_index];
-
- stp->stored = 0;
- if (val & 1) {
- stp->stored = 1;
- st_count++;
- }
+ s->p[st_index].stored = val & 1;
+ st_count += val & 1;
val >>= 1;
st_index++;
}
--
2.52.0
>From 61799eece99c8b57f61fec0a2a84c95f366208fd Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 16:47:39 +0100
Subject: [PATCH 48/83] avformat/mov: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/mov.c | 79 +++++++++++++++++++++++------------------------
1 file changed, 38 insertions(+), 41 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1a4450153f..0de575e15b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -166,7 +166,7 @@ static const uint32_t mac_to_unicode[128] = {
0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7,
};
-static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len,
+static int mov_read_mac_string(AVIOContext *const pb, int len,
char *dst, int dstlen)
{
char *p = dst;
@@ -521,7 +521,7 @@ retry:
parse(c, pb, str_size, key);
else {
if (!raw && (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff)))) { // MAC Encoded
- mov_read_mac_string(c, pb, str_size, str, str_size_alloc);
+ mov_read_mac_string(pb, str_size, str, str_size_alloc);
} else if (data_type == 21) { // BE signed integer, variable size
int val = 0;
if (str_size == 1)
@@ -2736,7 +2736,7 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb,
len = avio_r8(pb); /* codec name, pascal string */
if (len > 31)
len = 31;
- mov_read_mac_string(c, pb, len, codec_name, sizeof(codec_name));
+ mov_read_mac_string(pb, len, codec_name, sizeof(codec_name));
if (len < 31)
avio_skip(pb, 31 - len);
@@ -4705,7 +4705,6 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
unsigned int stsc_index = 0;
unsigned int stss_index = 0;
unsigned int stps_index = 0;
- unsigned int i, j;
uint64_t stream_size = 0;
int ret = build_open_gop_key_points(st);
@@ -4713,11 +4712,11 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
return;
if (sc->elst_count) {
- int i, edit_start_index = 0, multiple_edits = 0;
+ int edit_start_index = 0, multiple_edits = 0;
int64_t empty_duration = 0; // empty duration of the first edit list entry
int64_t start_time = 0; // start time of the media
- for (i = 0; i < sc->elst_count; i++) {
+ for (unsigned i = 0; i < sc->elst_count; ++i) {
const MOVElst *e = &sc->elst_data[i];
if (i == 0 && e->time == -1) {
/* if empty, the first entry is the start time of the stream
@@ -4790,7 +4789,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
if (ret < 0)
return;
- for (i = 0; i < sc->chunk_count; i++) {
+ for (unsigned i = 0; i < sc->chunk_count; ++i) {
int64_t next_offset = i+1 < sc->chunk_count ? sc->chunk_offsets[i+1] : INT64_MAX;
current_offset = sc->chunk_offsets[i];
while (mov_stsc_index_valid(stsc_index, sc->stsc_count) &&
@@ -4807,7 +4806,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
sc->stsz_sample_size = sc->sample_size;
}
- for (j = 0; j < sc->stsc_data[stsc_index].count; j++) {
+ for (unsigned j = 0; j < sc->stsc_data[stsc_index].count; ++j) {
int keyframe = 0;
if (current_sample >= sc->sample_count) {
av_log(mov->fc, AV_LOG_ERROR, "wrong sample count\n");
@@ -4889,7 +4888,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
return;
// compute total chunk count
- for (i = 0; i < sc->stsc_count; i++) {
+ for (unsigned i = 0; i < sc->stsc_count; ++i) {
unsigned count, chunk_count;
chunk_samples = sc->stsc_data[i].count;
@@ -4927,7 +4926,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
sti->index_entries_allocated_size = (sti->nb_index_entries + total) * sizeof(*sti->index_entries);
// populate index
- for (i = 0; i < sc->chunk_count; i++) {
+ for (unsigned i = 0; i < sc->chunk_count; ++i) {
current_offset = sc->chunk_offsets[i];
if (mov_stsc_index_valid(stsc_index, sc->stsc_count) &&
i + 1 == sc->stsc_data[stsc_index + 1].first)
@@ -5803,7 +5802,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int64_t dts, pts = AV_NOPTS_VALUE;
int data_offset = 0;
unsigned entries, first_sample_flags = frag->flags;
- int flags, distance, i;
+ int flags, distance;
int64_t prev_dts = AV_NOPTS_VALUE;
int next_frag_index = -1, index_entry_pos;
size_t requested_size;
@@ -5816,7 +5815,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return AVERROR_INVALIDDATA;
}
- for (i = 0; i < c->fc->nb_streams; i++) {
+ for (unsigned i = 0; i < c->fc->nb_streams; ++i) {
sc = c->fc->streams[i]->priv_data;
if (sc->id == frag->track_id) {
st = c->fc->streams[i];
@@ -5839,7 +5838,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
// and it's samples are in index_entries at the given position.
// New index entries will be inserted before the index_entry found.
index_entry_pos = sti->nb_index_entries;
- for (i = c->frag_index.current + 1; i < c->frag_index.nb_items; i++) {
+ for (int i = c->frag_index.current + 1; i < c->frag_index.nb_items; ++i) {
frag_stream_info = get_frag_stream_info(&c->frag_index, i, frag->track_id);
if (frag_stream_info && frag_stream_info->index_entry >= 0) {
next_frag_index = i;
@@ -5971,9 +5970,10 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (index_entry_pos > 0)
prev_dts = sti->index_entries[index_entry_pos-1].timestamp;
- for (i = 0; i < entries && !pb->eof_reached; i++) {
+ unsigned cur_entry;
+ for (cur_entry = 0; cur_entry < entries && !pb->eof_reached; ++cur_entry) {
unsigned sample_size = frag->size;
- int sample_flags = i ? frag->flags : first_sample_flags;
+ int sample_flags = cur_entry ? frag->flags : first_sample_flags;
unsigned sample_duration = frag->duration;
unsigned ctts_duration = 0;
int keyframe = 0;
@@ -6047,10 +6047,10 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
}
if (frag_stream_info)
frag_stream_info->next_trun_dts = dts + sc->time_offset;
- if (i < entries) {
+ if (cur_entry < entries) {
// EOF found before reading all entries. Fix the hole this would
// leave in index_entries and tts_data
- int gap = entries - i;
+ int gap = entries - cur_entry;
memmove(sti->index_entries + index_entry_pos,
sti->index_entries + index_entry_pos + gap,
sizeof(*sti->index_entries) *
@@ -6065,7 +6065,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (index_entry_pos < sc->current_sample) {
sc->current_sample -= gap;
}
- entries = i;
+ entries = cur_entry;
}
// The end of this new fragment may overlap in time with the start
@@ -9099,7 +9099,7 @@ static int mov_read_iref_dimg(MOVContext *c, AVIOContext *pb, int version)
{
HEIFItem *item = NULL;
HEIFGrid *grid;
- int entries, i;
+ int entries;
int from_item_id = version ? avio_rb32(pb) : avio_rb16(pb);
for (int i = 0; i < c->nb_heif_grid; i++) {
@@ -9144,7 +9144,7 @@ static int mov_read_iref_dimg(MOVContext *c, AVIOContext *pb, int version)
if (!grid->tile_id_list || !grid->tile_item_list || !grid->tile_idx_list)
return AVERROR(ENOMEM);
/* 'to' item ids */
- for (i = 0; i < entries; i++)
+ for (int i = 0; i < entries; i++)
grid->tile_id_list[i] = version ? avio_rb32(pb) : avio_rb16(pb);
grid->nb_tiles = entries;
grid->item = item;
@@ -9751,14 +9751,13 @@ static void mov_read_chapters(AVFormatContext *s)
MOVContext *mov = s->priv_data;
MOVStreamContext *sc;
int64_t cur_pos;
- int i, j;
int chapter_track;
- for (j = 0; j < mov->nb_chapter_tracks; j++) {
+ for (unsigned j = 0; j < mov->nb_chapter_tracks; j++) {
AVStream *st = NULL;
FFStream *sti = NULL;
chapter_track = mov->chapter_tracks[j];
- for (i = 0; i < s->nb_streams; i++) {
+ for (unsigned i = 0; i < s->nb_streams; i++) {
sc = mov->fc->streams[i]->priv_data;
if (sc->id == chapter_track) {
st = s->streams[i];
@@ -10237,7 +10236,7 @@ static int read_image_grid(AVFormatContext *s, const HEIFGrid *grid,
MOVContext *c = s->priv_data;
const HEIFItem *item = grid->item;
int64_t offset = 0, pos = avio_tell(s->pb);
- int x = 0, y = 0, i = 0;
+ int x = 0, y = 0;
int tile_rows, tile_cols;
int flags, size;
@@ -10287,18 +10286,19 @@ static int read_image_grid(AVFormatContext *s, const HEIFGrid *grid,
if (!tile_grid->offsets)
return AVERROR(ENOMEM);
+ unsigned cur_tile = 0;
while (y < tile_grid->coded_height) {
- int left_col = i;
+ unsigned left_col = cur_tile;
while (x < tile_grid->coded_width) {
- if (i == tile_grid->nb_tiles)
+ if (cur_tile == tile_grid->nb_tiles)
return AVERROR_INVALIDDATA;
- tile_grid->offsets[i].idx = grid->tile_idx_list[i];
- tile_grid->offsets[i].horizontal = x;
- tile_grid->offsets[i].vertical = y;
+ tile_grid->offsets[cur_tile].idx = grid->tile_idx_list[cur_tile];
+ tile_grid->offsets[cur_tile].horizontal = x;
+ tile_grid->offsets[cur_tile].vertical = y;
- x += grid->tile_item_list[i++]->width;
+ x += grid->tile_item_list[cur_tile++]->width;
}
if (x > tile_grid->coded_width) {
@@ -10310,7 +10310,7 @@ static int read_image_grid(AVFormatContext *s, const HEIFGrid *grid,
y += grid->tile_item_list[left_col]->height;
}
- if (y > tile_grid->coded_height || i != tile_grid->nb_tiles) {
+ if (y > tile_grid->coded_height || cur_tile != tile_grid->nb_tiles) {
av_log(c->fc, AV_LOG_ERROR, "Non uniform HEIF tiles\n");
return AVERROR_INVALIDDATA;
}
@@ -11253,7 +11253,6 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
FFStream *avsti = NULL;
int64_t current_index;
int ret;
- int i;
mov->fc = s;
retry:
if (s->pb->pos == 0) {
@@ -11270,7 +11269,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
mov->frag_index.complete = 0;
}
- for (i = 0; i < s->nb_streams; i++) {
+ for (unsigned i = 0; i < s->nb_streams; i++) {
AVStream *avst = s->streams[i];
MOVStreamContext *msc = avst->priv_data;
@@ -11585,23 +11584,21 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
sti->skip_samples = mov_get_skip_samples(st, sample);
for (i = 0; i < s->nb_streams; i++) {
- AVStream *const st = s->streams[i];
- FFStream *const sti = ffstream(st);
+ AVStream *const st2 = s->streams[i];
+ FFStream *const sti2 = ffstream(st2);
int64_t timestamp;
if (stream_index == i)
continue;
- timestamp = av_rescale_q(seek_timestamp, s->streams[stream_index]->time_base, st->time_base);
- sample = mov_seek_stream(s, st, timestamp, flags);
+ timestamp = av_rescale_q(seek_timestamp, s->streams[stream_index]->time_base, st2->time_base);
+ sample = mov_seek_stream(s, st2, timestamp, flags);
if (sample >= 0)
- sti->skip_samples = mov_get_skip_samples(st, sample);
+ sti2->skip_samples = mov_get_skip_samples(st2, sample);
}
} else {
for (i = 0; i < s->nb_streams; i++) {
- MOVStreamContext *sc;
- st = s->streams[i];
- sc = st->priv_data;
+ MOVStreamContext *sc = s->streams[i]->priv_data;
mov_current_sample_set(sc, 0);
}
while (1) {
--
2.52.0
>From 7abd860801f66f2887d062a66f8e3a13d7397437 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 16:49:51 +0100
Subject: [PATCH 49/83] avformat/http: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/http.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/http.c b/libavformat/http.c
index 5ddcb61f6c..1681329081 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -164,7 +164,7 @@ typedef struct HTTPContext {
#define E AV_OPT_FLAG_ENCODING_PARAM
#define DEFAULT_USER_AGENT "Lavf/" AV_STRINGIFY(LIBAVFORMAT_VERSION)
-static const AVOption options[] = {
+static const AVOption http_options[] = {
{ "seekable", "control seekability of connection", OFFSET(seekable), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, D },
{ "chunked_post", "use chunked transfer-encoding for posts", OFFSET(chunked_post), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E },
{ "http_proxy", "set HTTP proxy to tunnel through", OFFSET(http_proxy), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
@@ -2129,7 +2129,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo
av_log(h, AV_LOG_DEBUG, "Soft-seeking to offset %"PRIu64" by draining "
"%"PRIu64" remaining byte(s)\n", s->off, remaining);
while (remaining) {
- int ret = ffurl_read(s->hd, discard, FFMIN(remaining, sizeof(discard)));
+ ret = ffurl_read(s->hd, discard, FFMIN(remaining, sizeof(discard)));
if (ret < 0 || ret == AVERROR_EOF || (ret == 0 && remaining)) {
/* connection broken or stuck, need to reopen */
ffurl_closep(&s->hd);
@@ -2181,7 +2181,7 @@ static int http_get_short_seek(URLContext *h)
static const AVClass flavor ## _context_class = { \
.class_name = # flavor, \
.item_name = av_default_item_name, \
- .option = options, \
+ .option = http_options, \
.version = LIBAVUTIL_VERSION_INT, \
}
--
2.52.0
>From 9279ecb59d9da2488407acc1faa297b78fb687c9 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 16:53:11 +0100
Subject: [PATCH 50/83] avformat/id3v2: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/id3v2.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 5fc82ad9dc..c196549e00 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -998,16 +998,16 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
if (unsync || tunsync) {
uint8_t *b = buffer;
uint8_t *t = buffer;
- uint8_t *end = t + tlen;
if (avio_read(pb, buffer, tlen) != tlen) {
av_log(s, AV_LOG_ERROR, "Failed to read tag data\n");
goto seek;
}
- while (t != end) {
+ const uint8_t *const buf_end = t + tlen;
+ while (t != buf_end) {
*b++ = *t++;
- if (t != end && t[-1] == 0xff && !t[0])
+ if (t != buf_end && t[-1] == 0xff && !t[0])
t++;
}
--
2.52.0
>From 2c64999611e788da210b6826e1e877d757b0544b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 16:56:21 +0100
Subject: [PATCH 51/83] avcodec/asvdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/asvdec.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c
index 5abe279f35..c9f7c37655 100644
--- a/libavcodec/asvdec.c
+++ b/libavcodec/asvdec.c
@@ -156,23 +156,21 @@ static inline int asv1_decode_block(ASVDecContext *a, int16_t block[64])
static inline int asv2_decode_block(ASVDecContext *a, int16_t block[64])
{
- int i, count, ccp;
-
- count = get_bits_le(&a->gb, 4);
+ int count = get_bits_le(&a->gb, 4);
block[0] = 8 * get_bits_le(&a->gb, 8);
- ccp = asv2_get_vlc2(&a->gb, dc_ccp_vlc, DC_CCP_VLC_BITS);
- if (ccp) {
- if (ccp & 4)
+ int dc_ccp = asv2_get_vlc2(&a->gb, dc_ccp_vlc, DC_CCP_VLC_BITS);
+ if (dc_ccp) {
+ if (dc_ccp & 4)
block[a->permutated_scantable[1]] = (asv2_get_level(&a->gb) * a->intra_matrix[1]) >> 4;
- if (ccp & 2)
+ if (dc_ccp & 2)
block[a->permutated_scantable[2]] = (asv2_get_level(&a->gb) * a->intra_matrix[2]) >> 4;
- if (ccp & 1)
+ if (dc_ccp & 1)
block[a->permutated_scantable[3]] = (asv2_get_level(&a->gb) * a->intra_matrix[3]) >> 4;
}
- for (i = 1; i < count + 1; i++) {
+ for (int i = 1; i < count + 1; ++i) {
const int ccp = asv2_get_vlc2(&a->gb, ac_ccp_vlc, AC_CCP_VLC_BITS);
if (ccp) {
--
2.52.0
>From a92df63602f9429d4eef1985590942191811b299 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 16:56:54 +0100
Subject: [PATCH 52/83] avcodec/intrax8: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/intrax8.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index ada5fc317f..35e0b06a4a 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -61,7 +61,6 @@ static av_cold void x8_vlc_init(void)
{
static VLCElem vlc_buf[VLC_BUFFER_SIZE];
VLCInitState state = VLC_INIT_STATE(vlc_buf);
- int i;
// set ac tables
for (int i = 0; i < 2; i++)
@@ -77,10 +76,10 @@ static av_cold void x8_vlc_init(void)
x8_dc_quant_table[i][j]);
// set orient tables
- for (i = 0; i < 2; i++)
+ for (int i = 0; i < 2; ++i)
j_orient_vlc[0][i] = x8_init_vlc(&state, OR_VLC_BITS, 12,
x8_orient_highquant_table[i]);
- for (i = 0; i < 4; i++)
+ for (int i = 0; i < 4; ++i)
j_orient_vlc[1][i] = x8_init_vlc(&state, OR_VLC_BITS, 12,
x8_orient_lowquant_table[i]);
}
--
2.52.0
>From 9c0ef3db245fb67d22df09ac86e44146246cc624 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 16:59:11 +0100
Subject: [PATCH 53/83] avcodec/wmaprodec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/wmaprodec.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index dd33c56e54..2c8ac857a1 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -804,7 +804,6 @@ static void decode_decorrelation_matrix(WMAProDecodeCtx *s,
*/
static int decode_channel_transform(WMAProDecodeCtx* s)
{
- int i;
/* should never consume more than 1921 bits for the 8 channel case
* 1 + MAX_CHANNELS * (MAX_CHANNELS + 2 + 3 * MAX_CHANNELS * MAX_CHANNELS
* + MAX_CHANNELS + MAX_BANDS + 1)
@@ -830,7 +829,7 @@ static int decode_channel_transform(WMAProDecodeCtx* s)
/** decode channel mask */
if (remaining_channels > 2) {
- for (i = 0; i < s->channels_for_cur_subframe; i++) {
+ for (int i = 0; i < s->channels_for_cur_subframe; ++i) {
int channel_idx = s->channel_indexes_for_cur_subframe[i];
if (!s->channel[channel_idx].grouped
&& get_bits1(&s->gb)) {
@@ -841,7 +840,7 @@ static int decode_channel_transform(WMAProDecodeCtx* s)
}
} else {
chgroup->num_channels = remaining_channels;
- for (i = 0; i < s->channels_for_cur_subframe; i++) {
+ for (int i = 0; i < s->channels_for_cur_subframe; ++i) {
int channel_idx = s->channel_indexes_for_cur_subframe[i];
if (!s->channel[channel_idx].grouped)
*channel_data++ = s->channel[channel_idx].coeffs;
@@ -1062,9 +1061,8 @@ static int decode_scale_factors(WMAProDecodeCtx* s)
*sf = val;
}
} else {
- int i;
/** run level decode differences to the resampled factors */
- for (i = 0; i < s->num_bands; i++) {
+ for (int j = 0; j < s->num_bands; ++j) {
int idx;
int skip;
int val;
@@ -1085,13 +1083,13 @@ static int decode_scale_factors(WMAProDecodeCtx* s)
sign = get_bits1(&s->gb)-1;
}
- i += skip;
- if (i >= s->num_bands) {
+ j += skip;
+ if (j >= s->num_bands) {
av_log(s->avctx, AV_LOG_ERROR,
"invalid scale factor coding\n");
return AVERROR_INVALIDDATA;
}
- s->channel[c].scale_factors[i] += (val ^ sign) - sign;
+ s->channel[c].scale_factors[j] += (val ^ sign) - sign;
}
}
/** swap buffers */
@@ -1953,7 +1951,7 @@ static int xma_decode_packet(AVCodecContext *avctx, AVFrame *frame,
static av_cold int xma_decode_init(AVCodecContext *avctx)
{
XMADecodeCtx *s = avctx->priv_data;
- int i, ret, start_channels = 0;
+ int ret, start_channels = 0;
avctx->block_align = 2048;
@@ -1998,7 +1996,7 @@ static av_cold int xma_decode_init(AVCodecContext *avctx)
}
/* init all streams (several streams of 1/2ch make Nch files) */
- for (i = 0; i < s->num_streams; i++) {
+ for (int i = 0; i < s->num_streams; ++i) {
ret = decode_init(&s->xma[i], avctx, i);
if (ret < 0)
return ret;
--
2.52.0
>From cda5e17f0872199da820d57b4736c2af968de65f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:03:25 +0100
Subject: [PATCH 54/83] avcodec/alsdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/alsdec.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 09c1b8db9e..8d3d7addbc 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -649,7 +649,6 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
ALSSpecificConfig *sconf = &ctx->sconf;
AVCodecContext *avctx = ctx->avctx;
GetBitContext *gb = &ctx->gb;
- unsigned int k;
unsigned int s[8];
unsigned int sx[8];
unsigned int sub_blocks, log2_sub_blocks, sb_length;
@@ -692,19 +691,19 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
if (sconf->bgmc) {
s[0] = get_bits(gb, 8 + (sconf->resolution > 1));
- for (k = 1; k < sub_blocks; k++)
+ for (unsigned k = 1; k < sub_blocks; k++)
s[k] = s[k - 1] + decode_rice(gb, 2);
- for (k = 0; k < sub_blocks; k++) {
+ for (unsigned k = 0; k < sub_blocks; k++) {
sx[k] = s[k] & 0x0F;
s [k] >>= 4;
}
} else {
s[0] = get_bits(gb, 4 + (sconf->resolution > 1));
- for (k = 1; k < sub_blocks; k++)
+ for (unsigned k = 1; k < sub_blocks; k++)
s[k] = s[k - 1] + decode_rice(gb, 0);
}
- for (k = 1; k < sub_blocks; k++)
+ for (unsigned k = 1; k < sub_blocks; k++)
if (s[k] > 32) {
av_log(avctx, AV_LOG_ERROR, "k invalid for rice code.\n");
return AVERROR_INVALIDDATA;
@@ -745,14 +744,13 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)];
// read coefficients 2 to opt_order
- for (k = 2; k < opt_order; k++)
+ for (unsigned k = 2; k < opt_order; ++k)
quant_cof[k] = get_bits(gb, 7);
} else {
- int k_max;
add_base = 1;
// read coefficient 0 to 19
- k_max = FFMIN(opt_order, 20);
+ unsigned k, k_max = FFMIN(opt_order, 20);
for (k = 0; k < k_max; k++) {
int rice_param = parcor_rice_table[sconf->coef_table][k][1];
int offset = parcor_rice_table[sconf->coef_table][k][0];
@@ -780,7 +778,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64];
}
- for (k = 2; k < opt_order; k++)
+ for (unsigned k = 2; k < opt_order; ++k)
quant_cof[k] = (quant_cof[k] * (1U << 14)) + (add_base << 13);
}
}
@@ -1708,7 +1706,6 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
}
} else { // multi-channel coding
ALSBlockData bd = { 0 };
- int b, ret;
int *reverted_channels = ctx->reverted_channels;
unsigned int offset = 0;
@@ -1725,7 +1722,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
get_block_sizes(ctx, div_blocks, &bs_info);
- for (b = 0; b < ctx->num_blocks; b++) {
+ for (unsigned b = 0; b < ctx->num_blocks; ++b) {
bd.block_length = div_blocks[b];
if (bd.block_length <= 0) {
av_log(ctx->avctx, AV_LOG_WARNING,
--
2.52.0
>From 9bb31e700a5021430680bf3804c9fd2a02197c9a Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:04:47 +0100
Subject: [PATCH 55/83] avcodec/atrac3plus: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/atrac3plus.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c
index f17ed0cbb5..f923768b13 100644
--- a/libavcodec/atrac3plus.c
+++ b/libavcodec/atrac3plus.c
@@ -75,7 +75,7 @@ static av_cold void build_canonical_huff(const uint8_t *cb, const uint8_t **xlat
av_cold void ff_atrac3p_init_vlcs(void)
{
- int i, tab_offset = 0;
+ int tab_offset = 0;
const uint8_t *xlats;
xlats = atrac3p_wl_ct_xlats;
@@ -93,7 +93,7 @@ av_cold void ff_atrac3p_init_vlcs(void)
/* build huffman tables for spectrum decoding */
xlats = atrac3p_spectra_xlats;
- for (i = 0; i < 112; i++) {
+ for (int i = 0; i < 112; ++i) {
if (atrac3p_spectra_cbs[i][0] >= 0)
build_canonical_huff(atrac3p_spectra_cbs[i],
&xlats, &tab_offset, &spec_vlc_tabs[i]);
@@ -103,13 +103,13 @@ av_cold void ff_atrac3p_init_vlcs(void)
/* build huffman tables for gain data decoding */
xlats = atrac3p_gain_xlats;
- for (i = 0; i < 11; i++)
+ for (int i = 0; i < 11; ++i)
build_canonical_huff(atrac3p_gain_cbs[i], &xlats,
&tab_offset, &gain_vlc_tabs[i]);
/* build huffman tables for tone decoding */
xlats = atrac3p_tone_xlats;
- for (i = 0; i < 7; i++)
+ for (int i = 0; i < 7; ++i)
build_canonical_huff(atrac3p_tone_cbs[i], &xlats,
&tab_offset, &tone_vlc_tabs[i]);
}
--
2.52.0
>From 285c4916c3307e899f871d40e20400b36323bf10 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:10:36 +0100
Subject: [PATCH 56/83] avcodec/binkaudio: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/binkaudio.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
index ee75256ecd..52d10f715e 100644
--- a/libavcodec/binkaudio.c
+++ b/libavcodec/binkaudio.c
@@ -174,7 +174,6 @@ static const uint8_t rle_length_tab[16] = {
static int decode_block(BinkAudioContext *s, float **out, int use_dct,
int channels, int ch_offset)
{
- int ch, i, j, k;
float q, quant[25];
int width, coeff;
GetBitContext *gb = &s->gb;
@@ -183,7 +182,7 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct,
if (use_dct)
skip_bits(gb, 2);
- for (ch = 0; ch < channels; ch++) {
+ for (int ch = 0; ch < channels; ++ch) {
if (s->version_b) {
if (get_bits_left(gb) < 64)
return AVERROR_INVALIDDATA;
@@ -198,17 +197,15 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct,
if (get_bits_left(gb) < s->num_bands * 8)
return AVERROR_INVALIDDATA;
- for (i = 0; i < s->num_bands; i++) {
+ for (int i = 0; i < s->num_bands; ++i) {
int value = get_bits(gb, 8);
quant[i] = s->quant_table[FFMIN(value, 95)];
}
- k = 0;
- q = quant[0];
-
// parse coefficients
- i = 2;
- while (i < s->frame_len) {
+ q = quant[0];
+ for (int i = 2, k = 0; i < s->frame_len;) {
+ int j;
if (s->version_b) {
j = i + 16;
} else {
@@ -262,12 +259,10 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct,
}
}
- for (ch = 0; ch < channels; ch++) {
- int j;
+ for (int ch = 0; ch < channels; ++ch) {
int count = s->overlap_len * channels;
if (!s->first) {
- j = ch;
- for (i = 0; i < s->overlap_len; i++, j += channels)
+ for (int i = 0, j = ch; i < s->overlap_len; ++i, j += channels)
out[ch + ch_offset][i] = (s->previous[ch + ch_offset][i] * (count - j) +
out[ch + ch_offset][i] * j) / count;
}
--
2.52.0
>From dbec196d372a4cda6ea6aec880fa3caae98cb885 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:19:19 +0100
Subject: [PATCH 57/83] avcodec/bmp: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/bmp.c | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
index db5d704057..96a44e45f0 100644
--- a/libavcodec/bmp.c
+++ b/libavcodec/bmp.c
@@ -38,10 +38,9 @@ static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
unsigned int depth;
BiCompression comp;
unsigned int ihsize;
- int i, j, n, linesize, ret;
+ int n, ret;
uint32_t rgb[3] = {0};
uint32_t alpha = 0;
- uint8_t *ptr;
int dsize;
const uint8_t *buf0 = buf;
GetByteContext gb;
@@ -229,14 +228,6 @@ static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
if (comp == BMP_RLE4 || comp == BMP_RLE8)
memset(p->data[0], 0, avctx->height * p->linesize[0]);
- if (height > 0) {
- ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
- linesize = -p->linesize[0];
- } else {
- ptr = p->data[0];
- linesize = p->linesize[0];
- }
-
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
int colors = 1 << depth;
@@ -263,10 +254,10 @@ static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
av_log(avctx, AV_LOG_ERROR, "palette doesn't fit in packet\n");
return AVERROR_INVALIDDATA;
}
- for (i = 0; i < colors; i++)
+ for (int i = 0; i < colors; ++i)
((uint32_t*)p->data[1])[i] = (0xFFU<<24) | bytestream_get_le24(&buf);
} else {
- for (i = 0; i < colors; i++)
+ for (int i = 0; i < colors; ++i)
((uint32_t*)p->data[1])[i] = 0xFFU << 24 | bytestream_get_le32(&buf);
}
buf = buf0 + hsize;
@@ -283,9 +274,19 @@ static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
p->linesize[0] = -p->linesize[0];
}
} else {
+ uint8_t *ptr;
+ int linesize;
+ if (height > 0) {
+ ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
+ linesize = -p->linesize[0];
+ } else {
+ ptr = p->data[0];
+ linesize = p->linesize[0];
+ }
+
switch (depth) {
case 1:
- for (i = 0; i < avctx->height; i++) {
+ for (int i = 0; i < avctx->height; ++i) {
int j;
for (j = 0; j < avctx->width >> 3; j++) {
ptr[j*8+0] = buf[j] >> 7;
@@ -307,14 +308,14 @@ static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
case 8:
case 24:
case 32:
- for (i = 0; i < avctx->height; i++) {
+ for (int i = 0; i < avctx->height; ++i) {
memcpy(ptr, buf, n);
buf += n;
ptr += linesize;
}
break;
case 4:
- for (i = 0; i < avctx->height; i++) {
+ for (int i = 0; i < avctx->height; ++i) {
int j;
for (j = 0; j < n; j++) {
ptr[j*2+0] = (buf[j] >> 4) & 0xF;
@@ -325,11 +326,11 @@ static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
}
break;
case 16:
- for (i = 0; i < avctx->height; i++) {
+ for (int i = 0; i < avctx->height; ++i) {
const uint16_t *src = (const uint16_t *) buf;
uint16_t *dst = (uint16_t *) ptr;
- for (j = 0; j < avctx->width; j++)
+ for (int j = 0; j < avctx->width; ++j)
*dst++ = av_le2ne16(*src++);
buf += n;
@@ -342,6 +343,7 @@ static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
}
}
if (avctx->pix_fmt == AV_PIX_FMT_BGRA) {
+ int i;
for (i = 0; i < avctx->height; i++) {
int j;
uint8_t *ptr = p->data[0] + p->linesize[0]*i + 3;
--
2.52.0
>From 891dabab5a96268782f9d2c0ac595b5899626093 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:20:14 +0100
Subject: [PATCH 58/83] avcodec/dv_tablegen: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/dv_tablegen.h | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/libavcodec/dv_tablegen.h b/libavcodec/dv_tablegen.h
index 7f0ab53fa7..ee604b1cfe 100644
--- a/libavcodec/dv_tablegen.h
+++ b/libavcodec/dv_tablegen.h
@@ -51,7 +51,6 @@ static struct dv_vlc_pair dv_vlc_map[DV_VLC_MAP_RUN_SIZE][DV_VLC_MAP_LEV_SIZE];
static av_cold void dv_vlc_map_tableinit(void)
{
uint32_t code = 0;
- int i, j;
for (int i = 0; i < NB_DV_VLC; i++) {
uint32_t cur_code = code >> (32 - ff_dv_vlc_len[i]);
code += 1U << (32 - ff_dv_vlc_len[i]);
@@ -70,9 +69,9 @@ static av_cold void dv_vlc_map_tableinit(void)
dv_vlc_map[ff_dv_vlc_run[i]][ff_dv_vlc_level[i]].size =
ff_dv_vlc_len[i] + (!!ff_dv_vlc_level[i]);
}
- for (i = 0; i < DV_VLC_MAP_RUN_SIZE; i++) {
+ for (int i = 0; i < DV_VLC_MAP_RUN_SIZE; i++) {
#if CONFIG_SMALL
- for (j = 1; j < DV_VLC_MAP_LEV_SIZE; j++) {
+ for (int j = 1; j < DV_VLC_MAP_LEV_SIZE; j++) {
if (dv_vlc_map[i][j].size == 0) {
dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
(dv_vlc_map[i - 1][0].vlc <<
@@ -82,7 +81,7 @@ static av_cold void dv_vlc_map_tableinit(void)
}
}
#else
- for (j = 1; j < DV_VLC_MAP_LEV_SIZE / 2; j++) {
+ for (int j = 1; j < DV_VLC_MAP_LEV_SIZE / 2; j++) {
if (dv_vlc_map[i][j].size == 0) {
dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
(dv_vlc_map[i - 1][0].vlc <<
--
2.52.0
>From 2a2e1c64bc8f24de4e6003e7677da9b97dfe0047 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:21:27 +0100
Subject: [PATCH 59/83] avcodec/dvdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/dvdec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 4799ec96dc..cbbc5d567c 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -154,10 +154,10 @@ static av_cold void dv_init_static(void)
VLC dv_vlc = { .table = vlc_buf, .table_allocated = FF_ARRAY_ELEMS(vlc_buf) };
const unsigned offset = FF_ARRAY_ELEMS(dv_rl_vlc) - (2 * NB_DV_VLC - NB_DV_ZERO_LEVEL_ENTRIES);
RL_VLC_ELEM *tmp = dv_rl_vlc + offset;
- int i, j;
+ int j = 0;
/* it's faster to include sign bit in a generic VLC parsing scheme */
- for (i = 0, j = 0; i < NB_DV_VLC; i++, j++) {
+ for (int i = 0; i < NB_DV_VLC; ++i, ++j) {
tmp[j].len8 = ff_dv_vlc_len[i];
tmp[j].run = ff_dv_vlc_run[i];
tmp[j].level = ff_dv_vlc_level[i];
--
2.52.0
>From 1fe12ff4d66df4fa82be5f9f7accd22d8e60af70 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:23:25 +0100
Subject: [PATCH 60/83] avcodec/wmaenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/wmaenc.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 51487b72b5..b419694c51 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -379,7 +379,7 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr)
{
WMACodecContext *s = avctx->priv_data;
- int i, total_gain, ret, error;
+ int total_gain, ret, error;
s->block_len_bits = s->frame_len_bits; // required by non variable block len
s->block_len = 1 << s->block_len_bits;
@@ -391,9 +391,8 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
if (s->ms_stereo) {
float a, b;
- int i;
- for (i = 0; i < s->block_len; i++) {
+ for (int i = 0; i < s->block_len; i++) {
a = s->coefs[0][i] * 0.5;
b = s->coefs[1][i] * 0.5;
s->coefs[0][i] = a + b;
@@ -405,7 +404,7 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
return ret;
total_gain = 128;
- for (i = 64; i; i >>= 1) {
+ for (int i = 64; i; i >>= 1) {
error = encode_frame(s, s->coefs, avpkt->data, avpkt->size,
total_gain - i);
if (error <= 0)
@@ -419,9 +418,9 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
return AVERROR(EINVAL);
}
av_assert0((put_bits_count(&s->pb) & 7) == 0);
- i = avctx->block_align - put_bytes_count(&s->pb, 0);
- av_assert0(i>=0);
- while(i--)
+ int pad = avctx->block_align - put_bytes_count(&s->pb, 0);
+ av_assert0(pad >= 0);
+ while (pad--)
put_bits(&s->pb, 8, 'N');
flush_put_bits(&s->pb);
--
2.52.0
>From ba00e443393bb3fe4bdbd477c2bdf3d17123544b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:27:25 +0100
Subject: [PATCH 61/83] avcodec/wma: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/wma.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/libavcodec/wma.c b/libavcodec/wma.c
index 0a34c1b00e..fde17626cc 100644
--- a/libavcodec/wma.c
+++ b/libavcodec/wma.c
@@ -80,7 +80,7 @@ av_cold int ff_wma_init(AVCodecContext *avctx, int flags2)
{
WMACodecContext *s = avctx->priv_data;
int channels = avctx->ch_layout.nb_channels;
- int i, ret;
+ int ret;
float bps1, high_freq;
float bps;
int sample_rate1;
@@ -283,12 +283,11 @@ av_cold int ff_wma_init(AVCodecContext *avctx, int flags2)
#ifdef TRACE
{
- int i, j;
- for (i = 0; i < s->nb_block_sizes; i++) {
+ for (int i = 0; i < s->nb_block_sizes; ++i) {
ff_tlog(s->avctx, "%5d: n=%2d:",
s->frame_len >> i,
s->exponent_sizes[i]);
- for (j = 0; j < s->exponent_sizes[i]; j++)
+ for (int j = 0; j < s->exponent_sizes[i]; ++j)
ff_tlog(s->avctx, " %d", s->exponent_bands[i][j]);
ff_tlog(s->avctx, "\n");
}
@@ -296,7 +295,7 @@ av_cold int ff_wma_init(AVCodecContext *avctx, int flags2)
#endif /* TRACE */
/* init MDCT windows : simple sine window */
- for (i = 0; i < s->nb_block_sizes; i++) {
+ for (int i = 0; i < s->nb_block_sizes; ++i) {
ff_init_ff_sine_windows(s->frame_len_bits - i);
s->windows[i] = ff_sine_windows[s->frame_len_bits - i];
}
@@ -311,7 +310,7 @@ av_cold int ff_wma_init(AVCodecContext *avctx, int flags2)
s->noise_mult = 0.04;
#ifdef TRACE
- for (i = 0; i < NOISE_TAB_SIZE; i++)
+ for (int i = 0; i < NOISE_TAB_SIZE; ++i)
s->noise_table[i] = 1.0 * s->noise_mult;
#else
{
@@ -319,7 +318,7 @@ av_cold int ff_wma_init(AVCodecContext *avctx, int flags2)
float norm;
seed = 1;
norm = (1.0 / (float) (1LL << 31)) * sqrt(3) * s->noise_mult;
- for (i = 0; i < NOISE_TAB_SIZE; i++) {
+ for (int i = 0; i < NOISE_TAB_SIZE; ++i) {
seed = seed * 314159 + 1;
s->noise_table[i] = (float) ((int) seed) * norm;
}
--
2.52.0
>From 7dddb6d4d0780afa025bf5969ca4c49794c94534 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:28:40 +0100
Subject: [PATCH 62/83] avcodec/utvideodec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/utvideodec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 098706b705..e9321241f0 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -76,13 +76,12 @@ typedef struct HuffEntry {
static int build_huff(UtvideoContext *c, const uint8_t *src, VLC *vlc,
VLC_MULTI *multi, int *fsym, unsigned nb_elems)
{
- int i;
HuffEntry he[1024];
uint8_t bits[1024];
uint16_t codes_count[33] = { 0 };
*fsym = -1;
- for (i = 0; i < nb_elems; i++) {
+ for (unsigned i = 0; i < nb_elems; i++) {
if (src[i] == 0) {
*fsym = i;
return 0;
--
2.52.0
>From e63049d39410eefeb5fedbf1763357fe932de8b6 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:48:42 +0100
Subject: [PATCH 63/83] avcodec/tta: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/tta.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 467c78514f..33f2268e51 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -261,9 +261,8 @@ static int tta_decode_frame(AVCodecContext *avctx, AVFrame *frame,
s->ch_ctx[i].predictor = 0;
ff_tta_filter_init(filter, ff_tta_filter_configs[s->bps-1]);
if (s->format == FORMAT_ENCRYPTED) {
- int i;
- for (i = 0; i < 8; i++)
- filter->qm[i] = sign_extend(s->crc_pass[i], 8);
+ for (int j = 0; j < 8; ++j)
+ filter->qm[j] = sign_extend(s->crc_pass[j], 8);
}
ff_tta_rice_init(&s->ch_ctx[i].rice, 10, 10);
}
--
2.52.0
>From dda39f15d4c74e81f1c74fb8132e240daa4b2e3f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 17:58:57 +0100
Subject: [PATCH 64/83] avcodec/svq3: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/svq3.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 296e81f322..1d77384716 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -1047,8 +1047,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
}
if (s->watermark_key) {
- uint32_t header = AV_RL32(&s->slice_buf[1]);
- AV_WL32(&s->slice_buf[1], header ^ s->watermark_key);
+ AV_WL32(&s->slice_buf[1], AV_RL32(&s->slice_buf[1]) ^ s->watermark_key);
}
init_get_bits(&s->gb_slice, s->slice_buf, slice_bits);
@@ -1394,7 +1393,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
SVQ3Context *s = avctx->priv_data;
int buf_size = avpkt->size;
int left;
- int ret, m, i;
+ int ret;
/* special case for last picture */
if (buf_size == 0) {
@@ -1436,11 +1435,11 @@ static int svq3_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if (ret < 0)
return ret;
- for (i = 0; i < 16; i++) {
+ for (int i = 0; i < 16; ++i) {
s->block_offset[i] = (4 * ((scan8[i] - scan8[0]) & 7)) + 4 * s->cur_pic->f->linesize[0] * ((scan8[i] - scan8[0]) >> 3);
s->block_offset[48 + i] = (4 * ((scan8[i] - scan8[0]) & 7)) + 8 * s->cur_pic->f->linesize[0] * ((scan8[i] - scan8[0]) >> 3);
}
- for (i = 0; i < 16; i++) {
+ for (int i = 0; i < 16; ++i) {
s->block_offset[16 + i] =
s->block_offset[32 + i] = (4 * ((scan8[i] - scan8[0]) & 7)) + 4 * s->cur_pic->f->linesize[1] * ((scan8[i] - scan8[0]) >> 3);
s->block_offset[48 + 16 + i] =
@@ -1492,9 +1491,8 @@ static int svq3_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
s->prev_frame_num_offset += 256;
}
- for (m = 0; m < 2; m++) {
- int i;
- for (i = 0; i < 4; i++) {
+ for (int m = 0; m < 2; ++m) {
+ for (int i = 0; i < 4; ++i) {
int j;
for (j = -1; j < 4; j++)
s->ref_cache[m][scan8[0] + 8 * i + j] = 1;
--
2.52.0
>From 2358bfd153fb669816697982c01ae144a3060bf4 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:02:19 +0100
Subject: [PATCH 65/83] avcodec/ratecontrol: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/ratecontrol.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index d48ede909c..0d99cc47e3 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -498,7 +498,7 @@ av_cold int ff_rate_control_init(MPVMainEncContext *const m)
MPVEncContext *const s = &m->s;
RateControlContext *rcc = &m->rc_context;
AVCodecContext *const avctx = s->c.avctx;
- int i, res;
+ int res;
static const char * const const_names[] = {
"PI",
"E",
@@ -549,7 +549,7 @@ av_cold int ff_rate_control_init(MPVMainEncContext *const m)
return res;
}
- for (i = 0; i < 5; i++) {
+ for (int i = 0; i < 5; ++i) {
rcc->pred[i].coeff = FF_QP2LAMBDA * 7.0;
rcc->pred[i].count = 1.0;
rcc->pred[i].decay = 0.4;
@@ -567,24 +567,24 @@ av_cold int ff_rate_control_init(MPVMainEncContext *const m)
rcc->buffer_index = avctx->rc_buffer_size * 3 / 4;
if (avctx->flags & AV_CODEC_FLAG_PASS2) {
- int i;
+ int num_entries;
char *p;
/* find number of pics */
p = avctx->stats_in;
- for (i = -1; p; i++)
+ for (num_entries = -1; p; ++num_entries)
p = strchr(p + 1, ';');
- i += m->max_b_frames;
- if (i <= 0 || i >= INT_MAX / sizeof(RateControlEntry))
+ num_entries += m->max_b_frames;
+ if (num_entries <= 0 || num_entries >= INT_MAX / sizeof(RateControlEntry))
return -1;
- rcc->entry = av_mallocz(i * sizeof(RateControlEntry));
+ rcc->entry = av_mallocz(num_entries * sizeof(RateControlEntry));
if (!rcc->entry)
return AVERROR(ENOMEM);
- rcc->num_entries = i;
+ rcc->num_entries = num_entries;
/* init all to skipped P-frames
* (with B-frames we might have a not encoded frame at the end FIXME) */
- for (i = 0; i < rcc->num_entries; i++) {
+ for (int i = 0; i < rcc->num_entries; ++i) {
RateControlEntry *rce = &rcc->entry[i];
rce->pict_type = rce->new_pict_type = AV_PICTURE_TYPE_P;
@@ -595,7 +595,7 @@ av_cold int ff_rate_control_init(MPVMainEncContext *const m)
/* read stats */
p = avctx->stats_in;
- for (i = 0; i < rcc->num_entries - m->max_b_frames; i++) {
+ for (int i = 0; i < rcc->num_entries - m->max_b_frames; ++i) {
RateControlEntry *rce;
int picture_number;
int e;
@@ -650,7 +650,7 @@ av_cold int ff_rate_control_init(MPVMainEncContext *const m)
}
/* init stuff with the user specified complexity */
if (rcc->initial_cplx) {
- for (i = 0; i < 60 * 30; i++) {
+ for (int i = 0; i < 60 * 30; ++i) {
double bits = rcc->initial_cplx * (i / 10000.0 + 1.0) * s->c.mb_num;
RateControlEntry rce;
--
2.52.0
>From 5ad82e97db5fc282fd4b1c45e69dd9f3ad7aa119 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:19:22 +0100
Subject: [PATCH 66/83] avcodec/mpegvideo_enc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_enc.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 46c8863a14..166b584c8d 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3709,7 +3709,7 @@ static void set_frame_distances(MPVEncContext *const s)
static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt)
{
MPVEncContext *const s = &m->s;
- int i, ret;
+ int ret;
int bits;
int context_count = s->c.slice_context_count;
@@ -3787,9 +3787,8 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt)
NULL, context_count, sizeof(void*));
}
}
- for(i=1; i<context_count; i++){
+ for (int i = 1; i < context_count; ++i)
merge_context_after_me(s, s->c.enc_contexts[i]);
- }
m->mc_mb_var_sum = s->me.mc_mb_var_sum_temp;
m->mb_var_sum = s->me. mb_var_sum_temp;
emms_c();
@@ -3820,7 +3819,7 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt)
ff_fix_long_mvs(s, NULL, 0, s->p_mv_table, s->f_code, CANDIDATE_MB_TYPE_INTER, !!s->intra_penalty);
if (s->c.avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) {
int j;
- for(i=0; i<2; i++){
+ for (int i = 0; i < 2; ++i) {
for(j=0; j<2; j++)
ff_fix_long_mvs(s, s->p_field_select_table[i], j,
s->c.p_field_mv_table[i][j], s->f_code, CANDIDATE_MB_TYPE_INTER_I, !!s->intra_penalty);
@@ -3844,7 +3843,7 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt)
if (s->c.avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) {
int dir, j;
for(dir=0; dir<2; dir++){
- for(i=0; i<2; i++){
+ for (int i = 0; i < 2; ++i) {
for(j=0; j<2; j++){
int type= dir ? (CANDIDATE_MB_TYPE_BACKWARD_I|CANDIDATE_MB_TYPE_BIDIR_I)
: (CANDIDATE_MB_TYPE_FORWARD_I |CANDIDATE_MB_TYPE_BIDIR_I);
@@ -3933,12 +3932,11 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt)
bits= put_bits_count(&s->pb);
m->header_bits = bits - s->last_bits;
- for(i=1; i<context_count; i++){
+ for (int i = 1; i < context_count; ++i)
update_duplicate_context_after_me(s->c.enc_contexts[i], s);
- }
s->c.avctx->execute(s->c.avctx, encode_thread, &s->c.enc_contexts[0],
NULL, context_count, sizeof(void*));
- for(i=1; i<context_count; i++){
+ for (int i = 1; i<context_count; ++i) {
if (s->pb.buf_end == s->c.enc_contexts[i]->pb.buf)
set_put_bits_buffer_size(&s->pb, FFMIN(s->c.enc_contexts[i]->pb.buf_end - s->pb.buf, INT_MAX/8-BUF_BITS));
merge_context_after_encode(s, s->c.enc_contexts[i]);
@@ -4586,8 +4584,7 @@ static int dct_quantize_refine(MPVEncContext *const s, //FIXME breaks denoise?
run=0;
rle_index=0;
for(i=start_i; i<=last_non_zero; i++){
- int j= perm_scantable[i];
- const int level= block[j];
+ const int level = block[perm_scantable[i]];
if(level){
run_tab[rle_index++]=run;
--
2.52.0
>From 353e1e233dd303fb08a2d9d48abb7e880ad1f571 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:19:57 +0100
Subject: [PATCH 67/83] avcodec/qdmc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/qdmc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c
index 474e5ef8fa..97878b6a21 100644
--- a/libavcodec/qdmc.c
+++ b/libavcodec/qdmc.c
@@ -166,7 +166,6 @@ static const uint8_t huff_bits[] = {
static av_cold void qdmc_init_static_data(void)
{
const uint8_t (*hufftab)[2] = qdmc_hufftab;
- int i;
for (unsigned i = 0, offset = 0; i < FF_ARRAY_ELEMS(vtable); i++) {
static VLCElem vlc_buffer[13698];
@@ -179,7 +178,7 @@ static av_cold void qdmc_init_static_data(void)
offset += vtable[i].table_size;
}
- for (i = 0; i < 512; i++)
+ for (int i = 0; i < 512; ++i)
sin_table[i] = sin(2.0f * i * M_PI * 0.001953125f);
}
--
2.52.0
>From 1f4736148240a292940016cda70ac863d4f2abc3 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:20:53 +0100
Subject: [PATCH 68/83] avcodec/pnmenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/pnmenc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c
index 8f67fe0a3b..ad9bf2b327 100644
--- a/libavcodec/pnmenc.c
+++ b/libavcodec/pnmenc.c
@@ -39,7 +39,7 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
{
PHMEncContext *s = avctx->priv_data;
uint8_t *bytestream, *bytestream_start, *bytestream_end;
- int i, h, h1, c, n, linesize, ret;
+ int h, h1, c, n, linesize, ret;
int size = av_image_get_buffer_size(avctx->pix_fmt,
avctx->width, avctx->height, 1);
@@ -198,7 +198,7 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
} else {
const uint8_t *ptr = p->data[0];
linesize = p->linesize[0];
- for (i = 0; i < h; i++) {
+ for (int i = 0; i < h; ++i) {
memcpy(bytestream, ptr, n);
bytestream += n;
ptr += linesize;
@@ -209,7 +209,7 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const uint8_t *ptr1 = p->data[1], *ptr2 = p->data[2];
h >>= 1;
n >>= 1;
- for (i = 0; i < h; i++) {
+ for (int i = 0; i < h; ++i) {
memcpy(bytestream, ptr1, n);
bytestream += n;
memcpy(bytestream, ptr2, n);
--
2.52.0
>From 11bde9908071379507841de355e18ff32c48064f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:23:53 +0100
Subject: [PATCH 69/83] avcodec/pnmdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/pnmdec.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index 68bb7a41ec..70266fc20c 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -48,7 +48,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
PNMContext * const s = avctx->priv_data;
- int i, j, k, n, linesize, h, upgrade = 0, is_mono = 0;
+ int n, linesize, h, upgrade = 0, is_mono = 0;
unsigned char *ptr;
int components, sample_len, ret;
float scale;
@@ -134,10 +134,10 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
if (n * avctx->height > s->bytestream_end - s->bytestream)
return AVERROR_INVALIDDATA;
if(s->type < 4 || (is_mono && s->type==7)){
- for (i=0; i<avctx->height; i++) {
+ for (int i = 0; i < avctx->height; ++i) {
PutBitContext pb;
init_put_bits(&pb, ptr, FFABS(linesize));
- for(j=0; j<avctx->width * components; j++){
+ for (int j = 0; j < avctx->width * components; ++j) {
unsigned int c=0;
unsigned v=0;
if(s->type < 4)
@@ -150,7 +150,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
v = (*s->bytestream++)&1;
} else {
/* read a sequence of digits */
- for (k = 0; k < 6 && c <= 9; k += 1) {
+ for (int k = 0; k < 6 && c <= 9; k += 1) {
v = 10*v + c;
c = (*s->bytestream++) - '0';
}
@@ -201,7 +201,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
n *= 2;
if (n * avctx->height * 3 / 2 > s->bytestream_end - s->bytestream)
return AVERROR_INVALIDDATA;
- for (i = 0; i < avctx->height; i++) {
+ for (int i = 0; i < avctx->height; ++i) {
samplecpy(ptr, s->bytestream, n, s->maxval);
s->bytestream += n;
ptr += linesize;
@@ -210,7 +210,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
ptr2 = p->data[2];
n >>= 1;
h = avctx->height >> 1;
- for (i = 0; i < h; i++) {
+ for (int i = 0; i < h; ++i) {
samplecpy(ptr1, s->bytestream, n, s->maxval);
s->bytestream += n;
samplecpy(ptr2, s->bytestream, n, s->maxval);
@@ -231,7 +231,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
linesize = p->linesize[0];
if (n * avctx->height * 3 / 2 > s->bytestream_end - s->bytestream)
return AVERROR_INVALIDDATA;
- for (i = 0; i < avctx->height; i++) {
+ for (int i = 0; i < avctx->height; ++i) {
for (j = 0; j < n / 2; j++) {
v = AV_RB16(s->bytestream + 2*j);
((uint16_t *)ptr)[j] = (v * f + 16384) >> 15;
@@ -243,7 +243,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
ptr2 = (uint16_t*)p->data[2];
n >>= 1;
h = avctx->height >> 1;
- for (i = 0; i < h; i++) {
+ for (int i = 0; i < h; ++i) {
for (j = 0; j < n / 2; j++) {
v = AV_RB16(s->bytestream + 2*j);
ptr1[j] = (v * f + 16384) >> 15;
--
2.52.0
>From 37a40293a4b902892db5fd37b65220f3514d159e Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:26:40 +0100
Subject: [PATCH 70/83] avcodec/pngdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/pngdec.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 042b6a5c2f..f28eb53fbb 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1091,7 +1091,6 @@ static int decode_trns_chunk(AVCodecContext *avctx, PNGDecContext *s,
GetByteContext *gb)
{
int length = bytestream2_get_bytes_left(gb);
- int v, i;
if (!(s->hdr_state & PNG_IHDR)) {
av_log(avctx, AV_LOG_ERROR, "trns before IHDR\n");
@@ -1107,7 +1106,7 @@ static int decode_trns_chunk(AVCodecContext *avctx, PNGDecContext *s,
if (length > 256 || !(s->hdr_state & PNG_PLTE))
return AVERROR_INVALIDDATA;
- for (i = 0; i < length; i++) {
+ for (int i = 0; i < length; ++i) {
unsigned v = bytestream2_get_byte(gb);
s->palette[i] = (s->palette[i] & 0x00ffffff) | (v << 24);
}
@@ -1117,9 +1116,9 @@ static int decode_trns_chunk(AVCodecContext *avctx, PNGDecContext *s,
s->bit_depth == 1)
return AVERROR_INVALIDDATA;
- for (i = 0; i < length / 2; i++) {
+ for (int i = 0; i < length / 2; ++i) {
/* only use the least significant bits */
- v = av_zero_extend(bytestream2_get_be16(gb), s->bit_depth);
+ unsigned v = av_zero_extend(bytestream2_get_be16(gb), s->bit_depth);
if (s->bit_depth > 8)
AV_WB16(&s->transparent_color_be[2 * i], v);
@@ -1485,7 +1484,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
const AVCRC *crc_tab = av_crc_get_table(AV_CRC_32_IEEE_LE);
uint32_t tag, length;
int decode_next_dat = 0;
- int i, ret;
+ int ret;
for (;;) {
GetByteContext gb_chunk;
@@ -1642,7 +1641,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
s->white_point[1] = bytestream2_get_be32(&gb_chunk);
/* RGB Primaries */
- for (i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; ++i) {
s->display_primaries[i][0] = bytestream2_get_be32(&gb_chunk);
s->display_primaries[i][1] = bytestream2_get_be32(&gb_chunk);
}
--
2.52.0
>From 31758da2081ab91a02cfe03e6c4b1f4c10eeceee Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:28:59 +0100
Subject: [PATCH 71/83] avcodec/msmpeg4enc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/msmpeg4enc.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c
index 6141c63e1c..8b4b8ae3a6 100644
--- a/libavcodec/msmpeg4enc.c
+++ b/libavcodec/msmpeg4enc.c
@@ -379,7 +379,7 @@ static void msmpeg4_encode_mb(MPVEncContext *const s,
int motion_x, int motion_y)
{
MSMPEG4EncContext *const ms = mpv_to_msmpeg4(s);
- int cbp, coded_cbp, i;
+ int cbp, coded_cbp;
int pred_x, pred_y;
ff_msmpeg4_handle_slices(s);
@@ -387,7 +387,7 @@ static void msmpeg4_encode_mb(MPVEncContext *const s,
if (!s->c.mb_intra) {
/* compute cbp */
cbp = 0;
- for (i = 0; i < 6; i++) {
+ for (int i = 0; i < 6; ++i) {
if (s->c.block_last_index[i] >= 0)
cbp |= 1 << (5 - i);
}
@@ -433,9 +433,8 @@ static void msmpeg4_encode_mb(MPVEncContext *const s,
s->mv_bits += get_bits_diff(s);
- for (i = 0; i < 6; i++) {
+ for (int i = 0; i < 6; ++i)
ff_msmpeg4_encode_block(s, block[i], i);
- }
s->p_tex_bits += get_bits_diff(s);
} else {
/* compute cbp */
@@ -491,9 +490,8 @@ static void msmpeg4_encode_mb(MPVEncContext *const s,
}
s->misc_bits += get_bits_diff(s);
- for (i = 0; i < 6; i++) {
+ for (int i = 0; i < 6; ++i)
ff_msmpeg4_encode_block(s, block[i], i);
- }
s->i_tex_bits += get_bits_diff(s);
s->i_count++;
}
--
2.52.0
>From 80ff0e77148411be812531a716cccd4e4d440325 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:31:41 +0100
Subject: [PATCH 72/83] avcodec/mpegaudioenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegaudioenc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c
index 9727c3819d..e2758c621f 100644
--- a/libavcodec/mpegaudioenc.c
+++ b/libavcodec/mpegaudioenc.c
@@ -87,7 +87,7 @@ static av_cold int mpa_encode_init(AVCodecContext *avctx)
int freq = avctx->sample_rate;
int bitrate = avctx->bit_rate;
int channels = avctx->ch_layout.nb_channels;
- int i, v, table;
+ int i, table;
float a;
bitrate = bitrate / 1000;
@@ -160,7 +160,7 @@ static av_cold int mpa_encode_init(AVCodecContext *avctx)
}
for(i=0;i<64;i++) {
- v = (int)(exp2((3 - i) / 3.0) * (1 << 20));
+ int v = (int)(exp2((3 - i) / 3.0) * (1 << 20));
if (v <= 0)
v = 1;
s->scale_factor_table[i] = v;
@@ -173,7 +173,7 @@ static av_cold int mpa_encode_init(AVCodecContext *avctx)
}
}
for(i=0;i<128;i++) {
- v = i - 64;
+ int v = i - 64;
if (v <= -3)
v = 0;
else if (v < 0)
@@ -188,7 +188,7 @@ static av_cold int mpa_encode_init(AVCodecContext *avctx)
}
for(i=0;i<17;i++) {
- v = ff_mpa_quant_bits[i];
+ int v = ff_mpa_quant_bits[i];
if (v < 0)
v = -v;
else
--
2.52.0
>From d9a058306f0d8c82425463115ba032ce433f1596 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:33:43 +0100
Subject: [PATCH 73/83] avcodec/mpeg4videoenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpeg4videoenc.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index a10da6af82..66cfdcc2e5 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -459,7 +459,7 @@ static void mpeg4_encode_mb(MPVEncContext *const s, int16_t block[][64],
const int interleaved_stats = (s->c.avctx->flags & AV_CODEC_FLAG_PASS1) && !s->data_partitioning;
if (!s->c.mb_intra) {
- int i, cbp;
+ int cbp;
if (s->c.pict_type == AV_PICTURE_TYPE_B) {
/* convert from mv_dir to type */
@@ -467,7 +467,7 @@ static void mpeg4_encode_mb(MPVEncContext *const s, int16_t block[][64],
int mb_type = mb_type_table[s->c.mv_dir];
if (s->c.mb_x == 0) {
- for (i = 0; i < 2; i++)
+ for (int i = 0; i < 2; ++i)
s->c.last_mv[i][0][0] =
s->c.last_mv[i][0][1] =
s->c.last_mv[i][1][0] =
@@ -566,7 +566,7 @@ static void mpeg4_encode_mb(MPVEncContext *const s, int16_t block[][64],
put_bits(&s->pb, 1, s->c.field_select[1][1]);
}
if (s->c.mv_dir & MV_DIR_FORWARD) {
- for (i = 0; i < 2; i++) {
+ for (int i = 0; i < 2; ++i) {
ff_h263_encode_motion_vector(s,
s->c.mv[0][i][0] - s->c.last_mv[0][i][0],
s->c.mv[0][i][1] - s->c.last_mv[0][i][1] / 2,
@@ -576,7 +576,7 @@ static void mpeg4_encode_mb(MPVEncContext *const s, int16_t block[][64],
}
}
if (s->c.mv_dir & MV_DIR_BACKWARD) {
- for (i = 0; i < 2; i++) {
+ for (int i = 0; i < 2; ++i) {
ff_h263_encode_motion_vector(s,
s->c.mv[1][i][0] - s->c.last_mv[1][i][0],
s->c.mv[1][i][1] - s->c.last_mv[1][i][1] / 2,
@@ -740,7 +740,7 @@ static void mpeg4_encode_mb(MPVEncContext *const s, int16_t block[][64],
if (interleaved_stats)
s->misc_bits += get_bits_diff(s);
- for (i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; ++i) {
/* motion vectors: 8x8 mode*/
ff_h263_pred_motion(&s->c, i, 0, &pred_x, &pred_y);
@@ -765,7 +765,6 @@ static void mpeg4_encode_mb(MPVEncContext *const s, int16_t block[][64],
int dir[6]; // prediction direction
int zigzag_last_index[6];
const uint8_t *scan_table[6];
- int i;
for (int i = 0; i < 6; i++) {
int pred = mpeg4_pred_dc(&s->c, i, &dir[i]);
@@ -779,13 +778,13 @@ static void mpeg4_encode_mb(MPVEncContext *const s, int16_t block[][64],
if (s->c.avctx->flags & AV_CODEC_FLAG_AC_PRED) {
s->c.ac_pred = decide_ac_pred(s, block, dir, scan_table, zigzag_last_index);
} else {
- for (i = 0; i < 6; i++)
+ for (int i = 0; i < 6; ++i)
scan_table[i] = s->c.intra_scantable.permutated;
}
/* compute cbp */
cbp = 0;
- for (i = 0; i < 6; i++)
+ for (int i = 0; i < 6; ++i)
if (s->c.block_last_index[i] >= 1)
cbp |= 1 << (5 - i);
--
2.52.0
>From 41e0f4fbfe61ce7460d91cee6d5d8332d85b244c Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:36:24 +0100
Subject: [PATCH 74/83] avcodec/mjpegenc_huffman: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mjpegenc_huffman.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/libavcodec/mjpegenc_huffman.c b/libavcodec/mjpegenc_huffman.c
index 5a0d8b0b48..c584fc3a14 100644
--- a/libavcodec/mjpegenc_huffman.c
+++ b/libavcodec/mjpegenc_huffman.c
@@ -83,9 +83,6 @@ static void mjpegenc_huffman_compute_bits(PTable *prob_table,
int size, int max_length)
{
PackageMergerList list_a, list_b, *to = &list_a, *from = &list_b, *temp;
-
- int times, i, j, k;
-
int nbits[257] = {0};
int min;
@@ -98,13 +95,11 @@ static void mjpegenc_huffman_compute_bits(PTable *prob_table,
from->item_idx[0] = 0;
AV_QSORT(prob_table, size, PTable, compare_by_prob);
- for (times = 0; times <= max_length; times++) {
+ for (int i, times = 0; times <= max_length; ++times) {
+ int j = 0;
to->nitems = 0;
to->item_idx[0] = 0;
- j = 0;
- k = 0;
-
if (times < max_length) {
i = 0;
}
@@ -119,7 +114,7 @@ static void mjpegenc_huffman_compute_bits(PTable *prob_table,
to->probability[to->nitems - 1] = prob_table[i].prob;
i++;
} else {
- for (k = from->item_idx[j]; k < from->item_idx[j + 2]; k++) {
+ for (int k = from->item_idx[j]; k < from->item_idx[j + 2]; k++) {
to->items[to->item_idx[to->nitems]++] = from->items[k];
}
to->probability[to->nitems - 1] =
@@ -133,9 +128,8 @@ static void mjpegenc_huffman_compute_bits(PTable *prob_table,
}
min = (size - 1 < from->nitems) ? size - 1 : from->nitems;
- for (i = 0; i < from->item_idx[min]; i++) {
+ for (int i = 0; i < from->item_idx[min]; ++i)
nbits[from->items[i]]++;
- }
// we don't want to return the 256 bit count (it was just in here to prevent
// all 1s encoding)
memset(counts, 0, sizeof(counts[0]) * (max_length + 1));
--
2.52.0
>From 95a2fe75ce57fbf0a9949010d3533e1ea00752a9 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:41:07 +0100
Subject: [PATCH 75/83] avcodec/jpeg2000dwt: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/jpeg2000dwt.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/libavcodec/jpeg2000dwt.c b/libavcodec/jpeg2000dwt.c
index 9ee8122658..0e588612c2 100644
--- a/libavcodec/jpeg2000dwt.c
+++ b/libavcodec/jpeg2000dwt.c
@@ -251,11 +251,10 @@ static void dwt_encode97_int(DWTContext *s, int *t)
int lev;
int w = s->linelen[s->ndeclevels-1][0];
int h = s->linelen[s->ndeclevels-1][1];
- int i;
int *line = s->i_linebuf;
line += 5;
- for (i = 0; i < w * h; i++)
+ for (int i = 0; i < w * h; ++i)
t[i] *= 1 << I_PRESHIFT;
for (lev = s->ndeclevels-1; lev >= 0; lev--){
@@ -302,7 +301,7 @@ static void dwt_encode97_int(DWTContext *s, int *t)
}
- for (i = 0; i < w * h; i++)
+ for (int i = 0; i < w * h; ++i)
t[i] = (t[i] + ((1<<(I_PRESHIFT))>>1)) >> (I_PRESHIFT);
}
@@ -485,7 +484,6 @@ static void dwt_decode97_int(DWTContext *s, int32_t *t)
int lev;
int w = s->linelen[s->ndeclevels - 1][0];
int h = s->linelen[s->ndeclevels - 1][1];
- int i;
int32_t *line = s->i_linebuf;
int32_t *data = t;
/* position at index O of line range [0-5,w+5] cf. extend function */
@@ -531,7 +529,7 @@ static void dwt_decode97_int(DWTContext *s, int32_t *t)
}
}
- for (i = 0; i < w * h; i++)
+ for (int i = 0; i < w * h; ++i)
// We shift down by `I_PRESHIFT` because the input coefficients `datap[]` were shifted up by `I_PRESHIFT` to secure the precision
data[i] = (int32_t)(data[i] + ((1LL<<(I_PRESHIFT))>>1)) >> (I_PRESHIFT);
}
--
2.52.0
>From dcb6d40538079d72ae913d86d1432d1746e8be9f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:42:06 +0100
Subject: [PATCH 76/83] avcodec/huffyuvdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuvdec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index c98904d497..1fc50dc9b2 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -326,14 +326,13 @@ static int read_old_huffman_tables(HYuvDecContext *s)
static av_cold int decode_end(AVCodecContext *avctx)
{
HYuvDecContext *s = avctx->priv_data;
- int i;
for (int i = 0; i < 3; i++)
av_freep(&s->temp[i]);
av_freep(&s->bitstream_buffer);
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; ++i)
ff_vlc_free(&s->vlc[i]);
return 0;
--
2.52.0
>From 57eeb26ca2adb70afabb240b3dd6750b0cc417b4 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:54:28 +0100
Subject: [PATCH 77/83] avcodec/huffyuvenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuvenc.c | 46 ++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index b213d4dc95..5d12099073 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -244,7 +244,6 @@ static int store_huffman_tables(HYuvEncContext *s, uint8_t *buf)
static av_cold int encode_init(AVCodecContext *avctx)
{
HYuvEncContext *s = avctx->priv_data;
- int i, j;
int ret;
const AVPixFmtDescriptor *desc;
@@ -388,15 +387,15 @@ static av_cold int encode_init(AVCodecContext *avctx)
if (avctx->stats_in) {
char *p = avctx->stats_in;
- for (i = 0; i < 4; i++)
- for (j = 0; j < s->vlc_n; j++)
+ for (int i = 0; i < 4; ++i)
+ for (int j = 0; j < s->vlc_n; ++j)
s->stats[i][j] = 1;
for (;;) {
- for (i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; ++i) {
char *next;
- for (j = 0; j < s->vlc_n; j++) {
+ for (int j = 0; j < s->vlc_n; ++j) {
s->stats[i][j] += strtol(p, &next, 0);
if (next == p) return -1;
p = next;
@@ -405,8 +404,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
if (p[0] == 0 || p[1] == 0 || p[2] == 0) break;
}
} else {
- for (i = 0; i < 4; i++)
- for (j = 0; j < s->vlc_n; j++) {
+ for (int i = 0; i < 4; ++i)
+ for (int j = 0; j < s->vlc_n; ++j) {
int d = FFMIN(j, s->vlc_n - j);
s->stats[i][j] = 100000000 / (d*d + 1);
@@ -419,16 +418,16 @@ static av_cold int encode_init(AVCodecContext *avctx)
avctx->extradata_size += ret;
if (s->context) {
- for (i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; ++i) {
int pels = avctx->width * avctx->height / (i ? 40 : 10);
- for (j = 0; j < s->vlc_n; j++) {
+ for (int j = 0; j < s->vlc_n; ++j) {
int d = FFMIN(j, s->vlc_n - j);
s->stats[i][j] = pels/(d*d + 1);
}
}
} else {
- for (i = 0; i < 4; i++)
- for (j = 0; j < s->vlc_n; j++)
+ for (int i = 0; i < 4; ++i)
+ for (int j = 0; j < s->vlc_n; ++j)
s->stats[i][j]= 0;
}
@@ -704,7 +703,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const int fake_ystride = (1 + s->interlaced) * p->linesize[0];
const int fake_ustride = (1 + s->interlaced) * p->linesize[1];
const int fake_vstride = (1 + s->interlaced) * p->linesize[2];
- int i, j, size = 0, ret;
+ int size = 0, ret;
if ((ret = ff_alloc_packet(avctx, pkt, width * height * 3 * 4 + FF_INPUT_BUFFER_MIN_SIZE)) < 0)
return ret;
@@ -714,8 +713,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
if (size < 0)
return size;
- for (i = 0; i < 4; i++)
- for (j = 0; j < s->vlc_n; j++)
+ for (int i = 0; i < 4; ++i)
+ for (int j = 0; j < s->vlc_n; ++j)
s->stats[i][j] >>= 1;
}
@@ -945,18 +944,17 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
size /= 4;
if ((s->flags & AV_CODEC_FLAG_PASS1) && (s->picture_number & 31) == 0) {
- int j;
- char *p = avctx->stats_out;
- char *end = p + STATS_OUT_SIZE;
- for (i = 0; i < 4; i++) {
- for (j = 0; j < s->vlc_n; j++) {
- snprintf(p, end-p, "%"PRIu64" ", s->stats[i][j]);
- p += strlen(p);
+ char *d = avctx->stats_out;
+ char *end = d + STATS_OUT_SIZE;
+ for (int i = 0; i < 4; ++i) {
+ for (int j = 0; j < s->vlc_n; ++j) {
+ snprintf(d, end-d, "%"PRIu64" ", s->stats[i][j]);
+ d += strlen(d);
s->stats[i][j]= 0;
}
- snprintf(p, end-p, "\n");
- p++;
- if (end <= p)
+ snprintf(d, end-d, "\n");
+ d++;
+ if (end <= d)
return AVERROR(ENOMEM);
}
} else if (avctx->stats_out)
--
2.52.0
>From 6bd22aeb003b57f13cbbaf963fbb2e995621239d Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 18:58:26 +0100
Subject: [PATCH 78/83] avcodec/hdrdec: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/hdrdec.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/libavcodec/hdrdec.c b/libavcodec/hdrdec.c
index b7ade48e32..d6384db6e4 100644
--- a/libavcodec/hdrdec.c
+++ b/libavcodec/hdrdec.c
@@ -142,7 +142,6 @@ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p,
float *dst_g = (float *)(p->data[0] + y * p->linesize[0]);
float *dst_b = (float *)(p->data[1] + y * p->linesize[1]);
uint8_t *scanline = p->data[0] + y * p->linesize[0];
- int i;
if (width < MINELEN || width > MAXELEN) {
ret = decompress(scanline, width, &gb, scanline);
@@ -151,8 +150,7 @@ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p,
goto convert;
}
- i = bytestream2_peek_byte(&gb);
- if (i != 2) {
+ if (bytestream2_peek_byte(&gb) != 2) {
ret = decompress(scanline, width, &gb, scanline);
if (ret < 0)
return ret;
@@ -162,20 +160,18 @@ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p,
scanline[1] = bytestream2_get_byte(&gb);
scanline[2] = bytestream2_get_byte(&gb);
- i = bytestream2_get_byte(&gb);
+ unsigned byte = bytestream2_get_byte(&gb);
if (scanline[1] != 2 || scanline[2] & 128) {
scanline[0] = 2;
- scanline[3] = i;
+ scanline[3] = byte;
ret = decompress(scanline + 4, width - 1, &gb, scanline);
if (ret < 0)
return ret;
goto convert;
}
- for (int i = 0; i < 4; i++) {
- uint8_t *scanline = p->data[0] + y * p->linesize[0] + i;
-
+ for (int i = 0; i < 4; ++i, ++scanline) {
for (int j = 0; j < width * 4 && bytestream2_get_bytes_left(&gb) > 0;) {
int run = bytestream2_get_byte(&gb);
if (run > 128) {
--
2.52.0
>From 618f7a0e977f47189d9de073e1dfea10d5c88490 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 19:02:55 +0100
Subject: [PATCH 79/83] avcodec/cbs: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/cbs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index 41c8184434..7cf0e920b2 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -961,7 +961,7 @@ static int cbs_clone_noncomplex_unit_content(void **clonep,
{
const uint8_t *src;
uint8_t *copy;
- int err, i;
+ int err;
av_assert0(unit->content);
src = unit->content;
@@ -976,7 +976,7 @@ static int cbs_clone_noncomplex_unit_content(void **clonep,
*(ptr + 1) = NULL;
}
- for (i = 0; i < desc->type.ref.nb_offsets; i++) {
+ for (int i = 0; i < desc->type.ref.nb_offsets; i++) {
const uint8_t *const *src_ptr = (const uint8_t* const*)(src + desc->type.ref.offsets[i]);
const AVBufferRef *src_buf = *(AVBufferRef**)(src_ptr + 1);
uint8_t **copy_ptr = (uint8_t**)(copy + desc->type.ref.offsets[i]);
--
2.52.0
>From 860d55776dbd44cd7c954a687d60357a985b9322 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 19:07:38 +0100
Subject: [PATCH 80/83] avcodec/aacps: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aacps.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c
index 6008edd332..40a7f7326a 100644
--- a/libavcodec/aacps.c
+++ b/libavcodec/aacps.c
@@ -410,7 +410,7 @@ static void decorrelation(PSContext *ps, INTFLOAT (*out)[32][2], const INTFLOAT
const float a_smooth = 0.25f; ///< Smoothing coefficient
#endif /* USE_FIXED */
const int8_t *const k_to_i = is34 ? ff_k_to_i_34 : ff_k_to_i_20;
- int i, k, m, n;
+ int k;
int n0 = 0, nL = 32;
const INTFLOAT peak_decay_factor = Q31(0.76592833836465f);
@@ -431,8 +431,8 @@ static void decorrelation(PSContext *ps, INTFLOAT (*out)[32][2], const INTFLOAT
//Transient detection
#if USE_FIXED
- for (i = 0; i < NR_PAR_BANDS[is34]; i++) {
- for (n = n0; n < nL; n++) {
+ for (int i = 0; i < NR_PAR_BANDS[is34]; ++i) {
+ for (int n = n0; n < nL; n++) {
int decayed_peak;
decayed_peak = (int)(((int64_t)peak_decay_factor * \
peak_decay_nrg[i] + 0x40000000) >> 31);
@@ -448,8 +448,8 @@ static void decorrelation(PSContext *ps, INTFLOAT (*out)[32][2], const INTFLOAT
}
}
#else
- for (i = 0; i < NR_PAR_BANDS[is34]; i++) {
- for (n = n0; n < nL; n++) {
+ for (int i = 0; i < NR_PAR_BANDS[is34]; ++i) {
+ for (int n = n0; n < nL; n++) {
float decayed_peak = peak_decay_factor * peak_decay_nrg[i];
float denom;
peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]);
@@ -490,7 +490,7 @@ static void decorrelation(PSContext *ps, INTFLOAT (*out)[32][2], const INTFLOAT
#endif /* USE_FIXED */
memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
- for (m = 0; m < PS_AP_LINKS; m++) {
+ for (int m = 0; m < PS_AP_LINKS; ++m) {
memcpy(ap_delay[k][m], ap_delay[k][m]+numQMFSlots, 5*sizeof(ap_delay[k][m][0]));
}
ps->dsp.decorrelate(out[k], delay[k] + PS_MAX_DELAY - 2, ap_delay[k],
--
2.52.0
>From eddce5e1469bf4c8ee4a73252880faa3d7b85e0f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 19:17:36 +0100
Subject: [PATCH 81/83] avcodec/flacenc: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/flacenc.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index ead2c55f10..363763c7bf 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -952,7 +952,7 @@ static int lpc_encode_choose_datapath(FlacEncodeContext *s, int32_t bps,
static int encode_residual_ch(FlacEncodeContext *s, int ch)
{
- int i, n;
+ int n;
int min_order, max_order, opt_order, omethod;
FlacFrame *frame;
FlacSubframe *sub;
@@ -970,6 +970,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
/* CONSTANT */
if (sub->obits > 32) {
+ int i;
for (i = 1; i < n; i++)
if(smp_33bps[i] != smp_33bps[0])
break;
@@ -978,6 +979,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
return subframe_count_exact(s, sub, 0);
}
} else {
+ int i;
for (i = 1; i < n; i++)
if(smp[i] != smp[0])
break;
@@ -1006,7 +1008,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
max_order = MAX_FIXED_ORDER;
opt_order = 0;
bits[0] = UINT32_MAX;
- for (i = min_order; i <= max_order; i++) {
+ for (int i = min_order; i <= max_order; ++i) {
if (sub->obits == 33) {
if (encode_residual_fixed_with_residual_limit_33bps(res, smp_33bps, n, i))
continue;
@@ -1029,7 +1031,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
if (sub->order != max_order) {
if (sub->obits == 33)
encode_residual_fixed_with_residual_limit_33bps(res, smp_33bps, n, sub->order);
- else if (sub->obits + i >= 32)
+ else if (sub->obits + max_order >= 32)
encode_residual_fixed_with_residual_limit(res, smp, n, sub->order);
else
encode_residual_fixed(res, smp, n, sub->order);
@@ -1045,7 +1047,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
* probably isn't predictable anyway, throw away LSB for analysis
* so it fits 32 bit int and existing function can be used
* unmodified */
- for (i = 0; i < n; i++)
+ for (int i = 0; i < n; ++i)
smp[i] = smp_33bps[i] >> 1;
opt_order = ff_lpc_calc_coefs(&s->lpc_ctx, smp, n, min_order, max_order,
@@ -1062,7 +1064,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
int opt_index = levels-1;
opt_order = max_order-1;
bits[opt_index] = UINT32_MAX;
- for (i = levels-1; i >= 0; i--) {
+ for (int i = levels-1; i >= 0; --i) {
int last_order = order;
order = min_order + (((max_order-min_order+1) * (i+1)) / levels)-1;
order = av_clip(order, min_order - 1, max_order - 1);
@@ -1082,7 +1084,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
uint64_t bits[MAX_LPC_ORDER];
opt_order = 0;
bits[0] = UINT32_MAX;
- for (i = min_order-1; i < max_order; i++) {
+ for (int i = min_order - 1; i < max_order; ++i) {
if(lpc_encode_choose_datapath(s, sub->obits, res, smp, smp_33bps, n, i+1, coefs[i], shift[i]))
continue;
bits[i] = find_subframe_rice_params(s, sub, i+1);
@@ -1099,7 +1101,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
for (step = 16; step; step >>= 1) {
int last = opt_order;
- for (i = last-step; i <= last+step; i += step) {
+ for (int i = last - step; i <= last + step; i += step) {
if (i < min_order-1 || i >= max_order || bits[i] < UINT32_MAX)
continue;
if(lpc_encode_choose_datapath(s, sub->obits, res, smp, smp_33bps, n, i+1, coefs[i], shift[i]))
@@ -1155,7 +1157,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
sub->order = opt_order;
sub->type_code = sub->type | (sub->order-1);
sub->shift = shift[sub->order-1];
- for (i = 0; i < sub->order; i++)
+ for (int i = 0; i < sub->order; ++i)
sub->coefs[i] = coefs[sub->order-1][i];
if(lpc_encode_choose_datapath(s, sub->obits, res, smp, smp_33bps, n, sub->order, sub->coefs, sub->shift)) {
--
2.52.0
>From 5bd9483effde34bc96aa6b616e3747da3d6311ea Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 19:23:24 +0100
Subject: [PATCH 82/83] avcodec/hpeldsp: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/hpeldsp.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/libavcodec/hpeldsp.c b/libavcodec/hpeldsp.c
index e753d6216c..53d85cf31f 100644
--- a/libavcodec/hpeldsp.c
+++ b/libavcodec/hpeldsp.c
@@ -174,8 +174,8 @@ static inline void OPNAME ## _pixels4_xy2_8_c(uint8_t *block, \
{ \
/* FIXME HIGH BIT DEPTH */ \
int i; \
- const uint32_t a = AV_RN32(pixels); \
- const uint32_t b = AV_RN32(pixels + 1); \
+ uint32_t a = AV_RN32(pixels); \
+ uint32_t b = AV_RN32(pixels + 1); \
uint32_t l0 = (a & 0x03030303UL) + \
(b & 0x03030303UL) + \
0x02020202UL; \
@@ -185,8 +185,8 @@ static inline void OPNAME ## _pixels4_xy2_8_c(uint8_t *block, \
\
pixels += line_size; \
for (i = 0; i < h; i += 2) { \
- uint32_t a = AV_RN32(pixels); \
- uint32_t b = AV_RN32(pixels + 1); \
+ a = AV_RN32(pixels); \
+ b = AV_RN32(pixels + 1); \
l1 = (a & 0x03030303UL) + \
(b & 0x03030303UL); \
h1 = ((a & 0xFCFCFCFCUL) >> 2) + \
@@ -219,8 +219,8 @@ static inline void OPNAME ## _pixels8_xy2_8_c(uint8_t *block, \
\
for (j = 0; j < 2; j++) { \
int i; \
- const uint32_t a = AV_RN32(pixels); \
- const uint32_t b = AV_RN32(pixels + 1); \
+ uint32_t a = AV_RN32(pixels); \
+ uint32_t b = AV_RN32(pixels + 1); \
uint32_t l0 = (a & 0x03030303UL) + \
(b & 0x03030303UL) + \
0x02020202UL; \
@@ -230,8 +230,8 @@ static inline void OPNAME ## _pixels8_xy2_8_c(uint8_t *block, \
\
pixels += line_size; \
for (i = 0; i < h; i += 2) { \
- uint32_t a = AV_RN32(pixels); \
- uint32_t b = AV_RN32(pixels + 1); \
+ a = AV_RN32(pixels); \
+ b = AV_RN32(pixels + 1); \
l1 = (a & 0x03030303UL) + \
(b & 0x03030303UL); \
h1 = ((a & 0xFCFCFCFCUL) >> 2) + \
@@ -267,8 +267,8 @@ static inline void OPNAME ## _no_rnd_pixels8_xy2_8_c(uint8_t *block, \
\
for (j = 0; j < 2; j++) { \
int i; \
- const uint32_t a = AV_RN32(pixels); \
- const uint32_t b = AV_RN32(pixels + 1); \
+ uint32_t a = AV_RN32(pixels); \
+ uint32_t b = AV_RN32(pixels + 1); \
uint32_t l0 = (a & 0x03030303UL) + \
(b & 0x03030303UL) + \
0x01010101UL; \
@@ -278,8 +278,8 @@ static inline void OPNAME ## _no_rnd_pixels8_xy2_8_c(uint8_t *block, \
\
pixels += line_size; \
for (i = 0; i < h; i += 2) { \
- uint32_t a = AV_RN32(pixels); \
- uint32_t b = AV_RN32(pixels + 1); \
+ a = AV_RN32(pixels); \
+ b = AV_RN32(pixels + 1); \
l1 = (a & 0x03030303UL) + \
(b & 0x03030303UL); \
h1 = ((a & 0xFCFCFCFCUL) >> 2) + \
--
2.52.0
>From b1c4f60e1175650558fcae58dfea8138b5ecda41 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 21 Feb 2026 19:28:33 +0100
Subject: [PATCH 83/83] avcodec/rka: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/rka.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavcodec/rka.c b/libavcodec/rka.c
index 600c160028..975ff6dedf 100644
--- a/libavcodec/rka.c
+++ b/libavcodec/rka.c
@@ -410,7 +410,6 @@ static void update_ch_subobj(AdaptiveModel *am)
static int amdl_decode_int(AdaptiveModel *am, ACoder *ac, unsigned *dst, unsigned size)
{
unsigned freq, size2, val, mul;
- int j;
size = FFMIN(size, am->buf_size - 1);
@@ -435,7 +434,7 @@ static int amdl_decode_int(AdaptiveModel *am, ACoder *ac, unsigned *dst, unsigne
size2 = am->buf_size >> 1;
val = am->prob[0][0];
if (freq >= val) {
- int sum = 0;
+ int sum = 0, j;
for (j = freq - val; size2; size2 >>= 1) {
unsigned v = am->prob[0][size2 + sum];
if (j >= v) {
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-22 7:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-22 3:03 [FFmpeg-devel] [PR] Fix shadowing (PR #22247) mkver via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git