Reformat the WebRTC code base
Running clang-format with chromium's style guide. The goal is n-fold: * providing consistency and readability (that's what code guidelines are for) * preventing noise with presubmit checks and git cl format * building on the previous point: making it easier to automatically fix format issues * you name it Please consider using git-hyper-blame to ignore this commit. Bug: webrtc:9340 Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87 Reviewed-on: https://webrtc-review.googlesource.com/81185 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
@ -27,13 +27,13 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_AbsQuant(
|
||||
IlbcEncoder *iLBCenc_inst,
|
||||
IlbcEncoder* iLBCenc_inst,
|
||||
/* (i) Encoder instance */
|
||||
iLBC_bits *iLBC_encbits, /* (i/o) Encoded bits (outputs idxForMax
|
||||
iLBC_bits* iLBC_encbits, /* (i/o) Encoded bits (outputs idxForMax
|
||||
and idxVec, uses state_first as
|
||||
input) */
|
||||
int16_t *in, /* (i) vector to encode */
|
||||
int16_t *weightDenum /* (i) denominator of synthesis filter */
|
||||
);
|
||||
int16_t* in, /* (i) vector to encode */
|
||||
int16_t* weightDenum /* (i) denominator of synthesis filter */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,8 +26,10 @@
|
||||
* (subrutine for WebRtcIlbcfix_StateSearch)
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_AbsQuantLoop(int16_t *syntOutIN, int16_t *in_weightedIN,
|
||||
int16_t *weightDenumIN, size_t *quantLenIN,
|
||||
int16_t *idxVecIN);
|
||||
void WebRtcIlbcfix_AbsQuantLoop(int16_t* syntOutIN,
|
||||
int16_t* in_weightedIN,
|
||||
int16_t* weightDenumIN,
|
||||
size_t* quantLenIN,
|
||||
int16_t* idxVecIN);
|
||||
|
||||
#endif
|
||||
|
||||
@ -33,10 +33,10 @@ bool AudioDecoderIlbcImpl::HasDecodePlc() const {
|
||||
}
|
||||
|
||||
int AudioDecoderIlbcImpl::DecodeInternal(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type) {
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type) {
|
||||
RTC_DCHECK_EQ(sample_rate_hz, 8000);
|
||||
int16_t temp_type = 1; // Default is speech.
|
||||
int ret = WebRtcIlbcfix_Decode(dec_state_, encoded, encoded_len, decoded,
|
||||
@ -86,10 +86,9 @@ std::vector<AudioDecoder::ParseResult> AudioDecoderIlbcImpl::ParsePayload(
|
||||
} else {
|
||||
size_t byte_offset;
|
||||
uint32_t timestamp_offset;
|
||||
for (byte_offset = 0, timestamp_offset = 0;
|
||||
byte_offset < payload.size();
|
||||
for (byte_offset = 0, timestamp_offset = 0; byte_offset < payload.size();
|
||||
byte_offset += bytes_per_frame,
|
||||
timestamp_offset += timestamps_per_frame) {
|
||||
timestamp_offset += timestamps_per_frame) {
|
||||
std::unique_ptr<EncodedAudioFrame> frame(new LegacyEncodedAudioFrame(
|
||||
this, rtc::Buffer(payload.data() + byte_offset, bytes_per_frame)));
|
||||
results.emplace_back(timestamp + timestamp_offset, 0, std::move(frame));
|
||||
|
||||
@ -89,7 +89,6 @@ AudioEncoder::EncodedInfo AudioEncoderIlbcImpl::EncodeImpl(
|
||||
uint32_t rtp_timestamp,
|
||||
rtc::ArrayView<const int16_t> audio,
|
||||
rtc::Buffer* encoded) {
|
||||
|
||||
// Save timestamp if starting a new packet.
|
||||
if (num_10ms_frames_buffered_ == 0)
|
||||
first_timestamp_in_buffer_ = rtp_timestamp;
|
||||
@ -107,19 +106,15 @@ AudioEncoder::EncodedInfo AudioEncoderIlbcImpl::EncodeImpl(
|
||||
// Encode buffered input.
|
||||
RTC_DCHECK_EQ(num_10ms_frames_buffered_, num_10ms_frames_per_packet_);
|
||||
num_10ms_frames_buffered_ = 0;
|
||||
size_t encoded_bytes =
|
||||
encoded->AppendData(
|
||||
RequiredOutputSizeBytes(),
|
||||
[&] (rtc::ArrayView<uint8_t> encoded) {
|
||||
const int r = WebRtcIlbcfix_Encode(
|
||||
encoder_,
|
||||
input_buffer_,
|
||||
kSampleRateHz / 100 * num_10ms_frames_per_packet_,
|
||||
encoded.data());
|
||||
RTC_CHECK_GE(r, 0);
|
||||
size_t encoded_bytes = encoded->AppendData(
|
||||
RequiredOutputSizeBytes(), [&](rtc::ArrayView<uint8_t> encoded) {
|
||||
const int r = WebRtcIlbcfix_Encode(
|
||||
encoder_, input_buffer_,
|
||||
kSampleRateHz / 100 * num_10ms_frames_per_packet_, encoded.data());
|
||||
RTC_CHECK_GE(r, 0);
|
||||
|
||||
return static_cast<size_t>(r);
|
||||
});
|
||||
return static_cast<size_t>(r);
|
||||
});
|
||||
|
||||
RTC_DCHECK_EQ(encoded_bytes, RequiredOutputSizeBytes());
|
||||
|
||||
@ -135,20 +130,24 @@ void AudioEncoderIlbcImpl::Reset() {
|
||||
if (encoder_)
|
||||
RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderFree(encoder_));
|
||||
RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderCreate(&encoder_));
|
||||
const int encoder_frame_size_ms = frame_size_ms_ > 30
|
||||
? frame_size_ms_ / 2
|
||||
: frame_size_ms_;
|
||||
const int encoder_frame_size_ms =
|
||||
frame_size_ms_ > 30 ? frame_size_ms_ / 2 : frame_size_ms_;
|
||||
RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderInit(encoder_, encoder_frame_size_ms));
|
||||
num_10ms_frames_buffered_ = 0;
|
||||
}
|
||||
|
||||
size_t AudioEncoderIlbcImpl::RequiredOutputSizeBytes() const {
|
||||
switch (num_10ms_frames_per_packet_) {
|
||||
case 2: return 38;
|
||||
case 3: return 50;
|
||||
case 4: return 2 * 38;
|
||||
case 6: return 2 * 50;
|
||||
default: FATAL();
|
||||
case 2:
|
||||
return 38;
|
||||
case 3:
|
||||
return 50;
|
||||
case 4:
|
||||
return 2 * 38;
|
||||
case 6:
|
||||
return 2 * 50;
|
||||
default:
|
||||
FATAL();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -26,16 +26,16 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_AugmentedCbCorr(
|
||||
int16_t *target, /* (i) Target vector */
|
||||
int16_t *buffer, /* (i) Memory buffer */
|
||||
int16_t *interpSamples, /* (i) buffer with
|
||||
int16_t* target, /* (i) Target vector */
|
||||
int16_t* buffer, /* (i) Memory buffer */
|
||||
int16_t* interpSamples, /* (i) buffer with
|
||||
interpolated samples */
|
||||
int32_t *crossDot, /* (o) The cross correlation between
|
||||
the target and the Augmented
|
||||
vector */
|
||||
size_t low, /* (i) Lag to start from (typically
|
||||
20) */
|
||||
size_t high, /* (i) Lag to end at (typically 39 */
|
||||
int scale); /* (i) Scale factor to use for the crossDot */
|
||||
int32_t* crossDot, /* (o) The cross correlation between
|
||||
the target and the Augmented
|
||||
vector */
|
||||
size_t low, /* (i) Lag to start from (typically
|
||||
20) */
|
||||
size_t high, /* (i) Lag to end at (typically 39 */
|
||||
int scale); /* (i) Scale factor to use for the crossDot */
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,11 +26,11 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_BwExpand(
|
||||
int16_t *out, /* (o) the bandwidth expanded lpc coefficients */
|
||||
int16_t *in, /* (i) the lpc coefficients before bandwidth
|
||||
expansion */
|
||||
int16_t *coef, /* (i) the bandwidth expansion factor Q15 */
|
||||
int16_t* out, /* (o) the bandwidth expanded lpc coefficients */
|
||||
int16_t* in, /* (i) the lpc coefficients before bandwidth
|
||||
expansion */
|
||||
int16_t* coef, /* (i) the bandwidth expansion factor Q15 */
|
||||
int16_t length /* (i) the length of lpc coefficient vectors */
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -21,14 +21,14 @@
|
||||
|
||||
void WebRtcIlbcfix_CbMemEnergy(
|
||||
size_t range,
|
||||
int16_t *CB, /* (i) The CB memory (1:st section) */
|
||||
int16_t *filteredCB, /* (i) The filtered CB memory (2:nd section) */
|
||||
size_t lMem, /* (i) Length of the CB memory */
|
||||
size_t lTarget, /* (i) Length of the target vector */
|
||||
int16_t *energyW16, /* (o) Energy in the CB vectors */
|
||||
int16_t *energyShifts, /* (o) Shift value of the energy */
|
||||
int scale, /* (i) The scaling of all energy values */
|
||||
size_t base_size /* (i) Index to where energy values should be stored */
|
||||
);
|
||||
int16_t* CB, /* (i) The CB memory (1:st section) */
|
||||
int16_t* filteredCB, /* (i) The filtered CB memory (2:nd section) */
|
||||
size_t lMem, /* (i) Length of the CB memory */
|
||||
size_t lTarget, /* (i) Length of the target vector */
|
||||
int16_t* energyW16, /* (o) Energy in the CB vectors */
|
||||
int16_t* energyShifts, /* (o) Shift value of the energy */
|
||||
int scale, /* (i) The scaling of all energy values */
|
||||
size_t base_size /* (i) Index to where energy values should be stored */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -20,12 +20,12 @@
|
||||
#define MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_CB_MEM_ENERGY_AUGMENTATION_H_
|
||||
|
||||
void WebRtcIlbcfix_CbMemEnergyAugmentation(
|
||||
int16_t *interpSamples, /* (i) The interpolated samples */
|
||||
int16_t *CBmem, /* (i) The CB memory */
|
||||
int scale, /* (i) The scaling of all energy values */
|
||||
size_t base_size, /* (i) Index to where energy values should be stored */
|
||||
int16_t *energyW16, /* (o) Energy in the CB vectors */
|
||||
int16_t *energyShifts /* (o) Shift value of the energy */
|
||||
);
|
||||
int16_t* interpSamples, /* (i) The interpolated samples */
|
||||
int16_t* CBmem, /* (i) The CB memory */
|
||||
int scale, /* (i) The scaling of all energy values */
|
||||
size_t base_size, /* (i) Index to where energy values should be stored */
|
||||
int16_t* energyW16, /* (o) Energy in the CB vectors */
|
||||
int16_t* energyShifts /* (o) Shift value of the energy */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -20,14 +20,14 @@
|
||||
#define MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_CB_MEM_ENERGY_CALC_H_
|
||||
|
||||
void WebRtcIlbcfix_CbMemEnergyCalc(
|
||||
int32_t energy, /* (i) input start energy */
|
||||
size_t range, /* (i) number of iterations */
|
||||
int16_t *ppi, /* (i) input pointer 1 */
|
||||
int16_t *ppo, /* (i) input pointer 2 */
|
||||
int16_t *energyW16, /* (o) Energy in the CB vectors */
|
||||
int16_t *energyShifts, /* (o) Shift value of the energy */
|
||||
int scale, /* (i) The scaling of all energy values */
|
||||
size_t base_size /* (i) Index to where energy values should be stored */
|
||||
);
|
||||
int32_t energy, /* (i) input start energy */
|
||||
size_t range, /* (i) number of iterations */
|
||||
int16_t* ppi, /* (i) input pointer 1 */
|
||||
int16_t* ppo, /* (i) input pointer 2 */
|
||||
int16_t* energyW16, /* (o) Energy in the CB vectors */
|
||||
int16_t* energyShifts, /* (o) Shift value of the energy */
|
||||
int scale, /* (i) The scaling of all energy values */
|
||||
size_t base_size /* (i) Index to where energy values should be stored */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -20,16 +20,16 @@
|
||||
#define MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_CB_SEARCH_H_
|
||||
|
||||
void WebRtcIlbcfix_CbSearch(
|
||||
IlbcEncoder *iLBCenc_inst,
|
||||
IlbcEncoder* iLBCenc_inst,
|
||||
/* (i) the encoder state structure */
|
||||
int16_t *index, /* (o) Codebook indices */
|
||||
int16_t *gain_index, /* (o) Gain quantization indices */
|
||||
int16_t *intarget, /* (i) Target vector for encoding */
|
||||
int16_t *decResidual,/* (i) Decoded residual for codebook construction */
|
||||
size_t lMem, /* (i) Length of buffer */
|
||||
size_t lTarget, /* (i) Length of vector */
|
||||
int16_t *weightDenum,/* (i) weighting filter coefficients in Q12 */
|
||||
size_t block /* (i) the subblock number */
|
||||
);
|
||||
int16_t* index, /* (o) Codebook indices */
|
||||
int16_t* gain_index, /* (o) Gain quantization indices */
|
||||
int16_t* intarget, /* (i) Target vector for encoding */
|
||||
int16_t* decResidual, /* (i) Decoded residual for codebook construction */
|
||||
size_t lMem, /* (i) Length of buffer */
|
||||
size_t lTarget, /* (i) Length of vector */
|
||||
int16_t* weightDenum, /* (i) weighting filter coefficients in Q12 */
|
||||
size_t block /* (i) the subblock number */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -22,19 +22,19 @@
|
||||
#include "modules/audio_coding/codecs/ilbc/defines.h"
|
||||
|
||||
void WebRtcIlbcfix_CbSearchCore(
|
||||
int32_t *cDot, /* (i) Cross Correlation */
|
||||
size_t range, /* (i) Search range */
|
||||
int16_t stage, /* (i) Stage of this search */
|
||||
int16_t *inverseEnergy, /* (i) Inversed energy */
|
||||
int16_t *inverseEnergyShift, /* (i) Shifts of inversed energy
|
||||
int32_t* cDot, /* (i) Cross Correlation */
|
||||
size_t range, /* (i) Search range */
|
||||
int16_t stage, /* (i) Stage of this search */
|
||||
int16_t* inverseEnergy, /* (i) Inversed energy */
|
||||
int16_t* inverseEnergyShift, /* (i) Shifts of inversed energy
|
||||
with the offset 2*16-29 */
|
||||
int32_t *Crit, /* (o) The criteria */
|
||||
size_t *bestIndex, /* (o) Index that corresponds to
|
||||
maximum criteria (in this
|
||||
vector) */
|
||||
int32_t *bestCrit, /* (o) Value of critera for the
|
||||
chosen index */
|
||||
int16_t *bestCritSh); /* (o) The domain of the chosen
|
||||
criteria */
|
||||
int32_t* Crit, /* (o) The criteria */
|
||||
size_t* bestIndex, /* (o) Index that corresponds to
|
||||
maximum criteria (in this
|
||||
vector) */
|
||||
int32_t* bestCrit, /* (o) Value of critera for the
|
||||
chosen index */
|
||||
int16_t* bestCritSh); /* (o) The domain of the chosen
|
||||
criteria */
|
||||
|
||||
#endif
|
||||
|
||||
@ -22,17 +22,17 @@
|
||||
#include "modules/audio_coding/codecs/ilbc/defines.h"
|
||||
|
||||
void WebRtcIlbcfix_CbUpdateBestIndex(
|
||||
int32_t CritNew, /* (i) New Potentially best Criteria */
|
||||
int16_t CritNewSh, /* (i) Shift value of above Criteria */
|
||||
size_t IndexNew, /* (i) Index of new Criteria */
|
||||
int32_t cDotNew, /* (i) Cross dot of new index */
|
||||
int16_t invEnergyNew, /* (i) Inversed energy new index */
|
||||
int16_t energyShiftNew, /* (i) Energy shifts of new index */
|
||||
int32_t *CritMax, /* (i/o) Maximum Criteria (so far) */
|
||||
int16_t *shTotMax, /* (i/o) Shifts of maximum criteria */
|
||||
size_t *bestIndex, /* (i/o) Index that corresponds to
|
||||
maximum criteria */
|
||||
int16_t *bestGain); /* (i/o) Gain in Q14 that corresponds
|
||||
to maximum criteria */
|
||||
int32_t CritNew, /* (i) New Potentially best Criteria */
|
||||
int16_t CritNewSh, /* (i) Shift value of above Criteria */
|
||||
size_t IndexNew, /* (i) Index of new Criteria */
|
||||
int32_t cDotNew, /* (i) Cross dot of new index */
|
||||
int16_t invEnergyNew, /* (i) Inversed energy new index */
|
||||
int16_t energyShiftNew, /* (i) Energy shifts of new index */
|
||||
int32_t* CritMax, /* (i/o) Maximum Criteria (so far) */
|
||||
int16_t* shTotMax, /* (i/o) Shifts of maximum criteria */
|
||||
size_t* bestIndex, /* (i/o) Index that corresponds to
|
||||
maximum criteria */
|
||||
int16_t* bestGain); /* (i/o) Gain in Q14 that corresponds
|
||||
to maximum criteria */
|
||||
|
||||
#endif
|
||||
|
||||
@ -30,8 +30,8 @@
|
||||
|
||||
int16_t WebRtcIlbcfix_Chebyshev(
|
||||
/* (o) Result of C(x) */
|
||||
int16_t x, /* (i) Value to the Chevyshev polynomial */
|
||||
int16_t *f /* (i) The coefficients in the polynomial */
|
||||
);
|
||||
int16_t x, /* (i) Value to the Chevyshev polynomial */
|
||||
int16_t* f /* (i) The coefficients in the polynomial */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,14 +26,13 @@
|
||||
* of last subframe at given lag.
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_CompCorr(
|
||||
int32_t *corr, /* (o) cross correlation */
|
||||
int32_t *ener, /* (o) energy */
|
||||
int16_t *buffer, /* (i) signal buffer */
|
||||
size_t lag, /* (i) pitch lag */
|
||||
size_t bLen, /* (i) length of buffer */
|
||||
size_t sRange, /* (i) correlation search length */
|
||||
int16_t scale /* (i) number of rightshifts to use */
|
||||
void WebRtcIlbcfix_CompCorr(int32_t* corr, /* (o) cross correlation */
|
||||
int32_t* ener, /* (o) energy */
|
||||
int16_t* buffer, /* (i) signal buffer */
|
||||
size_t lag, /* (i) pitch lag */
|
||||
size_t bLen, /* (i) length of buffer */
|
||||
size_t sRange, /* (i) correlation search length */
|
||||
int16_t scale /* (i) number of rightshifts to use */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -79,7 +79,8 @@ extern const int16_t WebRtcIlbcfix_kAlpha[];
|
||||
|
||||
/* enhancer definitions */
|
||||
|
||||
extern const int16_t WebRtcIlbcfix_kEnhPolyPhaser[ENH_UPS0][ENH_FLO_MULT2_PLUS1];
|
||||
extern const int16_t WebRtcIlbcfix_kEnhPolyPhaser[ENH_UPS0]
|
||||
[ENH_FLO_MULT2_PLUS1];
|
||||
extern const int16_t WebRtcIlbcfix_kEnhWt[];
|
||||
extern const size_t WebRtcIlbcfix_kEnhPlocs[];
|
||||
|
||||
|
||||
@ -27,8 +27,8 @@
|
||||
*----------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_CreateAugmentedVec(
|
||||
size_t index, /* (i) Index for the augmented vector to be
|
||||
created */
|
||||
size_t index, /* (i) Index for the augmented vector to be
|
||||
created */
|
||||
const int16_t* buffer, /* (i) Pointer to the end of the codebook memory
|
||||
that is used for creation of the augmented
|
||||
codebook */
|
||||
|
||||
@ -31,8 +31,8 @@ int WebRtcIlbcfix_DecodeImpl(
|
||||
const uint16_t* bytes, /* (i) encoded signal bits */
|
||||
IlbcDecoder* iLBCdec_inst, /* (i/o) the decoder state
|
||||
structure */
|
||||
int16_t mode /* (i) 0: bad packet, PLC,
|
||||
1: normal */
|
||||
int16_t mode /* (i) 0: bad packet, PLC,
|
||||
1: normal */
|
||||
) RTC_WARN_UNUSED_RESULT;
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,13 +26,13 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_DecoderInterpolateLsp(
|
||||
int16_t *syntdenum, /* (o) synthesis filter coefficients */
|
||||
int16_t *weightdenum, /* (o) weighting denumerator
|
||||
int16_t* syntdenum, /* (o) synthesis filter coefficients */
|
||||
int16_t* weightdenum, /* (o) weighting denumerator
|
||||
coefficients */
|
||||
int16_t *lsfdeq, /* (i) dequantized lsf coefficients */
|
||||
int16_t length, /* (i) length of lsf coefficient vector */
|
||||
IlbcDecoder *iLBCdec_inst
|
||||
int16_t* lsfdeq, /* (i) dequantized lsf coefficients */
|
||||
int16_t length, /* (i) length of lsf coefficient vector */
|
||||
IlbcDecoder* iLBCdec_inst
|
||||
/* (i) the decoder state structure */
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,103 +25,109 @@
|
||||
|
||||
/* general codec settings */
|
||||
|
||||
#define FS 8000
|
||||
#define BLOCKL_20MS 160
|
||||
#define BLOCKL_30MS 240
|
||||
#define BLOCKL_MAX 240
|
||||
#define NSUB_20MS 4
|
||||
#define NSUB_30MS 6
|
||||
#define NSUB_MAX 6
|
||||
#define NASUB_20MS 2
|
||||
#define NASUB_30MS 4
|
||||
#define NASUB_MAX 4
|
||||
#define SUBL 40
|
||||
#define STATE_LEN 80
|
||||
#define STATE_SHORT_LEN_30MS 58
|
||||
#define STATE_SHORT_LEN_20MS 57
|
||||
#define FS 8000
|
||||
#define BLOCKL_20MS 160
|
||||
#define BLOCKL_30MS 240
|
||||
#define BLOCKL_MAX 240
|
||||
#define NSUB_20MS 4
|
||||
#define NSUB_30MS 6
|
||||
#define NSUB_MAX 6
|
||||
#define NASUB_20MS 2
|
||||
#define NASUB_30MS 4
|
||||
#define NASUB_MAX 4
|
||||
#define SUBL 40
|
||||
#define STATE_LEN 80
|
||||
#define STATE_SHORT_LEN_30MS 58
|
||||
#define STATE_SHORT_LEN_20MS 57
|
||||
|
||||
/* LPC settings */
|
||||
|
||||
#define LPC_FILTERORDER 10
|
||||
#define LPC_LOOKBACK 60
|
||||
#define LPC_N_20MS 1
|
||||
#define LPC_N_30MS 2
|
||||
#define LPC_N_MAX 2
|
||||
#define LPC_ASYMDIFF 20
|
||||
#define LSF_NSPLIT 3
|
||||
#define LSF_NUMBER_OF_STEPS 4
|
||||
#define LPC_HALFORDER 5
|
||||
#define LPC_FILTERORDER 10
|
||||
#define LPC_LOOKBACK 60
|
||||
#define LPC_N_20MS 1
|
||||
#define LPC_N_30MS 2
|
||||
#define LPC_N_MAX 2
|
||||
#define LPC_ASYMDIFF 20
|
||||
#define LSF_NSPLIT 3
|
||||
#define LSF_NUMBER_OF_STEPS 4
|
||||
#define LPC_HALFORDER 5
|
||||
#define COS_GRID_POINTS 60
|
||||
|
||||
/* cb settings */
|
||||
|
||||
#define CB_NSTAGES 3
|
||||
#define CB_EXPAND 2
|
||||
#define CB_MEML 147
|
||||
#define CB_FILTERLEN (2*4)
|
||||
#define CB_HALFFILTERLEN 4
|
||||
#define CB_RESRANGE 34
|
||||
#define CB_MAXGAIN_FIXQ6 83 /* error = -0.24% */
|
||||
#define CB_MAXGAIN_FIXQ14 21299
|
||||
#define CB_NSTAGES 3
|
||||
#define CB_EXPAND 2
|
||||
#define CB_MEML 147
|
||||
#define CB_FILTERLEN (2 * 4)
|
||||
#define CB_HALFFILTERLEN 4
|
||||
#define CB_RESRANGE 34
|
||||
#define CB_MAXGAIN_FIXQ6 83 /* error = -0.24% */
|
||||
#define CB_MAXGAIN_FIXQ14 21299
|
||||
|
||||
/* enhancer */
|
||||
|
||||
#define ENH_BLOCKL 80 /* block length */
|
||||
#define ENH_BLOCKL_HALF (ENH_BLOCKL/2)
|
||||
#define ENH_HL 3 /* 2*ENH_HL+1 is number blocks
|
||||
in said second sequence */
|
||||
#define ENH_SLOP 2 /* max difference estimated and
|
||||
correct pitch period */
|
||||
#define ENH_PLOCSL 8 /* pitch-estimates and
|
||||
pitch-locations buffer length */
|
||||
#define ENH_OVERHANG 2
|
||||
#define ENH_UPS0 4 /* upsampling rate */
|
||||
#define ENH_FL0 3 /* 2*FLO+1 is the length of each filter */
|
||||
#define ENH_FLO_MULT2_PLUS1 7
|
||||
#define ENH_VECTL (ENH_BLOCKL+2*ENH_FL0)
|
||||
#define ENH_CORRDIM (2*ENH_SLOP+1)
|
||||
#define ENH_NBLOCKS (BLOCKL/ENH_BLOCKL)
|
||||
#define ENH_NBLOCKS_EXTRA 5
|
||||
#define ENH_NBLOCKS_TOT 8 /* ENH_NBLOCKS+ENH_NBLOCKS_EXTRA */
|
||||
#define ENH_BUFL (ENH_NBLOCKS_TOT)*ENH_BLOCKL
|
||||
#define ENH_BUFL_FILTEROVERHEAD 3
|
||||
#define ENH_A0 819 /* Q14 */
|
||||
#define ENH_A0_MINUS_A0A0DIV4 848256041 /* Q34 */
|
||||
#define ENH_A0DIV2 26843546 /* Q30 */
|
||||
#define ENH_BLOCKL 80 /* block length */
|
||||
#define ENH_BLOCKL_HALF (ENH_BLOCKL / 2)
|
||||
#define ENH_HL \
|
||||
3 /* 2*ENH_HL+1 is number blocks \
|
||||
in said second \
|
||||
sequence */
|
||||
#define ENH_SLOP \
|
||||
2 /* max difference estimated and \
|
||||
correct pitch period */
|
||||
#define ENH_PLOCSL \
|
||||
8 /* pitch-estimates and \
|
||||
pitch-locations buffer \
|
||||
length */
|
||||
#define ENH_OVERHANG 2
|
||||
#define ENH_UPS0 4 /* upsampling rate */
|
||||
#define ENH_FL0 3 /* 2*FLO+1 is the length of each filter */
|
||||
#define ENH_FLO_MULT2_PLUS1 7
|
||||
#define ENH_VECTL (ENH_BLOCKL + 2 * ENH_FL0)
|
||||
#define ENH_CORRDIM (2 * ENH_SLOP + 1)
|
||||
#define ENH_NBLOCKS (BLOCKL / ENH_BLOCKL)
|
||||
#define ENH_NBLOCKS_EXTRA 5
|
||||
#define ENH_NBLOCKS_TOT 8 /* ENH_NBLOCKS+ENH_NBLOCKS_EXTRA */
|
||||
#define ENH_BUFL (ENH_NBLOCKS_TOT) * ENH_BLOCKL
|
||||
#define ENH_BUFL_FILTEROVERHEAD 3
|
||||
#define ENH_A0 819 /* Q14 */
|
||||
#define ENH_A0_MINUS_A0A0DIV4 848256041 /* Q34 */
|
||||
#define ENH_A0DIV2 26843546 /* Q30 */
|
||||
|
||||
/* PLC */
|
||||
|
||||
/* Down sampling */
|
||||
|
||||
#define FILTERORDER_DS_PLUS1 7
|
||||
#define DELAY_DS 3
|
||||
#define FACTOR_DS 2
|
||||
#define FILTERORDER_DS_PLUS1 7
|
||||
#define DELAY_DS 3
|
||||
#define FACTOR_DS 2
|
||||
|
||||
/* bit stream defs */
|
||||
|
||||
#define NO_OF_BYTES_20MS 38
|
||||
#define NO_OF_BYTES_30MS 50
|
||||
#define NO_OF_WORDS_20MS 19
|
||||
#define NO_OF_WORDS_30MS 25
|
||||
#define STATE_BITS 3
|
||||
#define BYTE_LEN 8
|
||||
#define ULP_CLASSES 3
|
||||
#define NO_OF_BYTES_20MS 38
|
||||
#define NO_OF_BYTES_30MS 50
|
||||
#define NO_OF_WORDS_20MS 19
|
||||
#define NO_OF_WORDS_30MS 25
|
||||
#define STATE_BITS 3
|
||||
#define BYTE_LEN 8
|
||||
#define ULP_CLASSES 3
|
||||
|
||||
/* help parameters */
|
||||
|
||||
#define TWO_PI_FIX 25736 /* Q12 */
|
||||
#define TWO_PI_FIX 25736 /* Q12 */
|
||||
|
||||
/* Constants for codebook search and creation */
|
||||
|
||||
#define ST_MEM_L_TBL 85
|
||||
#define MEM_LF_TBL 147
|
||||
|
||||
#define ST_MEM_L_TBL 85
|
||||
#define MEM_LF_TBL 147
|
||||
|
||||
/* Struct for the bits */
|
||||
typedef struct iLBC_bits_t_ {
|
||||
int16_t lsf[LSF_NSPLIT*LPC_N_MAX];
|
||||
int16_t cb_index[CB_NSTAGES*(NASUB_MAX+1)]; /* First CB_NSTAGES values contains extra CB index */
|
||||
int16_t gain_index[CB_NSTAGES*(NASUB_MAX+1)]; /* First CB_NSTAGES values contains extra CB gain */
|
||||
int16_t lsf[LSF_NSPLIT * LPC_N_MAX];
|
||||
int16_t cb_index[CB_NSTAGES * (NASUB_MAX + 1)]; /* First CB_NSTAGES values
|
||||
contains extra CB index */
|
||||
int16_t gain_index[CB_NSTAGES * (NASUB_MAX + 1)]; /* First CB_NSTAGES values
|
||||
contains extra CB gain */
|
||||
size_t idxForMax;
|
||||
int16_t state_first;
|
||||
int16_t idxVec[STATE_SHORT_LEN_30MS];
|
||||
@ -131,7 +137,6 @@ typedef struct iLBC_bits_t_ {
|
||||
|
||||
/* type definition encoder instance */
|
||||
typedef struct IlbcEncoder_ {
|
||||
|
||||
/* flag for frame size mode */
|
||||
int16_t mode;
|
||||
|
||||
@ -172,7 +177,6 @@ typedef struct IlbcEncoder_ {
|
||||
|
||||
/* type definition decoder instance */
|
||||
typedef struct IlbcDecoder_ {
|
||||
|
||||
/* flag for frame size mode */
|
||||
int16_t mode;
|
||||
|
||||
@ -199,13 +203,13 @@ typedef struct IlbcDecoder_ {
|
||||
|
||||
int16_t prevScale, prevPLI;
|
||||
size_t prevLag;
|
||||
int16_t prevLpc[LPC_FILTERORDER+1];
|
||||
int16_t prevResidual[NSUB_MAX*SUBL];
|
||||
int16_t prevLpc[LPC_FILTERORDER + 1];
|
||||
int16_t prevResidual[NSUB_MAX * SUBL];
|
||||
int16_t seed;
|
||||
|
||||
/* previous synthesis filter parameters */
|
||||
|
||||
int16_t old_syntdenum[(LPC_FILTERORDER + 1)*NSUB_MAX];
|
||||
int16_t old_syntdenum[(LPC_FILTERORDER + 1) * NSUB_MAX];
|
||||
|
||||
/* state of output HP filter */
|
||||
int16_t hpimemx[2];
|
||||
@ -213,7 +217,7 @@ typedef struct IlbcDecoder_ {
|
||||
|
||||
/* enhancer state information */
|
||||
int use_enhancer;
|
||||
int16_t enh_buf[ENH_BUFL+ENH_BUFL_FILTEROVERHEAD];
|
||||
int16_t enh_buf[ENH_BUFL + ENH_BUFL_FILTEROVERHEAD];
|
||||
size_t enh_period[ENH_NBLOCKS_TOT];
|
||||
|
||||
} IlbcDecoder;
|
||||
|
||||
@ -27,15 +27,15 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_DoThePlc(
|
||||
int16_t *PLCresidual, /* (o) concealed residual */
|
||||
int16_t *PLClpc, /* (o) concealed LP parameters */
|
||||
int16_t PLI, /* (i) packet loss indicator
|
||||
0 - no PL, 1 = PL */
|
||||
int16_t *decresidual, /* (i) decoded residual */
|
||||
int16_t *lpc, /* (i) decoded LPC (only used for no PL) */
|
||||
size_t inlag, /* (i) pitch lag */
|
||||
IlbcDecoder *iLBCdec_inst
|
||||
int16_t* PLCresidual, /* (o) concealed residual */
|
||||
int16_t* PLClpc, /* (o) concealed LP parameters */
|
||||
int16_t PLI, /* (i) packet loss indicator
|
||||
0 - no PL, 1 = PL */
|
||||
int16_t* decresidual, /* (i) decoded residual */
|
||||
int16_t* lpc, /* (i) decoded LPC (only used for no PL) */
|
||||
size_t inlag, /* (i) pitch lag */
|
||||
IlbcDecoder* iLBCdec_inst
|
||||
/* (i/o) decoder instance */
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,10 +26,10 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_EncodeImpl(
|
||||
uint16_t *bytes, /* (o) encoded data bits iLBC */
|
||||
const int16_t *block, /* (i) speech vector to encode */
|
||||
IlbcEncoder *iLBCenc_inst /* (i/o) the general encoder
|
||||
uint16_t* bytes, /* (o) encoded data bits iLBC */
|
||||
const int16_t* block, /* (i) speech vector to encode */
|
||||
IlbcEncoder* iLBCenc_inst /* (i/o) the general encoder
|
||||
state */
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -24,9 +24,10 @@
|
||||
/* Inverses the in vector in into Q29 domain */
|
||||
|
||||
void WebRtcIlbcfix_EnergyInverse(
|
||||
int16_t *energy, /* (i/o) Energy and inverse
|
||||
energy (in Q29) */
|
||||
size_t noOfEnergies); /* (i) The length of the energy
|
||||
vector */
|
||||
int16_t*
|
||||
energy, /* (i/o) Energy and inverse
|
||||
energy (in Q29) */
|
||||
size_t noOfEnergies); /* (i) The length of the energy
|
||||
vector */
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,8 +26,8 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_EnhUpsample(
|
||||
int32_t *useq1, /* (o) upsampled output sequence */
|
||||
int16_t *seq1 /* (i) unupsampled sequence */
|
||||
);
|
||||
int32_t* useq1, /* (o) upsampled output sequence */
|
||||
int16_t* seq1 /* (i) unupsampled sequence */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -27,13 +27,13 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Enhancer(
|
||||
int16_t *odata, /* (o) smoothed block, dimension blockl */
|
||||
int16_t *idata, /* (i) data buffer used for enhancing */
|
||||
size_t idatal, /* (i) dimension idata */
|
||||
int16_t* odata, /* (o) smoothed block, dimension blockl */
|
||||
int16_t* idata, /* (i) data buffer used for enhancing */
|
||||
size_t idatal, /* (i) dimension idata */
|
||||
size_t centerStartPos, /* (i) first sample current block within idata */
|
||||
size_t *period, /* (i) pitch period array (pitch bward-in time) */
|
||||
const size_t *plocs, /* (i) locations where period array values valid */
|
||||
size_t periodl /* (i) dimension of period and plocs */
|
||||
);
|
||||
size_t* period, /* (i) pitch period array (pitch bward-in time) */
|
||||
const size_t* plocs, /* (i) locations where period array values valid */
|
||||
size_t periodl /* (i) dimension of period and plocs */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,9 +26,8 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
size_t // (o) Estimated lag in end of in[]
|
||||
WebRtcIlbcfix_EnhancerInterface(
|
||||
int16_t* out, // (o) enhanced signal
|
||||
const int16_t* in, // (i) unenhanced signal
|
||||
IlbcDecoder* iLBCdec_inst); // (i) buffers etc
|
||||
WebRtcIlbcfix_EnhancerInterface(int16_t* out, // (o) enhanced signal
|
||||
const int16_t* in, // (i) unenhanced signal
|
||||
IlbcDecoder* iLBCdec_inst); // (i) buffers etc
|
||||
|
||||
#endif
|
||||
|
||||
@ -28,11 +28,11 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_FilteredCbVecs(
|
||||
int16_t *cbvectors, /* (o) Codebook vector for the higher section */
|
||||
int16_t *CBmem, /* (i) Codebook memory that is filtered to create a
|
||||
second CB section */
|
||||
size_t lMem, /* (i) Length of codebook memory */
|
||||
size_t samples /* (i) Number of samples to filter */
|
||||
);
|
||||
int16_t* cbvectors, /* (o) Codebook vector for the higher section */
|
||||
int16_t* CBmem, /* (i) Codebook memory that is filtered to create a
|
||||
second CB section */
|
||||
size_t lMem, /* (i) Length of codebook memory */
|
||||
size_t samples /* (i) Number of samples to filter */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
|
||||
size_t WebRtcIlbcfix_FrameClassify(
|
||||
/* (o) Index to the max-energy sub frame */
|
||||
IlbcEncoder *iLBCenc_inst,
|
||||
IlbcEncoder* iLBCenc_inst,
|
||||
/* (i/o) the encoder state structure */
|
||||
int16_t *residualFIX /* (i) lpc residual signal */
|
||||
);
|
||||
int16_t* residualFIX /* (i) lpc residual signal */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -30,7 +30,7 @@ int16_t WebRtcIlbcfix_GainDequant(
|
||||
/* (o) quantized gain value (Q14) */
|
||||
int16_t index, /* (i) quantization index */
|
||||
int16_t maxIn, /* (i) maximum of unquantized gain (Q14) */
|
||||
int16_t stage /* (i) The stage of the search */
|
||||
);
|
||||
int16_t stage /* (i) The stage of the search */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,11 +25,12 @@
|
||||
* quantizer for the gain in the gain-shape coding of residual
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
int16_t WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
|
||||
int16_t gain, /* (i) gain value Q14 */
|
||||
int16_t maxIn, /* (i) maximum of gain value Q14 */
|
||||
int16_t stage, /* (i) The stage of the search */
|
||||
int16_t *index /* (o) quantization index */
|
||||
);
|
||||
int16_t
|
||||
WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
|
||||
int16_t gain, /* (i) gain value Q14 */
|
||||
int16_t maxIn, /* (i) maximum of gain value Q14 */
|
||||
int16_t stage, /* (i) The stage of the search */
|
||||
int16_t* index /* (o) quantization index */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -40,8 +40,7 @@
|
||||
* }
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_GetLspPoly(
|
||||
int16_t *lsp, /* (i) LSP in Q15 */
|
||||
int32_t *f); /* (o) polonymial in Q24 */
|
||||
void WebRtcIlbcfix_GetLspPoly(int16_t* lsp, /* (i) LSP in Q15 */
|
||||
int32_t* f); /* (o) polonymial in Q24 */
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,15 +26,15 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_GetSyncSeq(
|
||||
int16_t *idata, /* (i) original data */
|
||||
size_t idatal, /* (i) dimension of data */
|
||||
int16_t* idata, /* (i) original data */
|
||||
size_t idatal, /* (i) dimension of data */
|
||||
size_t centerStartPos, /* (i) where current block starts */
|
||||
size_t *period, /* (i) rough-pitch-period array (Q-2) */
|
||||
const size_t *plocs, /* (i) where periods of period array are taken (Q-2) */
|
||||
size_t periodl, /* (i) dimension period array */
|
||||
size_t hl, /* (i) 2*hl+1 is the number of sequences */
|
||||
int16_t *surround /* (i/o) The contribution from this sequence
|
||||
summed with earlier contributions */
|
||||
);
|
||||
size_t* period, /* (i) rough-pitch-period array (Q-2) */
|
||||
const size_t* plocs, /* (i) where periods of period array are taken (Q-2) */
|
||||
size_t periodl, /* (i) dimension period array */
|
||||
size_t hl, /* (i) 2*hl+1 is the number of sequences */
|
||||
int16_t* surround /* (i/o) The contribution from this sequence
|
||||
summed with earlier contributions */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -22,13 +22,13 @@
|
||||
#include "modules/audio_coding/codecs/ilbc/defines.h"
|
||||
|
||||
void WebRtcIlbcfix_HpInput(
|
||||
int16_t *signal, /* (i/o) signal vector */
|
||||
int16_t *ba, /* (i) B- and A-coefficients (2:nd order)
|
||||
{b[0] b[1] b[2] -a[1] -a[2]} a[0]
|
||||
is assumed to be 1.0 */
|
||||
int16_t *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
|
||||
yhi[n-2] ylow[n-2] */
|
||||
int16_t *x, /* (i/o) Filter state x[n-1] x[n-2] */
|
||||
int16_t* signal, /* (i/o) signal vector */
|
||||
int16_t* ba, /* (i) B- and A-coefficients (2:nd order)
|
||||
{b[0] b[1] b[2] -a[1] -a[2]}
|
||||
a[0] is assumed to be 1.0 */
|
||||
int16_t* y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
|
||||
yhi[n-2] ylow[n-2] */
|
||||
int16_t* x, /* (i/o) Filter state x[n-1] x[n-2] */
|
||||
size_t len); /* (i) Number of samples to filter */
|
||||
|
||||
#endif
|
||||
|
||||
@ -22,13 +22,13 @@
|
||||
#include "modules/audio_coding/codecs/ilbc/defines.h"
|
||||
|
||||
void WebRtcIlbcfix_HpOutput(
|
||||
int16_t *signal, /* (i/o) signal vector */
|
||||
int16_t *ba, /* (i) B- and A-coefficients (2:nd order)
|
||||
{b[0] b[1] b[2] -a[1] -a[2]} a[0]
|
||||
is assumed to be 1.0 */
|
||||
int16_t *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
|
||||
int16_t* signal, /* (i/o) signal vector */
|
||||
int16_t* ba, /* (i) B- and A-coefficients (2:nd order)
|
||||
{b[0] b[1] b[2] -a[1] -a[2]} a[0]
|
||||
is assumed to be 1.0 */
|
||||
int16_t* y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
|
||||
yhi[n-2] ylow[n-2] */
|
||||
int16_t *x, /* (i/o) Filter state x[n-1] x[n-2] */
|
||||
size_t len); /* (i) Number of samples to filter */
|
||||
int16_t* x, /* (i/o) Filter state x[n-1] x[n-2] */
|
||||
size_t len); /* (i) Number of samples to filter */
|
||||
|
||||
#endif
|
||||
|
||||
@ -40,216 +40,214 @@ typedef struct iLBC_decinst_t_ IlbcDecoderInstance;
|
||||
*/
|
||||
|
||||
#define ILBC_SPEECH 1
|
||||
#define ILBC_CNG 2
|
||||
#define ILBC_CNG 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_XxxAssign(...)
|
||||
*
|
||||
* These functions assigns the encoder/decoder instance to the specified
|
||||
* memory location
|
||||
*
|
||||
* Input:
|
||||
* - XXX_xxxinst : Pointer to created instance that should be
|
||||
* assigned
|
||||
* - ILBCXXX_inst_Addr : Pointer to the desired memory space
|
||||
* - size : The size that this structure occupies (in Word16)
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_XxxAssign(...)
|
||||
*
|
||||
* These functions assigns the encoder/decoder instance to the specified
|
||||
* memory location
|
||||
*
|
||||
* Input:
|
||||
* - XXX_xxxinst : Pointer to created instance that should be
|
||||
* assigned
|
||||
* - ILBCXXX_inst_Addr : Pointer to the desired memory space
|
||||
* - size : The size that this structure occupies (in Word16)
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcIlbcfix_EncoderAssign(IlbcEncoderInstance **iLBC_encinst,
|
||||
int16_t *ILBCENC_inst_Addr,
|
||||
int16_t *size);
|
||||
int16_t WebRtcIlbcfix_DecoderAssign(IlbcDecoderInstance **iLBC_decinst,
|
||||
int16_t *ILBCDEC_inst_Addr,
|
||||
int16_t *size);
|
||||
int16_t WebRtcIlbcfix_EncoderAssign(IlbcEncoderInstance** iLBC_encinst,
|
||||
int16_t* ILBCENC_inst_Addr,
|
||||
int16_t* size);
|
||||
int16_t WebRtcIlbcfix_DecoderAssign(IlbcDecoderInstance** iLBC_decinst,
|
||||
int16_t* ILBCDEC_inst_Addr,
|
||||
int16_t* size);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_XxxAssign(...)
|
||||
*
|
||||
* These functions create a instance to the specified structure
|
||||
*
|
||||
* Input:
|
||||
* - XXX_inst : Pointer to created instance that should be created
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_XxxAssign(...)
|
||||
*
|
||||
* These functions create a instance to the specified structure
|
||||
*
|
||||
* Input:
|
||||
* - XXX_inst : Pointer to created instance that should be created
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int16_t WebRtcIlbcfix_EncoderCreate(IlbcEncoderInstance** iLBC_encinst);
|
||||
int16_t WebRtcIlbcfix_DecoderCreate(IlbcDecoderInstance** iLBC_decinst);
|
||||
|
||||
int16_t WebRtcIlbcfix_EncoderCreate(IlbcEncoderInstance **iLBC_encinst);
|
||||
int16_t WebRtcIlbcfix_DecoderCreate(IlbcDecoderInstance **iLBC_decinst);
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_XxxFree(...)
|
||||
*
|
||||
* These functions frees the dynamic memory of a specified instance
|
||||
*
|
||||
* Input:
|
||||
* - XXX_inst : Pointer to created instance that should be freed
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_XxxFree(...)
|
||||
*
|
||||
* These functions frees the dynamic memory of a specified instance
|
||||
*
|
||||
* Input:
|
||||
* - XXX_inst : Pointer to created instance that should be freed
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int16_t WebRtcIlbcfix_EncoderFree(IlbcEncoderInstance* iLBC_encinst);
|
||||
int16_t WebRtcIlbcfix_DecoderFree(IlbcDecoderInstance* iLBC_decinst);
|
||||
|
||||
int16_t WebRtcIlbcfix_EncoderFree(IlbcEncoderInstance *iLBC_encinst);
|
||||
int16_t WebRtcIlbcfix_DecoderFree(IlbcDecoderInstance *iLBC_decinst);
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_EncoderInit(...)
|
||||
*
|
||||
* This function initializes a iLBC instance
|
||||
*
|
||||
* Input:
|
||||
* - iLBCenc_inst : iLBC instance, i.e. the user that should receive
|
||||
* be initialized
|
||||
* - frameLen : The frame length of the codec 20/30 (ms)
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcIlbcfix_EncoderInit(IlbcEncoderInstance* iLBCenc_inst,
|
||||
int16_t frameLen);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_EncoderInit(...)
|
||||
*
|
||||
* This function initializes a iLBC instance
|
||||
*
|
||||
* Input:
|
||||
* - iLBCenc_inst : iLBC instance, i.e. the user that should receive
|
||||
* be initialized
|
||||
* - frameLen : The frame length of the codec 20/30 (ms)
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_Encode(...)
|
||||
*
|
||||
* This function encodes one iLBC frame. Input speech length has be a
|
||||
* multiple of the frame length.
|
||||
*
|
||||
* Input:
|
||||
* - iLBCenc_inst : iLBC instance, i.e. the user that should encode
|
||||
* a package
|
||||
* - speechIn : Input speech vector
|
||||
* - len : Samples in speechIn (160, 240, 320 or 480)
|
||||
*
|
||||
* Output:
|
||||
* - encoded : The encoded data vector
|
||||
*
|
||||
* Return value : >0 - Length (in bytes) of coded data
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcIlbcfix_EncoderInit(IlbcEncoderInstance *iLBCenc_inst,
|
||||
int16_t frameLen);
|
||||
int WebRtcIlbcfix_Encode(IlbcEncoderInstance* iLBCenc_inst,
|
||||
const int16_t* speechIn,
|
||||
size_t len,
|
||||
uint8_t* encoded);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_Encode(...)
|
||||
*
|
||||
* This function encodes one iLBC frame. Input speech length has be a
|
||||
* multiple of the frame length.
|
||||
*
|
||||
* Input:
|
||||
* - iLBCenc_inst : iLBC instance, i.e. the user that should encode
|
||||
* a package
|
||||
* - speechIn : Input speech vector
|
||||
* - len : Samples in speechIn (160, 240, 320 or 480)
|
||||
*
|
||||
* Output:
|
||||
* - encoded : The encoded data vector
|
||||
*
|
||||
* Return value : >0 - Length (in bytes) of coded data
|
||||
* -1 - Error
|
||||
*/
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_DecoderInit(...)
|
||||
*
|
||||
* This function initializes a iLBC instance with either 20 or 30 ms frames
|
||||
* Alternatively the WebRtcIlbcfix_DecoderInit_XXms can be used. Then it's
|
||||
* not needed to specify the frame length with a variable.
|
||||
*
|
||||
* Input:
|
||||
* - IlbcDecoderInstance : iLBC decoder instance
|
||||
* - frameLen : The frame length of the codec 20/30 (ms)
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int WebRtcIlbcfix_Encode(IlbcEncoderInstance *iLBCenc_inst,
|
||||
const int16_t *speechIn,
|
||||
size_t len,
|
||||
uint8_t* encoded);
|
||||
int16_t WebRtcIlbcfix_DecoderInit(IlbcDecoderInstance* iLBCdec_inst,
|
||||
int16_t frameLen);
|
||||
void WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance* iLBCdec_inst);
|
||||
void WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance* iLBCdec_inst);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_DecoderInit(...)
|
||||
*
|
||||
* This function initializes a iLBC instance with either 20 or 30 ms frames
|
||||
* Alternatively the WebRtcIlbcfix_DecoderInit_XXms can be used. Then it's
|
||||
* not needed to specify the frame length with a variable.
|
||||
*
|
||||
* Input:
|
||||
* - IlbcDecoderInstance : iLBC decoder instance
|
||||
* - frameLen : The frame length of the codec 20/30 (ms)
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_Decode(...)
|
||||
*
|
||||
* This function decodes a packet with iLBC frame(s). Output speech length
|
||||
* will be a multiple of 160 or 240 samples ((160 or 240)*frames/packet).
|
||||
*
|
||||
* Input:
|
||||
* - iLBCdec_inst : iLBC instance, i.e. the user that should decode
|
||||
* a packet
|
||||
* - encoded : Encoded iLBC frame(s)
|
||||
* - len : Bytes in encoded vector
|
||||
*
|
||||
* Output:
|
||||
* - decoded : The decoded vector
|
||||
* - speechType : 1 normal, 2 CNG
|
||||
*
|
||||
* Return value : >0 - Samples in decoded vector
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcIlbcfix_DecoderInit(IlbcDecoderInstance *iLBCdec_inst,
|
||||
int16_t frameLen);
|
||||
void WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance* iLBCdec_inst);
|
||||
void WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance* iLBCdec_inst);
|
||||
int WebRtcIlbcfix_Decode(IlbcDecoderInstance* iLBCdec_inst,
|
||||
const uint8_t* encoded,
|
||||
size_t len,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType);
|
||||
int WebRtcIlbcfix_Decode20Ms(IlbcDecoderInstance* iLBCdec_inst,
|
||||
const uint8_t* encoded,
|
||||
size_t len,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType);
|
||||
int WebRtcIlbcfix_Decode30Ms(IlbcDecoderInstance* iLBCdec_inst,
|
||||
const uint8_t* encoded,
|
||||
size_t len,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_Decode(...)
|
||||
*
|
||||
* This function decodes a packet with iLBC frame(s). Output speech length
|
||||
* will be a multiple of 160 or 240 samples ((160 or 240)*frames/packet).
|
||||
*
|
||||
* Input:
|
||||
* - iLBCdec_inst : iLBC instance, i.e. the user that should decode
|
||||
* a packet
|
||||
* - encoded : Encoded iLBC frame(s)
|
||||
* - len : Bytes in encoded vector
|
||||
*
|
||||
* Output:
|
||||
* - decoded : The decoded vector
|
||||
* - speechType : 1 normal, 2 CNG
|
||||
*
|
||||
* Return value : >0 - Samples in decoded vector
|
||||
* -1 - Error
|
||||
*/
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_DecodePlc(...)
|
||||
*
|
||||
* This function conducts PLC for iLBC frame(s). Output speech length
|
||||
* will be a multiple of 160 or 240 samples.
|
||||
*
|
||||
* Input:
|
||||
* - iLBCdec_inst : iLBC instance, i.e. the user that should perform
|
||||
* a PLC
|
||||
* - noOfLostFrames : Number of PLC frames to produce
|
||||
*
|
||||
* Output:
|
||||
* - decoded : The "decoded" vector
|
||||
*
|
||||
* Return value : Samples in decoded PLC vector
|
||||
*/
|
||||
|
||||
int WebRtcIlbcfix_Decode(IlbcDecoderInstance* iLBCdec_inst,
|
||||
const uint8_t* encoded,
|
||||
size_t len,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType);
|
||||
int WebRtcIlbcfix_Decode20Ms(IlbcDecoderInstance* iLBCdec_inst,
|
||||
const uint8_t* encoded,
|
||||
size_t len,
|
||||
size_t WebRtcIlbcfix_DecodePlc(IlbcDecoderInstance* iLBCdec_inst,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType);
|
||||
int WebRtcIlbcfix_Decode30Ms(IlbcDecoderInstance* iLBCdec_inst,
|
||||
const uint8_t* encoded,
|
||||
size_t len,
|
||||
int16_t* decoded,
|
||||
int16_t* speechType);
|
||||
size_t noOfLostFrames);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_DecodePlc(...)
|
||||
*
|
||||
* This function conducts PLC for iLBC frame(s). Output speech length
|
||||
* will be a multiple of 160 or 240 samples.
|
||||
*
|
||||
* Input:
|
||||
* - iLBCdec_inst : iLBC instance, i.e. the user that should perform
|
||||
* a PLC
|
||||
* - noOfLostFrames : Number of PLC frames to produce
|
||||
*
|
||||
* Output:
|
||||
* - decoded : The "decoded" vector
|
||||
*
|
||||
* Return value : Samples in decoded PLC vector
|
||||
*/
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_NetEqPlc(...)
|
||||
*
|
||||
* This function updates the decoder when a packet loss has occured, but it
|
||||
* does not produce any PLC data. Function can be used if another PLC method
|
||||
* is used (i.e NetEq).
|
||||
*
|
||||
* Input:
|
||||
* - iLBCdec_inst : iLBC instance that should be updated
|
||||
* - noOfLostFrames : Number of lost frames
|
||||
*
|
||||
* Output:
|
||||
* - decoded : The "decoded" vector (nothing in this case)
|
||||
*
|
||||
* Return value : Samples in decoded PLC vector
|
||||
*/
|
||||
|
||||
size_t WebRtcIlbcfix_DecodePlc(IlbcDecoderInstance *iLBCdec_inst,
|
||||
int16_t *decoded,
|
||||
size_t noOfLostFrames);
|
||||
size_t WebRtcIlbcfix_NetEqPlc(IlbcDecoderInstance* iLBCdec_inst,
|
||||
int16_t* decoded,
|
||||
size_t noOfLostFrames);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_NetEqPlc(...)
|
||||
*
|
||||
* This function updates the decoder when a packet loss has occured, but it
|
||||
* does not produce any PLC data. Function can be used if another PLC method
|
||||
* is used (i.e NetEq).
|
||||
*
|
||||
* Input:
|
||||
* - iLBCdec_inst : iLBC instance that should be updated
|
||||
* - noOfLostFrames : Number of lost frames
|
||||
*
|
||||
* Output:
|
||||
* - decoded : The "decoded" vector (nothing in this case)
|
||||
*
|
||||
* Return value : Samples in decoded PLC vector
|
||||
*/
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_version(...)
|
||||
*
|
||||
* This function returns the version number of iLBC
|
||||
*
|
||||
* Output:
|
||||
* - version : Version number of iLBC (maximum 20 char)
|
||||
*/
|
||||
|
||||
size_t WebRtcIlbcfix_NetEqPlc(IlbcDecoderInstance *iLBCdec_inst,
|
||||
int16_t *decoded,
|
||||
size_t noOfLostFrames);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_version(...)
|
||||
*
|
||||
* This function returns the version number of iLBC
|
||||
*
|
||||
* Output:
|
||||
* - version : Version number of iLBC (maximum 20 char)
|
||||
*/
|
||||
|
||||
void WebRtcIlbcfix_version(char *version);
|
||||
void WebRtcIlbcfix_version(char* version);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ class SplitIlbcTest : public ::testing::TestWithParam<std::pair<int, int> > {
|
||||
TEST_P(SplitIlbcTest, NumFrames) {
|
||||
AudioDecoderIlbcImpl decoder;
|
||||
const size_t frame_length_samples = frame_length_ms_ * 8;
|
||||
const auto generate_payload = [] (size_t payload_length_bytes) {
|
||||
const auto generate_payload = [](size_t payload_length_bytes) {
|
||||
rtc::Buffer payload(payload_length_bytes);
|
||||
// Fill payload with increasing integers {0, 1, 2, ...}.
|
||||
for (size_t i = 0; i < payload.size(); ++i) {
|
||||
@ -104,7 +104,8 @@ TEST_P(SplitIlbcTest, NumFrames) {
|
||||
// The maximum is defined by the largest payload length that can be uniquely
|
||||
// resolved to a frame size of either 38 bytes (20 ms) or 50 bytes (30 ms).
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
IlbcTest, SplitIlbcTest,
|
||||
IlbcTest,
|
||||
SplitIlbcTest,
|
||||
::testing::Values(std::pair<int, int>(1, 20), // 1 frame, 20 ms.
|
||||
std::pair<int, int>(2, 20), // 2 frames, 20 ms.
|
||||
std::pair<int, int>(3, 20), // And so on.
|
||||
|
||||
@ -21,8 +21,7 @@
|
||||
|
||||
#include "modules/audio_coding/codecs/ilbc/defines.h"
|
||||
|
||||
void WebRtcIlbcfix_IndexConvDec(
|
||||
int16_t *index /* (i/o) Codebook indexes */
|
||||
void WebRtcIlbcfix_IndexConvDec(int16_t* index /* (i/o) Codebook indexes */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,8 +25,7 @@
|
||||
* Convert the codebook indexes to make the search easier
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_IndexConvEnc(
|
||||
int16_t *index /* (i/o) Codebook indexes */
|
||||
void WebRtcIlbcfix_IndexConvEnc(int16_t* index /* (i/o) Codebook indexes */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,11 +25,12 @@
|
||||
* Initiation of decoder instance.
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
int WebRtcIlbcfix_InitDecode( /* (o) Number of decoded samples */
|
||||
IlbcDecoder *iLBCdec_inst, /* (i/o) Decoder instance */
|
||||
int16_t mode, /* (i) frame size mode */
|
||||
int use_enhancer /* (i) 1 to use enhancer
|
||||
0 to run without enhancer */
|
||||
);
|
||||
int WebRtcIlbcfix_InitDecode(/* (o) Number of decoded samples */
|
||||
IlbcDecoder*
|
||||
iLBCdec_inst, /* (i/o) Decoder instance */
|
||||
int16_t mode, /* (i) frame size mode */
|
||||
int use_enhancer /* (i) 1 to use enhancer
|
||||
0 to run without enhancer */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,9 +25,10 @@
|
||||
* Initiation of encoder instance.
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
int WebRtcIlbcfix_InitEncode( /* (o) Number of bytes encoded */
|
||||
IlbcEncoder *iLBCenc_inst, /* (i/o) Encoder instance */
|
||||
int16_t mode /* (i) frame size mode */
|
||||
);
|
||||
int WebRtcIlbcfix_InitEncode(/* (o) Number of bytes encoded */
|
||||
IlbcEncoder*
|
||||
iLBCenc_inst, /* (i/o) Encoder instance */
|
||||
int16_t mode /* (i) frame size mode */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,10 +26,10 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Interpolate(
|
||||
int16_t *out, /* (o) output vector */
|
||||
int16_t *in1, /* (i) first input vector */
|
||||
int16_t *in2, /* (i) second input vector */
|
||||
int16_t coef, /* (i) weight coefficient in Q14 */
|
||||
int16_t* out, /* (o) output vector */
|
||||
int16_t* in1, /* (i) first input vector */
|
||||
int16_t* in2, /* (i) second input vector */
|
||||
int16_t coef, /* (i) weight coefficient in Q14 */
|
||||
int16_t length); /* (i) number of sample is vectors */
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_InterpolateSamples(
|
||||
int16_t *interpSamples, /* (o) The interpolated samples */
|
||||
int16_t *CBmem, /* (i) The CB memory */
|
||||
size_t lMem /* (i) Length of the CB memory */
|
||||
);
|
||||
int16_t* interpSamples, /* (o) The interpolated samples */
|
||||
int16_t* CBmem, /* (i) The CB memory */
|
||||
size_t lMem /* (i) Length of the CB memory */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,14 +26,14 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_LpcEncode(
|
||||
int16_t *syntdenum, /* (i/o) synthesis filter coefficients
|
||||
before/after encoding */
|
||||
int16_t *weightdenum, /* (i/o) weighting denumerator coefficients
|
||||
int16_t* syntdenum, /* (i/o) synthesis filter coefficients
|
||||
before/after encoding */
|
||||
int16_t *lsf_index, /* (o) lsf quantization index */
|
||||
int16_t *data, /* (i) Speech to do LPC analysis on */
|
||||
IlbcEncoder *iLBCenc_inst
|
||||
int16_t* weightdenum, /* (i/o) weighting denumerator coefficients
|
||||
before/after encoding */
|
||||
int16_t* lsf_index, /* (o) lsf quantization index */
|
||||
int16_t* data, /* (i) Speech to do LPC analysis on */
|
||||
IlbcEncoder* iLBCenc_inst
|
||||
/* (i/o) the encoder state structure */
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,9 +25,8 @@
|
||||
* check for stability of lsf coefficients
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
int WebRtcIlbcfix_LsfCheck(
|
||||
int16_t *lsf, /* LSF parameters */
|
||||
int dim, /* dimension of LSF */
|
||||
int NoAn); /* No of analysis per frame */
|
||||
int WebRtcIlbcfix_LsfCheck(int16_t* lsf, /* LSF parameters */
|
||||
int dim, /* dimension of LSF */
|
||||
int NoAn); /* No of analysis per frame */
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,12 +26,12 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_LspInterpolate2PolyDec(
|
||||
int16_t *a, /* (o) lpc coefficients Q12 */
|
||||
int16_t *lsf1, /* (i) first set of lsf coefficients Q13 */
|
||||
int16_t *lsf2, /* (i) second set of lsf coefficients Q13 */
|
||||
int16_t* a, /* (o) lpc coefficients Q12 */
|
||||
int16_t* lsf1, /* (i) first set of lsf coefficients Q13 */
|
||||
int16_t* lsf2, /* (i) second set of lsf coefficients Q13 */
|
||||
int16_t coef, /* (i) weighting coefficient to use between
|
||||
lsf1 and lsf2 Q14 */
|
||||
int16_t length /* (i) length of coefficient vectors */
|
||||
);
|
||||
int16_t length /* (i) length of coefficient vectors */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -27,12 +27,12 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_LsfInterpolate2PloyEnc(
|
||||
int16_t *a, /* (o) lpc coefficients Q12 */
|
||||
int16_t *lsf1, /* (i) first set of lsf coefficients Q13 */
|
||||
int16_t *lsf2, /* (i) second set of lsf coefficients Q13 */
|
||||
int16_t coef, /* (i) weighting coefficient to use between
|
||||
lsf1 and lsf2 Q14 */
|
||||
int16_t* a, /* (o) lpc coefficients Q12 */
|
||||
int16_t* lsf1, /* (i) first set of lsf coefficients Q13 */
|
||||
int16_t* lsf2, /* (i) second set of lsf coefficients Q13 */
|
||||
int16_t coef, /* (i) weighting coefficient to use between
|
||||
lsf1 and lsf2 Q14 */
|
||||
int16_t length /* (i) length of coefficient vectors */
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Lsf2Lsp(
|
||||
int16_t *lsf, /* (i) lsf in Q13 values between 0 and pi */
|
||||
int16_t *lsp, /* (o) lsp in Q15 values between -1 and 1 */
|
||||
int16_t* lsf, /* (i) lsf in Q13 values between 0 and pi */
|
||||
int16_t* lsp, /* (o) lsp in Q15 values between -1 and 1 */
|
||||
int16_t m /* (i) number of coefficients */
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,8 +26,8 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Lsf2Poly(
|
||||
int16_t *a, /* (o) predictor coefficients (order = 10) in Q12 */
|
||||
int16_t *lsf /* (i) line spectral frequencies in Q13 */
|
||||
);
|
||||
int16_t* a, /* (o) predictor coefficients (order = 10) in Q12 */
|
||||
int16_t* lsf /* (i) line spectral frequencies in Q13 */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,10 +26,10 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Lsp2Lsf(
|
||||
int16_t *lsp, /* (i) lsp vector -1...+1 in Q15 */
|
||||
int16_t *lsf, /* (o) Lsf vector 0...Pi in Q13
|
||||
int16_t* lsp, /* (i) lsp vector -1...+1 in Q15 */
|
||||
int16_t* lsf, /* (o) Lsf vector 0...Pi in Q13
|
||||
(ordered, so that lsf[i]<lsf[i+1]) */
|
||||
int16_t m /* (i) Number of coefficients */
|
||||
);
|
||||
int16_t m /* (i) Number of coefficients */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,12 +25,11 @@
|
||||
* compute cross correlation between sequences
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_MyCorr(
|
||||
int32_t* corr, /* (o) correlation of seq1 and seq2 */
|
||||
const int16_t* seq1, /* (i) first sequence */
|
||||
size_t dim1, /* (i) dimension first seq1 */
|
||||
const int16_t* seq2, /* (i) second sequence */
|
||||
size_t dim2 /* (i) dimension seq2 */
|
||||
void WebRtcIlbcfix_MyCorr(int32_t* corr, /* (o) correlation of seq1 and seq2 */
|
||||
const int16_t* seq1, /* (i) first sequence */
|
||||
size_t dim1, /* (i) dimension first seq1 */
|
||||
const int16_t* seq2, /* (i) second sequence */
|
||||
size_t dim2 /* (i) dimension seq2 */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -27,10 +27,10 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_NearestNeighbor(
|
||||
size_t* index, /* (o) index of array element closest to value */
|
||||
size_t* index, /* (o) index of array element closest to value */
|
||||
const size_t* array, /* (i) data array (Q2) */
|
||||
size_t value, /* (i) value (Q2) */
|
||||
size_t arlength /* (i) dimension of data array (==ENH_NBLOCKS_TOT) */
|
||||
);
|
||||
size_t value, /* (i) value (Q2) */
|
||||
size_t arlength /* (i) dimension of data array (==ENH_NBLOCKS_TOT) */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,10 +25,10 @@
|
||||
* unpacking of bits from bitstream, i.e., vector of bytes
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_PackBits(
|
||||
uint16_t *bitstream, /* (o) The packetized bitstream */
|
||||
iLBC_bits *enc_bits, /* (i) Encoded bits */
|
||||
int16_t mode /* (i) Codec mode (20 or 30) */
|
||||
);
|
||||
void WebRtcIlbcfix_PackBits(
|
||||
uint16_t* bitstream, /* (o) The packetized bitstream */
|
||||
iLBC_bits* enc_bits, /* (i) Encoded bits */
|
||||
int16_t mode /* (i) Codec mode (20 or 30) */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,9 +25,8 @@
|
||||
* conversion from lpc coefficients to lsf coefficients
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Poly2Lsf(
|
||||
int16_t *lsf, /* (o) lsf coefficients (Q13) */
|
||||
int16_t *a /* (i) A coefficients (Q12) */
|
||||
void WebRtcIlbcfix_Poly2Lsf(int16_t* lsf, /* (o) lsf coefficients (Q13) */
|
||||
int16_t* a /* (i) A coefficients (Q12) */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -27,10 +27,10 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Poly2Lsp(
|
||||
int16_t *a, /* (o) A coefficients in Q12 */
|
||||
int16_t *lsp, /* (i) LSP coefficients in Q15 */
|
||||
int16_t *old_lsp /* (i) old LSP coefficients that are used if the new
|
||||
int16_t* a, /* (o) A coefficients in Q12 */
|
||||
int16_t* lsp, /* (i) LSP coefficients in Q15 */
|
||||
int16_t* old_lsp /* (i) old LSP coefficients that are used if the new
|
||||
coefficients turn out to be unstable */
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -30,14 +30,14 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Refiner(
|
||||
size_t *updStartPos, /* (o) updated start point (Q-2) */
|
||||
int16_t *idata, /* (i) original data buffer */
|
||||
size_t idatal, /* (i) dimension of idata */
|
||||
size_t* updStartPos, /* (o) updated start point (Q-2) */
|
||||
int16_t* idata, /* (i) original data buffer */
|
||||
size_t idatal, /* (i) dimension of idata */
|
||||
size_t centerStartPos, /* (i) beginning center segment */
|
||||
size_t estSegPos, /* (i) estimated beginning other segment (Q-2) */
|
||||
int16_t *surround, /* (i/o) The contribution from this sequence
|
||||
summed with earlier contributions */
|
||||
int16_t gain /* (i) Gain to use for this sequence */
|
||||
);
|
||||
size_t estSegPos, /* (i) estimated beginning other segment (Q-2) */
|
||||
int16_t* surround, /* (i/o) The contribution from this sequence
|
||||
summed with earlier contributions */
|
||||
int16_t gain /* (i) Gain to use for this sequence */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,21 +26,21 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_SimpleInterpolateLsf(
|
||||
int16_t *syntdenum, /* (o) the synthesis filter denominator
|
||||
resulting from the quantized
|
||||
interpolated lsf Q12 */
|
||||
int16_t *weightdenum, /* (o) the weighting filter denominator
|
||||
int16_t* syntdenum, /* (o) the synthesis filter denominator
|
||||
resulting from the quantized
|
||||
interpolated lsf Q12 */
|
||||
int16_t* weightdenum, /* (o) the weighting filter denominator
|
||||
resulting from the unquantized
|
||||
interpolated lsf Q12 */
|
||||
int16_t *lsf, /* (i) the unquantized lsf coefficients Q13 */
|
||||
int16_t *lsfdeq, /* (i) the dequantized lsf coefficients Q13 */
|
||||
int16_t *lsfold, /* (i) the unquantized lsf coefficients of
|
||||
the previous signal frame Q13 */
|
||||
int16_t *lsfdeqold, /* (i) the dequantized lsf coefficients of the
|
||||
previous signal frame Q13 */
|
||||
int16_t length, /* (i) should equate FILTERORDER */
|
||||
IlbcEncoder *iLBCenc_inst
|
||||
int16_t* lsf, /* (i) the unquantized lsf coefficients Q13 */
|
||||
int16_t* lsfdeq, /* (i) the dequantized lsf coefficients Q13 */
|
||||
int16_t* lsfold, /* (i) the unquantized lsf coefficients of
|
||||
the previous signal frame Q13 */
|
||||
int16_t* lsfdeqold, /* (i) the dequantized lsf coefficients of the
|
||||
previous signal frame Q13 */
|
||||
int16_t length, /* (i) should equate FILTERORDER */
|
||||
IlbcEncoder* iLBCenc_inst
|
||||
/* (i/o) the encoder state structure */
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,10 +26,10 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_SimpleLpcAnalysis(
|
||||
int16_t *lsf, /* (o) lsf coefficients */
|
||||
int16_t *data, /* (i) new block of speech */
|
||||
IlbcEncoder *iLBCenc_inst
|
||||
int16_t* lsf, /* (o) lsf coefficients */
|
||||
int16_t* data, /* (i) new block of speech */
|
||||
IlbcEncoder* iLBCenc_inst
|
||||
/* (i/o) the encoder state structure */
|
||||
);
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_SimpleLsfDeQ(
|
||||
int16_t *lsfdeq, /* (o) dequantized lsf coefficients */
|
||||
int16_t *index, /* (i) quantization index */
|
||||
int16_t lpc_n /* (i) number of LPCs */
|
||||
);
|
||||
int16_t* lsfdeq, /* (o) dequantized lsf coefficients */
|
||||
int16_t* index, /* (i) quantization index */
|
||||
int16_t lpc_n /* (i) number of LPCs */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,12 +26,12 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_SimpleLsfQ(
|
||||
int16_t *lsfdeq, /* (o) dequantized lsf coefficients
|
||||
int16_t* lsfdeq, /* (o) dequantized lsf coefficients
|
||||
(dimension FILTERORDER) Q13 */
|
||||
int16_t *index, /* (o) quantization index */
|
||||
int16_t *lsf, /* (i) the lsf coefficient vector to be
|
||||
quantized (dimension FILTERORDER) Q13 */
|
||||
int16_t lpc_n /* (i) number of lsf sets to quantize */
|
||||
);
|
||||
int16_t* index, /* (o) quantization index */
|
||||
int16_t* lsf, /* (i) the lsf coefficient vector to be
|
||||
quantized (dimension FILTERORDER) Q13 */
|
||||
int16_t lpc_n /* (i) number of lsf sets to quantize */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,12 +25,11 @@
|
||||
* find the smoothed output data
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Smooth(
|
||||
int16_t *odata, /* (o) smoothed output */
|
||||
int16_t *current, /* (i) the un enhanced residual for
|
||||
this block */
|
||||
int16_t *surround /* (i) The approximation from the
|
||||
surrounding sequences */
|
||||
void WebRtcIlbcfix_Smooth(int16_t* odata, /* (o) smoothed output */
|
||||
int16_t* current, /* (i) the un enhanced residual for
|
||||
this block */
|
||||
int16_t* surround /* (i) The approximation from the
|
||||
surrounding sequences */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,11 +25,9 @@
|
||||
* help function to WebRtcIlbcfix_Smooth()
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
int32_t WebRtcIlbcfix_Smooth_odata(
|
||||
int16_t *odata,
|
||||
int16_t *psseq,
|
||||
int16_t *surround,
|
||||
int16_t C);
|
||||
|
||||
int32_t WebRtcIlbcfix_Smooth_odata(int16_t* odata,
|
||||
int16_t* psseq,
|
||||
int16_t* surround,
|
||||
int16_t C);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,11 +26,11 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_SortSq(
|
||||
int16_t *xq, /* (o) the quantized value */
|
||||
int16_t *index, /* (o) the quantization index */
|
||||
int16_t x, /* (i) the value to quantize */
|
||||
const int16_t *cb, /* (i) the quantization codebook */
|
||||
int16_t cb_size /* (i) the size of the quantization codebook */
|
||||
);
|
||||
int16_t* xq, /* (o) the quantized value */
|
||||
int16_t* index, /* (o) the quantization index */
|
||||
int16_t x, /* (i) the value to quantize */
|
||||
const int16_t* cb, /* (i) the quantization codebook */
|
||||
int16_t cb_size /* (i) the size of the quantization codebook */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,13 +26,13 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_SplitVq(
|
||||
int16_t *qX, /* (o) the quantized vector in Q13 */
|
||||
int16_t *index, /* (o) a vector of indexes for all vector
|
||||
int16_t* qX, /* (o) the quantized vector in Q13 */
|
||||
int16_t* index, /* (o) a vector of indexes for all vector
|
||||
codebooks in the split */
|
||||
int16_t *X, /* (i) the vector to quantize */
|
||||
int16_t *CB, /* (i) the quantizer codebook in Q13 */
|
||||
int16_t *dim, /* (i) the dimension of X and qX */
|
||||
int16_t *cbsize /* (i) the number of vectors in the codebook */
|
||||
);
|
||||
int16_t* X, /* (i) the vector to quantize */
|
||||
int16_t* CB, /* (i) the quantizer codebook in Q13 */
|
||||
int16_t* dim, /* (i) the dimension of X and qX */
|
||||
int16_t* cbsize /* (i) the number of vectors in the codebook */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,10 +26,10 @@
|
||||
void WebRtcIlbcfix_StateConstruct(
|
||||
size_t idxForMax, /* (i) 6-bit index for the quantization of
|
||||
max amplitude */
|
||||
int16_t *idxVec, /* (i) vector of quantization indexes */
|
||||
int16_t *syntDenum, /* (i) synthesis filter denumerator */
|
||||
int16_t *Out_fix, /* (o) the decoded state vector */
|
||||
size_t len /* (i) length of a state vector */
|
||||
);
|
||||
int16_t* idxVec, /* (i) vector of quantization indexes */
|
||||
int16_t* syntDenum, /* (i) synthesis filter denumerator */
|
||||
int16_t* Out_fix, /* (o) the decoded state vector */
|
||||
size_t len /* (i) length of a state vector */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,13 +26,13 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_StateSearch(
|
||||
IlbcEncoder *iLBCenc_inst,
|
||||
IlbcEncoder* iLBCenc_inst,
|
||||
/* (i) Encoder instance */
|
||||
iLBC_bits *iLBC_encbits,/* (i/o) Encoded bits (output idxForMax
|
||||
and idxVec, input state_first) */
|
||||
int16_t *residual, /* (i) target residual vector */
|
||||
int16_t *syntDenum, /* (i) lpc synthesis filter */
|
||||
int16_t *weightDenum /* (i) weighting filter denuminator */
|
||||
);
|
||||
iLBC_bits* iLBC_encbits, /* (i/o) Encoded bits (output idxForMax
|
||||
and idxVec, input state_first) */
|
||||
int16_t* residual, /* (i) target residual vector */
|
||||
int16_t* syntDenum, /* (i) lpc synthesis filter */
|
||||
int16_t* weightDenum /* (i) weighting filter denuminator */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_SwapBytes(
|
||||
const uint16_t* input, /* (i) the sequence to swap */
|
||||
size_t wordLength, /* (i) number or uint16_t to swap */
|
||||
uint16_t* output /* (o) the swapped sequence */
|
||||
);
|
||||
const uint16_t* input, /* (i) the sequence to swap */
|
||||
size_t wordLength, /* (i) number or uint16_t to swap */
|
||||
uint16_t* output /* (o) the swapped sequence */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,10 +25,13 @@
|
||||
* unpacking of bits from bitstream, i.e., vector of bytes
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
int16_t WebRtcIlbcfix_UnpackBits( /* (o) "Empty" frame indicator */
|
||||
const uint16_t *bitstream, /* (i) The packatized bitstream */
|
||||
iLBC_bits *enc_bits, /* (o) Paramerers from bitstream */
|
||||
int16_t mode /* (i) Codec mode (20 or 30) */
|
||||
);
|
||||
int16_t
|
||||
WebRtcIlbcfix_UnpackBits(/* (o) "Empty" frame indicator */
|
||||
const uint16_t*
|
||||
bitstream, /* (i) The packatized bitstream */
|
||||
iLBC_bits*
|
||||
enc_bits, /* (o) Paramerers from bitstream */
|
||||
int16_t mode /* (i) Codec mode (20 or 30) */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,11 +26,11 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Vq3(
|
||||
int16_t *Xq, /* (o) the quantized vector (Q13) */
|
||||
int16_t *index, /* (o) the quantization index */
|
||||
int16_t *CB, /* (i) the vector quantization codebook (Q13) */
|
||||
int16_t *X, /* (i) the vector to quantize (Q13) */
|
||||
int16_t n_cb /* (i) the number of vectors in the codebook */
|
||||
);
|
||||
int16_t* Xq, /* (o) the quantized vector (Q13) */
|
||||
int16_t* index, /* (o) the quantization index */
|
||||
int16_t* CB, /* (i) the vector quantization codebook (Q13) */
|
||||
int16_t* X, /* (i) the vector to quantize (Q13) */
|
||||
int16_t n_cb /* (i) the number of vectors in the codebook */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,11 +26,11 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Vq4(
|
||||
int16_t *Xq, /* (o) the quantized vector (Q13) */
|
||||
int16_t *index, /* (o) the quantization index */
|
||||
int16_t *CB, /* (i) the vector quantization codebook (Q13) */
|
||||
int16_t *X, /* (i) the vector to quantize (Q13) */
|
||||
int16_t n_cb /* (i) the number of vectors in the codebook */
|
||||
);
|
||||
int16_t* Xq, /* (o) the quantized vector (Q13) */
|
||||
int16_t* index, /* (o) the quantization index */
|
||||
int16_t* CB, /* (i) the vector quantization codebook (Q13) */
|
||||
int16_t* X, /* (i) the vector to quantize (Q13) */
|
||||
int16_t n_cb /* (i) the number of vectors in the codebook */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,11 +25,10 @@
|
||||
* window multiplication
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_Window32W32(
|
||||
int32_t *z, /* Output */
|
||||
int32_t *x, /* Input (same domain as Output)*/
|
||||
const int32_t *y, /* Q31 Window */
|
||||
size_t N /* length to process */
|
||||
void WebRtcIlbcfix_Window32W32(int32_t* z, /* Output */
|
||||
int32_t* x, /* Input (same domain as Output)*/
|
||||
const int32_t* y, /* Q31 Window */
|
||||
size_t N /* length to process */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@ -27,12 +27,12 @@
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
size_t WebRtcIlbcfix_XcorrCoef(
|
||||
int16_t *target, /* (i) first array */
|
||||
int16_t *regressor, /* (i) second array */
|
||||
size_t subl, /* (i) dimension arrays */
|
||||
size_t searchLen, /* (i) the search lenght */
|
||||
size_t offset, /* (i) samples offset between arrays */
|
||||
int16_t step /* (i) +1 or -1 */
|
||||
);
|
||||
int16_t* target, /* (i) first array */
|
||||
int16_t* regressor, /* (i) second array */
|
||||
size_t subl, /* (i) dimension arrays */
|
||||
size_t searchLen, /* (i) the search lenght */
|
||||
size_t offset, /* (i) samples offset between arrays */
|
||||
int16_t step /* (i) +1 or -1 */
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user