Delete dead code inside #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED

Bug: None
Change-Id: If31f2a5e4a2536b3c7fda596f2c251e8074a18d4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153671
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29249}
This commit is contained in:
Niels Möller
2019-09-19 15:56:21 +02:00
committed by Commit Bot
parent feee1e4c36
commit e0b31677b6
6 changed files with 0 additions and 509 deletions

View File

@ -98,36 +98,6 @@ int WebRtcIsacfix_Encode(ISACFIX_MainStruct* ISAC_main_inst,
const int16_t* speechIn,
uint8_t* encoded);
/****************************************************************************
* WebRtcIsacfix_EncodeNb(...)
*
* This function encodes 10ms narrow band (8 kHz sampling) frame(s) and inserts
* it into a package. Input speech length has to be 80 samples (10ms). The
* encoder interpolates into wide-band (16 kHz sampling) buffers those 10ms
* frames until it reaches the chosen Framesize (480 or 960 wide-band samples
* corresponding to 30 or 60 ms frames), and then proceeds to the encoding.
*
* The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - speechIn : input speech vector.
*
* Output:
* - encoded : the encoded data vector
*
* Return value : >0 - Length (in bytes) of coded data
* 0 - The buffer didn't reach the chosen framesize
* so it keeps buffering speech samples.
* -1 - Error
*/
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
int16_t WebRtcIsacfix_EncodeNb(ISACFIX_MainStruct* ISAC_main_inst,
const int16_t* speechIn,
int16_t* encoded);
#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
/****************************************************************************
* WebRtcIsacfix_DecoderInit(...)
*
@ -213,61 +183,6 @@ int WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst,
int16_t* decoded,
int16_t* speechType);
/****************************************************************************
* WebRtcIsacfix_DecodeNb(...)
*
* This function decodes a ISAC frame in narrow-band (8 kHz sampling).
* Output speech length will be a multiple of 240 samples: 240 or 480 samples,
* depending on the framesize (30 or 60 ms).
*
* The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - encoded : encoded ISAC frame(s)
* - len : bytes in encoded vector
*
* Output:
* - decoded : The decoded vector
*
* Return value : >0 - number of samples in decoded vector
* -1 - Error
*/
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct* ISAC_main_inst,
const uint16_t* encoded,
size_t len,
int16_t* decoded,
int16_t* speechType);
#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
/****************************************************************************
* WebRtcIsacfix_DecodePlcNb(...)
*
* This function conducts PLC for ISAC frame(s) in narrow-band (8kHz sampling).
* Output speech length will be "240*noOfLostFrames" samples
* that equevalent of "30*noOfLostFrames" millisecond.
*
* The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - noOfLostFrames : Number of PLC frames (240 sample=30ms) to produce
* NOTE! Maximum number is 2 (480 samples = 60ms)
*
* Output:
* - decoded : The decoded vector
*
* Return value : Number of samples in decoded PLC vector
*/
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
size_t WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct* ISAC_main_inst,
int16_t* decoded,
size_t noOfLostFrames);
#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
/****************************************************************************
* WebRtcIsacfix_DecodePlc(...)
*

View File

@ -123,21 +123,6 @@ void WebRtcIsacfix_FilterAndCombine1(int16_t* tempin_ch1,
int16_t* out16,
PostFiltBankstr* postfiltdata);
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
void WebRtcIsacfix_SplitAndFilter2(int16_t* in,
int16_t* LP16,
int16_t* HP16,
PreFiltBankstr* prefiltdata);
void WebRtcIsacfix_FilterAndCombine2(int16_t* tempin_ch1,
int16_t* tempin_ch2,
int16_t* out16,
PostFiltBankstr* postfiltdata,
int16_t len);
#endif
/* normalized lattice filters */
void WebRtcIsacfix_NormLatticeFilterMa(size_t orderCoef,

View File

@ -235,67 +235,6 @@ void WebRtcIsacfix_SplitAndFilter1(int16_t *pin,
}/*end of WebRtcIsacfix_SplitAndFilter */
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
/* Without lookahead */
void WebRtcIsacfix_SplitAndFilter2(int16_t *pin,
int16_t *LP16,
int16_t *HP16,
PreFiltBankstr *prefiltdata)
{
/* Function WebRtcIsacfix_SplitAndFilter2 */
/* This function creates low-pass and high-pass decimated versions of part of
the input signal. */
int k;
int16_t tempin_ch1[FRAMESAMPLES/2];
int16_t tempin_ch2[FRAMESAMPLES/2];
/* High pass filter */
WebRtcIsacfix_HighpassFilterFixDec32(pin, FRAMESAMPLES, WebRtcIsacfix_kHpStCoeffInQ30, prefiltdata->HPstates_fix);
/* First Channel */
for (k=0;k<FRAMESAMPLES/2;k++) {
tempin_ch1[k] = pin[1 + 2 * k];
}
/* Second Channel. This is exactly like the first channel, except that the
even samples are now filtered instead (lower channel). */
for (k=0;k<FRAMESAMPLES/2;k++) {
tempin_ch2[k] = pin[2 * k];
}
/*obtain polyphase components by forward all-pass filtering through each channel */
/* The all pass filtering automatically updates the filter states which are exported in the
prefiltdata structure */
WebRtcIsacfix_AllpassFilter2FixDec16(tempin_ch1,
tempin_ch2,
WebRtcIsacfix_kUpperApFactorsQ15,
WebRtcIsacfix_kLowerApFactorsQ15,
FRAMESAMPLES/2,
prefiltdata->INSTAT1_fix,
prefiltdata->INSTAT2_fix);
/* Now Construct low-pass and high-pass signals as combinations of polyphase components */
for (k=0; k<FRAMESAMPLES/2; k++) {
int32_t tmp1, tmp2, tmp3;
tmp1 = (int32_t)tempin_ch1[k]; // Q0 -> Q0
tmp2 = (int32_t)tempin_ch2[k]; // Q0 -> Q0
tmp3 = (tmp1 + tmp2) >> 1; /* Low pass signal. */
LP16[k] = (int16_t)WebRtcSpl_SatW32ToW16(tmp3); /*low pass */
tmp3 = (tmp1 - tmp2) >> 1; /* High pass signal. */
HP16[k] = (int16_t)WebRtcSpl_SatW32ToW16(tmp3); /*high pass */
}
}/*end of WebRtcIsacfix_SplitAndFilter */
#endif
//////////////////////////////////////////////////////////
////////// Combining
@ -356,66 +295,3 @@ void WebRtcIsacfix_FilterAndCombine1(int16_t *tempin_ch1,
out16[k] = in[k];
}
}
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
/* Function WebRtcIsacfix_FilterAndCombine */
/* This is a decoder function that takes the decimated
length len/2 input low-pass and
high-pass signals and creates a reconstructed fullband
output signal of length len. WebRtcIsacfix_FilterAndCombine
is the sibling function of WebRtcIsacfix_SplitAndFilter */
/* INPUTS:
inLP: a length len/2 array of input low-pass
samples.
inHP: a length len/2 array of input high-pass
samples.
postfiltdata: input data structure containing the filterbank
states from the previous decoding iteration.
OUTPUTS:
Out: a length len array of output reconstructed
samples (fullband) based on the input low-pass and
high-pass signals.
postfiltdata: the input data structure containing the filterbank
states is updated for the next decoding iteration */
void WebRtcIsacfix_FilterAndCombine2(int16_t *tempin_ch1,
int16_t *tempin_ch2,
int16_t *out16,
PostFiltBankstr *postfiltdata,
int16_t len)
{
int k;
int16_t in[FRAMESAMPLES];
/* all-pass filter the new upper and lower channel signal.
For upper channel, use the all-pass filter factors that were used as a
lower channel at the encoding side. So at the decoder, the corresponding
all-pass filter factors for each channel are swapped.
For lower channel signal, since all-pass filter factors at the decoder are
swapped from the ones at the encoder, the 'upper' channel all-pass filter
factors (kUpperApFactors) are used to filter this new lower channel signal.
*/
WebRtcIsacfix_AllpassFilter2FixDec16(tempin_ch1,
tempin_ch2,
WebRtcIsacfix_kLowerApFactorsQ15,
WebRtcIsacfix_kUpperApFactorsQ15,
len / 2,
postfiltdata->STATE_0_UPPER_fix,
postfiltdata->STATE_0_LOWER_fix);
/* Merge outputs to form the full length output signal.*/
for (k=0;k<len/2;k++) {
in[2 * k] = tempin_ch2[k];
in[2 * k + 1] = tempin_ch1[k];
}
/* High pass filter */
WebRtcIsacfix_HighpassFilterFixDec32(in, len, WebRtcIsacfix_kHPStCoeffOut1Q30, postfiltdata->HPstates1_fix);
WebRtcIsacfix_HighpassFilterFixDec32(in, len, WebRtcIsacfix_kHPStCoeffOut2Q30, postfiltdata->HPstates2_fix);
for (k=0;k<len;k++) {
out16[k] = in[k];
}
}
#endif

View File

@ -290,10 +290,6 @@ int16_t WebRtcIsacfix_EncoderInit(ISACFIX_MainStruct *ISAC_main_inst,
ISAC_inst->ISACenc_obj.bitstr_obj.stream[k] = 0;
}
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACenc_obj.interpolatorstr_obj);
#endif
InitFunctionPointers();
return statusInit;
@ -383,85 +379,6 @@ int WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst,
}
/****************************************************************************
* WebRtcIsacfix_EncodeNb(...)
*
* This function encodes 10ms narrow band (8 kHz sampling) frame(s) and inserts
* it into a package. Input speech length has to be 80 samples (10ms). The encoder
* interpolates into wide-band (16 kHz sampling) buffers those
* 10ms frames until it reaches the chosen Framesize (480 or 960 wide-band samples
* corresponding to 30 or 60 ms frames), and then proceeds to the encoding.
*
* The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - speechIn : input speech vector.
*
* Output:
* - encoded : the encoded data vector
*
* Return value:
* : >0 - Length (in bytes) of coded data
* : 0 - The buffer didn't reach the chosen framesize
* so it keeps buffering speech samples.
* : -1 - Error
*/
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
int16_t WebRtcIsacfix_EncodeNb(ISACFIX_MainStruct *ISAC_main_inst,
const int16_t *speechIn,
int16_t *encoded)
{
ISACFIX_SubStruct *ISAC_inst;
int16_t stream_len;
int16_t speechInWB[FRAMESAMPLES_10ms];
int16_t Vector_Word16_1[FRAMESAMPLES_10ms/2];
int16_t Vector_Word16_2[FRAMESAMPLES_10ms/2];
int k;
/* typecast pointer to rela structure */
ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst;
/* check if encoder initiated */
if ((ISAC_inst->initflag & 2) != 2) {
ISAC_inst->errorcode = ISAC_ENCODER_NOT_INITIATED;
return (-1);
}
/* Oversample to WB */
/* Form polyphase signals, and compensate for DC offset */
for (k=0;k<FRAMESAMPLES_10ms/2;k++) {
Vector_Word16_1[k] = speechIn[k] + 1;
Vector_Word16_2[k] = speechIn[k];
}
WebRtcIsacfix_FilterAndCombine2(Vector_Word16_1, Vector_Word16_2, speechInWB, &ISAC_inst->ISACenc_obj.interpolatorstr_obj, FRAMESAMPLES_10ms);
/* Encode WB signal */
stream_len = WebRtcIsacfix_EncodeImpl((int16_t*)speechInWB,
&ISAC_inst->ISACenc_obj,
&ISAC_inst->bwestimator_obj,
ISAC_inst->CodingMode);
if (stream_len<0) {
ISAC_inst->errorcode = - stream_len;
return -1;
}
write_be16(ISAC_inst->ISACenc_obj.bitstr_obj.stream,
stream_len,
(uint8_t*)encoded);
return stream_len;
}
#endif /* WEBRTC_ISAC_FIX_NB_CALLS_ENABLED */
/****************************************************************************
* WebRtcIsacfix_GetNewBitStream(...)
*
@ -540,11 +457,6 @@ void WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst)
/* TS */
WebRtcIsacfix_InitPlc( &ISAC_inst->ISACdec_obj.plcstr_obj );
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
WebRtcIsacfix_InitPreFilterbank(&ISAC_inst->ISACdec_obj.decimatorstr_obj);
#endif
}
@ -788,180 +700,6 @@ int WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst,
}
/****************************************************************************
* WebRtcIsacfix_DecodeNb(...)
*
* This function decodes a ISAC frame in narrow-band (8 kHz sampling).
* Output speech length will be a multiple of 240 samples: 240 or 480 samples,
* depending on the framesize (30 or 60 ms).
*
* The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - encoded : encoded ISAC frame(s)
* - len : bytes in encoded vector
*
* Output:
* - decoded : The decoded vector
*
* Return value : >0 - number of samples in decoded vector
* -1 - Error
*/
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct* ISAC_main_inst,
const uint16_t* encoded,
size_t len,
int16_t* decoded,
int16_t* speechType)
{
ISACFIX_SubStruct *ISAC_inst;
/* twice the number of samples (480 or 960), output from decoder */
/* that were actually used in the encoder/decoder (determined on the fly) */
size_t number_of_samples;
int declen_int = 0;
size_t declen;
int16_t dummy[FRAMESAMPLES/2];
/* typecast pointer to real structure */
ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst;
/* check if decoder initiated */
if ((ISAC_inst->initflag & 1) != 1) {
ISAC_inst->errorcode = ISAC_DECODER_NOT_INITIATED;
return (-1);
}
if (len == 0) {
/* return error code if the packet length is null or less */
ISAC_inst->errorcode = ISAC_EMPTY_PACKET;
return -1;
} else if (len > (STREAM_MAXW16<<1)) {
/* return error code if length of stream is too long */
ISAC_inst->errorcode = ISAC_LENGTH_MISMATCH;
return -1;
}
InitializeDecoderBitstream(len, &ISAC_inst->ISACdec_obj.bitstr_obj);
read_be16(encoded, len, ISAC_inst->ISACdec_obj.bitstr_obj.stream);
/* added for NetEq purposes (VAD/DTX related) */
*speechType=1;
declen_int = WebRtcIsacfix_DecodeImpl(decoded, &ISAC_inst->ISACdec_obj,
&number_of_samples);
if (declen_int < 0) {
/* Some error inside the decoder */
ISAC_inst->errorcode = -(int16_t)declen_int;
memset(decoded, 0, sizeof(int16_t) * FRAMESAMPLES);
return -1;
}
declen = (size_t)declen_int;
/* error check */
if (declen & 1) {
if (len != declen &&
len != declen +
((ISAC_inst->ISACdec_obj.bitstr_obj.stream[declen >> 1]) & 0xFF)) {
ISAC_inst->errorcode = ISAC_LENGTH_MISMATCH;
memset(decoded, 0, sizeof(int16_t) * number_of_samples);
return -1;
}
} else {
if (len != declen &&
len != declen +
((ISAC_inst->ISACdec_obj.bitstr_obj.stream[declen >>1]) >> 8)) {
ISAC_inst->errorcode = ISAC_LENGTH_MISMATCH;
memset(decoded, 0, sizeof(int16_t) * number_of_samples);
return -1;
}
}
WebRtcIsacfix_SplitAndFilter2(decoded, decoded, dummy, &ISAC_inst->ISACdec_obj.decimatorstr_obj);
if (number_of_samples>FRAMESAMPLES) {
WebRtcIsacfix_SplitAndFilter2(decoded + FRAMESAMPLES, decoded + FRAMESAMPLES/2,
dummy, &ISAC_inst->ISACdec_obj.decimatorstr_obj);
}
return (int)(number_of_samples / 2);
}
#endif /* WEBRTC_ISAC_FIX_NB_CALLS_ENABLED */
/****************************************************************************
* WebRtcIsacfix_DecodePlcNb(...)
*
* This function conducts PLC for ISAC frame(s) in narrow-band (8kHz sampling).
* Output speech length will be "240*noOfLostFrames" samples
* that is equevalent of "30*noOfLostFrames" millisecond.
*
* The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - noOfLostFrames : Number of PLC frames (240 sample=30ms) to produce
*
* Output:
* - decoded : The decoded vector
*
* Return value : Number of samples in decoded PLC vector
*/
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
size_t WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct* ISAC_main_inst,
int16_t* decoded,
size_t noOfLostFrames )
{
size_t no_of_samples, declen, k;
int16_t outframeNB[FRAMESAMPLES];
int16_t outframeWB[FRAMESAMPLES];
int16_t dummy[FRAMESAMPLES/2];
ISACFIX_SubStruct *ISAC_inst;
/* typecast pointer to real structure */
ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst;
/* Limit number of frames to two = 60 msec. Otherwise we exceed data vectors */
if (noOfLostFrames > 2){
noOfLostFrames = 2;
}
k = 0;
declen = 0;
while( noOfLostFrames > 0 )
{
WebRtcIsacfix_DecodePlcImpl(outframeWB, &ISAC_inst->ISACdec_obj,
&no_of_samples);
WebRtcIsacfix_SplitAndFilter2(outframeWB, &(outframeNB[k*240]), dummy, &ISAC_inst->ISACdec_obj.decimatorstr_obj);
declen += no_of_samples;
noOfLostFrames--;
k++;
}
declen>>=1;
for (k=0;k<declen;k++) {
decoded[k] = outframeNB[k];
}
return declen;
}
#endif /* WEBRTC_ISAC_FIX_NB_CALLS_ENABLED */
/****************************************************************************
* WebRtcIsacfix_DecodePlc(...)
*

View File

@ -296,9 +296,6 @@ typedef struct {
uint16_t MaxBits;
int16_t bitstr_seed;
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
PostFiltBankstr interpolatorstr_obj;
#endif
IsacSaveEncoderData* SaveEnc_ptr;
int16_t payloadLimitBytes30; /* Maximum allowed number of bits for a 30 msec
@ -318,11 +315,6 @@ typedef struct {
PostFiltBankstr postfiltbankstr_obj;
PitchFiltstr pitchfiltstr_obj;
PLCstr plcstr_obj; /* TS; for packet loss concealment */
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
PreFiltBankstr decimatorstr_obj;
#endif
} IsacFixDecoderInstance;
typedef struct {

View File

@ -665,12 +665,7 @@ TEST(IsacFixTest, Kenny) {
}
}
} else {
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
stream_len_int =
WebRtcIsacfix_EncodeNb(ISAC_main_inst, shortdata, streamdata);
#else
stream_len_int = -1;
#endif
}
} else {
break;
@ -786,12 +781,7 @@ TEST(IsacFixTest, Kenny) {
declen = static_cast<int>(
WebRtcIsacfix_DecodePlc(ISAC_main_inst, decoded, prevFrameSize));
} else {
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
declen = static_cast<int>(WebRtcIsacfix_DecodePlcNb(
ISAC_main_inst, decoded, prevFrameSize));
#else
declen = -1;
#endif
}
lostPackets++;
} else {
@ -815,12 +805,7 @@ TEST(IsacFixTest, Kenny) {
prevFrameSize = static_cast<size_t>(declen / 480);
} else {
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
declen = WebRtcIsacfix_DecodeNb(ISAC_main_inst, streamdata,
stream_len, decoded, speechType);
#else
declen = -1;
#endif
prevFrameSize = static_cast<size_t>(declen / 240);
}
}