shithub: opus

Download patch

ref: 0d73d676d76f9bc9eae4d3863e0c43d2c73f943e
parent: f7479653be7649267fd9e2096adf47862cea1a95
author: Jean-Marc Valin <[email protected]>
date: Thu Mar 17 21:29:17 EDT 2011

Fixing DTX for fixed-point too, updating project files

--- a/src_FIX/SKP_Silk_encode_frame_FIX.c
+++ b/src_FIX/SKP_Silk_encode_frame_FIX.c
@@ -46,24 +46,6 @@
 
 TIC(ENCODE_FRAME)
 
-    if( psEnc->sCmn.nFramesAnalyzed == 0 && !psEnc->sCmn.prefillFlag && !( psEnc->sCmn.useDTX && psEnc->sCmn.inDTX ) ) {
-        /* Create space at start of payload for VAD and FEC flags */
-        SKP_uint8 iCDF[ 2 ] = { 0, 0 };
-        iCDF[ 0 ] = 256 - SKP_RSHIFT( 256, psEnc->sCmn.nFramesPerPacket + 1 );
-        ec_enc_icdf( psRangeEnc, 0, iCDF, 8 );
-
-        /* Encode any LBRR data from previous packet */
-        SKP_Silk_LBRR_embed( &psEnc->sCmn, psRangeEnc );
-
-        /* Reduce coding SNR depending on how many bits used by LBRR */
-        nBits = ec_tell( psRangeEnc );
-        psEnc->inBandFEC_SNR_comp_Q7 = SKP_DIV32_16( SKP_SMULBB( SKP_FIX_CONST( 6.0f, 7 ), nBits ), 
-            SKP_SMULBB( psEnc->sCmn.nFramesPerPacket, psEnc->sCmn.frame_length ) );
-
-        /* Reset LBRR flags */
-        SKP_memset( psEnc->sCmn.LBRR_flags, 0, sizeof( psEnc->sCmn.LBRR_flags ) );
-    }
-
     psEnc->sCmn.indices.Seed = psEnc->sCmn.frameCounter++ & 3;
 
     /**************************************************************/
@@ -99,6 +81,24 @@
         psEnc->sCmn.inDTX              = 0;
         psEnc->sCmn.indices.signalType = TYPE_UNVOICED;
         psEnc->sCmn.VAD_flags[ psEnc->sCmn.nFramesAnalyzed ] = 1;
+    }
+
+    if( psEnc->sCmn.nFramesAnalyzed == 0 && !psEnc->sCmn.prefillFlag && !( psEnc->sCmn.useDTX && psEnc->sCmn.inDTX ) ) {
+        /* Create space at start of payload for VAD and FEC flags */
+        SKP_uint8 iCDF[ 2 ] = { 0, 0 };
+        iCDF[ 0 ] = 256 - SKP_RSHIFT( 256, psEnc->sCmn.nFramesPerPacket + 1 );
+        ec_enc_icdf( psRangeEnc, 0, iCDF, 8 );
+
+        /* Encode any LBRR data from previous packet */
+        SKP_Silk_LBRR_embed( &psEnc->sCmn, psRangeEnc );
+
+        /* Reduce coding SNR depending on how many bits used by LBRR */
+        nBits = ec_tell( psRangeEnc );
+        psEnc->inBandFEC_SNR_comp_Q7 = SKP_DIV32_16( SKP_SMULBB( SKP_FIX_CONST( 6.0f, 7 ), nBits ), 
+            SKP_SMULBB( psEnc->sCmn.nFramesPerPacket, psEnc->sCmn.frame_length ) );
+
+        /* Reset LBRR flags */
+        SKP_memset( psEnc->sCmn.LBRR_flags, 0, sizeof( psEnc->sCmn.LBRR_flags ) );
     }
 
     /*******************************************/
--- a/src_FIX/src_FIX.vcxproj
+++ b/src_FIX/src_FIX.vcxproj
@@ -45,7 +45,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface;../src_SigProc_FIX;../src_common;../../celt/libcelt</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../interface;../src_SigProc_FIX;../src_common;../../celt/msvc;../../celt/libcelt</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -61,7 +61,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface;../src_SigProc_FIX;../src_common;../../celt/libcelt</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../interface;../src_SigProc_FIX;../src_common;../../celt/msvc;../../celt/libcelt</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
--- a/src_FLP/SKP_Silk_encode_frame_FLP.c
+++ b/src_FLP/SKP_Silk_encode_frame_FLP.c
@@ -95,13 +95,12 @@
 
         /* Reduce coding SNR depending on how many bits used by LBRR */
         nBits = ec_tell( psRangeEnc );
-        psEnc->inBandFEC_SNR_comp = ( 6.0f * nBits ) /
-                ( psEnc->sCmn.nFramesPerPacket * psEnc->sCmn.frame_length );
+        psEnc->inBandFEC_SNR_comp = ( 6.0f * nBits ) / 
+            ( psEnc->sCmn.nFramesPerPacket * psEnc->sCmn.frame_length );
 
         /* Reset LBRR flags */
         SKP_memset( psEnc->sCmn.LBRR_flags, 0, sizeof( psEnc->sCmn.LBRR_flags ) );
     }
-
 
     /*******************************************/
     /* High-pass filtering of the input signal */
--- a/src_FLP/src_FLP.vcxproj
+++ b/src_FLP/src_FLP.vcxproj
@@ -45,7 +45,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface;../src_SigProc_FLP;../src_SigProc_FIX;../src_common;../../celt/libcelt</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../interface;../src_SigProc_FLP;../src_SigProc_FIX;../src_common;../../celt/msvc;../../celt/libcelt</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -61,7 +61,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface;../src_SigProc_FLP;../src_SigProc_FIX;../src_common;../../celt/libcelt</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../interface;../src_SigProc_FLP;../src_SigProc_FIX;../src_common;../../celt/msvc;../../celt/libcelt</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
--- a/src_SigProc_FIX/src_SigProc_FIX.vcxproj
+++ b/src_SigProc_FIX/src_SigProc_FIX.vcxproj
@@ -45,7 +45,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface;H:\Work\Codecs_silk_celt_experiments\ietfcodec\celt\libcelt</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../interface;..\..\celt\libcelt</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -61,7 +61,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface;H:\Work\Codecs_silk_celt_experiments\ietfcodec\celt\libcelt</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../interface;..\..\celt\libcelt</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
--- a/src_SigProc_FLP/src_SigProc_FLP.vcxproj
+++ b/src_SigProc_FLP/src_SigProc_FLP.vcxproj
@@ -45,7 +45,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>H:\Work\Codecs_silk_celt_experiments\ietfcodec\celt\libcelt;../interface;../src_SigProc_FIX</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\celt\libcelt;../interface;../src_SigProc_FIX</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -61,7 +61,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>H:\Work\Codecs_silk_celt_experiments\ietfcodec\celt\libcelt;../interface;../src_SigProc_FIX</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\celt\libcelt;../interface;../src_SigProc_FIX</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
--- a/src_common/SKP_Silk_dec_API.c
+++ b/src_common/SKP_Silk_dec_API.c
@@ -25,6 +25,9 @@
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ***********************************************************************/
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include "SKP_Silk_SDK_API.h"
 #include "SKP_Silk_main.h"
 
--- a/src_common/src_common.vcxproj
+++ b/src_common/src_common.vcxproj
@@ -45,7 +45,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface/;../src_SigProc_FIX;../src_SigProc_FLP;../src_FIX;../src_FLP;../../celt/libcelt</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../interface/;../src_SigProc_FIX;../src_SigProc_FLP;../src_FIX;../src_FLP;../../celt/libcelt;../../celt/msvc</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -61,7 +61,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface/;../src_SigProc_FIX;../src_SigProc_FLP;../src_FIX;../src_FLP;../../celt/libcelt</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../interface/;../src_SigProc_FIX;../src_SigProc_FLP;../src_FIX;../src_FLP;../../celt/libcelt;../../celt/msvc</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
--- a/test/Decoder.c
+++ b/test/Decoder.c
@@ -37,6 +37,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif 
+
 #include "SKP_Silk_SDK_API.h"
 #include "../src_SigProc_FIX/SKP_Silk_SigProc_FIX.h"
 
--- a/test/Encoder.c
+++ b/test/Encoder.c
@@ -38,6 +38,11 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif 
+
 #include "SKP_Silk_SDK_API.h"
 #include "../src_SigProc_FIX/SKP_Silk_SigProc_FIX.h"
 
--- a/test_silk_dec/test_silk_dec.vcxproj
+++ b/test_silk_dec/test_silk_dec.vcxproj
@@ -50,7 +50,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\interface;..\..\celt\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\interface;..\..\celt\libcelt;../../celt/msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -68,7 +68,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\interface;..\..\celt\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\interface;..\..\celt\libcelt;../../celt/msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
--- a/test_silk_enc/test_silk_enc.vcxproj
+++ b/test_silk_enc/test_silk_enc.vcxproj
@@ -50,7 +50,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\interface;..\..\celt\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\interface;..\..\celt\libcelt;../../celt/msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -68,7 +68,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\interface;..\..\celt\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\interface;..\..\celt\libcelt;../../celt/msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>