[FFmpeg-devel] [PATCH 1/4] all: Remove unused-but-set variables
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Dec 3 11:26:22 EET 2021
Andreas Rheinhardt:
> Newer versions of Clang detect this and emit warnings for it.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
> libavcodec/aaccoder.c | 3 +--
> libavcodec/cinepakenc.c | 3 ---
> libavcodec/error_resilience.c | 3 ---
> libavcodec/imc.c | 5 ++---
> libavcodec/j2kenc.c | 2 --
> libavcodec/roqvideoenc.c | 2 --
> libavfilter/af_astats.c | 4 ----
> libswresample/tests/swresample.c | 8 --------
> 8 files changed, 3 insertions(+), 27 deletions(-)
>
> diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
> index 11b0559e1c..7bbd4d5b2e 100644
> --- a/libavcodec/aaccoder.c
> +++ b/libavcodec/aaccoder.c
> @@ -414,11 +414,10 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
> start = 0;
> for (g = 0; g < sce->ics.num_swb; g++) {
> int nz = 0;
> - float uplim = 0.0f, energy = 0.0f;
> + float uplim = 0.0f;
> for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
> FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
> uplim += band->threshold;
> - energy += band->energy;
> if (band->energy <= band->threshold || band->threshold == 0.0f) {
> sce->zeroes[(w+w2)*16+g] = 1;
> continue;
> diff --git a/libavcodec/cinepakenc.c b/libavcodec/cinepakenc.c
> index edb553f0db..0574b125d7 100644
> --- a/libavcodec/cinepakenc.c
> +++ b/libavcodec/cinepakenc.c
> @@ -705,7 +705,6 @@ static int quantize(CinepakEncContext *s, int h, uint8_t *data[4],
> int entry_size = s->pix_fmt == AV_PIX_FMT_RGB24 ? 6 : 4;
> int *codebook = v1mode ? info->v1_codebook : info->v4_codebook;
> int size = v1mode ? info->v1_size : info->v4_size;
> - int64_t total_error = 0;
> uint8_t vq_pict_buf[(MB_AREA * 3) / 2];
> uint8_t *sub_data[4], *vq_data[4];
> int sub_linesize[4], vq_linesize[4];
> @@ -795,7 +794,6 @@ static int quantize(CinepakEncContext *s, int h, uint8_t *data[4],
>
> mb->v1_error = compute_mb_distortion(s, sub_data, sub_linesize,
> vq_data, vq_linesize);
> - total_error += mb->v1_error;
> } else {
> for (k = 0; k < 4; k++)
> mb->v4_vector[k] = s->codebook_closest[i + k];
> @@ -805,7 +803,6 @@ static int quantize(CinepakEncContext *s, int h, uint8_t *data[4],
>
> mb->v4_error = compute_mb_distortion(s, sub_data, sub_linesize,
> vq_data, vq_linesize);
> - total_error += mb->v4_error;
> }
> i += v1mode ? 1 : 4;
> }
> diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
> index f13be7b918..91cd8a4444 100644
> --- a/libavcodec/error_resilience.c
> +++ b/libavcodec/error_resilience.c
> @@ -476,8 +476,6 @@ static void guess_mv(ERContext *s)
> none_left = 1;
> changed = 1;
> for (pass = 0; (changed || pass < 2) && pass < 10; pass++) {
> - int score_sum = 0;
> -
> changed = 0;
> for (blocklist_index = 0; blocklist_index < blocklist_length; blocklist_index++) {
> const int mb_x = blocklist[blocklist_index][0];
> @@ -668,7 +666,6 @@ skip_mean_and_median:
> best_pred = j;
> }
> }
> - score_sum += best_score;
> s->mv[0][0][0] = mv_predictor[best_pred][0];
> s->mv[0][0][1] = mv_predictor[best_pred][1];
>
> diff --git a/libavcodec/imc.c b/libavcodec/imc.c
> index cbe3edeeec..116c273ba0 100644
> --- a/libavcodec/imc.c
> +++ b/libavcodec/imc.c
> @@ -829,7 +829,7 @@ static void imc_get_coeffs(AVCodecContext *avctx,
> static void imc_refine_bit_allocation(IMCContext *q, IMCChannel *chctx)
> {
> int i, j;
> - int bits, summer;
> + int summer;
>
> for (i = 0; i < BANDS; i++) {
> chctx->sumLenArr[i] = 0;
> @@ -853,7 +853,7 @@ static void imc_refine_bit_allocation(IMCContext *q, IMCChannel *chctx)
> }
>
> /* calculate bits left, bits needed and adjust bit allocation */
> - bits = summer = 0;
> + summer = 0;
>
> for (i = 0; i < BANDS; i++) {
> if (chctx->bandFlagsBuf[i]) {
> @@ -863,7 +863,6 @@ static void imc_refine_bit_allocation(IMCContext *q, IMCChannel *chctx)
> chctx->CWlengthT[j] = 0;
> }
> }
> - bits += chctx->skipFlagBits[i];
> summer -= chctx->skipFlagBits[i];
> }
> }
> diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
> index fa6fc208f5..c06752f43a 100644
> --- a/libavcodec/j2kenc.c
> +++ b/libavcodec/j2kenc.c
> @@ -1272,7 +1272,6 @@ static void makelayers(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile)
> double min = DBL_MAX;
> double max = 0;
> double thresh;
> - int tile_disto = 0;
>
> Jpeg2000CodingStyle *codsty = &s->codsty;
>
> @@ -1294,7 +1293,6 @@ static void makelayers(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile)
> int dr;
> double dd, drslope;
>
> - tile_disto += pass->disto;
> if (passno == 0) {
> dr = (int32_t)pass->rate;
> dd = pass->disto;
> diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
> index 684dbe0af5..95012f7c1a 100644
> --- a/libavcodec/roqvideoenc.c
> +++ b/libavcodec/roqvideoenc.c
> @@ -666,7 +666,6 @@ static void reconstruct_and_encode_image(RoqEncContext *enc,
> int i, j, k;
> int x, y;
> int subX, subY;
> - int dist=0;
>
> roq_qcell *qcell;
> CelEvaluation *eval;
> @@ -692,7 +691,6 @@ static void reconstruct_and_encode_image(RoqEncContext *enc,
>
> x = eval->sourceX;
> y = eval->sourceY;
> - dist += eval->eval_dist[eval->best_coding];
>
> switch (eval->best_coding) {
> case RoQ_ID_MOT:
> diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c
> index 0621d18b35..3955a4e8e9 100644
> --- a/libavfilter/af_astats.c
> +++ b/libavfilter/af_astats.c
> @@ -403,7 +403,6 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata)
> max_sigma_x = 0,
> diff1_sum = 0,
> diff1_sum_x2 = 0,
> - sigma_x = 0,
> sigma_x2 = 0,
> noise_floor = 0,
> entropy = 0,
> @@ -428,7 +427,6 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata)
> diff1_sum_x2 += p->diff1_sum_x2;
> min_sigma_x2 = FFMIN(min_sigma_x2, p->min_sigma_x2);
> max_sigma_x2 = FFMAX(max_sigma_x2, p->max_sigma_x2);
> - sigma_x += p->sigma_x;
> sigma_x2 += p->sigma_x2;
> noise_floor = FFMAX(noise_floor, p->noise_floor);
> noise_floor_count += p->noise_floor_count;
> @@ -659,7 +657,6 @@ static void print_stats(AVFilterContext *ctx)
> max_sigma_x = 0,
> diff1_sum_x2 = 0,
> diff1_sum = 0,
> - sigma_x = 0,
> sigma_x2 = 0,
> noise_floor = 0,
> entropy = 0,
> @@ -684,7 +681,6 @@ static void print_stats(AVFilterContext *ctx)
> diff1_sum += p->diff1_sum;
> min_sigma_x2 = FFMIN(min_sigma_x2, p->min_sigma_x2);
> max_sigma_x2 = FFMAX(max_sigma_x2, p->max_sigma_x2);
> - sigma_x += p->sigma_x;
> sigma_x2 += p->sigma_x2;
> noise_floor = FFMAX(noise_floor, p->noise_floor);
> p->entropy = calc_entropy(s, p);
> diff --git a/libswresample/tests/swresample.c b/libswresample/tests/swresample.c
> index 53896585e2..14a8f14f3e 100644
> --- a/libswresample/tests/swresample.c
> +++ b/libswresample/tests/swresample.c
> @@ -362,16 +362,12 @@ int main(int argc, char **argv){
>
> for(ch=0; ch<in_ch_count; ch++){
> double sse, maxdiff=0;
> - double sum_a= 0;
> - double sum_b= 0;
> double sum_aa= 0;
> double sum_bb= 0;
> double sum_ab= 0;
> for(i=0; i<out_count; i++){
> double a= get(ain , ch, i, in_ch_count, in_sample_fmt);
> double b= get(aout, ch, i, in_ch_count, in_sample_fmt);
> - sum_a += a;
> - sum_b += b;
> sum_aa+= a*a;
> sum_bb+= b*b;
> sum_ab+= a*b;
> @@ -392,16 +388,12 @@ int main(int argc, char **argv){
> if(flush_count){
> for(ch=0; ch<in_ch_count; ch++){
> double sse, maxdiff=0;
> - double sum_a= 0;
> - double sum_b= 0;
> double sum_aa= 0;
> double sum_bb= 0;
> double sum_ab= 0;
> for(i=0; i<flush_count; i++){
> double a= get(ain , ch, i+out_count, in_ch_count, in_sample_fmt);
> double b= get(aout, ch, i, in_ch_count, in_sample_fmt);
> - sum_a += a;
> - sum_b += b;
> sum_aa+= a*a;
> sum_bb+= b*b;
> sum_ab+= a*b;
>
Will apply tonight unless there are objections.
- Andreas
More information about the ffmpeg-devel
mailing list