On 09/18/2012 07:05 PM, Alex Converse wrote:
On Mon, Sep 17, 2012 at 4:35 PM, Benjamin Larsson<[email protected]>  wrote:
gcc:
libavcodec/aacsbr.c:399:8: warning: ‘max_qmf_subbands’ may be used 
uninitialized in this function [-Wuninitialized]
libavcodec/aacsbr.c:326:24: note: ‘max_qmf_subbands’ was declared here

clang:
libavcodec/aacsbr.c:391:16: warning: variable 'max_qmf_subbands' is used 
uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     } else if (sbr->sample_rate>= 48000)
                ^~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/aacsbr.c:394:33: note: uninitialized use occurs here
     if (sbr->k[2] - sbr->k[0]>  max_qmf_subbands) {
                                 ^~~~~~~~~~~~~~~~

Reorder and change the if else block so that the max_qmf_subbands
variable always will be set. This change is valid as the only allowed
sample rate betwen 32000 and 48000 is 41000.
---
  libavcodec/aacsbr.c |    6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 5eca115..35e7c72 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -386,10 +386,10 @@ static int sbr_make_f_master(AACContext *ac, 
SpectralBandReplication *sbr,
      // Requirements (14496-3 sp04 p205)
      if (sbr->sample_rate<= 32000) {
          max_qmf_subbands = 48;
-    } else if (sbr->sample_rate == 44100) {
-        max_qmf_subbands = 35;
-    } else if (sbr->sample_rate>= 48000)
+    } else if (sbr->sample_rate>= 48000) {
          max_qmf_subbands = 32;
+    } else /*if (sbr->sample_rate == 44100) */
+        max_qmf_subbands = 35;

Is there a reason you are changing the order?

To be able to change the 44100 else if block to an else.


MvH
Benjamin Larsson

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to