Delete full-band mode from the iSAC codec

This mode is no longer used.

BUG=4210

Review URL: https://codereview.webrtc.org/1392173004

Cr-Commit-Position: refs/heads/master@{#10275}
This commit is contained in:
henrik.lundin
2015-10-14 06:05:52 -07:00
committed by Commit bot
parent 1d7bcd87e8
commit bd7de0c6ef
6 changed files with 8 additions and 65 deletions

View File

@ -44,10 +44,6 @@ int AudioDecoderIsacT<T>::DecodeInternal(const uint8_t* encoded,
int sample_rate_hz,
int16_t* decoded,
SpeechType* speech_type) {
// We want to crate the illusion that iSAC supports 48000 Hz decoding, while
// in fact it outputs 32000 Hz. This is the iSAC fullband mode.
if (sample_rate_hz == 48000)
sample_rate_hz = 32000;
RTC_CHECK(sample_rate_hz == 16000 || sample_rate_hz == 32000)
<< "Unsupported sample rate " << sample_rate_hz;
if (sample_rate_hz != decoder_sample_rate_hz_) {

View File

@ -27,7 +27,6 @@ class AudioEncoderIsacT final : public AudioEncoder {
// - 16000 Hz, 30 ms, 10000-32000 bps
// - 16000 Hz, 60 ms, 10000-32000 bps
// - 32000 Hz, 30 ms, 10000-56000 bps (if T has super-wideband support)
// - 48000 Hz, 30 ms, 10000-56000 bps (if T has super-wideband support)
struct Config {
bool IsOk() const;

View File

@ -50,7 +50,6 @@ bool AudioEncoderIsacT<T>::Config::IsOk() const {
return (frame_size_ms == 30 || frame_size_ms == 60) &&
(bit_rate == 0 || (bit_rate >= 10000 && bit_rate <= 32000));
case 32000:
case 48000:
if (max_bit_rate > 160000)
return false;
if (max_payload_size_bytes > 600)
@ -177,15 +176,11 @@ void AudioEncoderIsacT<T>::RecreateEncoderInstance(const Config& config) {
if (config.max_bit_rate != -1)
RTC_CHECK_EQ(0, T::SetMaxRate(isac_state_, config.max_bit_rate));
// When config.sample_rate_hz is set to 48000 Hz (iSAC-fb), the decoder is
// still set to 32000 Hz, since there is no full-band mode in the decoder.
const int decoder_sample_rate_hz = std::min(config.sample_rate_hz, 32000);
// Set the decoder sample rate even though we just use the encoder. This
// doesn't appear to be necessary to produce a valid encoding, but without it
// we get an encoding that isn't bit-for-bit identical with what a combined
// encoder+decoder object produces.
RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, decoder_sample_rate_hz));
RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, config.sample_rate_hz));
config_ = config;
}

View File

@ -469,7 +469,6 @@ int16_t WebRtcIsac_EncoderInit(ISACStruct* ISAC_main_inst,
return -1;
}
}
memset(instISAC->state_in_resampler, 0, sizeof(instISAC->state_in_resampler));
/* Initialization is successful, set the flag. */
instISAC->initFlag |= BIT_MASK_ENC_INIT;
return 0;
@ -516,8 +515,6 @@ int WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
ISACLBStruct* instLB = &(instISAC->instLB);
ISACUBStruct* instUB = &(instISAC->instUB);
const int16_t* speech_in_ptr = speechIn;
int16_t resampled_buff[FRAMESAMPLES_10ms * 2];
/* Check if encoder initiated. */
if ((instISAC->initFlag & BIT_MASK_ENC_INIT) !=
@ -526,37 +523,8 @@ int WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
return -1;
}
if (instISAC->in_sample_rate_hz == 48000) {
/* Samples in 10 ms @ 48 kHz. */
const size_t kNumInputSamples = FRAMESAMPLES_10ms * 3;
/* Samples 10 ms @ 32 kHz. */
const size_t kNumOutputSamples = FRAMESAMPLES_10ms * 2;
/* Resampler divide the input into blocks of 3 samples, i.e.
* kNumInputSamples / 3. */
const size_t kNumResamplerBlocks = FRAMESAMPLES_10ms;
int32_t buffer32[FRAMESAMPLES_10ms * 3 + SIZE_RESAMPLER_STATE];
/* Restore last samples from the past to the beginning of the buffer
* and store the last samples of current frame for the next resampling. */
for (k = 0; k < SIZE_RESAMPLER_STATE; k++) {
buffer32[k] = instISAC->state_in_resampler[k];
instISAC->state_in_resampler[k] = speechIn[kNumInputSamples -
SIZE_RESAMPLER_STATE + k];
}
for (k = 0; k < kNumInputSamples; k++) {
buffer32[SIZE_RESAMPLER_STATE + k] = speechIn[k];
}
/* Resampling 3 samples to 2. Function divides the input in
* |kNumResamplerBlocks| number of 3-sample groups, and output is
* |kNumResamplerBlocks| number of 2-sample groups. */
WebRtcSpl_Resample48khzTo32khz(buffer32, buffer32, kNumResamplerBlocks);
WebRtcSpl_VectorBitShiftW32ToW16(resampled_buff, kNumOutputSamples,
buffer32, 15);
speech_in_ptr = resampled_buff;
}
if (instISAC->encoderSamplingRateKHz == kIsacSuperWideband) {
WebRtcSpl_AnalysisQMF(speech_in_ptr, SWBFRAMESAMPLES_10ms, speechInLB,
WebRtcSpl_AnalysisQMF(speechIn, SWBFRAMESAMPLES_10ms, speechInLB,
speechInUB, instISAC->analysisFBState1,
instISAC->analysisFBState2);
@ -1852,10 +1820,8 @@ int16_t WebRtcIsac_GetNewFrameLen(ISACStruct* ISAC_main_inst) {
/* Return new frame length. */
if (instISAC->in_sample_rate_hz == 16000)
return (instISAC->instLB.ISACencLB_obj.new_framelength);
else if (instISAC->in_sample_rate_hz == 32000)
else /* 32000 Hz */
return ((instISAC->instLB.ISACencLB_obj.new_framelength) * 2);
else
return ((instISAC->instLB.ISACencLB_obj.new_framelength) * 3);
}
@ -2205,17 +2171,10 @@ void WebRtcIsac_version(char* version) {
* and the bottleneck remain unchanged by this call, however, the maximum rate
* and maximum payload-size will be reset to their default values.
*
* NOTE:
* The maximum internal sampling rate is 32 kHz. If the encoder sample rate is
* set to 48 kHz the input is expected to be at 48 kHz but will be resampled to
* 32 kHz before any further processing.
* This mode is created for compatibility with full-band codecs if iSAC is used
* in dual-streaming. See SetDecSampleRate() for sampling rates at the decoder.
*
* Input:
* - ISAC_main_inst : iSAC instance
* - sample_rate_hz : sampling rate in Hertz, valid values are 16000,
* 32000 and 48000.
* - sample_rate_hz : sampling rate in Hertz, valid values are 16000
* and 32000.
*
* Return value : 0 if successful
* -1 if failed.
@ -2225,8 +2184,7 @@ int16_t WebRtcIsac_SetEncSampRate(ISACStruct* ISAC_main_inst,
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
enum IsacSamplingRate encoder_operational_rate;
if ((sample_rate_hz != 16000) && (sample_rate_hz != 32000) &&
(sample_rate_hz != 48000)) {
if ((sample_rate_hz != 16000) && (sample_rate_hz != 32000)) {
/* Sampling Frequency is not supported. */
instISAC->errorCode = ISAC_UNSUPPORTED_SAMPLING_FREQUENCY;
return -1;

View File

@ -168,8 +168,6 @@ enum IsacSamplingRate {kIsacWideband = 16, kIsacSuperWideband = 32};
#define RCU_TRANSCODING_SCALE_UB 0.50f
#define RCU_TRANSCODING_SCALE_UB_INVERSE 2.0f
#define SIZE_RESAMPLER_STATE 6
/* Define Error codes */
/* 6000 General */
#define ISAC_MEMORY_ALLOCATION_FAILED 6010

View File

@ -484,12 +484,9 @@ typedef struct {
int16_t maxRateBytesPer30Ms;
// Maximum allowed payload-size, measured in Bytes.
int16_t maxPayloadSizeBytes;
/* The expected sampling rate of the input signal. Valid values are 16000,
* 32000 and 48000. This is not the operation sampling rate of the codec.
* Input signals at 48 kHz are resampled to 32 kHz, then encoded. */
/* The expected sampling rate of the input signal. Valid values are 16000
* and 32000. This is not the operation sampling rate of the codec. */
uint16_t in_sample_rate_hz;
/* State for the input-resampler. It is only used for 48 kHz input signals. */
int16_t state_in_resampler[SIZE_RESAMPLER_STATE];
// Trig tables for WebRtcIsac_Time2Spec and WebRtcIsac_Spec2time.
TransformTables transform_tables;