ref: e61e6a752e62354ef0ce2684c54d379130ff897b
parent: 4e28e7426638655959294670c36d0c52be44fb74
author: Koen Vos <[email protected]>
date: Thu Feb 3 04:07:32 EST 2011
SILK update
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,7 +35,6 @@
src_common/SKP_Silk_decode_pulses.c \
src_common/SKP_Silk_decoder_set_fs.c \
src_common/SKP_Silk_dec_API.c \
-src_common/SKP_Silk_detect_SWB_input.c \
src_common/SKP_Silk_enc_API.c \
src_common/SKP_Silk_encode_indices.c \
src_common/SKP_Silk_encode_pulses.c \
@@ -96,7 +95,6 @@
src_SigProc_FIX/SKP_Silk_array_maxabs.c \
src_SigProc_FIX/SKP_Silk_autocorr.c \
src_SigProc_FIX/SKP_Silk_biquad_alt.c \
-src_SigProc_FIX/SKP_Silk_biquad.c \
src_SigProc_FIX/SKP_Silk_burg_modified.c \
src_SigProc_FIX/SKP_Silk_bwexpander_32.c \
src_SigProc_FIX/SKP_Silk_bwexpander.c \
--- a/src_FIX/SKP_Silk_control_codec_FIX.c
+++ b/src_FIX/SKP_Silk_control_codec_FIX.c
@@ -278,14 +278,9 @@
/* Unsupported number of frames */
SKP_assert( 0 );
}
- if( psEnc->sCmn.fs_kHz == 24 ) {
- psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_SWB, 9 );
- psEnc->sCmn.bitrate_threshold_up = SKP_int32_MAX;
- psEnc->sCmn.bitrate_threshold_down = SWB2WB_BITRATE_BPS;
- psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform12_iCDF;
- } else if( psEnc->sCmn.fs_kHz == 16 ) {
+ if( psEnc->sCmn.fs_kHz == 16 ) {
psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_WB, 9 );
- psEnc->sCmn.bitrate_threshold_up = WB2SWB_BITRATE_BPS;
+ psEnc->sCmn.bitrate_threshold_up = SKP_int32_MAX;
psEnc->sCmn.bitrate_threshold_down = WB2MB_BITRATE_BPS;
psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform8_iCDF;
} else if( psEnc->sCmn.fs_kHz == 12 ) {
@@ -332,7 +327,11 @@
} else if( psEnc->sCmn.fs_kHz == 16 ) {
rateTable = TargetRate_table_WB;
} else {
- rateTable = TargetRate_table_SWB;
+ SKP_assert( 0 );
+ }
+ /* Reduce bitrate for 10 ms modes in these calculations */
+ if( psEnc->sCmn.nb_subfr == 2 ) {
+ TargetRate_bps -= REDUCE_BITRATE_10_MS_BPS;
}
for( k = 1; k < TARGET_RATE_TAB_SZ; k++ ) {
/* Find bitrate interval in table and interpolate */
--- a/src_FIX/SKP_Silk_encode_frame_FIX.c
+++ b/src_FIX/SKP_Silk_encode_frame_FIX.c
@@ -205,7 +205,7 @@
frame_terminator = SKP_SILK_NO_LBRR;
/* Add the frame termination info to stream */
- ec_enc_icdf( psRangeEnc, frame_terminator, SKP_Silk_FrameTermination_iCDF, 8 );
+ ec_enc_icdf( psRangeEnc, frame_terminator, SKP_Silk_LBRR_Present_iCDF, 8 );
/* Code excitation signal */
for( i = 0; i < psEnc->sCmn.nFramesInPayloadBuf; i++ ) {
@@ -240,10 +240,6 @@
psEnc->BufferedInChannel_ms = SKP_LIMIT_int( psEnc->BufferedInChannel_ms, 0, 100 );
psEnc->sCmn.nBytesInPayloadBuf = nBytes;
- if( psEnc->speech_activity_Q8 > SKP_FIX_CONST( WB_DETECT_ACTIVE_SPEECH_LEVEL_THRES, 8 ) ) {
- psEnc->sCmn.sSWBdetect.ActiveSpeech_ms = SKP_ADD_POS_SAT32( psEnc->sCmn.sSWBdetect.ActiveSpeech_ms, SKP_SMULBB( SUB_FRAME_LENGTH_MS, psEnc->sCmn.nb_subfr ) );
- }
-
TOC(ENCODE_FRAME)
#ifdef SAVE_ALL_INTERNAL_DATA
@@ -338,8 +334,6 @@
Rate_only_parameters = 15500;
} else if( psEnc->sCmn.fs_kHz == 16 ) {
Rate_only_parameters = 17500;
- } else if( psEnc->sCmn.fs_kHz == 24 ) {
- Rate_only_parameters = 19500;
} else {
SKP_assert( 0 );
}
@@ -412,7 +406,7 @@
frame_terminator = SKP_SILK_LAST_FRAME;
/* Add the frame termination info to stream */
- ec_enc_icdf( psRangeEnc, frame_terminator, SKP_Silk_FrameTermination_iCDF, 8 );
+ ec_enc_icdf( psRangeEnc, frame_terminator, SKP_Silk_LBRR_Present_iCDF, 8 );
/*********************************************/
/* Encode quantization indices of excitation */
@@ -452,7 +446,7 @@
/* Encode that more frames follows */
frame_terminator = SKP_SILK_MORE_FRAMES;
- ec_enc_icdf( psRangeEnc, frame_terminator, SKP_Silk_FrameTermination_iCDF, 8 );
+ ec_enc_icdf( psRangeEnc, frame_terminator, SKP_Silk_LBRR_Present_iCDF, 8 );
}
/* Restore original Gains */
--- a/src_FIX/SKP_Silk_noise_shape_analysis_FIX.c
+++ b/src_FIX/SKP_Silk_noise_shape_analysis_FIX.c
@@ -165,11 +165,6 @@
psEncCtrl->current_SNR_dB_Q7 = psEnc->SNR_dB_Q7 - SKP_SMULWB( SKP_LSHIFT( ( SKP_int32 )psEnc->BufferedInChannel_ms, 7 ),
SKP_FIX_CONST( 0.1, 16 ) );
- /* Reduce SNR for 10 ms frames */
- if( psEnc->sCmn.nb_subfr == 2 ) {
- psEncCtrl->current_SNR_dB_Q7 -= SKP_FIX_CONST( 1.5, 7 );
- }
-
/* Reduce SNR_dB if inband FEC used */
if( psEnc->speech_activity_Q8 > SKP_FIX_CONST( LBRR_SPEECH_ACTIVITY_THRES, 8 ) ) {
psEncCtrl->current_SNR_dB_Q7 -= SKP_RSHIFT( psEnc->inBandFEC_SNR_comp_Q8, 1 );
--- a/src_FLP/SKP_Silk_control_codec_FLP.c
+++ b/src_FLP/SKP_Silk_control_codec_FLP.c
@@ -281,14 +281,9 @@
/* Unsupported number of frames */
SKP_assert( 0 );
}
- if( psEnc->sCmn.fs_kHz == 24 ) {
- psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_SWB, 9 );
- psEnc->sCmn.bitrate_threshold_up = SKP_int32_MAX;
- psEnc->sCmn.bitrate_threshold_down = SWB2WB_BITRATE_BPS;
- psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform12_iCDF;
- } else if( psEnc->sCmn.fs_kHz == 16 ) {
+ if( psEnc->sCmn.fs_kHz == 16 ) {
psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_WB, 9 );
- psEnc->sCmn.bitrate_threshold_up = WB2SWB_BITRATE_BPS;
+ psEnc->sCmn.bitrate_threshold_up = SKP_int32_MAX;
psEnc->sCmn.bitrate_threshold_down = WB2MB_BITRATE_BPS;
psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform8_iCDF;
} else if( psEnc->sCmn.fs_kHz == 12 ) {
@@ -335,7 +330,11 @@
} else if( psEnc->sCmn.fs_kHz == 16 ) {
rateTable = TargetRate_table_WB;
} else {
- rateTable = TargetRate_table_SWB;
+ SKP_assert( 0 );
+ }
+ /* Reduce bitrate for 10 ms modes in these calculations */
+ if( psEnc->sCmn.nb_subfr == 2 ) {
+ TargetRate_bps -= REDUCE_BITRATE_10_MS_BPS;
}
for( k = 1; k < TARGET_RATE_TAB_SZ; k++ ) {
/* Find bitrate interval in table and interpolate */
--- a/src_FLP/SKP_Silk_encode_frame_FLP.c
+++ b/src_FLP/SKP_Silk_encode_frame_FLP.c
@@ -162,7 +162,7 @@
/* Noise shaping quantization */
/*****************************************/
TIC(NSQ)
- SKP_Silk_NSQ_wrapper_FLP( psEnc, &sEncCtrl, xfw, &psEnc->sCmn.q[ psEnc->sCmn.nFramesInPayloadBuf * psEnc->sCmn.frame_length ], 0 );
+ SKP_Silk_NSQ_wrapper_FLP( psEnc, &sEncCtrl, xfw, &psEnc->sCmn.q[ psEnc->sCmn.nFramesInPayloadBuf * MAX_FRAME_LENGTH ], 0 );
TOC(NSQ)
/****************************************/
@@ -202,12 +202,12 @@
frame_terminator = SKP_SILK_NO_LBRR;
/* Add the frame termination info to stream */
- ec_enc_icdf( psRangeEnc, frame_terminator, SKP_Silk_FrameTermination_iCDF, 8 );
+ ec_enc_icdf( psRangeEnc, frame_terminator, SKP_Silk_LBRR_Present_iCDF, 8 );
/* Code excitation signal */
for( i = 0; i < psEnc->sCmn.nFramesInPayloadBuf; i++ ) {
SKP_Silk_encode_pulses( psRangeEnc, psEnc->sCmn.signalType[ i ], psEnc->sCmn.quantOffsetType[ i ],
- &psEnc->sCmn.q[ i * psEnc->sCmn.frame_length ], psEnc->sCmn.frame_length );
+ &psEnc->sCmn.q[ i * MAX_FRAME_LENGTH ], psEnc->sCmn.frame_length );
}
/* Payload length so far */
@@ -225,7 +225,7 @@
/* Take into account the q signal that isn't in the bitstream yet */
nBytes += SKP_Silk_pulses_to_bytes( &psEnc->sCmn,
- &psEnc->sCmn.q[ psEnc->sCmn.nFramesInPayloadBuf * psEnc->sCmn.frame_length ] );
+ &psEnc->sCmn.q[ psEnc->sCmn.nFramesInPayloadBuf * MAX_FRAME_LENGTH ] );
}
/* Simulate number of ms buffered in channel because of exceeding TargetRate */
@@ -234,10 +234,6 @@
psEnc->BufferedInChannel_ms = SKP_LIMIT_float( psEnc->BufferedInChannel_ms, 0.0f, 100.0f );
psEnc->sCmn.nBytesInPayloadBuf = nBytes;
- if( psEnc->speech_activity > WB_DETECT_ACTIVE_SPEECH_LEVEL_THRES ) {
- psEnc->sCmn.sSWBdetect.ActiveSpeech_ms = SKP_ADD_POS_SAT32( psEnc->sCmn.sSWBdetect.ActiveSpeech_ms, SUB_FRAME_LENGTH_MS * psEnc->sCmn.nb_subfr );
- }
-
TOC(ENCODE_FRAME)
#ifdef SAVE_ALL_INTERNAL_DATA
//DEBUG_STORE_DATA( xf.dat, pIn_HP_LP, psEnc->sCmn.frame_length * sizeof( SKP_int16 ) );
@@ -307,8 +303,6 @@
Rate_only_parameters = 15500;
} else if( psEnc->sCmn.fs_kHz == 16 ) {
Rate_only_parameters = 17500;
- } else if( psEnc->sCmn.fs_kHz == 24 ) {
- Rate_only_parameters = 19500;
} else {
SKP_assert( 0 );
}
@@ -334,9 +328,9 @@
/*****************************************/
/* Noise shaping quantization */
/*****************************************/
- SKP_Silk_NSQ_wrapper_FLP( psEnc, psEncCtrl, xfw, &psEnc->sCmn.q_LBRR[ psEnc->sCmn.nFramesInPayloadBuf * psEnc->sCmn.frame_length ], 1 );
+ SKP_Silk_NSQ_wrapper_FLP( psEnc, psEncCtrl, xfw, &psEnc->sCmn.q_LBRR[ psEnc->sCmn.nFramesInPayloadBuf * MAX_FRAME_LENGTH ], 1 );
} else {
- SKP_memset( &psEnc->sCmn.q_LBRR[ psEnc->sCmn.nFramesInPayloadBuf * psEnc->sCmn.frame_length ], 0, psEnc->sCmn.frame_length * sizeof( SKP_int8 ) );
+ SKP_memset( &psEnc->sCmn.q_LBRR[ psEnc->sCmn.nFramesInPayloadBuf * MAX_FRAME_LENGTH ], 0, psEnc->sCmn.frame_length * sizeof( SKP_int8 ) );
psEncCtrl->sCmn.LTP_scaleIndex = 0;
}
/****************************************/
@@ -379,7 +373,7 @@
/*********************************************/
for( i = 0; i < nFramesInPayloadBuf; i++ ) {
SKP_Silk_encode_pulses( &psEnc->sCmn.sRC_LBRR, psEnc->sCmn.signalType[ i ], psEnc->sCmn.quantOffsetType[ i ],
- &psEnc->sCmn.q_LBRR[ i * psEnc->sCmn.frame_length ], psEnc->sCmn.frame_length );
+ &psEnc->sCmn.q_LBRR[ i * MAX_FRAME_LENGTH ], psEnc->sCmn.frame_length );
}
/* Payload length so far */
--- a/src_FLP/SKP_Silk_noise_shape_analysis_FLP.c
+++ b/src_FLP/SKP_Silk_noise_shape_analysis_FLP.c
@@ -144,11 +144,6 @@
/* Reduce SNR_dB values if recent bitstream has exceeded TargetRate */
psEncCtrl->current_SNR_dB = psEnc->SNR_dB - 0.1f * psEnc->BufferedInChannel_ms;
- /* Reduce SNR for 10 ms frames */
- if( psEnc->sCmn.nb_subfr == 2 ) {
- psEncCtrl->current_SNR_dB -= 1.5f;
- }
-
/* Reduce SNR_dB if inband FEC used */
if( psEnc->speech_activity > LBRR_SPEECH_ACTIVITY_THRES ) {
psEncCtrl->current_SNR_dB -= psEnc->inBandFEC_SNR_comp;
--- a/src_SigProc_FIX/SKP_Silk_SigProc_FIX.h
+++ b/src_SigProc_FIX/SKP_Silk_SigProc_FIX.h
@@ -150,18 +150,6 @@
const SKP_int32 len /* I: Number of samples */
);
-/*!
- * second order ARMA filter
- * can handle (slowly) varying coefficients
- */
-void SKP_Silk_biquad(
- const SKP_int16 *in, /* I: input signal */
- const SKP_int16 *B, /* I: MA coefficients, Q13 [3] */
- const SKP_int16 *A, /* I: AR coefficients, Q13 [2] */
- SKP_int32 *S, /* I/O: state vector [2] */
- SKP_int16 *out, /* O: output signal */
- const SKP_int32 len /* I: signal length */
-);
/*!
* second order ARMA filter;
* slower than biquad() but uses more precise coefficients
--- a/src_SigProc_FIX/SKP_Silk_biquad.c
+++ /dev/null
@@ -1,71 +1,0 @@
-/***********************************************************************
-Copyright (c) 2006-2010, Skype Limited. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, (subject to the limitations in the disclaimer below)
-are permitted provided that the following conditions are met:
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-- Neither the name of Skype Limited, nor the names of specific
-contributors, may be used to endorse or promote products derived from
-this software without specific prior written permission.
-NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
-BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-***********************************************************************/
-
-/* *
- * SKP_Silk_biquad.c *
- * *
- * Second order ARMA filter *
- * Can handle slowly varying filter coefficients *
- * *
- * Copyright 2006 (c), Skype Limited *
- * Date: 060221 *
- * */
-#include "SKP_Silk_SigProc_FIX.h"
-
-/* Second order ARMA filter */
-/* Can handle slowly varying filter coefficients */
-void SKP_Silk_biquad(
- const SKP_int16 *in, /* I: input signal */
- const SKP_int16 *B, /* I: MA coefficients, Q13 [3] */
- const SKP_int16 *A, /* I: AR coefficients, Q13 [2] */
- SKP_int32 *S, /* I/O: state vector [2] */
- SKP_int16 *out, /* O: output signal */
- const SKP_int32 len /* I: signal length */
-)
-{
- SKP_int k, in16;
- SKP_int32 A0_neg, A1_neg, S0, S1, out32;
-
- S0 = S[ 0 ];
- S1 = S[ 1 ];
- A0_neg = -A[ 0 ];
- A1_neg = -A[ 1 ];
- for( k = 0; k < len; k++ ) {
- /* S[ 0 ], S[ 1 ]: Q13 */
- in16 = in[ k ];
- out32 = SKP_SMLABB( S0, in16, B[ 0 ] );
-
- S0 = SKP_SMLABB( S1, in16, B[ 1 ] );
- S0 += SKP_LSHIFT( SKP_SMULWB( out32, A0_neg ), 3 );
-
- S1 = SKP_LSHIFT( SKP_SMULWB( out32, A1_neg ), 3 );
- S1 = SKP_SMLABB( S1, in16, B[ 2 ] );
- out[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 13 ) );
- }
- S[ 0 ] = S0;
- S[ 1 ] = S1;
-}
--- a/src_SigProc_FIX/SKP_Silk_burg_modified.c
+++ b/src_SigProc_FIX/SKP_Silk_burg_modified.c
@@ -37,7 +37,7 @@
#include "SKP_Silk_SigProc_FIX.h"
-#define MAX_FRAME_SIZE 544 // subfr_length * nb_subfr = ( 0.005 * 24000 + 16 ) * 4 = 544
+#define MAX_FRAME_SIZE 384 // subfr_length * nb_subfr = ( 0.005 * 16000 + 16 ) * 4 = 384
#define MAX_NB_SUBFR 4
#define QA 25
--- a/src_SigProc_FIX/SKP_Silk_debug.c
+++ /dev/null
@@ -1,175 +1,0 @@
-/***********************************************************************
-Copyright (c) 2006-2010, Skype Limited. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, (subject to the limitations in the disclaimer below)
-are permitted provided that the following conditions are met:
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-- Neither the name of Skype Limited, nor the names of specific
-contributors, may be used to endorse or promote products derived from
-this software without specific prior written permission.
-NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
-BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-***********************************************************************/
-
-/* *
- * SKP_debug.c *
- * *
- * This contains code to help debugging *
- * *
- * Copyright 2009 (c), Skype Limited *
- * Date: 090629 *
- * */
-
-#include "SKP_debug.h"
-#include "../src_SigProc_FIX/SKP_Silk_SigProc_FIX.h"
-
-#ifdef _WIN32
-
-#if (defined(_WIN32) || defined(_WINCE))
-#include <windows.h> /* timer */
-#else // Linux or Mac
-#include <sys/time.h>
-#endif
-
-unsigned long GetHighResolutionTime() /* O: time in usec*/
-{
- /* Returns a time counter in microsec */
- /* the resolution is platform dependent */
- /* but is typically 1.62 us resolution */
- LARGE_INTEGER lpPerformanceCount;
- LARGE_INTEGER lpFrequency;
- QueryPerformanceCounter(&lpPerformanceCount);
- QueryPerformanceFrequency(&lpFrequency);
- return (unsigned long)((1000000*(lpPerformanceCount.QuadPart)) / lpFrequency.QuadPart);
-}
-#else // Linux or Mac
-unsigned long GetHighResolutionTime() /* O: time in usec*/
-{
- struct timeval tv;
- gettimeofday(&tv, 0);
- return((tv.tv_sec*1000000)+(tv.tv_usec));
-}
-#endif
-
-#if SKP_TIC_TOC
-
-int SKP_Timer_nTimers = 0;
-int SKP_Timer_depth_ctr = 0;
-char SKP_Timer_tags[SKP_NUM_TIMERS_MAX][SKP_NUM_TIMERS_MAX_TAG_LEN];
-#ifdef WIN32
-LARGE_INTEGER SKP_Timer_start[SKP_NUM_TIMERS_MAX];
-#else
-unsigned long SKP_Timer_start[SKP_NUM_TIMERS_MAX];
-#endif
-unsigned int SKP_Timer_cnt[SKP_NUM_TIMERS_MAX];
-SKP_int64 SKP_Timer_min[SKP_NUM_TIMERS_MAX];
-SKP_int64 SKP_Timer_sum[SKP_NUM_TIMERS_MAX];
-SKP_int64 SKP_Timer_max[SKP_NUM_TIMERS_MAX];
-SKP_int64 SKP_Timer_depth[SKP_NUM_TIMERS_MAX];
-
-#ifdef WIN32
-void SKP_TimerSave(char *file_name)
-{
- if( SKP_Timer_nTimers > 0 )
- {
- int k;
- FILE *fp;
- LARGE_INTEGER lpFrequency;
- LARGE_INTEGER lpPerformanceCount1, lpPerformanceCount2;
- int del = 0x7FFFFFFF;
- double avg, sum_avg;
- /* estimate overhead of calling performance counters */
- for( k = 0; k < 1000; k++ ) {
- QueryPerformanceCounter(&lpPerformanceCount1);
- QueryPerformanceCounter(&lpPerformanceCount2);
- lpPerformanceCount2.QuadPart -= lpPerformanceCount1.QuadPart;
- if( (int)lpPerformanceCount2.LowPart < del )
- del = lpPerformanceCount2.LowPart;
- }
- QueryPerformanceFrequency(&lpFrequency);
- /* print results to file */
- sum_avg = 0.0f;
- for( k = 0; k < SKP_Timer_nTimers; k++ ) {
- if (SKP_Timer_depth[k] == 0) {
- sum_avg += (1e6 * SKP_Timer_sum[k] / SKP_Timer_cnt[k] - del) / lpFrequency.QuadPart * SKP_Timer_cnt[k];
- }
- }
- fp = fopen(file_name, "w");
- fprintf(fp, " min avg %% max count\n");
- for( k = 0; k < SKP_Timer_nTimers; k++ ) {
- if (SKP_Timer_depth[k] == 0) {
- fprintf(fp, "%-28s", SKP_Timer_tags[k]);
- } else if (SKP_Timer_depth[k] == 1) {
- fprintf(fp, " %-27s", SKP_Timer_tags[k]);
- } else if (SKP_Timer_depth[k] == 2) {
- fprintf(fp, " %-26s", SKP_Timer_tags[k]);
- } else if (SKP_Timer_depth[k] == 3) {
- fprintf(fp, " %-25s", SKP_Timer_tags[k]);
- } else {
- fprintf(fp, " %-24s", SKP_Timer_tags[k]);
- }
- avg = (1e6 * SKP_Timer_sum[k] / SKP_Timer_cnt[k] - del) / lpFrequency.QuadPart;
- fprintf(fp, "%8.2f", (1e6 * (SKP_max_64(SKP_Timer_min[k] - del, 0))) / lpFrequency.QuadPart);
- fprintf(fp, "%12.2f %6.2f", avg, 100.0 * avg / sum_avg * SKP_Timer_cnt[k]);
- fprintf(fp, "%12.2f", (1e6 * (SKP_max_64(SKP_Timer_max[k] - del, 0))) / lpFrequency.QuadPart);
- fprintf(fp, "%10d\n", SKP_Timer_cnt[k]);
- }
- fprintf(fp, " microseconds\n");
- fclose(fp);
- }
-}
-#else
-void SKP_TimerSave(char *file_name)
-{
- if( SKP_Timer_nTimers > 0 )
- {
- int k;
- FILE *fp;
- /* print results to file */
- fp = fopen(file_name, "w");
- fprintf(fp, " min avg max count\n");
- for( k = 0; k < SKP_Timer_nTimers; k++ )
- {
- if (SKP_Timer_depth[k] == 0) {
- fprintf(fp, "%-28s", SKP_Timer_tags[k]);
- } else if (SKP_Timer_depth[k] == 1) {
- fprintf(fp, " %-27s", SKP_Timer_tags[k]);
- } else if (SKP_Timer_depth[k] == 2) {
- fprintf(fp, " %-26s", SKP_Timer_tags[k]);
- } else if (SKP_Timer_depth[k] == 3) {
- fprintf(fp, " %-25s", SKP_Timer_tags[k]);
- } else {
- fprintf(fp, " %-24s", SKP_Timer_tags[k]);
- }
- fprintf(fp, "%d ", SKP_Timer_min[k]);
- fprintf(fp, "%f ", (double)SKP_Timer_sum[k] / (double)SKP_Timer_cnt[k]);
- fprintf(fp, "%d ", SKP_Timer_max[k]);
- fprintf(fp, "%10d\n", SKP_Timer_cnt[k]);
- }
- fprintf(fp, " microseconds\n");
- fclose(fp);
- }
-}
-#endif
-
-#endif /* SKP_TIC_TOC */
-
-#if SKP_DEBUG
-FILE *SKP_debug_store_fp[ SKP_NUM_STORES_MAX ];
-int SKP_debug_store_count = 0;
-#endif /* SKP_DEBUG */
-
--- a/src_SigProc_FIX/SKP_Silk_decode_pitch.c
+++ b/src_SigProc_FIX/SKP_Silk_decode_pitch.c
@@ -34,7 +34,7 @@
void SKP_Silk_decode_pitch(
SKP_int lagIndex, /* I */
SKP_int contourIndex, /* O */
- SKP_int pitch_lags[], /* O 4 pitch values */
+ SKP_int pitch_lags[], /* O pitch values */
const SKP_int Fs_kHz, /* I sampling frequency (kHz) */
const SKP_int nb_subfr /* I number of sub frames */
)
@@ -47,7 +47,7 @@
Lag_CB_ptr = &SKP_Silk_CB_lags_stage2[ 0 ][ 0 ];
cbk_size = PE_NB_CBKS_STAGE2_EXT;
} else {
- SKP_assert( PE_MAX_NB_SUBFR >> 1 == nb_subfr );
+ SKP_assert( nb_subfr == PE_MAX_NB_SUBFR >> 1 );
Lag_CB_ptr = &SKP_Silk_CB_lags_stage2_10_ms[ 0 ][ 0 ];
cbk_size = PE_NB_CBKS_STAGE2_10MS;
}
@@ -56,7 +56,7 @@
Lag_CB_ptr = &SKP_Silk_CB_lags_stage3[ 0 ][ 0 ];
cbk_size = PE_NB_CBKS_STAGE3_MAX;
} else {
- SKP_assert( PE_MAX_NB_SUBFR >> 1 == nb_subfr );
+ SKP_assert( nb_subfr == PE_MAX_NB_SUBFR >> 1 );
Lag_CB_ptr = &SKP_Silk_CB_lags_stage3_10_ms[ 0 ][ 0 ];
cbk_size = PE_NB_CBKS_STAGE3_10MS;
}
--- a/src_SigProc_FIX/SKP_Silk_pitch_analysis_core.c
+++ b/src_SigProc_FIX/SKP_Silk_pitch_analysis_core.c
@@ -103,7 +103,7 @@
SKP_int32 delta_lag_log2_sqr_Q7, lag_log2_Q7, prevLag_log2_Q7, prev_lag_bias_Q15, corr_thres_Q15;
const SKP_int8 *Lag_CB_ptr;
/* Check for valid sampling frequency */
- SKP_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 || Fs_kHz == 24 );
+ SKP_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 );
/* Check for valid complexity setting */
SKP_assert( complexity >= SKP_Silk_PE_MIN_COMPLEX );
@@ -136,10 +136,6 @@
SKP_int32 R23[ 6 ];
SKP_memset( R23, 0, 6 * sizeof( SKP_int32 ) );
SKP_Silk_resampler_down2_3( R23, signal_8kHz, signal, frame_length );
- } else if( Fs_kHz == 24 ) {
- SKP_int32 filt_state_fix[ 8 ];
- SKP_memset( filt_state_fix, 0, 8 * sizeof(SKP_int32) );
- SKP_Silk_resampler_down3( filt_state_fix, signal_8kHz, signal, frame_length );
} else {
SKP_assert( Fs_kHz == 8 );
SKP_memcpy( signal_8kHz, signal, frame_length_8kHz * sizeof(SKP_int16) );
@@ -372,8 +368,6 @@
prevLag = SKP_DIV32_16( SKP_LSHIFT( prevLag, 1 ), 3 );
} else if( Fs_kHz == 16 ) {
prevLag = SKP_RSHIFT( prevLag, 1 );
- } else if( Fs_kHz == 24 ) {
- prevLag = SKP_DIV32_16( prevLag, 3 );
}
prevLag_log2_Q7 = SKP_Silk_lin2log( (SKP_int32)prevLag );
} else {
@@ -570,7 +564,7 @@
CCmax = SKP_max( CCmax, 0 );
*LTPCorr_Q15 = (SKP_int)SKP_Silk_SQRT_APPROX( SKP_LSHIFT( CCmax, 13 ) ); /* Output normalized correlation */
for( k = 0; k < nb_subfr; k++ ) {
- pitch_out[ k ] = lag + SKP_Silk_CB_lags_stage2[ k ][ CBimax ];
+ pitch_out[ k ] = lag + matrix_ptr( Lag_CB_ptr, k, CBimax, cbk_size );
}
*lagIndex = lag - min_lag_8kHz;
*contourIndex = CBimax;
--- a/src_SigProc_FIX/SKP_Silk_pitch_est_defines.h
+++ b/src_SigProc_FIX/SKP_Silk_pitch_est_defines.h
@@ -34,7 +34,7 @@
/* Definitions For Fix pitch estimator */
/************************************************************/
-#define PE_MAX_FS_KHZ 24 /* Maximum sampling frequency used */
+#define PE_MAX_FS_KHZ 16 /* Maximum sampling frequency used */
#define PE_MAX_NB_SUBFR 4
#define PE_SUBFR_LENGTH_MS 5 /* 5 ms */
--- a/src_SigProc_FIX/src_SigProc_FIX.vcxproj
+++ b/src_SigProc_FIX/src_SigProc_FIX.vcxproj
@@ -91,7 +91,6 @@
<ClCompile Include="SKP_Silk_apply_sine_window.c" />
<ClCompile Include="SKP_Silk_array_maxabs.c" />
<ClCompile Include="SKP_Silk_autocorr.c" />
- <ClCompile Include="SKP_Silk_biquad.c" />
<ClCompile Include="SKP_Silk_biquad_alt.c" />
<ClCompile Include="SKP_Silk_burg_modified.c" />
<ClCompile Include="SKP_Silk_bwexpander.c" />
--- a/src_SigProc_FIX/src_SigProc_FIX.vcxproj.filters
+++ b/src_SigProc_FIX/src_SigProc_FIX.vcxproj.filters
@@ -65,9 +65,6 @@
<ClCompile Include="SKP_Silk_autocorr.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="SKP_Silk_biquad.c">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="SKP_Silk_biquad_alt.c">
<Filter>Source Files</Filter>
</ClCompile>
--- a/src_SigProc_FLP/SKP_Silk_burg_modified_FLP.c
+++ b/src_SigProc_FLP/SKP_Silk_burg_modified_FLP.c
@@ -37,11 +37,11 @@
#include "SKP_Silk_SigProc_FLP.h"
-#define MAX_FRAME_SIZE 544 // subfr_length * nb_subfr = ( 0.005 * 24000 + 16 ) * 4 = 544
+#define MAX_FRAME_SIZE 384 // subfr_length * nb_subfr = ( 0.005 * 16000 + 16 ) * 4 = 384
#define MAX_NB_SUBFR 4
/* Compute reflection coefficients from input signal */
-SKP_float SKP_Silk_burg_modified_FLP( /* O returns residual energy */
+SKP_float SKP_Silk_burg_modified_FLP( /* O returns residual energy */
SKP_float A[], /* O prediction coefficients (length order) */
const SKP_float x[], /* I input signal, length: nb_subfr*(D+L_sub) */
const SKP_int subfr_length, /* I input signal subframe length (including D preceeding samples) */
--- a/src_SigProc_FLP/SKP_Silk_pitch_analysis_core_FLP.c
+++ b/src_SigProc_FLP/SKP_Silk_pitch_analysis_core_FLP.c
@@ -88,7 +88,7 @@
SKP_float filt_state[ PE_MAX_DECIMATE_STATE_LENGTH ];
SKP_int i, k, d, j;
SKP_float threshold, contour_bias;
- SKP_float C[ PE_MAX_NB_SUBFR][ (PE_MAX_LAG >> 1) + 5 ]; /* use to be +2 but then valgrind reported errors for SWB */
+ SKP_float C[ PE_MAX_NB_SUBFR][ (PE_MAX_LAG >> 1) + 5 ];
SKP_float CC[ PE_NB_CBKS_STAGE2_EXT ];
const SKP_float *target_ptr, *basis_ptr;
double cross_corr, normalizer, energy, energy_tmp;
@@ -110,7 +110,7 @@
const SKP_int8 *Lag_CB_ptr;
/* Check for valid sampling frequency */
- SKP_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 || Fs_kHz == 24 );
+ SKP_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 );
/* Check for valid complexity setting */
SKP_assert( complexity >= SigProc_PE_MIN_COMPLEX );
@@ -160,16 +160,6 @@
SKP_Silk_decimate2_coarsest_FLP( signal, filt_state, signal_8kHz,
scratch_mem, frame_length_8kHz );
}
- } else if( Fs_kHz == 24 ) {
- SKP_int16 signal_24[ PE_MAX_FRAME_LENGTH ];
- SKP_int16 signal_8[ 8 * PE_MAX_FRAME_LENGTH_MS ];
- SKP_int32 filt_state_fix[ 8 ];
-
- /* Resample to 24 -> 8 khz */
- SKP_float2short_array( signal_24, signal, frame_length );
- SKP_memset( filt_state_fix, 0, 8 * sizeof(SKP_int32) );
- SKP_Silk_resampler_down3( filt_state_fix, signal_8, signal_24, frame_length );
- SKP_short2float_array( signal_8kHz, signal_8, frame_length_8kHz );
} else {
SKP_assert( Fs_kHz == 8 );
SKP_memcpy( signal_8kHz, signal, frame_length_8kHz * sizeof(SKP_float) );
@@ -354,8 +344,6 @@
prevLag = SKP_LSHIFT( prevLag, 1 ) / 3;
} else if( Fs_kHz == 16 ) {
prevLag = SKP_RSHIFT( prevLag, 1 );
- } else if( Fs_kHz == 24 ) {
- prevLag = prevLag / 3;
}
prevLag_log2 = SKP_P_log2((SKP_float)prevLag);
} else {
@@ -509,7 +497,7 @@
SKP_assert( CCmax >= 0.0f );
*LTPCorr = (SKP_float)sqrt( CCmax / nb_subfr ); /* Output normalized correlation */
for( k = 0; k < nb_subfr; k++ ) {
- pitch_out[ k ] = lag + SKP_Silk_CB_lags_stage2[ k ][ CBimax ];
+ pitch_out[ k ] = lag + matrix_ptr( Lag_CB_ptr, k, CBimax, cbk_size );
}
*lagIndex = lag - min_lag;
*contourIndex = CBimax;
--- a/src_common/SKP_Silk_NSQ.c
+++ b/src_common/SKP_Silk_NSQ.c
@@ -32,7 +32,6 @@
SKP_Silk_nsq_state *NSQ, /* I/O NSQ state */
const SKP_int16 x[], /* I input in Q0 */
SKP_int32 x_sc_Q10[], /* O input scaled with 1/Gain */
- SKP_int subfr_length, /* I length of input */
const SKP_int16 sLTP[], /* I re-whitened LTP state in Q0 */
SKP_int32 sLTP_Q16[], /* O LTP state matching scaled input */
SKP_int subfr, /* I subframe number */
@@ -61,12 +60,6 @@
SKP_int length, /* I Input length */
SKP_int shapingLPCOrder, /* I Noise shaping AR filter order */
SKP_int predictLPCOrder /* I Prediction filter order */
-#ifdef SAVE_ALL_INTERNAL_DATA
- ,SKP_float q_in_env[], /* O */
- SKP_float q_exc[], /* O */
- SKP_float q_LPC_exc[], /* O */
- SKP_float q_exc_prev[] /* O */
-#endif
);
void SKP_Silk_NSQ(
@@ -87,7 +80,7 @@
const SKP_int LTP_scale_Q14 /* I LTP state scaling */
)
{
- SKP_int k, lag, start_idx, subfr_length, LSF_interpolation_flag;
+ SKP_int k, lag, start_idx, LSF_interpolation_flag;
const SKP_int16 *A_Q12, *B_Q14, *AR_shp_Q13;
SKP_int16 *pxq;
SKP_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ];
@@ -96,23 +89,9 @@
SKP_int offset_Q10;
SKP_int32 FiltState[ MAX_LPC_ORDER ];
SKP_int32 x_sc_Q10[ MAX_FRAME_LENGTH / MAX_NB_SUBFR ];
-#ifdef SAVE_ALL_INTERNAL_DATA
- /* Date buffers for analysing */
- SKP_float q_in_env_buf[ MAX_FRAME_LENGTH ];
- SKP_float q_exc_buf[ MAX_FRAME_LENGTH ];
- SKP_float q_LPC_exc_buf[ MAX_FRAME_LENGTH ];
- SKP_float q_exc_prev_buf[ MAX_FRAME_LENGTH ];
- SKP_float *q_in_env, *q_exc, *q_LPC_exc, *q_exc_prev;
- q_in_env = q_in_env_buf;
- q_exc = q_exc_buf;
- q_LPC_exc = q_LPC_exc_buf;
- q_exc_prev = q_exc_prev_buf;
-#endif
-
- subfr_length = psEncC->frame_length / MAX_NB_SUBFR;
-
NSQ->rand_seed = psEncCtrlC->Seed;
+
/* Set unvoiced lag to the previous one, overwrite later for voiced */
lag = NSQ->lagPrev;
@@ -147,7 +126,6 @@
/* Re-whitening */
if( ( k & ( 3 - SKP_LSHIFT( LSF_interpolation_flag, 1 ) ) ) == 0 ) {
-
/* Rewhiten with new A coefs */
start_idx = psEncC->ltp_mem_length - lag - psEncC->predictLPCOrder - LTP_ORDER / 2;
SKP_assert( start_idx > 0 );
@@ -154,7 +132,7 @@
SKP_memset( FiltState, 0, psEncC->predictLPCOrder * sizeof( SKP_int32 ) );
SKP_Silk_MA_Prediction( &NSQ->xq[ start_idx + k * psEncC->subfr_length ],
- A_Q12, FiltState, sLTP + start_idx, psEncC->ltp_mem_length - start_idx, psEncC->predictLPCOrder );
+ A_Q12, FiltState, &sLTP[ start_idx ], psEncC->ltp_mem_length - start_idx, psEncC->predictLPCOrder );
NSQ->rewhite_flag = 1;
NSQ->sLTP_buf_idx = psEncC->ltp_mem_length;
@@ -161,26 +139,15 @@
}
}
- SKP_Silk_nsq_scale_states( psEncC, NSQ, x, x_sc_Q10, psEncC->subfr_length, sLTP,
- sLTP_Q16, k, LTP_scale_Q14, Gains_Q16, psEncCtrlC->pitchL );
+ SKP_Silk_nsq_scale_states( psEncC, NSQ, x, x_sc_Q10, sLTP, sLTP_Q16, k, LTP_scale_Q14, Gains_Q16, psEncCtrlC->pitchL );
SKP_Silk_noise_shape_quantizer( NSQ, psEncCtrlC->signalType, x_sc_Q10, q, pxq, sLTP_Q16, A_Q12, B_Q14,
AR_shp_Q13, lag, HarmShapeFIRPacked_Q14, Tilt_Q14[ k ], LF_shp_Q14[ k ], Gains_Q16[ k ], Lambda_Q10,
- offset_Q10, psEncC->subfr_length, psEncC->shapingLPCOrder, psEncC->predictLPCOrder
-#ifdef SAVE_ALL_INTERNAL_DATA
- , q_in_env, q_exc, q_LPC_exc, q_exc_prev
-#endif
- );
+ offset_Q10, psEncC->subfr_length, psEncC->shapingLPCOrder, psEncC->predictLPCOrder );
- x += psEncC->subfr_length;
- q += psEncC->subfr_length;
- pxq += psEncC->subfr_length;
-#ifdef SAVE_ALL_INTERNAL_DATA
- q_in_env += psEncC->subfr_length;
- q_exc += psEncC->subfr_length;
- q_LPC_exc += psEncC->subfr_length;
- q_exc_prev += subfr_length;
-#endif
+ x += psEncC->subfr_length;
+ q += psEncC->subfr_length;
+ pxq += psEncC->subfr_length;
}
/* Update lagPrev for next frame */
@@ -191,11 +158,9 @@
SKP_memcpy( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( SKP_int32 ) );
#ifdef SAVE_ALL_INTERNAL_DATA
- DEBUG_STORE_DATA( q_in_env.dat, q_in_env_buf, psEncC->frame_length * sizeof( SKP_float ) );
- DEBUG_STORE_DATA( q_exc.dat, q_exc_buf, psEncC->frame_length * sizeof( SKP_float ) );
- DEBUG_STORE_DATA( q_lpc_exc.dat, q_LPC_exc_buf, psEncC->frame_length * sizeof( SKP_float ) );
- DEBUG_STORE_DATA( xq.dat, NSQ->xq, psEncC->frame_length * sizeof( SKP_int16 ) );
- DEBUG_STORE_DATA( q.dat, &q[ -psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int8 ) );
+ DEBUG_STORE_DATA( xq.dat, &pxq[ -psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int16 ) );
+ DEBUG_STORE_DATA( q.dat, &q[ -psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int8 ) );
+ DEBUG_STORE_DATA( sLTP_Q16.dat, &sLTP_Q16[ psEncC->ltp_mem_length ], psEncC->frame_length * sizeof( SKP_int32 ) );
#endif
}
@@ -222,12 +187,6 @@
SKP_int length, /* I Input length */
SKP_int shapingLPCOrder, /* I Noise shaping AR filter order */
SKP_int predictLPCOrder /* I Prediction filter order */
-#ifdef SAVE_ALL_INTERNAL_DATA
- ,SKP_float q_in_env[], /* O */
- SKP_float q_exc[], /* O */
- SKP_float q_LPC_exc[], /* O */
- SKP_float q_exc_prev[] /* O */
-#endif
)
{
SKP_int i, j;
@@ -322,16 +281,17 @@
n_LTP_Q14 = SKP_SMLAWT( n_LTP_Q14, shp_lag_ptr[ -1 ], HarmShapeFIRPacked_Q14 );
n_LTP_Q14 = SKP_LSHIFT( n_LTP_Q14, 6 );
shp_lag_ptr++;
+
+ tmp1 = SKP_SUB32( LTP_pred_Q14, n_LTP_Q14 ); /* Add Q14 stuff */
+ tmp1 = SKP_RSHIFT( tmp1, 4 ); /* convert to Q10 */
+ tmp1 = SKP_ADD32( tmp1, LPC_pred_Q10 ); /* add Q10 stuff */
+ tmp1 = SKP_SUB32( tmp1, n_AR_Q10 ); /* subtract Q10 stuff */
} else {
- n_LTP_Q14 = 0;
+ tmp1 = SKP_SUB32( LPC_pred_Q10, n_AR_Q10 ); /* subtract Q10 stuff */
}
/* Input minus prediction plus noise feedback */
//r = x[ i ] - LTP_pred - LPC_pred + n_AR + n_Tilt + n_LF + n_LTP;
- tmp1 = SKP_SUB32( LTP_pred_Q14, n_LTP_Q14 ); /* Add Q14 stuff */
- tmp1 = SKP_RSHIFT( tmp1, 4 ); /* convert to Q10 */
- tmp1 = SKP_ADD32( tmp1, LPC_pred_Q10 ); /* add Q10 stuff */
- tmp1 = SKP_SUB32( tmp1, n_AR_Q10 ); /* subtract Q10 stuff */
tmp1 = SKP_SUB32( tmp1, n_LF_Q10 ); /* subtract Q10 stuff */
r_Q10 = SKP_SUB32( x_sc_Q10[ i ], tmp1 );
@@ -370,12 +330,6 @@
/* Scale XQ back to normal level before saving */
xq[ i ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( xq_Q10, Gain_Q16 ), 10 ) );
-#ifdef SAVE_ALL_INTERNAL_DATA
- q_in_env[ i ] = ( (SKP_float)r_Q10 * (SKP_float)Gain_Q16 ) / ( 1024.0f * 65536.0f );
- q_exc[ i ] = ( (SKP_float)exc_Q10 * (SKP_float)Gain_Q16 ) / ( 1024.0f * 65536.0f );
- q_LPC_exc[ i ] = ( (SKP_float)LPC_exc_Q10 * (SKP_float)Gain_Q16 ) / ( 1024.0f * 65536.0f );
-#endif
-
/* Update states */
psLPC_Q14++;
*psLPC_Q14 = SKP_LSHIFT( xq_Q10, 4 );
@@ -400,7 +354,6 @@
SKP_Silk_nsq_state *NSQ, /* I/O NSQ state */
const SKP_int16 x[], /* I input in Q0 */
SKP_int32 x_sc_Q10[], /* O input scaled with 1/Gain */
- SKP_int subfr_length, /* I length of input */
const SKP_int16 sLTP[], /* I re-whitened LTP state in Q0 */
SKP_int32 sLTP_Q16[], /* O LTP state matching scaled input */
SKP_int subfr, /* I subframe number */
@@ -434,7 +387,7 @@
gain_adj_Q16 = SKP_DIV32_varQ( inv_gain_Q16, NSQ->prev_inv_gain_Q16, 16 );
/* Scale long-term shaping state */
- for( i = NSQ->sLTP_shp_buf_idx - subfr_length * psEncC->nb_subfr; i < NSQ->sLTP_shp_buf_idx; i++ ) {
+ for( i = NSQ->sLTP_shp_buf_idx - psEncC->ltp_mem_length; i < NSQ->sLTP_shp_buf_idx; i++ ) {
NSQ->sLTP_shp_Q10[ i ] = SKP_SMULWW( gain_adj_Q16, NSQ->sLTP_shp_Q10[ i ] );
}
@@ -457,7 +410,7 @@
}
/* Scale input */
- for( i = 0; i < subfr_length; i++ ) {
+ for( i = 0; i < psEncC->subfr_length; i++ ) {
x_sc_Q10[ i ] = SKP_RSHIFT( SKP_SMULBB( x[ i ], ( SKP_int16 )inv_gain_Q16 ), 6 );
}
--- a/src_common/SKP_Silk_NSQ_del_dec.c
+++ b/src_common/SKP_Silk_NSQ_del_dec.c
@@ -63,7 +63,6 @@
NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */
const SKP_int16 x[], /* I Input in Q0 */
SKP_int32 x_sc_Q10[], /* O Input scaled with 1/Gain in Q10 */
- SKP_int subfr_length, /* I Length of input */
const SKP_int16 sLTP[], /* I Re-whitened LTP state in Q0 */
SKP_int32 sLTP_Q16[], /* O LTP state matching scaled input */
SKP_int subfr, /* I Subframe number */
@@ -124,7 +123,7 @@
)
{
SKP_int i, k, lag, start_idx, LSF_interpolation_flag, Winner_ind, subfr;
- SKP_int last_smple_idx, smpl_buf_idx, decisionDelay, subfr_length;
+ SKP_int last_smple_idx, smpl_buf_idx, decisionDelay;
const SKP_int16 *A_Q12, *B_Q14, *AR_shp_Q13;
SKP_int16 *pxq;
SKP_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ];
@@ -136,8 +135,6 @@
NSQ_del_dec_struct psDelDec[ MAX_DEL_DEC_STATES ];
NSQ_del_dec_struct *psDD;
- subfr_length = psEncC->subfr_length;
-
/* Set unvoiced lag to the previous one, overwrite later for voiced */
lag = NSQ->lagPrev;
@@ -159,7 +156,7 @@
offset_Q10 = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrlC->signalType >> 1 ][ psEncCtrlC->quantOffsetType ];
smpl_buf_idx = 0; /* index of oldest samples */
- decisionDelay = SKP_min_int( DECISION_DELAY, subfr_length );
+ decisionDelay = SKP_min_int( DECISION_DELAY, psEncC->subfr_length );
/* For voiced frames limit the decision delay to lower than the pitch lag */
if( psEncCtrlC->signalType == TYPE_VOICED ) {
@@ -225,8 +222,7 @@
last_smple_idx = ( last_smple_idx - 1 ) & DECISION_DELAY_MASK;
q[ i - decisionDelay ] = ( SKP_int8 )SKP_RSHIFT( psDD->Q_Q10[ last_smple_idx ], 10 );
pxq[ i - decisionDelay ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND(
- SKP_SMULWW( psDD->Xq_Q10[ last_smple_idx ],
- psDD->Gain_Q16[ last_smple_idx ] ), 10 ) );
+ SKP_SMULWW( psDD->Xq_Q10[ last_smple_idx ], psDD->Gain_Q16[ last_smple_idx ] ), 10 ) );
NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - decisionDelay + i ] = psDD->Shape_Q10[ last_smple_idx ];
}
@@ -239,7 +235,7 @@
SKP_memset( FiltState, 0, psEncC->predictLPCOrder * sizeof( SKP_int32 ) );
SKP_Silk_MA_Prediction( &NSQ->xq[ start_idx + k * psEncC->subfr_length ],
- A_Q12, FiltState, sLTP + start_idx, psEncC->ltp_mem_length - start_idx, psEncC->predictLPCOrder );
+ A_Q12, FiltState, &sLTP[ start_idx ], psEncC->ltp_mem_length - start_idx, psEncC->predictLPCOrder );
NSQ->sLTP_buf_idx = psEncC->ltp_mem_length;
NSQ->rewhite_flag = 1;
@@ -246,9 +242,8 @@
}
}
- SKP_Silk_nsq_del_dec_scale_states( psEncC, NSQ, psDelDec, x, x_sc_Q10,
- subfr_length, sLTP, sLTP_Q16, k, psEncC->nStatesDelayedDecision, smpl_buf_idx,
- LTP_scale_Q14, Gains_Q16, psEncCtrlC->pitchL );
+ SKP_Silk_nsq_del_dec_scale_states( psEncC, NSQ, psDelDec, x, x_sc_Q10, sLTP, sLTP_Q16, k,
+ psEncC->nStatesDelayedDecision, smpl_buf_idx, LTP_scale_Q14, Gains_Q16, psEncCtrlC->pitchL );
SKP_Silk_noise_shape_quantizer_del_dec( NSQ, psDelDec, psEncCtrlC->signalType, x_sc_Q10, q, pxq, sLTP_Q16,
A_Q12, B_Q14, AR_shp_Q13, lag, HarmShapeFIRPacked_Q14, Tilt_Q14[ k ], LF_shp_Q14[ k ], Gains_Q16[ k ],
@@ -294,9 +289,9 @@
SKP_memmove( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( SKP_int32 ) );
#ifdef SAVE_ALL_INTERNAL_DATA
- DEBUG_STORE_DATA( sLTP_Q16.dat, &sLTP_Q16[ psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int32 ) );
- DEBUG_STORE_DATA( xq.dat, NSQ->xq, psEncC->frame_length * sizeof( SKP_int16 ) );
- DEBUG_STORE_DATA( q.dat, &q[ -psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int8 ) );
+ DEBUG_STORE_DATA( xq.dat, &pxq[ -psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int16 ) );
+ DEBUG_STORE_DATA( q.dat, &q[ -psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int8 ) );
+ DEBUG_STORE_DATA( sLTP_Q16.dat, &sLTP_Q16[ psEncC->ltp_mem_length ], psEncC->frame_length * sizeof( SKP_int32 ) );
#endif
}
@@ -333,7 +328,7 @@
{
SKP_int i, j, k, Winner_ind, RDmin_ind, RDmax_ind, last_smple_idx;
SKP_int32 Winner_rand_state;
- SKP_int32 LTP_pred_Q14, LPC_pred_Q10, n_AR_Q10, n_LTP_Q14;
+ SKP_int32 LTP_pred_Q14, LPC_pred_Q10, n_AR_Q10, n_LTP_Q14, LTP_Q10;
SKP_int32 n_LF_Q10, r_Q10, rr_Q20, rd1_Q10, rd2_Q10, RDmin_Q10, RDmax_Q10;
SKP_int32 q1_Q10, q2_Q10, dither, exc_Q10, LPC_exc_Q10, xq_Q10;
SKP_int32 tmp1, tmp2, sLF_AR_shp_Q10;
@@ -368,8 +363,10 @@
n_LTP_Q14 = SKP_SMLAWT( n_LTP_Q14, shp_lag_ptr[ -1 ], HarmShapeFIRPacked_Q14 );
n_LTP_Q14 = SKP_LSHIFT( n_LTP_Q14, 6 );
shp_lag_ptr++;
+
+ LTP_Q10 = SKP_RSHIFT( SKP_SUB32( LTP_pred_Q14, n_LTP_Q14 ), 4 );
} else {
- n_LTP_Q14 = 0;
+ LTP_Q10 = 0;
}
for( k = 0; k < nStatesDelayedDecision; k++ ) {
@@ -436,9 +433,7 @@
/* Input minus prediction plus noise feedback */
/* r = x[ i ] - LTP_pred - LPC_pred + n_AR + n_Tilt + n_LF + n_LTP */
- tmp1 = SKP_SUB32( LTP_pred_Q14, n_LTP_Q14 ); /* Add Q14 stuff */
- tmp1 = SKP_RSHIFT( tmp1, 4 ); /* convert to Q10 */
- tmp1 = SKP_ADD32( tmp1, LPC_pred_Q10 ); /* add Q10 stuff */
+ tmp1 = SKP_ADD32( LTP_Q10, LPC_pred_Q10 ); /* add Q10 stuff */
tmp1 = SKP_SUB32( tmp1, n_AR_Q10 ); /* subtract Q10 stuff */
tmp1 = SKP_SUB32( tmp1, n_LF_Q10 ); /* subtract Q10 stuff */
r_Q10 = SKP_SUB32( x_Q10[ i ], tmp1 ); /* residual error Q10 */
@@ -607,7 +602,6 @@
NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */
const SKP_int16 x[], /* I Input in Q0 */
SKP_int32 x_sc_Q10[], /* O Input scaled with 1/Gain in Q10 */
- SKP_int subfr_length, /* I Length of input */
const SKP_int16 sLTP[], /* I Re-whitened LTP state in Q0 */
SKP_int32 sLTP_Q16[], /* O LTP state matching scaled input */
SKP_int subfr, /* I Subframe number */
@@ -644,7 +638,7 @@
gain_adj_Q16 = SKP_DIV32_varQ( inv_gain_Q16, NSQ->prev_inv_gain_Q16, 16 );
/* Scale long-term shaping state */
- for( i = NSQ->sLTP_shp_buf_idx - subfr_length * psEncC->nb_subfr; i < NSQ->sLTP_shp_buf_idx; i++ ) {
+ for( i = NSQ->sLTP_shp_buf_idx - psEncC->ltp_mem_length; i < NSQ->sLTP_shp_buf_idx; i++ ) {
NSQ->sLTP_shp_Q10[ i ] = SKP_SMULWW( gain_adj_Q16, NSQ->sLTP_shp_Q10[ i ] );
}
@@ -676,7 +670,7 @@
}
/* Scale input */
- for( i = 0; i < subfr_length; i++ ) {
+ for( i = 0; i < psEncC->subfr_length; i++ ) {
x_sc_Q10[ i ] = SKP_RSHIFT( SKP_SMULBB( x[ i ], ( SKP_int16 )inv_gain_Q16 ), 6 );
}
--- a/src_common/SKP_Silk_code_signs.c
+++ b/src_common/SKP_Silk_code_signs.c
@@ -43,7 +43,7 @@
const SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */
)
{
- SKP_int i, j, p, inData;
+ SKP_int i, j, p;
SKP_uint8 icdf[ 2 ];
const SKP_int8 *q_ptr;
const SKP_uint8 *icdf_ptr;
@@ -52,7 +52,7 @@
q_ptr = q;
i = SKP_SMULBB( 6, SKP_ADD_LSHIFT( quantOffsetType, signalType, 1 ) );
icdf_ptr = &SKP_Silk_sign_iCDF[ i ];
- length = SKP_RSHIFT( length, LOG2_SHELL_CODEC_FRAME_LENGTH );
+ length = SKP_RSHIFT( length + SHELL_CODEC_FRAME_LENGTH/2, LOG2_SHELL_CODEC_FRAME_LENGTH );
for( i = 0; i < length; i++ ) {
p = sum_pulses[ i ];
if( p > 0 ) {
@@ -59,8 +59,7 @@
icdf[ 0 ] = icdf_ptr[ SKP_min( p - 1, 5 ) ];
for( j = 0; j < SHELL_CODEC_FRAME_LENGTH; j++ ) {
if( q_ptr[ j ] != 0 ) {
- inData = SKP_enc_map( q_ptr[ j ]); /* - = 0, + = 1 */
- ec_enc_icdf( psRangeEnc, inData, icdf, 8 );
+ ec_enc_icdf( psRangeEnc, SKP_enc_map( q_ptr[ j ]), icdf, 8 );
}
}
}
@@ -78,7 +77,7 @@
const SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */
)
{
- SKP_int i, j, p, data;
+ SKP_int i, j, p;
SKP_uint8 icdf[ 2 ];
SKP_int *q_ptr;
const SKP_uint8 *icdf_ptr;
@@ -87,7 +86,7 @@
q_ptr = q;
i = SKP_SMULBB( 6, SKP_ADD_LSHIFT( quantOffsetType, signalType, 1 ) );
icdf_ptr = &SKP_Silk_sign_iCDF[ i ];
- length = SKP_RSHIFT( length, LOG2_SHELL_CODEC_FRAME_LENGTH );
+ length = SKP_RSHIFT( length + SHELL_CODEC_FRAME_LENGTH/2, LOG2_SHELL_CODEC_FRAME_LENGTH );
for( i = 0; i < length; i++ ) {
p = sum_pulses[ i ];
if( p > 0 ) {
@@ -94,10 +93,16 @@
icdf[ 0 ] = icdf_ptr[ SKP_min( p - 1, 5 ) ];
for( j = 0; j < SHELL_CODEC_FRAME_LENGTH; j++ ) {
if( q_ptr[ j ] > 0 ) {
- data = ec_dec_icdf( psRangeDec, icdf, 8 );
/* attach sign */
+#if 1
+ /* conditional implementation */
+ if( ec_dec_icdf( psRangeDec, icdf, 8 ) == 0 ) {
+ q_ptr[ j ] = -q_ptr[ j ];
+ }
+#else
/* implementation with shift, subtraction, multiplication */
- q_ptr[ j ] *= SKP_dec_map( data );
+ q_ptr[ j ] *= SKP_dec_map( ec_dec_icdf( psRangeDec, icdf, 8 ) );
+#endif
}
}
}
--- a/src_common/SKP_Silk_control_audio_bandwidth.c
+++ b/src_common/SKP_Silk_control_audio_bandwidth.c
@@ -30,17 +30,21 @@
/* Control internal sampling rate */
SKP_int SKP_Silk_control_audio_bandwidth(
SKP_Silk_encoder_state *psEncC, /* I/O Pointer to Silk encoder state */
- const SKP_int32 TargetRate_bps /* I Target max bitrate (bps) */
+ SKP_int32 TargetRate_bps /* I Target max bitrate (bps) */
)
{
SKP_int fs_kHz;
fs_kHz = psEncC->fs_kHz;
+
+ /* Reduce bitrate for 10 ms modes in these calculations */
+ if( psEncC->nb_subfr == 2 ) {
+ TargetRate_bps -= REDUCE_BITRATE_10_MS_BPS;
+ }
+
if( fs_kHz == 0 ) {
/* Encoder has just been initialized */
- if( TargetRate_bps >= SWB2WB_BITRATE_BPS ) {
- fs_kHz = 24;
- } else if( TargetRate_bps >= WB2MB_BITRATE_BPS ) {
+ if( TargetRate_bps >= WB2MB_BITRATE_BPS ) {
fs_kHz = 16;
} else if( TargetRate_bps >= MB2NB_BITRATE_BPS ) {
fs_kHz = 12;
@@ -60,7 +64,7 @@
/* State machine for the internal sampling rate switching */
if( psEncC->API_fs_Hz > 8000 ) {
/* Accumulate the difference between the target rate and limit for switching down */
- psEncC->bitrateDiff += SKP_MUL( psEncC->PacketSize_ms, psEncC->TargetRate_bps - psEncC->bitrate_threshold_down );
+ psEncC->bitrateDiff += SKP_MUL( psEncC->PacketSize_ms, TargetRate_bps - psEncC->bitrate_threshold_down );
psEncC->bitrateDiff = SKP_min( psEncC->bitrateDiff, 0 );
if( psEncC->prevSignalType == TYPE_NO_VOICE_ACTIVITY ) { /* Low speech activity */
@@ -67,8 +71,7 @@
/* Check if we should switch down */
#if SWITCH_TRANSITION_FILTERING
if( ( psEncC->sLP.transition_frame_no == 0 ) && /* Transition phase not active */
- ( psEncC->bitrateDiff <= -ACCUM_BITS_DIFF_THRESHOLD || /* Bitrate threshold is met */
- ( psEncC->sSWBdetect.WB_detected * psEncC->fs_kHz == 24 ) ) ) { /* Forced down-switching due to WB input */
+ ( psEncC->bitrateDiff <= -ACCUM_BITS_DIFF_THRESHOLD ) ) { /* Bitrate threshold is met */
psEncC->sLP.transition_frame_no = 1; /* Begin transition phase */
psEncC->sLP.mode = 0; /* Switch down */
} else if(
@@ -93,10 +96,8 @@
/* Check if we should switch up */
if( ( ( psEncC->fs_kHz * 1000 < psEncC->API_fs_Hz ) &&
- ( psEncC->TargetRate_bps >= psEncC->bitrate_threshold_up ) &&
- ( psEncC->sSWBdetect.WB_detected * psEncC->fs_kHz < 16 ) ) &&
- ( ( psEncC->fs_kHz == 16 ) && ( psEncC->maxInternal_fs_kHz >= 24 ) ||
- ( psEncC->fs_kHz == 12 ) && ( psEncC->maxInternal_fs_kHz >= 16 ) ||
+ ( TargetRate_bps > psEncC->bitrate_threshold_up ) ) &&
+ ( ( psEncC->fs_kHz == 12 ) && ( psEncC->maxInternal_fs_kHz >= 16 ) ||
( psEncC->fs_kHz == 8 ) && ( psEncC->maxInternal_fs_kHz >= 12 ) )
#if SWITCH_TRANSITION_FILTERING
&& ( psEncC->sLP.transition_frame_no == 0 ) ) /* No transition phase running, ready to switch */
@@ -113,8 +114,7 @@
} else if( psEncC->fs_kHz == 12 ) {
fs_kHz = 16;
} else {
- SKP_assert( psEncC->fs_kHz == 16 );
- fs_kHz = 24;
+ SKP_assert( 0 );
}
}
}
--- a/src_common/SKP_Silk_create_init_destroy.c
+++ b/src_common/SKP_Silk_create_init_destroy.c
@@ -38,9 +38,9 @@
/* Clear the entire encoder state, except anything copied */
SKP_memset( psDec, 0, sizeof( SKP_Silk_decoder_state ) );
- /* Set sampling rate to 24 kHz, and init non-zero values */
+ /* Set sampling rate to 16 kHz, and init non-zero values */
psDec->nb_subfr = MAX_NB_SUBFR;
- SKP_Silk_decoder_set_fs( psDec, 24 );
+ SKP_Silk_decoder_set_fs( psDec, 16 );
/* Used to deactivate e.g. LSF interpolation and fluctuation reduction */
psDec->first_frame_after_reset = 1;
--- a/src_common/SKP_Silk_dec_API.c
+++ b/src_common/SKP_Silk_dec_API.c
@@ -110,7 +110,7 @@
return SKP_SILK_DEC_INVALID_FRAME_SIZE;
}
fs_kHz_dec = ( decControl->internalSampleRate >> 10 ) + 1;
- if( fs_kHz_dec != 8 && fs_kHz_dec != 12 && fs_kHz_dec != 16 && fs_kHz_dec != 24 ) {
+ if( fs_kHz_dec != 8 && fs_kHz_dec != 12 && fs_kHz_dec != 16 ) {
SKP_assert( 0 );
return SKP_SILK_DEC_INVALID_SAMPLING_FREQUENCY;
}
@@ -120,8 +120,7 @@
/* Call decoder for one frame */
ret += SKP_Silk_decode_frame( psDec, psRangeDec, samplesOut, nSamplesOut, nBytesIn, lostFlag, &used_bytes );
- if( used_bytes ) { /* Only Call if not a packet loss */
-
+ if( used_bytes ) { /* Only Call if not a packet loss */
psDec->moreInternalDecoderFrames = psDec->nFramesInPacket - psDec->nFramesDecoded;
if( psDec->nBytesLeft <= 0 || psDec->moreInternalDecoderFrames <= 0 ) {
/* Last frame in Payload */
@@ -141,14 +140,13 @@
}
}
- if( MAX_API_FS_KHZ * 1000 < decControl->API_sampleRate ||
- 8000 > decControl->API_sampleRate ) {
+ if( decControl->API_sampleRate > MAX_API_FS_KHZ * 1000 || decControl->API_sampleRate < 8000 ) {
ret = SKP_SILK_DEC_INVALID_SAMPLING_FREQUENCY;
return( ret );
}
/* Resample if needed */
- if( psDec->fs_kHz * 1000 != decControl->API_sampleRate ) {
+ if( SKP_SMULBB( psDec->fs_kHz, 1000 ) != decControl->API_sampleRate ) {
SKP_int16 samplesOut_tmp[ MAX_API_FS_KHZ * MAX_FRAME_LENGTH_MS ];
SKP_assert( psDec->fs_kHz <= MAX_API_FS_KHZ );
@@ -164,7 +162,7 @@
ret += SKP_Silk_resampler( &psDec->resampler_state, samplesOut, samplesOut_tmp, *nSamplesOut );
/* Update the number of output samples */
- *nSamplesOut = SKP_DIV32( ( SKP_int32 )*nSamplesOut * decControl->API_sampleRate, psDec->fs_kHz * 1000 );
+ *nSamplesOut = SKP_DIV32( ( SKP_int32 )*nSamplesOut * decControl->API_sampleRate, SKP_SMULBB( psDec->fs_kHz, 1000 ) );
}
psDec->prev_API_sampleRate = decControl->API_sampleRate;
--- a/src_common/SKP_Silk_decode_core.c
+++ b/src_common/SKP_Silk_decode_core.c
@@ -41,7 +41,7 @@
SKP_int16 *A_Q12, *B_Q14, *pxq, A_Q12_tmp[ MAX_LPC_ORDER ];
SKP_int16 sLTP[ MAX_FRAME_LENGTH ];
SKP_int32 LTP_pred_Q14, LPC_pred_Q10, Gain_Q16, inv_gain_Q16, inv_gain_Q32, gain_adj_Q16, rand_seed, offset_Q10, dither;
- SKP_int32 *pred_lag_ptr, *pexc_Q10, *pres_Q10;
+ SKP_int32 *pred_lag_ptr, *pexc_Q10;
SKP_int32 vec_Q10[ MAX_SUB_FRAME_LENGTH ];
SKP_int32 FiltState[ MAX_LPC_ORDER ];
@@ -49,16 +49,12 @@
offset_Q10 = SKP_Silk_Quantization_Offsets_Q10[ psDecCtrl->signalType >> 1 ][ psDecCtrl->quantOffsetType ];
- if( psDecCtrl->NLSFInterpCoef_Q2 < ( 1 << 2 ) ) {
+ if( psDecCtrl->NLSFInterpCoef_Q2 < 1 << 2 ) {
NLSF_interpolation_flag = 1;
} else {
NLSF_interpolation_flag = 0;
}
-#ifdef SAVE_ALL_INTERNAL_DATA
- //DEBUG_STORE_DATA( q_dec.dat, q, psDec->frame_length * sizeof( SKP_int ) );
-#endif
-
/* Decode excitation */
rand_seed = psDecCtrl->Seed;
for( i = 0; i < psDec->frame_length; i++ ) {
@@ -73,13 +69,11 @@
}
#ifdef SAVE_ALL_INTERNAL_DATA
- DEBUG_STORE_DATA( exc_Q10.dat, psDec->exc_Q10, psDec->frame_length * sizeof( SKP_int32 ));
-
- /* Resync LTP state here after loss */
+ DEBUG_STORE_DATA( dec_q.dat, q, psDec->frame_length * sizeof( SKP_int ) );
+ DEBUG_STORE_DATA( dec_exc_Q10.dat, psDec->exc_Q10, psDec->frame_length * sizeof( SKP_int32 ));
#endif
pexc_Q10 = psDec->exc_Q10;
- pres_Q10 = psDec->res_Q10;
pxq = &psDec->outBuf[ psDec->ltp_mem_length ];
sLTP_buf_idx = psDec->ltp_mem_length;
/* Loop over subframes */
@@ -88,25 +82,34 @@
/* Preload LPC coeficients to array on stack. Gives small performance gain */
SKP_memcpy( A_Q12_tmp, A_Q12, psDec->LPC_order * sizeof( SKP_int16 ) );
- B_Q14 = &psDecCtrl->LTPCoef_Q14[ k * LTP_ORDER ];
- Gain_Q16 = psDecCtrl->Gains_Q16[ k ];
- signalType = psDecCtrl->signalType;
+ B_Q14 = &psDecCtrl->LTPCoef_Q14[ k * LTP_ORDER ];
+ Gain_Q16 = psDecCtrl->Gains_Q16[ k ];
+ signalType = psDecCtrl->signalType;
inv_gain_Q16 = SKP_INVERSE32_varQ( SKP_max( Gain_Q16, 1 ), 32 );
inv_gain_Q16 = SKP_min( inv_gain_Q16, SKP_int16_MAX );
/* Calculate Gain adjustment factor */
- gain_adj_Q16 = ( SKP_int32 )1 << 16;
+ gain_adj_Q16 = 1 << 16;
if( inv_gain_Q16 != psDec->prev_inv_gain_Q16 ) {
gain_adj_Q16 = SKP_DIV32_varQ( inv_gain_Q16, psDec->prev_inv_gain_Q16, 16 );
+
+ /* Scale short term state */
+ for( i = 0; i < MAX_LPC_ORDER; i++ ) {
+ psDec->sLPC_Q14[ i ] = SKP_SMULWW( gain_adj_Q16, psDec->sLPC_Q14[ i ] );
+ }
}
+ /* Save inv_gain */
+ SKP_assert( inv_gain_Q16 != 0 );
+ psDec->prev_inv_gain_Q16 = inv_gain_Q16;
+
/* Avoid abrupt transition from voiced PLC to unvoiced normal decoding */
if( psDec->lossCnt && psDec->prevSignalType == TYPE_VOICED &&
- psDecCtrl->signalType != TYPE_VOICED && k < ( MAX_NB_SUBFR >> 1 ) ) {
+ psDecCtrl->signalType != TYPE_VOICED && k < MAX_NB_SUBFR/2 ) {
SKP_memset( B_Q14, 0, LTP_ORDER * sizeof( SKP_int16 ) );
- B_Q14[ LTP_ORDER/2 ] = ( SKP_int16 )1 << 12; /* 0.25 */
+ B_Q14[ LTP_ORDER/2 ] = SKP_FIX_CONST( 0.25, 14 );
signalType = TYPE_VOICED;
psDecCtrl->pitchL[ k ] = psDec->lagPrev;
@@ -114,8 +117,8 @@
if( signalType == TYPE_VOICED ) {
/* Voiced */
-
lag = psDecCtrl->pitchL[ k ];
+
/* Re-whitening */
if( ( k & ( 3 - SKP_LSHIFT( NLSF_interpolation_flag, 1 ) ) ) == 0 ) {
/* Rewhiten with new A coefs */
@@ -122,9 +125,9 @@
start_idx = psDec->ltp_mem_length - lag - psDec->LPC_order - LTP_ORDER / 2;
SKP_assert( start_idx > 0 );
- SKP_memset( FiltState, 0, psDec->LPC_order * sizeof( SKP_int32 ) ); /* Not really necessary, but Valgrind and Coverity will complain otherwise */
+ SKP_memset( FiltState, 0, psDec->LPC_order * sizeof( SKP_int32 ) );
SKP_Silk_MA_Prediction( &psDec->outBuf[ start_idx + k * psDec->subfr_length ],
- A_Q12, FiltState, sLTP + start_idx, psDec->ltp_mem_length - start_idx, psDec->LPC_order );
+ A_Q12, FiltState, &sLTP[ start_idx ], psDec->ltp_mem_length - start_idx, psDec->LPC_order );
/* After rewhitening the LTP state is unscaled */
inv_gain_Q32 = SKP_LSHIFT( inv_gain_Q16, 16 );
@@ -132,13 +135,13 @@
/* Do LTP downscaling */
inv_gain_Q32 = SKP_LSHIFT( SKP_SMULWB( inv_gain_Q32, psDecCtrl->LTP_scale_Q14 ), 2 );
}
- for( i = 0; i < (lag + LTP_ORDER/2); i++ ) {
+ for( i = 0; i < lag + LTP_ORDER/2; i++ ) {
psDec->sLTP_Q16[ sLTP_buf_idx - i - 1 ] = SKP_SMULWB( inv_gain_Q32, sLTP[ psDec->ltp_mem_length - i - 1 ] );
}
} else {
/* Update LTP state when Gain changes */
- if( gain_adj_Q16 != ( SKP_int32 )1 << 16 ) {
- for( i = 0; i < ( lag + LTP_ORDER / 2 ); i++ ) {
+ if( gain_adj_Q16 != 1 << 16 ) {
+ for( i = 0; i < lag + LTP_ORDER/2; i++ ) {
psDec->sLTP_Q16[ sLTP_buf_idx - i - 1 ] = SKP_SMULWW( gain_adj_Q16, psDec->sLTP_Q16[ sLTP_buf_idx - i - 1 ] );
}
}
@@ -145,15 +148,6 @@
}
}
- /* Scale short term state */
- for( i = 0; i < MAX_LPC_ORDER; i++ ) {
- psDec->sLPC_Q14[ i ] = SKP_SMULWW( gain_adj_Q16, psDec->sLPC_Q14[ i ] );
- }
-
- /* Save inv_gain */
- SKP_assert( inv_gain_Q16 != 0 );
- psDec->prev_inv_gain_Q16 = inv_gain_Q16;
-
/* Long-term prediction */
if( signalType == TYPE_VOICED ) {
/* Setup pointer */
@@ -168,18 +162,16 @@
pred_lag_ptr++;
/* Generate LPC residual */
- pres_Q10[ i ] = SKP_ADD32( pexc_Q10[ i ], SKP_RSHIFT_ROUND( LTP_pred_Q14, 4 ) );
+ pexc_Q10[ i ] = SKP_ADD32( pexc_Q10[ i ], SKP_RSHIFT_ROUND( LTP_pred_Q14, 4 ) );
/* Update states */
- psDec->sLTP_Q16[ sLTP_buf_idx ] = SKP_LSHIFT( pres_Q10[ i ], 6 );
+ psDec->sLTP_Q16[ sLTP_buf_idx ] = SKP_LSHIFT( pexc_Q10[ i ], 6 );
sLTP_buf_idx++;
}
- } else {
- SKP_memcpy( pres_Q10, pexc_Q10, psDec->subfr_length * sizeof( SKP_int32 ) );
}
#ifdef SAVE_ALL_INTERNAL_DATA
- DEBUG_STORE_DATA( res_Q10.dat, pres_Q10, psDec->subfr_length * sizeof( SKP_int32 ) );
+ DEBUG_STORE_DATA( dec_res_Q10.dat, pexc_Q10, psDec->subfr_length * sizeof( SKP_int32 ) );
#endif
for( i = 0; i < psDec->subfr_length; i++ ) {
@@ -194,14 +186,13 @@
LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psDec->sLPC_Q14[ MAX_LPC_ORDER + i - 8 ], A_Q12_tmp[ 7 ] );
LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psDec->sLPC_Q14[ MAX_LPC_ORDER + i - 9 ], A_Q12_tmp[ 8 ] );
LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psDec->sLPC_Q14[ MAX_LPC_ORDER + i - 10 ], A_Q12_tmp[ 9 ] );
-
- for( j = 10; j < psDec->LPC_order; j ++ ) {
+ for( j = 10; j < psDec->LPC_order; j++ ) {
LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psDec->sLPC_Q14[ MAX_LPC_ORDER + i - j - 1 ], A_Q12_tmp[ j ] );
}
/* Add prediction to LPC residual */
- vec_Q10[ i ] = SKP_ADD32( pres_Q10[ i ], LPC_pred_Q10 );
-
+ vec_Q10[ i ] = SKP_ADD32( pexc_Q10[ i ], LPC_pred_Q10 );
+
/* Update states */
psDec->sLPC_Q14[ MAX_LPC_ORDER + i ] = SKP_LSHIFT( vec_Q10[ i ], 4 );
}
@@ -214,7 +205,6 @@
/* Update LPC filter state */
SKP_memcpy( psDec->sLPC_Q14, &psDec->sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER * sizeof( SKP_int32 ) );
pexc_Q10 += psDec->subfr_length;
- pres_Q10 += psDec->subfr_length;
pxq += psDec->subfr_length;
}
@@ -222,7 +212,7 @@
SKP_memcpy( xq, &psDec->outBuf[ psDec->ltp_mem_length ], psDec->frame_length * sizeof( SKP_int16 ) );
#ifdef SAVE_ALL_INTERNAL_DATA
- //DEBUG_STORE_DATA( LTP_buf_Q16.dat, &psDec->sLTP_Q16[psDec->frame_length], psDec->frame_length * sizeof( SKP_int32 ));
- //DEBUG_STORE_DATA( xq_dec.dat, xq, psDec->frame_length * sizeof( SKP_int16 ) );
+ DEBUG_STORE_DATA( dec_sLTP_Q16.dat, &psDec->sLTP_Q16[ psDec->ltp_mem_length ], psDec->frame_length * sizeof( SKP_int32 ));
+ DEBUG_STORE_DATA( dec_xq.dat, xq, psDec->frame_length * sizeof( SKP_int16 ) );
#endif
}
--- a/src_common/SKP_Silk_decode_frame.c
+++ b/src_common/SKP_Silk_decode_frame.c
@@ -49,7 +49,7 @@
L = psDec->frame_length;
sDecCtrl.LTP_scale_Q14 = 0;
-
+
/* Safety checks */
SKP_assert( L > 0 && L <= MAX_FRAME_LENGTH );
@@ -61,8 +61,8 @@
/********************************************/
/* Initialize arithmetic coder */
/********************************************/
- fs_Khz_old = psDec->fs_kHz;
- nb_subfr_old = psDec->nb_subfr;
+ fs_Khz_old = psDec->fs_kHz;
+ nb_subfr_old = psDec->nb_subfr;
if( psDec->nFramesDecoded == 0 ) {
SKP_Silk_decode_indices( psDec, psRangeDec );
}
@@ -71,51 +71,34 @@
/* Decode parameters and pulse signal */
/********************************************/
TIC(decode_params)
- SKP_Silk_decode_parameters( psDec, &sDecCtrl, psRangeDec, Pulses, 1 );
+ SKP_Silk_decode_parameters( psDec, &sDecCtrl, psRangeDec, Pulses );
TOC(decode_params)
- if( 0 ) { //psDec->sRC.error ) {
- psDec->nBytesLeft = 0;
+ *decBytes = psRangeDec->buf->storage - psDec->nBytesLeft;
+ psDec->nFramesDecoded++;
- action = 1; /* PLC operation */
- psDec->nb_subfr = nb_subfr_old;
- SKP_Silk_decoder_set_fs( psDec, fs_Khz_old );
+ /* Update length. Sampling frequency may have changed */
+ L = psDec->frame_length;
- /* Avoid crashing */
- *decBytes = psRangeDec->buf->storage;
- /*
- if( psDec->sRC.error == RANGE_CODER_DEC_PAYLOAD_TOO_LONG ) {
- ret = SKP_SILK_DEC_PAYLOAD_TOO_LARGE;
- } else {
- ret = SKP_SILK_DEC_PAYLOAD_ERROR;
- }
- */
- } else {
- *decBytes = psRangeDec->buf->storage - psDec->nBytesLeft;
- psDec->nFramesDecoded++;
-
- /* Update lengths. Sampling frequency could have changed */
- L = psDec->frame_length;
-
- /********************************************************/
- /* Run inverse NSQ */
- /********************************************************/
+ /********************************************************/
+ /* Run inverse NSQ */
+ /********************************************************/
TIC(decode_core)
- SKP_Silk_decode_core( psDec, &sDecCtrl, pOut, Pulses );
+ SKP_Silk_decode_core( psDec, &sDecCtrl, pOut, Pulses );
TOC(decode_core)
- /********************************************************/
- /* Update PLC state */
- /********************************************************/
- SKP_Silk_PLC( psDec, &sDecCtrl, pOut, L, action );
+ /********************************************************/
+ /* Update PLC state */
+ /********************************************************/
+ SKP_Silk_PLC( psDec, &sDecCtrl, pOut, L, action );
- psDec->lossCnt = 0;
- psDec->prevSignalType = sDecCtrl.signalType;
+ psDec->lossCnt = 0;
+ psDec->prevSignalType = sDecCtrl.signalType;
- /* A frame has been decoded without errors */
- psDec->first_frame_after_reset = 0;
- }
+ /* A frame has been decoded without errors */
+ psDec->first_frame_after_reset = 0;
}
+
/*************************************************************/
/* Generate Concealment frame if packet is lost, or corrupt */
/*************************************************************/
@@ -129,10 +112,8 @@
/*************************/
SKP_assert( psDec->ltp_mem_length >= psDec->frame_length );
mv_len = psDec->ltp_mem_length - psDec->frame_length;
- SKP_memmove( psDec->outBuf, &psDec->outBuf[ psDec->ltp_mem_length - mv_len ],
- mv_len * sizeof(SKP_int16) );
- SKP_memcpy( &psDec->outBuf[ mv_len ], pOut,
- psDec->frame_length * sizeof( SKP_int16 ) );
+ SKP_memmove( psDec->outBuf, &psDec->outBuf[ psDec->frame_length ], mv_len * sizeof(SKP_int16) );
+ SKP_memcpy( &psDec->outBuf[ mv_len ], pOut, psDec->frame_length * sizeof( SKP_int16 ) );
/****************************************************************/
/* Ensure smooth connection of extrapolated and good frames */
@@ -147,19 +128,17 @@
/********************************************/
/* HP filter output */
/********************************************/
- SKP_assert( ( ( psDec->fs_kHz == 12 ) && ( L % 3 ) == 0 ) ||
- ( ( psDec->fs_kHz != 12 ) && ( L % 2 ) == 0 ) );
TIC(HP_out)
SKP_Silk_biquad_alt( pOut, psDec->HP_B, psDec->HP_A, psDec->HPState, pOut, L );
TOC(HP_out)
+ /* Update some decoder state variables */
+ psDec->lagPrev = sDecCtrl.pitchL[ psDec->nb_subfr - 1 ];
+
/********************************************/
/* set output frame length */
/********************************************/
*pN = ( SKP_int16 )L;
-
- /* Update some decoder state variables */
- psDec->lagPrev = sDecCtrl.pitchL[ MAX_NB_SUBFR - 1 ];
TOC(decode_frame)
--- a/src_common/SKP_Silk_decode_indices.c
+++ b/src_common/SKP_Silk_decode_indices.c
@@ -85,7 +85,11 @@
/***********************************/
/* Decode LSF interpolation factor */
/***********************************/
- psDec->NLSFInterpCoef_Q2[ FrameIndex ] = ec_dec_icdf( psRangeDec, SKP_Silk_NLSF_interpolation_factor_iCDF, 8 );
+ if( psDec->nb_subfr == MAX_NB_SUBFR ) {
+ psDec->NLSFInterpCoef_Q2[ FrameIndex ] = ec_dec_icdf( psRangeDec, SKP_Silk_NLSF_interpolation_factor_iCDF, 8 );
+ } else {
+ psDec->NLSFInterpCoef_Q2[ FrameIndex ] = 4;
+ }
if( signalType == TYPE_VOICED ) {
/*********************/
@@ -140,10 +144,10 @@
/**************************************/
/* Decode Frame termination indicator */
/**************************************/
- psDec->FrameTermination = ec_dec_icdf( psRangeDec, SKP_Silk_FrameTermination_iCDF, 8 );
+ psDec->FrameTermination = ec_dec_icdf( psRangeDec, SKP_Silk_LBRR_Present_iCDF, 8 );
/****************************************/
- /* get number of bytes used so far */
+ /* Get number of bytes used so far */
/****************************************/
nBytesUsed = SKP_RSHIFT( ec_dec_tell( psRangeDec, 0 ) + 7, 3 );
psDec->nBytesLeft = psRangeDec->buf->storage - nBytesUsed;
--- a/src_common/SKP_Silk_decode_parameters.c
+++ b/src_common/SKP_Silk_decode_parameters.c
@@ -29,11 +29,10 @@
/* Decode parameters from payload */
void SKP_Silk_decode_parameters(
- SKP_Silk_decoder_state *psDec, /* I/O State */
- SKP_Silk_decoder_control *psDecCtrl, /* I/O Decoder control */
- ec_dec *psRangeDec, /* I/O Compressor data structure */
- SKP_int q[ MAX_FRAME_LENGTH ], /* O Excitation signal */
- const SKP_int fullDecoding /* I Flag to tell if only arithmetic decoding */
+ SKP_Silk_decoder_state *psDec, /* I/O State */
+ SKP_Silk_decoder_control *psDecCtrl, /* I/O Decoder control */
+ ec_dec *psRangeDec, /* I/O Compressor data structure */
+ SKP_int q[ MAX_FRAME_LENGTH ] /* O Excitation signal */
)
{
SKP_int i, k, Ix, nBytesUsed;
@@ -74,7 +73,7 @@
/* the previous NLSF1, and the current NLSF1 */
for( i = 0; i < psDec->LPC_order; i++ ) {
pNLSF0_Q15[ i ] = psDec->prevNLSF_Q15[ i ] + SKP_RSHIFT( SKP_MUL( psDecCtrl->NLSFInterpCoef_Q2,
- ( pNLSF_Q15[ i ] - psDec->prevNLSF_Q15[ i ] ) ), 2 );
+ pNLSF_Q15[ i ] - psDec->prevNLSF_Q15[ i ] ), 2 );
}
/* Convert NLSF parameters to AR prediction filter coefficients */
--- a/src_common/SKP_Silk_decode_pulses.c
+++ b/src_common/SKP_Silk_decode_pulses.c
@@ -54,6 +54,7 @@
SKP_assert( frame_length == 12 * 10 ); /* Make sure only happens for 10 ms @ 12 kHz */
iter++;
}
+
/***************************************************/
/* Sum-Weighted-Pulses Decoding */
/***************************************************/
--- a/src_common/SKP_Silk_decoder_set_fs.c
+++ b/src_common/SKP_Silk_decoder_set_fs.c
@@ -74,11 +74,7 @@
psDec->prevSignalType = TYPE_NO_VOICE_ACTIVITY;
psDec->first_frame_after_reset = 1;
- if( fs_kHz == 24 ) {
- psDec->HP_A = SKP_Silk_Dec_A_HP_24;
- psDec->HP_B = SKP_Silk_Dec_B_HP_24;
- psDec->pitch_lag_low_bits_iCDF = SKP_Silk_uniform12_iCDF;
- } else if( fs_kHz == 16 ) {
+ if( fs_kHz == 16 ) {
psDec->HP_A = SKP_Silk_Dec_A_HP_16;
psDec->HP_B = SKP_Silk_Dec_B_HP_16;
psDec->pitch_lag_low_bits_iCDF = SKP_Silk_uniform8_iCDF;
--- a/src_common/SKP_Silk_define.h
+++ b/src_common/SKP_Silk_define.h
@@ -50,9 +50,10 @@
#define MIN_TARGET_RATE_BPS 5000
#define MAX_TARGET_RATE_BPS SKP_uint16_MAX
+/* Compensation in bitrate calculations for 10 ms modes */
+#define REDUCE_BITRATE_10_MS_BPS 2200
+
/* Transition bitrates between modes */
-#define SWB2WB_BITRATE_BPS 24000
-#define WB2SWB_BITRATE_BPS 28000
#define WB2MB_BITRATE_BPS 12000
#define MB2WB_BITRATE_BPS 16000
#define MB2NB_BITRATE_BPS 9000
@@ -67,7 +68,7 @@
#define NO_SPEECH_FRAMES_BEFORE_DTX 5 /* eq 100 ms */
#define MAX_CONSECUTIVE_DTX 20 /* eq 400 ms */
-#define USE_LBRR 1
+#define USE_LBRR 0
/* Amount of concecutive no FEC packets before telling JB */
#define NO_LBRR_THRES 10
@@ -83,12 +84,6 @@
#define SKP_SILK_NO_LBRR 0
#define SKP_SILK_LBRR 1
-/* Number of Second order Sections for SWB detection HP filter */
-#define NB_SOS 3
-#define HP_8_KHZ_THRES 10 /* average energy per sample, above 8 kHz */
-#define CONCEC_SWB_SMPLS_THRES 480 * 15 /* 300 ms */
-#define WB_DETECT_ACTIVE_SPEECH_MS_THRES 15000 /* ms of active speech needed for WB detection */
-
/* Activate bandwidth transition filtering for mode switching */
#define SWITCH_TRANSITION_FILTERING 1
@@ -96,7 +91,7 @@
#define DEC_HP_ORDER 2
/* Maximum sampling frequency, should be 16 for embedded */
-#define MAX_FS_KHZ 24
+#define MAX_FS_KHZ 16
#define MAX_API_FS_KHZ 48
/* Signal types used by silk */
@@ -147,7 +142,7 @@
/* Number of gain quantization levels */
#define N_LEVELS_QGAIN 64
/* Max increase in gain quantization index */
-#define MAX_DELTA_GAIN_QUANT 38
+#define MAX_DELTA_GAIN_QUANT 36
/* Max decrease in gain quantization index */
#define MIN_DELTA_GAIN_QUANT -4
--- a/src_common/SKP_Silk_detect_SWB_input.c
+++ /dev/null
@@ -1,76 +1,0 @@
-/***********************************************************************
-Copyright (c) 2006-2010, Skype Limited. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, (subject to the limitations in the disclaimer below)
-are permitted provided that the following conditions are met:
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-- Neither the name of Skype Limited, nor the names of specific
-contributors, may be used to endorse or promote products derived from
-this software without specific prior written permission.
-NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
-BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-***********************************************************************/
-
-/*
- * Detect SWB input by measuring energy above 8 kHz.
- */
-
-#include "SKP_Silk_main.h"
-
-void SKP_Silk_detect_SWB_input(
- SKP_Silk_detect_SWB_state *psSWBdetect, /* (I/O) encoder state */
- const SKP_int16 samplesIn[], /* (I) input to encoder */
- SKP_int nSamplesIn /* (I) length of input */
-)
-{
- SKP_int HP_8_kHz_len, i, shift;
- SKP_int16 in_HP_8_kHz[ MAX_FRAME_LENGTH ];
- SKP_int32 energy_32;
-
- /* High pass filter with cutoff at 8 khz */
- HP_8_kHz_len = SKP_min_int( nSamplesIn, MAX_FRAME_LENGTH );
- HP_8_kHz_len = SKP_max_int( HP_8_kHz_len, 0 );
-
- /* Cutoff around 9 khz */
- /* A = conv(conv([8192,14613, 6868], [8192,12883, 7337]), [8192,11586, 7911]); */
- /* B = conv(conv([575, -948, 575], [575, -221, 575]), [575, 104, 575]); */
- SKP_Silk_biquad( samplesIn, SKP_Silk_SWB_detect_B_HP_Q13[ 0 ], SKP_Silk_SWB_detect_A_HP_Q13[ 0 ],
- psSWBdetect->S_HP_8_kHz[ 0 ], in_HP_8_kHz, HP_8_kHz_len );
- for( i = 1; i < NB_SOS; i++ ) {
- SKP_Silk_biquad( in_HP_8_kHz, SKP_Silk_SWB_detect_B_HP_Q13[ i ], SKP_Silk_SWB_detect_A_HP_Q13[ i ],
- psSWBdetect->S_HP_8_kHz[ i ], in_HP_8_kHz, HP_8_kHz_len );
- }
-
- /* Calculate energy in HP signal */
- SKP_Silk_sum_sqr_shift( &energy_32, &shift, in_HP_8_kHz, HP_8_kHz_len );
-
- /* Count concecutive samples above threshold, after adjusting threshold for number of input samples and shift */
- if( energy_32 > SKP_RSHIFT( SKP_SMULBB( HP_8_KHZ_THRES, HP_8_kHz_len ), shift ) ) {
- psSWBdetect->ConsecSmplsAboveThres += nSamplesIn;
- if( psSWBdetect->ConsecSmplsAboveThres > CONCEC_SWB_SMPLS_THRES ) {
- psSWBdetect->SWB_detected = 1;
- }
- } else {
- psSWBdetect->ConsecSmplsAboveThres -= nSamplesIn;
- psSWBdetect->ConsecSmplsAboveThres = SKP_max( psSWBdetect->ConsecSmplsAboveThres, 0 );
- }
-
- /* If sufficient speech activity and no SWB detected, we detect the signal as being WB */
- if( ( psSWBdetect->ActiveSpeech_ms > WB_DETECT_ACTIVE_SPEECH_MS_THRES ) && ( psSWBdetect->SWB_detected == 0 ) ) {
- psSWBdetect->WB_detected = 1;
- }
-}
--- a/src_common/SKP_Silk_enc_API.c
+++ b/src_common/SKP_Silk_enc_API.c
@@ -145,12 +145,10 @@
( encControl->API_sampleRate != 48000 ) ) ||
( ( encControl->maxInternalSampleRate != 8000 ) &&
( encControl->maxInternalSampleRate != 12000 ) &&
- ( encControl->maxInternalSampleRate != 16000 ) &&
- ( encControl->maxInternalSampleRate != 24000 ) ) ||
+ ( encControl->maxInternalSampleRate != 16000 ) ) ||
( ( encControl->minInternalSampleRate != 8000 ) &&
( encControl->minInternalSampleRate != 12000 ) &&
- ( encControl->minInternalSampleRate != 16000 ) &&
- ( encControl->minInternalSampleRate != 24000 ) ) ||
+ ( encControl->minInternalSampleRate != 16000 ) ) ||
( encControl->minInternalSampleRate > encControl->maxInternalSampleRate ) ) {
ret = SKP_SILK_ENC_FS_NOT_SUPPORTED;
SKP_assert( 0 );
@@ -206,15 +204,6 @@
return( ret );
}
-#if MAX_FS_KHZ > 16
- /* Detect energy above 8 kHz */
- if( SKP_min( API_fs_Hz, 1000 * max_internal_fs_kHz ) == 24000 &&
- psEnc->sCmn.sSWBdetect.SWB_detected == 0 &&
- psEnc->sCmn.sSWBdetect.WB_detected == 0 ) {
- SKP_Silk_detect_SWB_input( &psEnc->sCmn.sSWBdetect, samplesIn, ( SKP_int )nSamplesIn );
- }
-#endif
-
/* Input buffering/resampling and encoding */
MaxBytesOut = 0; /* return 0 output bytes if no encoder called */
while( 1 ) {
@@ -266,7 +255,7 @@
*nBytesOut = MaxBytesOut;
if( psEnc->sCmn.useDTX && psEnc->sCmn.inDTX ) {
- /* DTX simulation */
+ /* DTX */
*nBytesOut = 0;
}
--- a/src_common/SKP_Silk_encode_indices.c
+++ b/src_common/SKP_Silk_encode_indices.c
@@ -97,9 +97,11 @@
ec_enc_icdf( psRangeEnc, psEncCtrlC->NLSFIndices[ i ], psNLSF_CB->StartPtr[ i ], 8 );
}
- /* Encode NLSF interpolation factor */
- SKP_assert( psEncC->useInterpolatedNLSFs == 1 || psEncCtrlC->NLSFInterpCoef_Q2 == ( 1 << 2 ) );
- ec_enc_icdf( psRangeEnc, psEncCtrlC->NLSFInterpCoef_Q2, SKP_Silk_NLSF_interpolation_factor_iCDF, 8 );
+ if( psEncC->nb_subfr == MAX_NB_SUBFR ) {
+ /* Encode NLSF interpolation factor */
+ SKP_assert( psEncC->useInterpolatedNLSFs == 1 || psEncCtrlC->NLSFInterpCoef_Q2 == ( 1 << 2 ) );
+ ec_enc_icdf( psRangeEnc, psEncCtrlC->NLSFInterpCoef_Q2, SKP_Silk_NLSF_interpolation_factor_iCDF, 8 );
+ }
#ifdef SAVE_ALL_INTERNAL_DATA
DEBUG_STORE_DATA( lsf_interpol.dat, &psEncCtrlC->NLSFInterpCoef_Q2, sizeof(int) );
--- a/src_common/SKP_Silk_gain_quant.c
+++ b/src_common/SKP_Silk_gain_quant.c
@@ -61,7 +61,7 @@
/* Delta index */
ind[ k ] = ind[ k ] - *prev_ind;
- /* Double the quantization step size is doubled for large gain increases, so that the max gain level can be reached */
+ /* Double the quantization step size for large gain increases, so that the max gain level can be reached */
double_step_size_threshold = 2 * MAX_DELTA_GAIN_QUANT - N_LEVELS_QGAIN + *prev_ind;
if( ind[ k ] > double_step_size_threshold ) {
ind[ k ] = double_step_size_threshold + SKP_RSHIFT( ind[ k ] - double_step_size_threshold + 1, 1 );
@@ -105,7 +105,7 @@
/* Accumulate deltas */
double_step_size_threshold = 2 * MAX_DELTA_GAIN_QUANT - N_LEVELS_QGAIN + *prev_ind;
- if( ind[ k ] > double_step_size_threshold ) {
+ if( ind_tmp > double_step_size_threshold ) {
*prev_ind += SKP_LSHIFT( ind_tmp, 1 ) - double_step_size_threshold;
} else {
*prev_ind += ind_tmp;
--- a/src_common/SKP_Silk_main.h
+++ b/src_common/SKP_Silk_main.h
@@ -72,7 +72,7 @@
/* Control internal sampling rate */
SKP_int SKP_Silk_control_audio_bandwidth(
SKP_Silk_encoder_state *psEncC, /* I/O Pointer to Silk encoder state */
- const SKP_int32 TargetRate_bps /* I Target max bitrate (bps) */
+ SKP_int32 TargetRate_bps /* I Target max bitrate (bps) */
);
/***************/
@@ -224,13 +224,6 @@
const SKP_int fs_kHz /* I Input frame sample frequency */
);
-/* Detect signal in 8 - 12 khz range */
-void SKP_Silk_detect_SWB_input(
- SKP_Silk_detect_SWB_state *psSWBdetect, /* I/O Encoder state */
- const SKP_int16 samplesIn[], /* I Input to encoder */
- SKP_int nSamplesIn /* I Length of input */
-);
-
#if SWITCH_TRANSITION_FILTERING
/* Low-pass filter with variable cutoff frequency based on */
/* piece-wise linear interpolation between elliptic filters */
@@ -285,11 +278,10 @@
/* Decode parameters from payload v4 Bitstream */
void SKP_Silk_decode_parameters(
- SKP_Silk_decoder_state *psDec, /* I/O State */
- SKP_Silk_decoder_control *psDecCtrl, /* I/O Decoder control */
- ec_dec *psRangeDec, /* I/O Compressor data structure */
- SKP_int q[ MAX_FRAME_LENGTH ], /* O Excitation signal */
- const SKP_int fullDecoding /* I Flag to tell if only arithmetic decoding */
+ SKP_Silk_decoder_state *psDec, /* I/O State */
+ SKP_Silk_decoder_control *psDecCtrl, /* I/O Decoder control */
+ ec_dec *psRangeDec, /* I/O Compressor data structure */
+ SKP_int q[ MAX_FRAME_LENGTH ] /* O Excitation signal */
);
/* Core decoder. Performs inverse NSQ operation LTP + LPC */
--- a/src_common/SKP_Silk_structs.h
+++ b/src_common/SKP_Silk_structs.h
@@ -89,15 +89,6 @@
} SKP_Silk_range_coder_state;
#endif
-/* Input frequency range detection struct */
-typedef struct {
- SKP_int32 S_HP_8_kHz[ NB_SOS ][ 2 ]; /* HP filter State */
- SKP_int32 ConsecSmplsAboveThres;
- SKP_int32 ActiveSpeech_ms; /* Accumulated time with active speech */
- SKP_int SWB_detected; /* Flag to indicate SWB input */
- SKP_int WB_detected; /* Flag to indicate WB input */
-} SKP_Silk_detect_SWB_state;
-
#if SWITCH_TRANSITION_FILTERING
/* Variable cut-off low-pass filter state */
typedef struct {
@@ -208,10 +199,6 @@
SKP_int inDTX; /* Flag to signal DTX period */
SKP_int LBRR_nBytes;
- /* Struct for detecting SWB input */
- SKP_Silk_detect_SWB_state sSWBdetect;
-
-
/* Buffers */
SKP_int8 q[ MAX_FRAME_LENGTH * MAX_FRAMES_PER_PACKET ]; /* pulse signal buffer */
SKP_int8 q_LBRR[ MAX_FRAME_LENGTH * MAX_FRAMES_PER_PACKET ]; /* pulse signal buffer */
@@ -278,7 +265,6 @@
SKP_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ];
SKP_int32 sLPC_Q14[ MAX_FRAME_LENGTH / MAX_NB_SUBFR + MAX_LPC_ORDER ];
SKP_int32 exc_Q10[ MAX_FRAME_LENGTH ];
- SKP_int32 res_Q10[ MAX_FRAME_LENGTH ];
SKP_int16 outBuf[ 2 * MAX_FRAME_LENGTH ]; /* Buffer for output signal */
SKP_int lagPrev; /* Previous Lag */
SKP_int LastGainIndex; /* Previous gain index */
--- a/src_common/SKP_Silk_tables.h
+++ b/src_common/SKP_Silk_tables.h
@@ -41,7 +41,7 @@
/* entropy coding tables */
extern const SKP_uint8 SKP_Silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ]; /* 24 */
-extern const SKP_uint8 SKP_Silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ]; /* 43 */
+extern const SKP_uint8 SKP_Silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ]; /* 41 */
extern const SKP_uint8 SKP_Silk_pitch_lag_iCDF[ 2 * ( PITCH_EST_MAX_LAG_MS - PITCH_EST_MIN_LAG_MS ) ]; /* 32 */
extern const SKP_uint8 SKP_Silk_pitch_delta_iCDF[21]; /* 21 */
@@ -71,7 +71,6 @@
extern const SKP_uint8 SKP_Silk_uniform4_iCDF[ 4 ]; /* 4 */
extern const SKP_uint8 SKP_Silk_uniform6_iCDF[ 6 ]; /* 6 */
extern const SKP_uint8 SKP_Silk_uniform8_iCDF[ 8 ]; /* 8 */
-extern const SKP_uint8 SKP_Silk_uniform12_iCDF[ 12 ]; /* 12 */
extern const SKP_uint8 SKP_Silk_LTP_per_index_iCDF[ 3 ]; /* 3 */
extern const SKP_uint8 * const SKP_Silk_LTP_gain_iCDF_ptrs[ NB_LTP_CBKS ]; /* 3 */
@@ -96,16 +95,9 @@
extern const SKP_uint16 TargetRate_table_NB[ TARGET_RATE_TAB_SZ ];
extern const SKP_uint16 TargetRate_table_MB[ TARGET_RATE_TAB_SZ ];
extern const SKP_uint16 TargetRate_table_WB[ TARGET_RATE_TAB_SZ ];
-extern const SKP_uint16 TargetRate_table_SWB[ TARGET_RATE_TAB_SZ ];
extern const SKP_uint16 SNR_table_Q1[ TARGET_RATE_TAB_SZ ];
-/* Filter coeficicnts for HP filter: 4. Order filter implementad as two biquad filters */
-extern const SKP_int16 SKP_Silk_SWB_detect_B_HP_Q13[ NB_SOS ][ 3 ];
-extern const SKP_int16 SKP_Silk_SWB_detect_A_HP_Q13[ NB_SOS ][ 2 ];
-
/* Decoder high-pass filter coefficients */
-extern const SKP_int32 SKP_Silk_Dec_A_HP_24[ DEC_HP_ORDER ]; /* 2 */
-extern const SKP_int32 SKP_Silk_Dec_B_HP_24[ DEC_HP_ORDER + 1 ]; /* 3 */
extern const SKP_int32 SKP_Silk_Dec_A_HP_16[ DEC_HP_ORDER ]; /* 2 */
extern const SKP_int32 SKP_Silk_Dec_B_HP_16[ DEC_HP_ORDER + 1 ]; /* 3 */
extern const SKP_int32 SKP_Silk_Dec_A_HP_12[ DEC_HP_ORDER ]; /* 2 */
@@ -114,7 +106,7 @@
extern const SKP_int32 SKP_Silk_Dec_B_HP_8[ DEC_HP_ORDER + 1 ]; /* 3 */
/* Table for frame termination indication */
-extern const SKP_uint8 SKP_Silk_FrameTermination_iCDF[ 2 ];
+extern const SKP_uint8 SKP_Silk_LBRR_Present_iCDF[ 2 ];
/* Table for random seed */
extern const SKP_uint8 SKP_Silk_Seed_iCDF[ 4 ];
--- a/src_common/SKP_Silk_tables_gain.c
+++ b/src_common/SKP_Silk_tables_gain.c
@@ -46,12 +46,12 @@
};
const SKP_uint8 SKP_Silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ] = {
- 250, 245, 234, 203, 73, 52, 44, 40,
- 37, 35, 33, 31, 30, 29, 28, 27,
- 26, 25, 24, 23, 22, 21, 20, 19,
- 18, 17, 16, 15, 14, 13, 12, 11,
- 10, 9, 8, 7, 6, 5, 4, 3,
- 2, 1, 0
+ 250, 245, 234, 203, 71, 50, 42, 38,
+ 35, 33, 31, 29, 28, 27, 26, 25,
+ 24, 23, 22, 21, 20, 19, 18, 17,
+ 16, 15, 14, 13, 12, 11, 10, 9,
+ 8, 7, 6, 5, 4, 3, 2, 1,
+ 0
};
#ifdef __cplusplus
--- a/src_common/SKP_Silk_tables_other.c
+++ b/src_common/SKP_Silk_tables_other.c
@@ -44,27 +44,11 @@
const SKP_uint16 TargetRate_table_WB[ TARGET_RATE_TAB_SZ ] = {
0, 11000, 14000, 17000, 21000, 26000, 35000, MAX_TARGET_RATE_BPS
};
-const SKP_uint16 TargetRate_table_SWB[ TARGET_RATE_TAB_SZ ] = {
- 0, 13000, 16000, 19000, 25000, 32000, 45000, MAX_TARGET_RATE_BPS
-};
const SKP_uint16 SNR_table_Q1[ TARGET_RATE_TAB_SZ ] = {
19, 31, 35, 39, 44, 49, 55, 60
};
-/* Filter coeficicnts for HP filter: 4. Order filter implementad as two biquad filters */
-const SKP_int16 SKP_Silk_SWB_detect_B_HP_Q13[ NB_SOS ][ 3 ] = {
- //{400, -550, 400}, {400, 130, 400}, {400, 390, 400}
- {575, -948, 575}, {575, -221, 575}, {575, 104, 575}
-};
-const SKP_int16 SKP_Silk_SWB_detect_A_HP_Q13[ NB_SOS ][ 2 ] = {
- {14613, 6868}, {12883, 7337}, {11586, 7911}
- //{14880, 6900}, {14400, 7300}, {13700, 7800}
-};
-
/* Decoder high-pass filter coefficients, -6 dB @ 50 Hz, 0.05 dB ripple */
-const SKP_int32 SKP_Silk_Dec_A_HP_24[ DEC_HP_ORDER ] = {-530479464, 262127223}; /* second order AR coefs, Q28 */
-const SKP_int32 SKP_Silk_Dec_B_HP_24[ DEC_HP_ORDER + 1 ] = { 265214231, -530428461, 265214231}; /* second order MA coefs, Q28 */
-
const SKP_int32 SKP_Silk_Dec_A_HP_16[ DEC_HP_ORDER ] = {-527234079, 258986528}; /* second order AR coefs, Q28 */
const SKP_int32 SKP_Silk_Dec_B_HP_16[ DEC_HP_ORDER + 1 ] = { 263603618, -527207236, 263603618}; /* second order MA coefs, Q28 */
@@ -114,7 +98,7 @@
const SKP_uint8 SKP_Silk_NLSF_interpolation_factor_iCDF[ 5 ] = { 243, 221, 192, 181, 0 };
/* Table for frame termination indication */
-const SKP_uint8 SKP_Silk_FrameTermination_iCDF[ 2 ] = { 64, 0 };
+const SKP_uint8 SKP_Silk_LBRR_Present_iCDF[ 2 ] = { 100, 0 };
/* Table for random seed */
const SKP_uint8 SKP_Silk_Seed_iCDF[ 4 ] = { 192, 128, 64, 0 };
@@ -131,7 +115,6 @@
const SKP_uint8 SKP_Silk_uniform4_iCDF[ 4 ] = { 192, 128, 64, 0 };
const SKP_uint8 SKP_Silk_uniform6_iCDF[ 6 ] = { 213, 171, 128, 85, 43, 0 };
const SKP_uint8 SKP_Silk_uniform8_iCDF[ 8 ] = { 224, 192, 160, 128, 96, 64, 32, 0 };
-const SKP_uint8 SKP_Silk_uniform12_iCDF[ 12 ] = { 235, 213, 192, 171, 149, 128, 107, 85, 64, 43, 21, 0 };
#if SWITCH_TRANSITION_FILTERING
/* Elliptic/Cauer filters designed with 0.1 dB passband ripple,
--- a/src_common/SKP_Silk_tuning_parameters.h
+++ b/src_common/SKP_Silk_tuning_parameters.h
@@ -60,7 +60,6 @@
#define MU_LTP_QUANT_NB 0.03f
#define MU_LTP_QUANT_MB 0.025f
#define MU_LTP_QUANT_WB 0.02f
-#define MU_LTP_QUANT_SWB 0.016f
/***********************/
/* High pass filtering */
--- a/src_common/src_common.vcxproj
+++ b/src_common/src_common.vcxproj
@@ -95,7 +95,6 @@
<ClCompile Include="SKP_Silk_decode_parameters.c" />
<ClCompile Include="SKP_Silk_decode_pulses.c" />
<ClCompile Include="SKP_Silk_dec_API.c" />
- <ClCompile Include="SKP_Silk_detect_SWB_input.c" />
<ClCompile Include="SKP_Silk_encode_indices.c" />
<ClCompile Include="SKP_Silk_encode_pulses.c" />
<ClCompile Include="SKP_Silk_enc_API.c" />
--- a/src_common/src_common.vcxproj.filters
+++ b/src_common/src_common.vcxproj.filters
@@ -71,9 +71,6 @@
<ClCompile Include="SKP_Silk_decoder_set_fs.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="SKP_Silk_detect_SWB_input.c">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="SKP_Silk_enc_API.c">
<Filter>Source Files</Filter>
</ClCompile>
--- a/test/Decoder.c
+++ b/test/Decoder.c
@@ -73,7 +73,9 @@
printf( "\nin.bit : Bitstream input to decoder" );
printf( "\nout.pcm : Speech output from decoder" );
printf( "\n settings:" );
- printf( "\n-Fs_API <Hz> : Sampling rate of output signal in Hz; default: 24000" );
+ printf( "\n-Fs_API <Hz> : Sampling rate of output signal in Hz" );
+ printf( "\n-Fs_Internal <Hz> : Internal sampling rate in Hz, default" );
+ printf( "\n-packetlength <ms> : Packet interval in ms, default" );
printf( "\n-loss <perc> : Simulated packet loss percentage (0-100); default: 0" );
printf( "\n" );
}
@@ -131,6 +133,12 @@
args += 2;
} else if( SKP_STR_CASEINSENSITIVE_COMPARE( argv[ args ], "-Fs_API" ) == 0 ) {
sscanf( argv[ args + 1 ], "%d", &API_Fs_Hz );
+ args += 2;
+ } else if( SKP_STR_CASEINSENSITIVE_COMPARE( argv[ args ], "-Fs_Internal" ) == 0 ) {
+ sscanf( argv[ args + 1 ], "%d", &DecControl.internalSampleRate );
+ args += 2;
+ } else if( SKP_STR_CASEINSENSITIVE_COMPARE( argv[ args ], "-packetlength" ) == 0 ) {
+ sscanf( argv[ args + 1 ], "%d", &DecControl.payloadSize_ms );
args += 2;
} else if( SKP_STR_CASEINSENSITIVE_COMPARE( argv[ args ], "-quiet" ) == 0 ) {
quiet = 1;
--- a/test/Encoder.c
+++ b/test/Encoder.c
@@ -45,7 +45,7 @@
#define MAX_BYTES_PER_FRAME 250 // Equals peak bitrate of 100 kbps
#define MAX_INPUT_FRAMES 5
#define MAX_LBRR_DELAY 2
-#define MAX_FRAME_LENGTH 480
+#define MAX_FRAME_LENGTH 320
#define MAX_FRAME_LENGTH_MS 20
#define MAX_API_FS_KHZ 48
@@ -78,8 +78,8 @@
printf( "\nin.pcm : Speech input to encoder" );
printf( "\nout.bit : Bitstream output from encoder" );
printf( "\n settings:" );
- printf( "\n-Fs_API <Hz> : API sampling rate in Hz, default: 24000" );
- printf( "\n-Fs_maxInternal <Hz> : Maximum internal sampling rate in Hz, default: 24000" );
+ printf( "\n-Fs_API <Hz> : API sampling rate in Hz, default: 16000" );
+ printf( "\n-Fs_maxInternal <Hz> : Maximum internal sampling rate in Hz, default: 16000" );
printf( "\n-packetlength <ms> : Packet interval in ms, default: 20" );
printf( "\n-rate <bps> : Target bitrate; default: 25000" );
printf( "\n-loss <perc> : Uplink loss estimate, in percent (0-100); default: 0" );
@@ -112,8 +112,8 @@
ec_enc range_enc_celt_state;
/* default settings */
- SKP_int32 API_fs_Hz = 24000;
- SKP_int32 max_internal_fs_Hz = 24000;
+ SKP_int32 API_fs_Hz = 16000;
+ SKP_int32 max_internal_fs_Hz = 16000;
SKP_int32 min_internal_fs_Hz = 8000;
SKP_int32 targetRate_bps = 25000;
SKP_int32 packetSize_ms = 20;