shithub: opus

Download patch

ref: 0ba6458ba1490098ffbaccc7f4be8a9643c0dd77
parent: e04826d42240dab2e04c3500a62fe3bf6b80062f
author: Jan Buethe <jbuethe@amazon.de>
date: Wed Oct 26 08:37:43 EDT 2022

added --enable-neural-fec option to configure

--- a/configure.ac
+++ b/configure.ac
@@ -162,6 +162,15 @@
 
 AM_CONDITIONAL([CUSTOM_MODES], [test "$enable_custom_modes" = "yes"])
 
+AC_ARG_ENABLE([neural-fec],
+    [AS_HELP_STRING([--enable-neural-fec], [Use neural FEC for SILK])],,
+    [enable_neural_fec=yes])
+
+AS_IF([test "$enable_neural_fec" = "yes"],[
+  AC_DEFINE([ENABLE_NEURAL_FEC], [1], [Neural FEC])
+  AC_DEFINE([DISABLE_DOT_PROD], [1], [Disable dot product])
+])  
+
 AC_ARG_ENABLE([neural-plc],
     [AS_HELP_STRING([--enable-neural-plc], [Use neural PLC for SILK])],,
     [enable_neural_plc=yes])
--- a/silk/dred_decoder.c
+++ b/silk/dred_decoder.c
@@ -73,7 +73,6 @@
     {
         q_level = (int) round(DRED_ENC_Q0 + 1.f * (DRED_ENC_Q1 - DRED_ENC_Q0) * i / (DRED_NUM_REDUNDANCY_FRAMES - 2));
         offset = q_level * DRED_LATENT_DIM;
-
         dred_decode_latents(
             &dec->ec_dec,
             latents,
--- a/silk/enc_API.c
+++ b/silk/enc_API.c
@@ -41,7 +41,9 @@
 #include "main_FLP.h"
 #endif
 
+#ifdef ENABLE_NEURAL_FEC
 #include "dred_encoder.h"
+#endif
 
 /***************************************/
 /* Read control structure from encoder */
@@ -466,8 +468,10 @@
             }
             silk_encode_do_VAD_Fxx( &psEnc->state_Fxx[ 0 ], activity );
 
+#ifdef ENABLE_NEURAL_FEC
             /* DRED Encoder */
             dred_encode_silk_frame( &psEnc->state_Fxx[ 0 ].sCmn.dred_encoder, &psEnc->state_Fxx[ 0 ].sCmn.inputBuf[0] );
+#endif
 
             /* Encode */
             for( n = 0; n < encControl->nChannelsInternal; n++ ) {
--- a/silk/init_encoder.c
+++ b/silk/init_encoder.c
@@ -36,7 +36,9 @@
 #include "tuning_parameters.h"
 #include "cpu_support.h"
 
+#ifdef ENABLE_NEURAL_FEC
 #include "dred_encoder.h"
+#endif
 
 /*********************************/
 /* Initialize Silk Encoder state */
@@ -62,8 +64,9 @@
     /* Initialize Silk VAD */
     ret += silk_VAD_Init( &psEnc->sCmn.sVAD );
 
+#ifdef ENABLE_NEURAL_FEC
     /* Initialize DRED Encoder */
     init_dred_encoder( &psEnc->sCmn.dred_encoder );
-
+#endif
     return  ret;
 }
--- a/silk/structs.h
+++ b/silk/structs.h
@@ -234,7 +234,9 @@
     opus_int                     LBRR_GainIncreases;                /* Gains increment for coding LBRR frames                           */
     SideInfoIndices              indices_LBRR[ MAX_FRAMES_PER_PACKET ];
     opus_int8                    pulses_LBRR[ MAX_FRAMES_PER_PACKET ][ MAX_FRAME_LENGTH ];
+#ifdef ENABLE_NEURAL_FEC
     DREDEnc                      dred_encoder;
+#endif
 } silk_encoder_state;
 
 
--