shithub: opus

Download patch

ref: d8765e54ea84c7e52c3f9132aaf6f41f8f02f115
parent: d2124cdf0dce5389f2a627ef69a99c4f25fc7209
author: Koen Vos <[email protected]>
date: Tue Apr 26 19:21:27 EDT 2011

SILK update

--- a/COPYING
+++ b/COPYING
@@ -26,7 +26,7 @@
 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) 
--- a/opus.sln
+++ b/opus.sln
@@ -28,6 +28,7 @@
 		{950F7176-3D29-4CBF-8C40-58B918EAEBB2} = {950F7176-3D29-4CBF-8C40-58B918EAEBB2}
 		{06D10292-A23C-4C5E-9C0F-28737769206F} = {06D10292-A23C-4C5E-9C0F-28737769206F}
 		{245603E3-F580-41A5-9632-B25FE3372CBF} = {245603E3-F580-41A5-9632-B25FE3372CBF}
+		{C303D2FC-FF97-49B8-9DDD-467B4C9A0B16} = {C303D2FC-FF97-49B8-9DDD-467B4C9A0B16}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "src_FLP", "silk\src_FLP\src_FLP.vcxproj", "{9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}"
@@ -35,28 +36,9 @@
 		{950F7176-3D29-4CBF-8C40-58B918EAEBB2} = {950F7176-3D29-4CBF-8C40-58B918EAEBB2}
 		{06D10292-A23C-4C5E-9C0F-28737769206F} = {06D10292-A23C-4C5E-9C0F-28737769206F}
 		{245603E3-F580-41A5-9632-B25FE3372CBF} = {245603E3-F580-41A5-9632-B25FE3372CBF}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_silk_dec", "silk\test_silk_dec\test_silk_dec.vcxproj", "{8CA2DBCB-F28E-4022-ACD7-E2C23A15827F}"
-	ProjectSection(ProjectDependencies) = postProject
-		{8484C90D-1561-402F-A91D-2DB10F8C5171} = {8484C90D-1561-402F-A91D-2DB10F8C5171}
-		{950F7176-3D29-4CBF-8C40-58B918EAEBB2} = {950F7176-3D29-4CBF-8C40-58B918EAEBB2}
-		{06D10292-A23C-4C5E-9C0F-28737769206F} = {06D10292-A23C-4C5E-9C0F-28737769206F}
-		{9C4961D2-5DDB-40C7-9BE8-CA918DC4E782} = {9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}
-		{245603E3-F580-41A5-9632-B25FE3372CBF} = {245603E3-F580-41A5-9632-B25FE3372CBF}
 		{C303D2FC-FF97-49B8-9DDD-467B4C9A0B16} = {C303D2FC-FF97-49B8-9DDD-467B4C9A0B16}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_silk_enc", "silk\test_silk_enc\test_silk_enc.vcxproj", "{38945839-ADA4-40CA-9C43-092FD47960A0}"
-	ProjectSection(ProjectDependencies) = postProject
-		{8484C90D-1561-402F-A91D-2DB10F8C5171} = {8484C90D-1561-402F-A91D-2DB10F8C5171}
-		{950F7176-3D29-4CBF-8C40-58B918EAEBB2} = {950F7176-3D29-4CBF-8C40-58B918EAEBB2}
-		{06D10292-A23C-4C5E-9C0F-28737769206F} = {06D10292-A23C-4C5E-9C0F-28737769206F}
-		{9C4961D2-5DDB-40C7-9BE8-CA918DC4E782} = {9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}
-		{245603E3-F580-41A5-9632-B25FE3372CBF} = {245603E3-F580-41A5-9632-B25FE3372CBF}
-		{C303D2FC-FF97-49B8-9DDD-467B4C9A0B16} = {C303D2FC-FF97-49B8-9DDD-467B4C9A0B16}
-	EndProjectSection
-EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -91,14 +73,6 @@
 		{9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}.Debug|Win32.Build.0 = Debug|Win32
 		{9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}.Release|Win32.ActiveCfg = Release|Win32
 		{9C4961D2-5DDB-40C7-9BE8-CA918DC4E782}.Release|Win32.Build.0 = Release|Win32
-		{8CA2DBCB-F28E-4022-ACD7-E2C23A15827F}.Debug|Win32.ActiveCfg = Debug|Win32
-		{8CA2DBCB-F28E-4022-ACD7-E2C23A15827F}.Debug|Win32.Build.0 = Debug|Win32
-		{8CA2DBCB-F28E-4022-ACD7-E2C23A15827F}.Release|Win32.ActiveCfg = Release|Win32
-		{8CA2DBCB-F28E-4022-ACD7-E2C23A15827F}.Release|Win32.Build.0 = Release|Win32
-		{38945839-ADA4-40CA-9C43-092FD47960A0}.Debug|Win32.ActiveCfg = Debug|Win32
-		{38945839-ADA4-40CA-9C43-092FD47960A0}.Debug|Win32.Build.0 = Debug|Win32
-		{38945839-ADA4-40CA-9C43-092FD47960A0}.Release|Win32.ActiveCfg = Release|Win32
-		{38945839-ADA4-40CA-9C43-092FD47960A0}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -145,10 +145,6 @@
     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 @@
             /* Hybrid mode */
             DecControl.internalSampleRate = 16000;
         }
+        DecControl.nChannels = st->channels;
 
         lost_flag = data == NULL ? 1 : 2 * decode_fec;
         decoded_samples = 0;
@@ -198,12 +195,12 @@
             /* 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 @@
             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)
     {
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -66,6 +66,7 @@
 
     /* 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 @@
         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)
     {
@@ -370,7 +367,6 @@
                 nb_compr_bytes = bytes_target;
             }
         }
-
 
         ec_enc_shrink(&enc, nb_compr_bytes);
 	} else {
--- a/src/test_opus.c
+++ b/src/test_opus.c
@@ -44,7 +44,7 @@
 {
     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 @@
          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  ) {