diff options
author | Jan Buethe <jbuethe@amazon.com> | 2023-05-22 15:38:18 +0300 |
---|---|---|
committer | Jan Buethe <jbuethe@amazon.com> | 2023-05-22 15:38:18 +0300 |
commit | 528a0128ee22bf2bf4547d5d948dca7565a0bfa2 (patch) | |
tree | 87188ced36f7d5633bf2e596a3f316a1a89a00d5 | |
parent | be46e1367d5b885b75c42fb6147aa3ad030f96bf (diff) |
added 16kHz output from silk decoderexp-neural-silk-enhancement
-rw-r--r-- | silk/decode_core.c | 7 | ||||
-rw-r--r-- | src/opus_demo.c | 12 |
2 files changed, 13 insertions, 6 deletions
diff --git a/silk/decode_core.c b/silk/decode_core.c index c69d4244..abc9bd20 100644 --- a/silk/decode_core.c +++ b/silk/decode_core.c @@ -55,12 +55,14 @@ void silk_decode_core( static FILE *fltp = NULL; static FILE *fperiod = NULL; static FILE *foffset = NULL; + static FILE *fnoisy16k = 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");} if (fperiod == NULL) {fperiod = fopen("features_period.s16", "wb");} if (foffset == NULL) {foffset = fopen("features_offset.f32", "wb");} + if (fnoisy16k == NULL) {fnoisy16k = fopen("noisy_16k.s16", "wb");} #endif opus_int i, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType; @@ -280,12 +282,17 @@ void silk_decode_core( pxq[ i ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( silk_SMULWW( sLPC_Q14[ MAX_LPC_ORDER + i ], Gain_Q10 ), 8 ) ); } + /* Update LPC filter state */ silk_memcpy( sLPC_Q14, &sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER * sizeof( opus_int32 ) ); pexc_Q14 += psDec->subfr_length; pxq += psDec->subfr_length; } +#ifdef FEATURES + fwrite(xq, psDec->nb_subfr * psDec->subfr_length, sizeof(xq[0]), fnoisy16k); +#endif + /* Save LPC state */ silk_memcpy( psDec->sLPC_Q14_buf, sLPC_Q14, MAX_LPC_ORDER * sizeof( opus_int32 ) ); RESTORE_STACK; diff --git a/src/opus_demo.c b/src/opus_demo.c index 37d888d3..56988a33 100644 --- a/src/opus_demo.c +++ b/src/opus_demo.c @@ -207,12 +207,12 @@ static OpusDecoder *ms_opus_decoder_create(opus_int32 Fs, int channels, int *err } #endif -#define COMPLEXITY_MIN 10 +#define COMPLEXITY_MIN 0 #define COMPLEXITY_MAX 10 #define PACKET_LOSS_PERC_MIN 0 -#define PACKET_LOSS_PERC_MAX 0 -#define PACKET_LOSS_PERC_STEP 1 +#define PACKET_LOSS_PERC_MAX 50 +#define PACKET_LOSS_PERC_STEP 5 #define NUM_BITRATES 102 static int bitrates[NUM_BITRATES] = { @@ -849,16 +849,16 @@ int main(int argc, char *argv[]) /* attempt to decode with in-band FEC from next packet */ opus_decoder_ctl(dec, OPUS_GET_LAST_PACKET_DURATION(&output_samples)); output_samples = opus_decode(dec, lost ? NULL : data[toggle], len[toggle], out, output_samples, 1); - if (output_samples != 320) {printf("[frame %d] decoder return value %d\n", silk_frame_counter, output_samples); exit(1);} + //if (output_samples != 320) {printf("[frame %d] decoder return value %d\n", silk_frame_counter, output_samples); exit(1);} } else { /* regular decode */ output_samples = max_frame_size; output_samples = opus_decode(dec, data[1-toggle], len[1-toggle], out, output_samples, 0); - if (output_samples != 320) {printf("[frame %d] decoder return value %d\n", silk_frame_counter, output_samples); exit(1);} + //if (output_samples != 320) {printf("[frame %d] decoder return value %d\n", silk_frame_counter, output_samples); exit(1);} } } else { output_samples = opus_decode(dec, lost ? NULL : data[toggle], len[toggle], out, output_samples, 0); - if (output_samples != 320) {printf("[frame %d] decoder return value %d\n", silk_frame_counter, output_samples); exit(1);} + //if (output_samples != 320) {printf("[frame %d] decoder return value %d\n", silk_frame_counter, output_samples); exit(1);} } if (output_samples>0) { |