[FFmpeg-devel] lavc/opusenc_psy: Remove a write-only variable

Submitted by Carl Eugen Hoyos on Jan. 5, 2018, 4:11 a.m.

Details

Message ID CAB0OVGrFVNnniNt9F_3aKcEFTG7=E9fuEkS+8QKA-e+FAQtRFA@mail.gmail.com
State Superseded
Headers show

Commit Message

Carl Eugen Hoyos Jan. 5, 2018, 4:11 a.m.
2018-01-05 3:24 GMT+01:00 Rostislav Pehlivanov <atomnuker@gmail.com>:
> On 4 January 2018 at 04:38, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:

>> Attached patch fixes a warning here when compiling the opus encoder.

> I don't like this patch and I'm planning on using that variable in the
> future.

New patch attached.

Thank you, Carl Eugen

Patch hide | download patch | download mbox

From 55ef093222ff162bfaffc95e1546f95e88532c0f Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Fri, 5 Jan 2018 05:09:49 +0100
Subject: [PATCH] lavc/opusenc_psy: Split variable declarations and code.

Fixes a warning:
libavcodec/opusenc_psy.c:407:5: warning: ISO C90 forbids mixed declarations and code
---
 libavcodec/opusenc_psy.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/opusenc_psy.c b/libavcodec/opusenc_psy.c
index b712603..2df2eb3 100644
--- a/libavcodec/opusenc_psy.c
+++ b/libavcodec/opusenc_psy.c
@@ -398,14 +398,12 @@  static void celt_search_for_dual_stereo(OpusPsyContext *s, CeltFrame *f)
 static void celt_search_for_intensity(OpusPsyContext *s, CeltFrame *f)
 {
     int i, best_band = CELT_MAX_BANDS - 1;
-    float dist, best_dist = FLT_MAX;
+    float dist, best_dist = FLT_MAX, end_band = 0;
 
     if (s->avctx->channels < 2)
         return;
 
     /* TODO: fix, make some heuristic up here using the lambda value */
-    float end_band = 0;
-
     for (i = f->end_band; i >= end_band; i--) {
         f->intensity_stereo = i;
         bands_dist(s, f, &dist);
-- 
1.7.10.4