SILK update
authorKoen Vos <koen.vos@skype.net>
Wed, 27 Apr 2011 03:21:27 +0000 (23:21 -0400)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Wed, 27 Apr 2011 04:51:03 +0000 (00:51 -0400)
COPYING
autogen.sh [changed mode: 0755->0644]
doc/build_draft.sh [changed mode: 0755->0644]
opus.sln
silk
src/opus_decoder.c
src/opus_encoder.c
src/test_opus.c

diff --git a/COPYING b/COPYING
index ca0f52c..6df9b09 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -26,7 +26,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-Copyright (c) 2006-2010, Skype Limited. All rights reserved.
+Copyright (c) 2006-2011, Skype Limited. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without 
 modification, (subject to the limitations in the disclaimer below) 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 660e242..7525308 100644 (file)
--- a/opus.sln
+++ b/opus.sln
@@ -28,31 +28,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "src_FIX", "silk\src_FIX\src
                {950F7176-3D29-4CBF-8C40-58B918EAEBB2} = {950F7176-3D29-4CBF-8C40-58B918EAEBB2}\r
                {06D10292-A23C-4C5E-9C0F-28737769206F} = {06D10292-A23C-4C5E-9C0F-28737769206F}\r
                {245603E3-F580-41A5-9632-B25FE3372CBF} = {245603E3-F580-41A5-9632-B25FE3372CBF}\r
-       EndProjectSection\r
-EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "src_FLP", "silk\src_FLP\src_FLP.vcxproj", "{9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}"\r
-       ProjectSection(ProjectDependencies) = postProject\r
-               {950F7176-3D29-4CBF-8C40-58B918EAEBB2} = {950F7176-3D29-4CBF-8C40-58B918EAEBB2}\r
-               {06D10292-A23C-4C5E-9C0F-28737769206F} = {06D10292-A23C-4C5E-9C0F-28737769206F}\r
-               {245603E3-F580-41A5-9632-B25FE3372CBF} = {245603E3-F580-41A5-9632-B25FE3372CBF}\r
-       EndProjectSection\r
-EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_silk_dec", "silk\test_silk_dec\test_silk_dec.vcxproj", "{8CA2DBCB-F28E-4022-ACD7-E2C23A15827F}"\r
-       ProjectSection(ProjectDependencies) = postProject\r
-               {8484C90D-1561-402F-A91D-2DB10F8C5171} = {8484C90D-1561-402F-A91D-2DB10F8C5171}\r
-               {950F7176-3D29-4CBF-8C40-58B918EAEBB2} = {950F7176-3D29-4CBF-8C40-58B918EAEBB2}\r
-               {06D10292-A23C-4C5E-9C0F-28737769206F} = {06D10292-A23C-4C5E-9C0F-28737769206F}\r
-               {9C4961D2-5DDB-40C7-9BE8-CA918DC4E782} = {9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}\r
-               {245603E3-F580-41A5-9632-B25FE3372CBF} = {245603E3-F580-41A5-9632-B25FE3372CBF}\r
                {C303D2FC-FF97-49B8-9DDD-467B4C9A0B16} = {C303D2FC-FF97-49B8-9DDD-467B4C9A0B16}\r
        EndProjectSection\r
 EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_silk_enc", "silk\test_silk_enc\test_silk_enc.vcxproj", "{38945839-ADA4-40CA-9C43-092FD47960A0}"\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "src_FLP", "silk\src_FLP\src_FLP.vcxproj", "{9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}"\r
        ProjectSection(ProjectDependencies) = postProject\r
-               {8484C90D-1561-402F-A91D-2DB10F8C5171} = {8484C90D-1561-402F-A91D-2DB10F8C5171}\r
                {950F7176-3D29-4CBF-8C40-58B918EAEBB2} = {950F7176-3D29-4CBF-8C40-58B918EAEBB2}\r
                {06D10292-A23C-4C5E-9C0F-28737769206F} = {06D10292-A23C-4C5E-9C0F-28737769206F}\r
-               {9C4961D2-5DDB-40C7-9BE8-CA918DC4E782} = {9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}\r
                {245603E3-F580-41A5-9632-B25FE3372CBF} = {245603E3-F580-41A5-9632-B25FE3372CBF}\r
                {C303D2FC-FF97-49B8-9DDD-467B4C9A0B16} = {C303D2FC-FF97-49B8-9DDD-467B4C9A0B16}\r
        EndProjectSection\r
@@ -91,14 +73,6 @@ Global
                {9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}.Debug|Win32.Build.0 = Debug|Win32\r
                {9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}.Release|Win32.ActiveCfg = Release|Win32\r
                {9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}.Release|Win32.Build.0 = Release|Win32\r
-               {8CA2DBCB-F28E-4022-ACD7-E2C23A15827F}.Debug|Win32.ActiveCfg = Debug|Win32\r
-               {8CA2DBCB-F28E-4022-ACD7-E2C23A15827F}.Debug|Win32.Build.0 = Debug|Win32\r
-               {8CA2DBCB-F28E-4022-ACD7-E2C23A15827F}.Release|Win32.ActiveCfg = Release|Win32\r
-               {8CA2DBCB-F28E-4022-ACD7-E2C23A15827F}.Release|Win32.Build.0 = Release|Win32\r
-               {38945839-ADA4-40CA-9C43-092FD47960A0}.Debug|Win32.ActiveCfg = Debug|Win32\r
-               {38945839-ADA4-40CA-9C43-092FD47960A0}.Debug|Win32.Build.0 = Debug|Win32\r
-               {38945839-ADA4-40CA-9C43-092FD47960A0}.Release|Win32.ActiveCfg = Release|Win32\r
-               {38945839-ADA4-40CA-9C43-092FD47960A0}.Release|Win32.Build.0 = Release|Win32\r
        EndGlobalSection\r
        GlobalSection(SolutionProperties) = preSolution\r
                HideSolutionNode = FALSE\r
diff --git a/silk b/silk
index 0d73d67..fcf95ba 160000 (submodule)
--- a/silk
+++ b/silk
@@ -1 +1 @@
-Subproject commit 0d73d676d76f9bc9eae4d3863e0c43d2c73f943e
+Subproject commit fcf95bac9330e8e6db1184496ae33007a7c7a9cf
index 4c7d179..14ab6cc 100644 (file)
@@ -145,10 +145,6 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
     if (st->stream_channels > st->channels)
         return OPUS_CORRUPTED_DATA;
 
-    /* FIXME: Remove this when we add SILK stereo support */
-    if (st->stream_channels == 2 && mode != MODE_CELT_ONLY)
-        return OPUS_UNIMPLEMENTED;
-
     if (data!=NULL && !st->prev_redundancy && mode != st->prev_mode && st->prev_mode > 0
                && !(mode == MODE_SILK_ONLY && st->prev_mode == MODE_HYBRID)
                && !(mode == MODE_HYBRID && st->prev_mode == MODE_SILK_ONLY))
@@ -191,6 +187,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
             /* Hybrid mode */
             DecControl.internalSampleRate = 16000;
         }
+        DecControl.nChannels = st->channels;
 
         lost_flag = data == NULL ? 1 : 2 * decode_fec;
         decoded_samples = 0;
@@ -198,12 +195,12 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
             /* Call SILK decoder */
             int first_frame = decoded_samples == 0;
             silk_ret = SKP_Silk_SDK_Decode( st->silk_dec, &DecControl, 
-                lost_flag, first_frame, &dec, len, pcm_ptr, &silk_frame_size );
+                lost_flag, first_frame, &dec, pcm_ptr, &silk_frame_size );
             if( silk_ret ) {
                 fprintf (stderr, "SILK decode error\n");
                 /* Handle error */
             }
-            pcm_ptr += silk_frame_size;
+            pcm_ptr += silk_frame_size * st->channels;
             decoded_samples += silk_frame_size;
         } while( decoded_samples < frame_size );
     } else {
@@ -283,11 +280,13 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
             pcm[i] = ADD_SAT16(pcm[i], pcm_celt[i]);
     }
 
+
     {
         const CELTMode *celt_mode;
         celt_decoder_ctl(st->celt_dec, CELT_GET_MODE(&celt_mode));
         window = celt_mode->window;
     }
+
     /* 5 ms redundant frame for SILK->CELT */
     if (redundancy && !celt_to_silk)
     {
index cf0eee1..a5f3ffd 100644 (file)
@@ -66,6 +66,7 @@ OpusEncoder *opus_encoder_create(int Fs, int channels)
 
     /* default SILK parameters */
     st->silk_mode.API_sampleRate        = st->Fs;
+    st->silk_mode.nChannels             = channels;
     st->silk_mode.maxInternalSampleRate = 16000;
     st->silk_mode.minInternalSampleRate = 8000;
     st->silk_mode.payloadSize_ms        = 20;
@@ -154,10 +155,6 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
         st->mode = MODE_CELT_ONLY;
     }
 
-    /* FIXME: Remove this once SILK supports stereo */
-    if (st->channels == 2)
-        st->mode = MODE_CELT_ONLY;
-
     /* Bandwidth selection */
     if (st->mode == MODE_CELT_ONLY)
     {
@@ -371,7 +368,6 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
             }
         }
 
-
         ec_enc_shrink(&enc, nb_compr_bytes);
        } else {
            nb_compr_bytes = 0;
index 78115f0..797c872 100644 (file)
@@ -44,7 +44,7 @@ void print_usage( char* argv[] )
 {
     fprintf(stderr, "Usage: %s <mode (0/1/2)> <sampling rate (Hz)> <channels> "
         "<bits per second>  [options] <input> <output>\n\n", argv[0]);
-    fprintf(stderr, "mode: 0 for audo, 1 for voice, 2 for audio:\n" );
+    fprintf(stderr, "mode: 0 for auto, 1 for voice, 2 for audio:\n" );
     fprintf(stderr, "options:\n" );
     fprintf(stderr, "-cbr                 : enable constant bitrate; default: VBR\n" );
     fprintf(stderr, "-bandwidth <NB|MB|WB|SWB|FB>  : audio bandwidth (from narrowband to fullband); default: sampling rate\n" );
@@ -291,7 +291,7 @@ int main(int argc, char *argv[])
          return 1;
       }
 
-      lost = rand()%100<packet_loss_perc || len[toggle]==0;
+      lost = rand()%100 < packet_loss_perc || len[toggle]==0;
       if( count >= use_inbandfec ) {
           /* delay by one packet when using in-band FEC */
           if( use_inbandfec  ) {