summaryrefslogtreecommitdiff
path: root/silk/decode_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'silk/decode_core.c')
-rw-r--r--silk/decode_core.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/silk/decode_core.c b/silk/decode_core.c
index 1c352a65..a2288b67 100644
--- a/silk/decode_core.c
+++ b/silk/decode_core.c
@@ -29,6 +29,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include "config.h"
#endif
+#define FEATURES
+#ifdef FEATURES
+#include <stdio.h>
+#endif
+
#include "main.h"
#include "stack_alloc.h"
@@ -43,6 +48,17 @@ void silk_decode_core(
int arch /* I Run-time architecture */
)
{
+
+#ifdef FEATURES
+ static FILE *flpc = NULL;
+ static FILE *fgain = NULL;
+ static FILE *fltp = NULL;
+
+ if (flpc == NULL) {flpc = fopen("features_lpc.f32", "wb");}
+ if (fgain == NULL) {fgain = fopen("features_gain.f32", "wb");}
+ if (fltp == NULL) {fltp = fopen("features_ltp.f32", "wb");}
+
+#endif
opus_int i, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType;
opus_int16 *A_Q12, *B_Q14, *pxq, A_Q12_tmp[ MAX_LPC_ORDER ];
VARDECL( opus_int16, sLTP );
@@ -106,6 +122,34 @@ void silk_decode_core(
Gain_Q10 = silk_RSHIFT( psDecCtrl->Gains_Q16[ k ], 6 );
inv_gain_Q31 = silk_INVERSE32_varQ( psDecCtrl->Gains_Q16[ k ], 47 );
+#ifdef FEATURES
+ {
+ float tmp;
+
+ /* gain */
+ tmp = (float) psDecCtrl->Gains_Q16[k] / (1UL << 16);
+ fwrite(&tmp, sizeof(tmp), 1, fgain);
+
+ /* LPC */
+ if (k % 2 == 0)
+ {
+ for (i = 0; i < psDec->LPC_order; i++)
+ {
+ tmp = (float) A_Q12[i] / (1U << 12);
+ fwrite(&tmp, sizeof(tmp), 1, flpc);
+ }
+ }
+
+ /* LTP */
+ for (i = 0; i < 5; i++)
+ {
+ tmp = (float) B_Q14[i] / (1U << 14);
+ fwrite(&tmp, sizeof(tmp), 1, fltp);
+ }
+
+ }
+#endif
+
/* Calculate gain adjustment factor */
if( psDecCtrl->Gains_Q16[ k ] != psDec->prev_gain_Q16 ) {
gain_adj_Q16 = silk_DIV32_varQ( psDec->prev_gain_Q16, psDecCtrl->Gains_Q16[ k ], 16 );