Remove compiler warnings, revised ARM QMF encoder

Bug 8493170

Change-Id: I64d19a8a8059c5a96386b1eaac297fd2469515f8
diff --git a/libAACenc/src/aacEnc_rom.cpp b/libAACenc/src/aacEnc_rom.cpp
index 0cdf5fe..c6477e3 100644
--- a/libAACenc/src/aacEnc_rom.cpp
+++ b/libAACenc/src/aacEnc_rom.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -93,7 +93,7 @@
 /*
    Huffman Tables
 */
-const INT FDKaacEnc_huff_ltab1_2[3][3][3][3]=
+const ULONG FDKaacEnc_huff_ltab1_2[3][3][3][3]=
 {
   {
     { {0x000b0009,0x00090007,0x000b0009}, {0x000a0008,0x00070006,0x000a0008}, {0x000b0009,0x00090008,0x000b0009} },
@@ -113,7 +113,7 @@
 };
 
 
-const INT FDKaacEnc_huff_ltab3_4[3][3][3][3]=
+const ULONG FDKaacEnc_huff_ltab3_4[3][3][3][3]=
 {
   {
     { {0x00010004,0x00040005,0x00080008}, {0x00040005,0x00050004,0x00080008}, {0x00090009,0x00090008,0x000a000b} },
@@ -132,7 +132,7 @@
   }
 };
 
-const INT FDKaacEnc_huff_ltab5_6[9][9]=
+const ULONG FDKaacEnc_huff_ltab5_6[9][9]=
 {
   {0x000d000b, 0x000c000a, 0x000b0009, 0x000b0009, 0x000a0009, 0x000b0009, 0x000b0009, 0x000c000a, 0x000d000b},
   {0x000c000a, 0x000b0009, 0x000a0008, 0x00090007, 0x00080007, 0x00090007, 0x000a0008, 0x000b0009, 0x000c000a},
@@ -145,7 +145,7 @@
   {0x000d000b, 0x000c000a, 0x000c0009, 0x000b0009, 0x000a0009, 0x000a0009, 0x000b0009, 0x000c000a, 0x000d000b}
 };
 
-const INT FDKaacEnc_huff_ltab7_8[8][8]=
+const ULONG FDKaacEnc_huff_ltab7_8[8][8]=
 {
   {0x00010005, 0x00030004, 0x00060005, 0x00070006, 0x00080007, 0x00090008, 0x000a0009, 0x000b000a},
   {0x00030004, 0x00040003, 0x00060004, 0x00070005, 0x00080006, 0x00080007, 0x00090007, 0x00090008},
@@ -157,7 +157,7 @@
   {0x000b000a, 0x000a0008, 0x000a0008, 0x000a0008, 0x000b0009, 0x000b0009, 0x000c0009, 0x000c000a}
 };
 
-const INT FDKaacEnc_huff_ltab9_10[13][13]=
+const ULONG FDKaacEnc_huff_ltab9_10[13][13]=
 {
   {0x00010006, 0x00030005, 0x00060006, 0x00080006, 0x00090007, 0x000a0008, 0x000a0009, 0x000b000a, 0x000b000a, 0x000c000a, 0x000c000b, 0x000d000b, 0x000d000c},
   {0x00030005, 0x00040004, 0x00060004, 0x00070005, 0x00080006, 0x00080007, 0x00090007, 0x000a0008, 0x000a0008, 0x000a0009, 0x000b000a, 0x000c000a, 0x000c000b},
@@ -392,7 +392,7 @@
   {0x0046, 0x00ea, 0x0034, 0x00ea, 0x0011, 0x001b, 0x00a9, 0x0094, 0x00e2, 0x0031, 0x00d0, 0x00e5, 0x0007, 0x0070, 0x0069, 0x003e, 0x0021}
 };
 
-const INT FDKaacEnc_huff_ctabscf[121]=
+const ULONG FDKaacEnc_huff_ctabscf[121]=
 {
   0x0003ffe8, 0x0003ffe6, 0x0003ffe7, 0x0003ffe5, 0x0007fff5, 0x0007fff1, 0x0007ffed, 0x0007fff6,
   0x0007ffee, 0x0007ffef, 0x0007fff0, 0x0007fffc, 0x0007fffd, 0x0007ffff, 0x0007fffe, 0x0007fff7,
@@ -657,11 +657,11 @@
 */
 const FIXP_DBL FDKaacEnc_tnsEncCoeff3[8]=
 {
-  0x81f1d201, 0x91261481, 0xadb92301, 0xd438af00, 0x00000000, 0x37898080, 0x64130dff, 0x7cca6fff
+  (FIXP_DBL)0x81f1d201, (FIXP_DBL)0x91261481, (FIXP_DBL)0xadb92301, (FIXP_DBL)0xd438af00, (FIXP_DBL)0x00000000, (FIXP_DBL)0x37898080, (FIXP_DBL)0x64130dff, (FIXP_DBL)0x7cca6fff
 };
 const FIXP_DBL FDKaacEnc_tnsCoeff3Borders[8]={
-  0x80000001 /*-4*/,  0x87b826df /*-3*/,  0x9df24154 /*-2*/,  0xbfffffe5 /*-1*/,
-  0xe9c5e578 /* 0*/,  0x1c7b90f0 /* 1*/,  0x4fce83a9 /* 2*/,  0x7352f2c3 /* 3*/
+  (FIXP_DBL)0x80000001 /*-4*/,  (FIXP_DBL)0x87b826df /*-3*/,  (FIXP_DBL)0x9df24154 /*-2*/,  (FIXP_DBL)0xbfffffe5 /*-1*/,
+  (FIXP_DBL)0xe9c5e578 /* 0*/,  (FIXP_DBL)0x1c7b90f0 /* 1*/,  (FIXP_DBL)0x4fce83a9 /* 2*/,  (FIXP_DBL)0x7352f2c3 /* 3*/
 };
 
 /*
@@ -669,15 +669,15 @@
 */
 const FIXP_DBL FDKaacEnc_tnsEncCoeff4[16]=
 {
-  0x808bc881, 0x84e2e581, 0x8d6b4a01, 0x99da9201, 0xa9c45701, 0xbc9dde81, 0xd1c2d500, 0xe87ae540,
-  0x00000000, 0x1a9cd9c0, 0x340ff240, 0x4b3c8bff, 0x5f1f5e7f, 0x6ed9eb7f, 0x79bc387f, 0x7f4c7e7f
+  (FIXP_DBL)0x808bc881, (FIXP_DBL)0x84e2e581, (FIXP_DBL)0x8d6b4a01, (FIXP_DBL)0x99da9201, (FIXP_DBL)0xa9c45701, (FIXP_DBL)0xbc9dde81, (FIXP_DBL)0xd1c2d500, (FIXP_DBL)0xe87ae540,
+  (FIXP_DBL)0x00000000, (FIXP_DBL)0x1a9cd9c0, (FIXP_DBL)0x340ff240, (FIXP_DBL)0x4b3c8bff, (FIXP_DBL)0x5f1f5e7f, (FIXP_DBL)0x6ed9eb7f, (FIXP_DBL)0x79bc387f, (FIXP_DBL)0x7f4c7e7f
 };
 const FIXP_DBL FDKaacEnc_tnsCoeff4Borders[16]=
 {
-  0x80000001 /*-8*/,  0x822deff0 /*-7*/,  0x88a4bfe6 /*-6*/,  0x932c159d /*-5*/,
-  0xa16827c2 /*-4*/,  0xb2dcde27 /*-3*/,  0xc6f20b91 /*-2*/,  0xdcf89c64 /*-1*/,
-  0xf4308ce1 /* 0*/,  0x0d613054 /* 1*/,  0x278dde80 /* 2*/,  0x4000001b /* 3*/,
-  0x55a6127b /* 4*/,  0x678dde8f /* 5*/,  0x74ef0ed7 /* 6*/,  0x7d33f0da /* 7*/
+  (FIXP_DBL)0x80000001 /*-8*/,  (FIXP_DBL)0x822deff0 /*-7*/,  (FIXP_DBL)0x88a4bfe6 /*-6*/,  (FIXP_DBL)0x932c159d /*-5*/,
+  (FIXP_DBL)0xa16827c2 /*-4*/,  (FIXP_DBL)0xb2dcde27 /*-3*/,  (FIXP_DBL)0xc6f20b91 /*-2*/,  (FIXP_DBL)0xdcf89c64 /*-1*/,
+  (FIXP_DBL)0xf4308ce1 /* 0*/,  (FIXP_DBL)0x0d613054 /* 1*/,  (FIXP_DBL)0x278dde80 /* 2*/,  (FIXP_DBL)0x4000001b /* 3*/,
+  (FIXP_DBL)0x55a6127b /* 4*/,  (FIXP_DBL)0x678dde8f /* 5*/,  (FIXP_DBL)0x74ef0ed7 /* 6*/,  (FIXP_DBL)0x7d33f0da /* 7*/
 };
 const FIXP_DBL FDKaacEnc_mTab_4_3Elc[512]={
   FL2FXCONST_DBL(0.3968502629920499),FL2FXCONST_DBL(0.3978840634868335),FL2FXCONST_DBL(0.3989185359354711),FL2FXCONST_DBL(0.3999536794661432),
diff --git a/libAACenc/src/aacEnc_rom.h b/libAACenc/src/aacEnc_rom.h
index 37e5012..862417f 100644
--- a/libAACenc/src/aacEnc_rom.h
+++ b/libAACenc/src/aacEnc_rom.h
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -105,11 +105,11 @@
 /*
   Huffman Tables
 */
-extern const INT    FDKaacEnc_huff_ltab1_2[3][3][3][3];
-extern const INT    FDKaacEnc_huff_ltab3_4[3][3][3][3];
-extern const INT    FDKaacEnc_huff_ltab5_6[9][9];
-extern const INT    FDKaacEnc_huff_ltab7_8[8][8];
-extern const INT    FDKaacEnc_huff_ltab9_10[13][13];
+extern const ULONG  FDKaacEnc_huff_ltab1_2[3][3][3][3];
+extern const ULONG  FDKaacEnc_huff_ltab3_4[3][3][3][3];
+extern const ULONG  FDKaacEnc_huff_ltab5_6[9][9];
+extern const ULONG  FDKaacEnc_huff_ltab7_8[8][8];
+extern const ULONG  FDKaacEnc_huff_ltab9_10[13][13];
 extern const UCHAR  FDKaacEnc_huff_ltab11[17][17];
 extern const UCHAR  FDKaacEnc_huff_ltabscf[121];
 extern const USHORT FDKaacEnc_huff_ctab1[3][3][3][3];
@@ -123,7 +123,7 @@
 extern const USHORT FDKaacEnc_huff_ctab9[13][13];
 extern const USHORT FDKaacEnc_huff_ctab10[13][13];
 extern const USHORT FDKaacEnc_huff_ctab11[21][17];
-extern const INT    FDKaacEnc_huff_ctabscf[121];
+extern const ULONG  FDKaacEnc_huff_ctabscf[121];
 
 /*
   quantizer
diff --git a/libAACenc/src/aacenc.cpp b/libAACenc/src/aacenc.cpp
index 569662b..c47e882 100644
--- a/libAACenc/src/aacenc.cpp
+++ b/libAACenc/src/aacenc.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -435,7 +435,9 @@
          &averageBitsPerFrame,
           config->bitrateMode,
           config->nSubFrames
-          ) != config->bitRate )
+          ) != config->bitRate
+      && !((config->bitrateMode>=1) && (config->bitrateMode<=5))
+     )
   {
     return AAC_ENC_UNSUPPORTED_BITRATE;
   }
diff --git a/libAACenc/src/aacenc_hcr.cpp b/libAACenc/src/aacenc_hcr.cpp
deleted file mode 100644
index 316623a..0000000
--- a/libAACenc/src/aacenc_hcr.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-
-/* -----------------------------------------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
-  All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements
-the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio.
-This FDK AAC Codec software is intended to be used on a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual
-audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by
-independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part
-of the MPEG specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer)
-may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners
-individually for the purpose of encoding or decoding bit streams in products that are compliant with
-the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license
-these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec
-software may already be covered under those patent licenses when it is used for those licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality,
-are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional
-applications information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification, are permitted without
-payment of copyright license fees provided that you satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of the FDK AAC Codec or
-your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation and/or other materials
-provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form.
-You must make available free of charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived from this library without
-prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec
-software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software
-and the date of any change. For modified versions of the FDK AAC Codec, the term
-"Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term
-"Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer,
-ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with
-respect to this software.
-
-You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized
-by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors
-"AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties
-of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages,
-including but not limited to procurement of substitute goods or services; loss of use, data, or profits,
-or business interruption, however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of this software, even if
-advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------------------------------------ */
-
-/***************************  MPEG AAC Audio Encoder  *************************
-
-   Initial author:       R. Boehm
-   contents/description: huffman codeword reordering
-                         based on source from aacErrRobTrans
-
-******************************************************************************/
-
-#include "aacenc_hcr.h"
-
diff --git a/libAACenc/src/aacenc_hcr.h b/libAACenc/src/aacenc_hcr.h
deleted file mode 100644
index 934247a..0000000
--- a/libAACenc/src/aacenc_hcr.h
+++ /dev/null
@@ -1,96 +0,0 @@
-
-/* -----------------------------------------------------------------------------------------------------------
-Software License for The Fraunhofer FDK AAC Codec Library for Android
-
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
-  All rights reserved.
-
- 1.    INTRODUCTION
-The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements
-the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio.
-This FDK AAC Codec software is intended to be used on a wide variety of Android devices.
-
-AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual
-audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by
-independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part
-of the MPEG specifications.
-
-Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer)
-may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners
-individually for the purpose of encoding or decoding bit streams in products that are compliant with
-the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license
-these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec
-software may already be covered under those patent licenses when it is used for those licensed purposes only.
-
-Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality,
-are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional
-applications information and documentation.
-
-2.    COPYRIGHT LICENSE
-
-Redistribution and use in source and binary forms, with or without modification, are permitted without
-payment of copyright license fees provided that you satisfy the following conditions:
-
-You must retain the complete text of this software license in redistributions of the FDK AAC Codec or
-your modifications thereto in source code form.
-
-You must retain the complete text of this software license in the documentation and/or other materials
-provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form.
-You must make available free of charge copies of the complete source code of the FDK AAC Codec and your
-modifications thereto to recipients of copies in binary form.
-
-The name of Fraunhofer may not be used to endorse or promote products derived from this library without
-prior written permission.
-
-You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec
-software or your modifications thereto.
-
-Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software
-and the date of any change. For modified versions of the FDK AAC Codec, the term
-"Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term
-"Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android."
-
-3.    NO PATENT LICENSE
-
-NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer,
-ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with
-respect to this software.
-
-You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized
-by appropriate patent licenses.
-
-4.    DISCLAIMER
-
-This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors
-"AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties
-of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages,
-including but not limited to procurement of substitute goods or services; loss of use, data, or profits,
-or business interruption, however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence), arising in any way out of the use of this software, even if
-advised of the possibility of such damage.
-
-5.    CONTACT INFORMATION
-
-Fraunhofer Institute for Integrated Circuits IIS
-Attention: Audio and Multimedia Departments - FDK AAC LL
-Am Wolfsmantel 33
-91058 Erlangen, Germany
-
-www.iis.fraunhofer.de/amm
-amm-info@iis.fraunhofer.de
------------------------------------------------------------------------------------------------------------ */
-
-/***************************  MPEG AAC Audio Encoder  *************************
-
-   Initial author:       R. Boehm
-   contents/description: huffman codeword reordering
-                         based on source from aacErrRobTrans
-
-******************************************************************************/
-
-#ifndef _AACENC_HCR
-#define _AACENC_HCR_H
-
-
-#endif  /* ifndef _AACENC_HCR */
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index 63563fd..02f83bf 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -98,7 +98,7 @@
 /* Encoder library info */
 #define AACENCODER_LIB_VL0 3
 #define AACENCODER_LIB_VL1 4
-#define AACENCODER_LIB_VL2 12
+#define AACENCODER_LIB_VL2 14
 #define AACENCODER_LIB_TITLE "AAC Encoder"
 #ifdef __ANDROID__
 #define AACENCODER_LIB_BUILD_DATE ""
@@ -303,7 +303,7 @@
     int i, cfgIdx = -1;
     const ULONG channelBitrate = totalBitrate / FDKaacEnc_GetChannelModeConfiguration(channelMode)->nChannelsEff;
 
-    for (i=0; i<(sizeof(eldSbrAutoConfigTab)/sizeof(ELD_SBR_CONFIGURATOR)); i++) {
+    for (i=0; i<(int)(sizeof(eldSbrAutoConfigTab)/sizeof(ELD_SBR_CONFIGURATOR)); i++) {
       if ( (samplingRate <= eldSbrAutoConfigTab[i].samplingRate)
         && (channelBitrate >= eldSbrAutoConfigTab[i].bitrateRange) )
       {
@@ -914,7 +914,7 @@
     }
     else {
       /* SBR ratio has been set by the user, so use it. */
-      hAacConfig->sbrRatio = config->userSbrRatio;
+      hAacConfig->sbrRatio = isSbrActive(hAacConfig) ? config->userSbrRatio : 0;
     }
 
     {
@@ -1998,7 +1998,7 @@
         break;
     case AACENC_METADATA_MODE:
         if ((UINT)settings->userMetaDataMode != value) {
-            if ( !((value>=0) && (value<=2)) ) {
+            if ( !(((INT)value>=0) && ((INT)value<=2)) ) {
                 err = AACENC_INVALID_CONFIG;
                 break;
             }
diff --git a/libAACenc/src/adj_thr.cpp b/libAACenc/src/adj_thr.cpp
index 6433633..69a70b4 100644
--- a/libAACenc/src/adj_thr.cpp
+++ b/libAACenc/src/adj_thr.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -130,14 +130,14 @@
 
 typedef struct {
   INT                 bitrate;
-  LONG                bits2PeFactor_mono;
-  LONG                bits2PeFactor_mono_slope;
-  LONG                bits2PeFactor_stereo;
-  LONG                bits2PeFactor_stereo_slope;
-  LONG                bits2PeFactor_mono_scfOpt;
-  LONG                bits2PeFactor_mono_scfOpt_slope;
-  LONG                bits2PeFactor_stereo_scfOpt;
-  LONG                bits2PeFactor_stereo_scfOpt_slope;
+  ULONG               bits2PeFactor_mono;
+  ULONG               bits2PeFactor_mono_slope;
+  ULONG               bits2PeFactor_stereo;
+  ULONG               bits2PeFactor_stereo_slope;
+  ULONG               bits2PeFactor_mono_scfOpt;
+  ULONG               bits2PeFactor_mono_scfOpt_slope;
+  ULONG               bits2PeFactor_stereo_scfOpt;
+  ULONG               bits2PeFactor_stereo_scfOpt_slope;
 
 } BIT_PE_SFAC;
 
diff --git a/libAACenc/src/psy_main.cpp b/libAACenc/src/psy_main.cpp
index 59193c7..1c593f8 100644
--- a/libAACenc/src/psy_main.cpp
+++ b/libAACenc/src/psy_main.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -447,7 +447,7 @@
                                     INT                  totalChannels
                                    )
 {
-    INT commonWindow = 1;
+    const INT commonWindow = 1;
     INT maxSfbPerGroup[(2)];
     INT mdctSpectrum_e;
     INT ch;   /* counts through channels          */
@@ -815,7 +815,7 @@
                       &hThisPsyConf[1]->tnsConf);
             }
 
-            FDK_ASSERT(commonWindow=1); /* all checks for TNS do only work for common windows (which is always set)*/
+            FDK_ASSERT(1==commonWindow); /* all checks for TNS do only work for common windows (which is always set)*/
             for(w = 0; w < nWindows[0]; w++)
             {
                 if (isShortWindow[0])
diff --git a/libAACenc/src/qc_main.cpp b/libAACenc/src/qc_main.cpp
index b74510a..278bcb2 100644
--- a/libAACenc/src/qc_main.cpp
+++ b/libAACenc/src/qc_main.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -107,14 +107,11 @@
 } TAB_VBR_QUAL_FACTOR;
 
 static const TAB_VBR_QUAL_FACTOR tableVbrQualFactor[] = {
-  {QCDATA_BR_MODE_CBR,   FL2FXCONST_DBL(0.00f)},
   {QCDATA_BR_MODE_VBR_1, FL2FXCONST_DBL(0.160f)}, /* 32 kbps mono   AAC-LC + SBR + PS */
   {QCDATA_BR_MODE_VBR_2, FL2FXCONST_DBL(0.148f)}, /* 64 kbps stereo AAC-LC + SBR      */
   {QCDATA_BR_MODE_VBR_3, FL2FXCONST_DBL(0.135f)}, /* 80 - 96 kbps stereo AAC-LC       */
   {QCDATA_BR_MODE_VBR_4, FL2FXCONST_DBL(0.111f)}, /* 128 kbps stereo AAC-LC           */
-  {QCDATA_BR_MODE_VBR_5, FL2FXCONST_DBL(0.070f)}, /* 192 kbps stereo AAC-LC           */
-  {QCDATA_BR_MODE_SFR,   FL2FXCONST_DBL(0.00f)},
-  {QCDATA_BR_MODE_FF,    FL2FXCONST_DBL(0.00f)}
+  {QCDATA_BR_MODE_VBR_5, FL2FXCONST_DBL(0.070f)}  /* 192 kbps stereo AAC-LC           */
 };
 
 static INT isConstantBitrateMode(
@@ -369,6 +366,7 @@
 AAC_ENCODER_ERROR FDKaacEnc_QCInit(QC_STATE *hQC,
                                    struct QC_INIT *init)
 {
+  int i;
   hQC->maxBitsPerFrame = init->maxBits;
   hQC->minBitsPerFrame = init->minBits;
   hQC->nElements       = init->channelMapping->nElements;
@@ -399,25 +397,12 @@
                             (init->averageBits/init->nSubFrames) - hQC->globHdrBits,
                             hQC->maxBitsPerFrame/init->channelMapping->nChannelsEff);
 
-  switch(hQC->bitrateMode){
-    case QCDATA_BR_MODE_CBR:
-    case QCDATA_BR_MODE_VBR_1:
-    case QCDATA_BR_MODE_VBR_2:
-    case QCDATA_BR_MODE_VBR_3:
-    case QCDATA_BR_MODE_VBR_4:
-    case QCDATA_BR_MODE_VBR_5:
-    case QCDATA_BR_MODE_SFR:
-    case QCDATA_BR_MODE_FF:
-      if((int)hQC->bitrateMode < (int)(sizeof(tableVbrQualFactor)/sizeof(TAB_VBR_QUAL_FACTOR))){
-        hQC->vbrQualFactor = (FIXP_DBL)tableVbrQualFactor[hQC->bitrateMode].vbrQualFactor;
-      } else {
-        hQC->vbrQualFactor = FL2FXCONST_DBL(0.f); /* default setting */
-      }
+  hQC->vbrQualFactor = FL2FXCONST_DBL(0.f);
+  for (i=0; i<(int)(sizeof(tableVbrQualFactor)/sizeof(TAB_VBR_QUAL_FACTOR)); i++) {
+    if (hQC->bitrateMode==tableVbrQualFactor[i].bitrateMode) {
+      hQC->vbrQualFactor = (FIXP_DBL)tableVbrQualFactor[i].vbrQualFactor;
       break;
-    case QCDATA_BR_MODE_INVALID:
-    default:
-      hQC->vbrQualFactor = FL2FXCONST_DBL(0.f);
-      break;
+    }
   }
 
   FDKaacEnc_AdjThrInit(
diff --git a/libFDK/src/FDK_core.cpp b/libFDK/src/FDK_core.cpp
index a706eb0..cccb925 100644
--- a/libFDK/src/FDK_core.cpp
+++ b/libFDK/src/FDK_core.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -93,7 +93,7 @@
 /* FDK tools library info */
 #define FDK_TOOLS_LIB_VL0 2
 #define FDK_TOOLS_LIB_VL1 3
-#define FDK_TOOLS_LIB_VL2 2
+#define FDK_TOOLS_LIB_VL2 3
 #define FDK_TOOLS_LIB_TITLE "FDK Tools"
 #ifdef __ANDROID__
 #define FDK_TOOLS_LIB_BUILD_DATE ""
diff --git a/libFDK/src/arm/qmf_arm.cpp b/libFDK/src/arm/qmf_arm.cpp
index 0c0ce80..fbeebfb 100644
--- a/libFDK/src/arm/qmf_arm.cpp
+++ b/libFDK/src/arm/qmf_arm.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -482,42 +482,42 @@
      B = p_flt[4];                        /* Bottom=[8] Top=[9]     */
      A = p_fltm[3];                       /* Bottom=[316] Top=[317] */
      sta0 = sta[0];                       /* save state[0]          */
-     *sta++ = SMLAWT( sta[1], imag, B );  /* index=9...........319  */
-     *sta++ = SMLAWB( sta[1], real, A );  /* index=316...........6  */
-     *sta++ = SMLAWB( sta[1], imag, B );  /* index=8,18,    ...318  */
+     sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=9...........319  */
+     sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=316...........6  */
+     sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=8,18,    ...318  */
      B = p_flt[3];                        /* Bottom=[6] Top=[7]     */
-     *sta++ = SMLAWT( sta[1], real, A );  /* index=317...........7  */
+     sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=317...........7  */
      A = p_fltm[4];                       /* Bottom=[318] Top=[319] */
-     *sta++ = SMLAWT( sta[1], imag, B );  /* index=7...........317  */
-     *sta++ = SMLAWB( sta[1], real, A );  /* index=318...........8  */
-     *sta++ = SMLAWB( sta[1], imag, B );  /* index=6...........316  */
+     sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=7...........317  */
+     sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=318...........8  */
+     sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=6...........316  */
      B = p_flt[2];                        /* Bottom=[X] Top=[5]     */
-     *sta++ = SMLAWT( sta[1], real, A );  /* index=9...........319  */
+     sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=9...........319  */
      A = p_fltm[2];                       /* Bottom=[X] Top=[315]   */
-     *sta++ =         SMULWT( imag, B );  /* index=5,15, ...   315  */
+     sta[0] =         SMULWT( imag, B ); sta++; /* index=5,15, ...   315  */
      result = SMLAWT( sta0,   real, A );  /* index=315...........5  */
 
-     *pMyTimeOut++ = result;
+     pMyTimeOut[0] = result; pMyTimeOut++;
 
      real = *--realSlot;
      imag = *--imagSlot;
      A = p_fltm[0];                       /* Bottom=[310] Top=[311] */
      B = p_flt[7];                        /* Bottom=[14]  Top=[15]  */
      result = SMLAWB( sta[0], real, A );  /* index=310...........0  */
-     *sta++ = SMLAWB( sta[1], imag, B );  /* index=14..........324  */
-     *pMyTimeOut++ = result;
+     sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=14..........324  */
+     pMyTimeOut[0] = result; pMyTimeOut++;
      B = p_flt[6];                        /* Bottom=[12]  Top=[13]  */
-     *sta++ = SMLAWT( sta[1], real, A );  /* index=311...........1  */
+     sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=311...........1  */
      A = p_fltm[1];                       /* Bottom=[312] Top=[313] */
-     *sta++ = SMLAWT( sta[1], imag, B );  /* index=13..........323  */
-     *sta++ = SMLAWB( sta[1], real, A );  /* index=312...........2  */
-     *sta++ = SMLAWB( sta[1], imag, B );  /* index=12..........322  */
-     *sta++ = SMLAWT( sta[1], real, A );  /* index=313...........3  */
+     sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=13..........323  */
+     sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=312...........2  */
+     sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=12..........322  */
+     sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=313...........3  */
      A = p_fltm[2];                       /* Bottom=[314] Top=[315] */
      B = p_flt[5];                        /* Bottom=[10]  Top=[11]  */
-     *sta++ = SMLAWT( sta[1], imag, B );  /* index=11..........321  */
-     *sta++ = SMLAWB( sta[1], real, A );  /* index=314...........4  */
-     *sta++ =         SMULWB( imag, B );  /* index=10..........320  */
+     sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=11..........321  */
+     sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=314...........4  */
+     sta[0] =         SMULWB( imag, B ); sta++; /* index=10..........320  */
 
 
      p_flt    += 5;
@@ -566,21 +566,21 @@
      A = p_fltm[0];                       /* Bottom=[310] Top=[311] */
      B = p_flt[7];                        /* Bottom=[14]  Top=[15]  */
      result = SMLAWB( sta[0], real, A );  /* index=310...........0  */
-     *sta++ = SMLAWB( sta[1], imag, B );  /* index=14..........324  */
+     sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=14..........324  */
      B = p_flt[6];                        /* Bottom=[12]  Top=[13]  */
-     *sta++ = SMLAWT( sta[1], real, A );  /* index=311...........1  */
+     sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=311...........1  */
      A = p_fltm[1];                       /* Bottom=[312] Top=[313] */
-     *sta++ = SMLAWT( sta[1], imag, B );  /* index=13..........323  */
-     *sta++ = SMLAWB( sta[1], real, A );  /* index=312...........2  */
-     *sta++ = SMLAWB( sta[1], imag, B );  /* index=12..........322  */
-     *sta++ = SMLAWT( sta[1], real, A );  /* index=313...........3  */
+     sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=13..........323  */
+     sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=312...........2  */
+     sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=12..........322  */
+     sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=313...........3  */
      A = p_fltm[2];                       /* Bottom=[314] Top=[315] */
      B = p_flt[5];                        /* Bottom=[10]  Top=[11]  */
-     *sta++ = SMLAWT( sta[1], imag, B );  /* index=11..........321  */
-     *sta++ = SMLAWB( sta[1], real, A );  /* index=314...........4  */
-     *sta++ =         SMULWB( imag, B );  /* index=10..........320  */
+     sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=11..........321  */
+     sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=314...........4  */
+     sta[0] =         SMULWB( imag, B ); sta++; /* index=10..........320  */
 
-     *pMyTimeOut++ = result;
+     pMyTimeOut[0] = result; pMyTimeOut++;
 
      p_fltm   -= 5;
      p_flt    += 5;
@@ -610,8 +610,8 @@
     {
       FIXP_DBL result1, result2;
 
-      result1 = *pMyTimeOut++;
-      result2 = *pMyTimeOut++;
+      result1 = pMyTimeOut[0]; pMyTimeOut++;
+      result2 = pMyTimeOut[0]; pMyTimeOut++;
 
       result1 = fMult(result1,gain);
       timeOut -= stride;
@@ -635,8 +635,8 @@
       timeOut[0] = result2 << scale;
 #endif
 
-      result1 = *pMyTimeOut++;
-      result2 = *pMyTimeOut++;
+      result1 = pMyTimeOut[0]; pMyTimeOut++;
+      result2 = pMyTimeOut[0]; pMyTimeOut++;
 
       result1 = fMult(result1,gain);
       timeOut -= stride;
@@ -666,8 +666,8 @@
     for (no_channels>>=2; no_channels--;)
     {
       FIXP_DBL result1, result2;
-      result1 = *pMyTimeOut++;
-      result2 = *pMyTimeOut++;
+      result1 = pMyTimeOut[0]; pMyTimeOut++;
+      result2 = pMyTimeOut[0]; pMyTimeOut++;
       timeOut -= stride;
       if (result1 < 0)        result1 += add_neg;
       if (result1 < max_neg)  result1 = max_neg;
@@ -688,8 +688,8 @@
       timeOut[0] = result2 << scale;
 #endif
       
-      result1 = *pMyTimeOut++;
-      result2 = *pMyTimeOut++;
+      result1 = pMyTimeOut[0]; pMyTimeOut++;
+      result2 = pMyTimeOut[0]; pMyTimeOut++;
       timeOut -= stride;
       if (result1 < 0)        result1 += add_neg;
       if (result1 < max_neg)  result1 = max_neg;
diff --git a/libSBRenc/src/bit_sbr.cpp b/libSBRenc/src/bit_sbr.cpp
index 963aeff..9200e01 100644
--- a/libSBRenc/src/bit_sbr.cpp
+++ b/libSBRenc/src/bit_sbr.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -283,9 +283,7 @@
                           INT            element_index,
                           int            fSendHeaders)
 {
-  int bits;
-
-  bits = encodeSbrHeaderData (&sbrEncoder->sbrElement[element_index]->sbrHeaderData, hBs);
+  encodeSbrHeaderData (&sbrEncoder->sbrElement[element_index]->sbrHeaderData, hBs);
     
   if (fSendHeaders == 0) {
     /* Prevent header being embedded into the SBR payload. */
diff --git a/libSBRenc/src/ps_bitenc.cpp b/libSBRenc/src/ps_bitenc.cpp
index b1fe12e..420ea15 100644
--- a/libSBRenc/src/ps_bitenc.cpp
+++ b/libSBRenc/src/ps_bitenc.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -261,21 +261,23 @@
   0x00000001,  0x00000002,  0x00000001,  0x00000007,  0x00000006,  0000000000,  0x00000002,  0x00000003
 };
 
-static const INT psBands[] =
+static INT getNoBands(const INT mode)
 {
-  PS_BANDS_COARSE,
-  PS_BANDS_MID
-};
+  INT noBands = 0;
 
-static INT getNoBands(PS_RESOLUTION mode)
-{
-  if(mode>=6)
-    return 0;
+  switch (mode) {
+    case 0: case 3: /* coarse */
+      noBands = PS_BANDS_COARSE;
+      break;
+    case 1: case 4: /* mid */
+      noBands = PS_BANDS_MID;
+      break;
+    case 2: case 5: /* fine not supported */
+    default:        /* coarse as default */
+      noBands = PS_BANDS_COARSE;
+  }
 
-  if(mode>=3)
-    mode = (PS_RESOLUTION)(mode-3);
-
-  return psBands[mode];
+  return noBands;
 }
 
 static INT getIIDRes(INT iidMode)
@@ -524,7 +526,7 @@
       bitCnt += FDKsbrEnc_EncodeIpd( hBitBuf,
                            psOut->ipd[env],
                            ipdLast,
-                           getNoBands((PS_RESOLUTION)psOut->iidMode),
+                           getNoBands(psOut->iidMode),
                            psOut->deltaIPD[env],
                            &error);
 
@@ -532,7 +534,7 @@
       bitCnt += FDKsbrEnc_EncodeOpd( hBitBuf,
                            psOut->opd[env],
                            opdLast,
-                           getNoBands((PS_RESOLUTION)psOut->iidMode),
+                           getNoBands(psOut->iidMode),
                            psOut->deltaOPD[env],
                            &error );
     }
@@ -661,7 +663,7 @@
         bitCnt += FDKsbrEnc_EncodeIid( hBitBuf,
                              psOut->iid[env],
                              iidLast,
-                             getNoBands((PS_RESOLUTION)psOut->iidMode),
+                             getNoBands(psOut->iidMode),
                              (PS_IID_RESOLUTION)getIIDRes(psOut->iidMode),
                              psOut->deltaIID[env],
                              &error );
@@ -677,7 +679,7 @@
         bitCnt += FDKsbrEnc_EncodeIcc( hBitBuf,
                              psOut->icc[env],
                              iccLast,
-                             getNoBands((PS_RESOLUTION)psOut->iccMode),
+                             getNoBands(psOut->iccMode),
                              psOut->deltaICC[env],
                              &error);
 
diff --git a/libSBRenc/src/ps_encode.cpp b/libSBRenc/src/ps_encode.cpp
index 2ae2788..fec39e8 100644
--- a/libSBRenc/src/ps_encode.cpp
+++ b/libSBRenc/src/ps_encode.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -149,21 +149,21 @@
 
 
 static const FIXP_DBL iidQuant_fx[15] = {
-  0xce000000, 0xdc000000, 0xe4000000, 0xec000000, 0xf2000000, 0xf8000000, 0xfc000000, 0x00000000,
-  0x04000000, 0x08000000, 0x0e000000, 0x14000000, 0x1c000000, 0x24000000, 0x32000000
+  (FIXP_DBL)0xce000000, (FIXP_DBL)0xdc000000, (FIXP_DBL)0xe4000000, (FIXP_DBL)0xec000000, (FIXP_DBL)0xf2000000, (FIXP_DBL)0xf8000000, (FIXP_DBL)0xfc000000, (FIXP_DBL)0x00000000,
+  (FIXP_DBL)0x04000000, (FIXP_DBL)0x08000000, (FIXP_DBL)0x0e000000, (FIXP_DBL)0x14000000, (FIXP_DBL)0x1c000000, (FIXP_DBL)0x24000000, (FIXP_DBL)0x32000000
 };
 
 static const FIXP_DBL iidQuantFine_fx[31] = {
-  0x9c000001, 0xa6000001, 0xb0000001, 0xba000001, 0xc4000000, 0xce000000, 0xd4000000, 0xda000000,
-  0xe0000000, 0xe6000000, 0xec000000, 0xf0000000, 0xf4000000, 0xf8000000, 0xfc000000, 0x00000000,
-  0x04000000, 0x08000000, 0x0c000000, 0x10000000, 0x14000000, 0x1a000000, 0x20000000, 0x26000000,
-  0x2c000000, 0x32000000, 0x3c000000, 0x45ffffff, 0x4fffffff, 0x59ffffff, 0x63ffffff
+  (FIXP_DBL)0x9c000001, (FIXP_DBL)0xa6000001, (FIXP_DBL)0xb0000001, (FIXP_DBL)0xba000001, (FIXP_DBL)0xc4000000, (FIXP_DBL)0xce000000, (FIXP_DBL)0xd4000000, (FIXP_DBL)0xda000000,
+  (FIXP_DBL)0xe0000000, (FIXP_DBL)0xe6000000, (FIXP_DBL)0xec000000, (FIXP_DBL)0xf0000000, (FIXP_DBL)0xf4000000, (FIXP_DBL)0xf8000000, (FIXP_DBL)0xfc000000, (FIXP_DBL)0x00000000,
+  (FIXP_DBL)0x04000000, (FIXP_DBL)0x08000000, (FIXP_DBL)0x0c000000, (FIXP_DBL)0x10000000, (FIXP_DBL)0x14000000, (FIXP_DBL)0x1a000000, (FIXP_DBL)0x20000000, (FIXP_DBL)0x26000000,
+  (FIXP_DBL)0x2c000000, (FIXP_DBL)0x32000000, (FIXP_DBL)0x3c000000, (FIXP_DBL)0x45ffffff, (FIXP_DBL)0x4fffffff, (FIXP_DBL)0x59ffffff, (FIXP_DBL)0x63ffffff
 };
 
 
 
 static const FIXP_DBL iccQuant[8] = {
-  0x7fffffff, 0x77ef9d7f, 0x6babc97f, 0x4ceaf27f, 0x2f0ed3c0, 0x00000000, 0xb49ba601, 0x80000000
+  (FIXP_DBL)0x7fffffff, (FIXP_DBL)0x77ef9d7f, (FIXP_DBL)0x6babc97f, (FIXP_DBL)0x4ceaf27f, (FIXP_DBL)0x2f0ed3c0, (FIXP_DBL)0x00000000, (FIXP_DBL)0xb49ba601, (FIXP_DBL)0x80000000
 };
 
 static FDK_PSENC_ERROR InitPSData(
diff --git a/libSBRenc/src/sbr_encoder.cpp b/libSBRenc/src/sbr_encoder.cpp
index 464c013..221aecd 100644
--- a/libSBRenc/src/sbr_encoder.cpp
+++ b/libSBRenc/src/sbr_encoder.cpp
@@ -2,7 +2,7 @@
 /* -----------------------------------------------------------------------------------------------------------
 Software License for The Fraunhofer FDK AAC Codec Library for Android
 
-© Copyright  1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright  1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
   All rights reserved.
 
  1.    INTRODUCTION
@@ -103,7 +103,7 @@
 
 #define SBRENCODER_LIB_VL0 3
 #define SBRENCODER_LIB_VL1 3
-#define SBRENCODER_LIB_VL2 4
+#define SBRENCODER_LIB_VL2 6
 
 
 
@@ -170,7 +170,6 @@
 {
   int i, bitRateClosestLowerIndex=-1, bitRateClosestUpperIndex=-1, found = 0;
   UINT bitRateClosestUpper = 0, bitRateClosestLower=DISTANCE_CEIL_VALUE;
-  int isforThisCodec=0;
 
   #define isForThisCore(i) \
     ( ( sbrTuningTable[i].coreCoder == CODEC_AACLD && core == AOT_ER_AAC_ELD ) || \
@@ -854,7 +853,7 @@
                          int                  clearOutput              /*!< Do not consider any input signal */
                         )
 {
-  HANDLE_SBR_ELEMENT hSbrElement = hEnvEncoder->sbrElement[iElement];
+  HANDLE_SBR_ELEMENT hSbrElement = NULL;
   FDK_CRCINFO  crcInfo;
   INT    crcReg;
   INT    ch;