Update SILK code using the CELT range coder
[opus.git] / src_SigProc_FIX / SKP_Silk_resampler_private_AR2.c
similarity index 62%
rename from src/SKP_Silk_resample_3_2_rom.c
rename to src_SigProc_FIX/SKP_Silk_resampler_private_AR2.c
index 3710604..9e8a141 100644 (file)
@@ -25,22 +25,36 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
 ***********************************************************************/\r
 \r
-/*                                                                      *\r
- * File Name:   SKP_Silk_resample_3_2_rom.c                           *\r
+/*                                                                                                                                             *\r
+ * SKP_Silk_resampler_private_AR2. c                                  *\r
+ *                                                                                                                                             *\r
+ * Second order AR filter with single delay elements                   *\r
  *                                                                      *\r
- * Description: Filter coefficients for FIR polyphase resampling        *\r
- *                                                                      *\r
- * Copyright 2009 (c), Skype Limited                                    *\r
- * All rights reserved.                                                 *\r
- *                                                                      *\r
- * Date: 090424                                                         *\r
+ * Copyright 2010 (c), Skype Limited                                    *\r
  *                                                                      */\r
 \r
-#include "SKP_Silk_resample_rom.h"\r
+#include "SKP_Silk_SigProc_FIX.h"\r
+#include "SKP_Silk_resampler_private.h"\r
 \r
-const SKP_int16 SigProc_Resample_3_2_coarse_INTERPOL[ SigProc_Resample_3_2_coarse_NUM_INTERPOLATORS ][ SigProc_Resample_3_2_coarse_NUM_FIR_COEFS ] = {\r
-    {    0,     0,     0, 32768,     0,     0,     0,     0 },\r
-    { -384,  1630, -5217, 26674, 12714, -3572,  1050,  -236 },\r
-    { -236,  1050, -3572, 12714, 26674, -5217,  1630,  -384 },\r
-};\r
+#if (EMBEDDED_ARM<5) && (!defined(__mips__)) \r
+/* Second order AR filter with single delay elements */\r
+void SKP_Silk_resampler_private_AR2(\r
+       SKP_int32                                           S[],                    /* I/O: State vector [ 2 ]                              */\r
+       SKP_int32                                           out_Q8[],           /* O:   Output signal                                       */\r
+       const SKP_int16                             in[],                       /* I:   Input signal                                        */\r
+       const SKP_int16                             A_Q14[],            /* I:   AR coefficients, Q14                    */\r
+       SKP_int32                                       len                             /* I:   Signal length                                           */\r
+)\r
+{\r
+       SKP_int32       k;\r
+       SKP_int32       out32;\r
 \r
+       for( k = 0; k < len; k++ ) {\r
+               out32       = SKP_ADD_LSHIFT32( S[ 0 ], (SKP_int32)in[ k ], 8 );\r
+               out_Q8[ k ] = out32;\r
+               out32       = SKP_LSHIFT( out32, 2 );\r
+               S[ 0 ]      = SKP_SMLAWB( S[ 1 ], out32, A_Q14[ 0 ] );\r
+               S[ 1 ]      = SKP_SMULWB( out32, A_Q14[ 1 ] );\r
+       }\r
+}\r
+#endif\r