shithub: opus

Download patch

ref: 38fca4a203a6759f2c90b86c84c4db087982ca81
parent: dd6d6d523b4e7e51f2cfee725caf41cedeba1af2
author: Mark Harris <[email protected]>
date: Sat Jul 28 09:07:15 EDT 2018

Work around VS2015 internal compiler error

The error was:
c:\projects\opus\celt\celt_encoder.c(1019): fatal error C1001: An internal error has occurred in the compiler. [C:\projects\opus\win32\VS2015\opus.vcxproj]
  (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 255)
   To work around this problem, try simplifying or changing the program near the locations listed above.
  Please choose the Technical Support command on the Visual C++
   Help menu, or open the Technical Support help file for more information

  Internal Compiler Error in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe.  You will be prompted to send an error report to Microsoft later.

--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1021,13 +1021,13 @@
          /* Compute SMR: Mask is never more than 72 dB below the peak and never below the noise floor.*/
          opus_val16 smr = sig[i]-MAX16(MAX16(0, maxDepth-QCONST16(12.f, DB_SHIFT)), mask[i]);
          /* Clamp SMR to make sure we're not shifting by something negative or too large. */
-         smr = MAX16(-QCONST16(5.f, DB_SHIFT), MIN16(0, smr));
 #ifdef FIXED_POINT
          /* FIXME: Use PSHR16() instead */
-         spread_weight[i] = IMAX(1, 32 >> -PSHR32(smr, DB_SHIFT));
+         int shift = -PSHR32(MAX16(-QCONST16(5.f, DB_SHIFT), MIN16(0, smr)), DB_SHIFT);
 #else
-         spread_weight[i] = IMAX(1, 32 >> -(int)floor(.5f + smr));
+         int shift = IMIN(5, IMAX(0, -(int)floor(.5f + smr)));
 #endif
+         spread_weight[i] = 32 >> shift;
       }
       /*for (i=0;i<end;i++)
          printf("%d ", spread_weight[i]);