diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2019-04-07 02:07:19 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2019-04-07 02:07:19 -0400 |
commit | a4d818b4a5c6b43e022458e621a3b40cc6945920 (patch) | |
tree | 5caed262c9c072cc440aefc59f08a2b293501049 | |
parent | 3765a248489e902b5e1b26e1d68aa10d6e02ff67 (diff) | |
download | opus-a4d818b4a5c6b43e022458e621a3b40cc6945920.tar.gz |
Dump features from the SILK decoder
This is a hack and is *not* thread-safe
-rw-r--r-- | include/opus.h | 2 | ||||
-rw-r--r-- | silk/decode_core.c | 24 | ||||
-rw-r--r-- | src/opus_encoder.c | 2 |
3 files changed, 26 insertions, 2 deletions
diff --git a/include/opus.h b/include/opus.h index d282f21d..c4fc8dc9 100644 --- a/include/opus.h +++ b/include/opus.h @@ -163,6 +163,8 @@ extern "C" { */ typedef struct OpusEncoder OpusEncoder; + OPUS_EXPORT void get_fdump(float data[4][16+3]); + /** Gets the size of an <code>OpusEncoder</code> structure. * @param[in] channels <tt>int</tt>: Number of channels. * This must be 1 or 2. diff --git a/silk/decode_core.c b/silk/decode_core.c index 1c352a65..ed90749b 100644 --- a/silk/decode_core.c +++ b/silk/decode_core.c @@ -31,6 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. #include "main.h" #include "stack_alloc.h" +#include "opus.h" +float fdump[4][16+3]; /**********************************************************/ /* Core decoder. Performs inverse NSQ operation LTP + LPC */ @@ -49,6 +51,7 @@ void silk_decode_core( VARDECL( opus_int32, sLTP_Q15 ); opus_int32 LTP_pred_Q13, LPC_pred_Q10, Gain_Q10, inv_gain_Q31, gain_adj_Q16, rand_seed, offset_Q10; opus_int32 *pred_lag_ptr, *pexc_Q14, *pres_Q14; + double energy=0; VARDECL( opus_int32, res_Q14 ); VARDECL( opus_int32, sLPC_Q14 ); SAVE_STACK; @@ -193,7 +196,18 @@ void silk_decode_core( } else { pres_Q14 = pexc_Q14; } - + energy = 0; + float pgain = (B_Q14[ 0 ] + B_Q14[ 1 ] + B_Q14[ 2 ] + B_Q14[ 3 ] + B_Q14[ 4 ])/16384.; + for( i = 0; i < psDec->subfr_length; i++ ) + energy += pres_Q14[ i ]*(double)pres_Q14[ i ]; +#if 0 + for (i=0;i<psDec->LPC_order;i++) printf("%f ", A_Q12_tmp[i]/4096.); + printf("%d %f %g\n", lag, pgain, Gain_Q10/1024.*sqrt(energy)/16384.); +#endif + for (i=0;i<psDec->LPC_order;i++) fdump[k][i] = A_Q12_tmp[i]/4096.; + fdump[k][16] = lag; + fdump[k][17] = pgain; + fdump[k][18] = Gain_Q10/1024.*sqrt(energy)/16384.; for( i = 0; i < psDec->subfr_length; i++ ) { /* Short-term prediction */ celt_assert( psDec->LPC_order == 10 || psDec->LPC_order == 16 ); @@ -235,3 +249,11 @@ void silk_decode_core( silk_memcpy( psDec->sLPC_Q14_buf, sLPC_Q14, MAX_LPC_ORDER * sizeof( opus_int32 ) ); RESTORE_STACK; } + +OPUS_EXPORT void get_fdump(float data[4][16+3]) { + int i, j; + for (i=0;i<4;i++) { + for (j=0;j<19;j++) data[i][j] = fdump[i][j]; + } + //printf("%f %f\n", data[1][16], data[3][16]); +} diff --git a/src/opus_encoder.c b/src/opus_encoder.c index ab9e3e89..148fb5b9 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -1137,7 +1137,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ #ifdef FIXED_POINT if (st->silk_mode.complexity >= 10 && st->Fs>=16000) #else - if (st->silk_mode.complexity >= 7 && st->Fs>=16000) + if (0&&st->silk_mode.complexity >= 7 && st->Fs>=16000) #endif { is_silence = is_digital_silence(pcm, frame_size, st->channels, lsb_depth); |