Move AudioDecoderIsac* to its own files

Currently, it's sitting in AudioEncoderIsac*'s files, which is less
than obvious. This CL puts the encoder and decoder in separate files
together with the C implementation; CLs are afoot to make it so for
the other built-in codecs as well.

BUG=webrtc:4557
R=henrik.lundin@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10018}
This commit is contained in:
Karl Wiberg
2015-09-22 19:31:40 +02:00
parent 7083e119e8
commit 7404368998
20 changed files with 505 additions and 333 deletions

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_
#include <vector>
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
#include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
namespace webrtc {
template <typename T>
class AudioDecoderIsacT final : public AudioDecoder {
public:
AudioDecoderIsacT();
explicit AudioDecoderIsacT(LockedIsacBandwidthInfo* bwinfo);
~AudioDecoderIsacT() override;
bool HasDecodePlc() const override;
size_t DecodePlc(size_t num_frames, int16_t* decoded) override;
void Reset() override;
int IncomingPacket(const uint8_t* payload,
size_t payload_len,
uint16_t rtp_sequence_number,
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) override;
int ErrorCode() override;
size_t Channels() const override;
int DecodeInternal(const uint8_t* encoded,
size_t encoded_len,
int sample_rate_hz,
int16_t* decoded,
SpeechType* speech_type) override;
private:
typename T::instance_type* isac_state_;
LockedIsacBandwidthInfo* bwinfo_;
int decoder_sample_rate_hz_;
RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacT);
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_

View File

@ -0,0 +1,108 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_IMPL_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_IMPL_H_
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/audio_decoder_isac.h"
#include "webrtc/base/checks.h"
namespace webrtc {
template <typename T>
AudioDecoderIsacT<T>::AudioDecoderIsacT()
: AudioDecoderIsacT(nullptr) {}
template <typename T>
AudioDecoderIsacT<T>::AudioDecoderIsacT(LockedIsacBandwidthInfo* bwinfo)
: bwinfo_(bwinfo), decoder_sample_rate_hz_(-1) {
RTC_CHECK_EQ(0, T::Create(&isac_state_));
T::DecoderInit(isac_state_);
if (bwinfo_) {
IsacBandwidthInfo bi;
T::GetBandwidthInfo(isac_state_, &bi);
bwinfo_->Set(bi);
}
}
template <typename T>
AudioDecoderIsacT<T>::~AudioDecoderIsacT() {
RTC_CHECK_EQ(0, T::Free(isac_state_));
}
template <typename T>
int AudioDecoderIsacT<T>::DecodeInternal(const uint8_t* encoded,
size_t encoded_len,
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_) {
RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, sample_rate_hz));
decoder_sample_rate_hz_ = sample_rate_hz;
}
int16_t temp_type = 1; // Default is speech.
int ret =
T::DecodeInternal(isac_state_, encoded, encoded_len, decoded, &temp_type);
*speech_type = ConvertSpeechType(temp_type);
return ret;
}
template <typename T>
bool AudioDecoderIsacT<T>::HasDecodePlc() const {
return false;
}
template <typename T>
size_t AudioDecoderIsacT<T>::DecodePlc(size_t num_frames, int16_t* decoded) {
return T::DecodePlc(isac_state_, decoded, num_frames);
}
template <typename T>
void AudioDecoderIsacT<T>::Reset() {
T::DecoderInit(isac_state_);
}
template <typename T>
int AudioDecoderIsacT<T>::IncomingPacket(const uint8_t* payload,
size_t payload_len,
uint16_t rtp_sequence_number,
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) {
int ret = T::UpdateBwEstimate(isac_state_, payload, payload_len,
rtp_sequence_number, rtp_timestamp,
arrival_timestamp);
if (bwinfo_) {
IsacBandwidthInfo bwinfo;
T::GetBandwidthInfo(isac_state_, &bwinfo);
bwinfo_->Set(bwinfo);
}
return ret;
}
template <typename T>
int AudioDecoderIsacT<T>::ErrorCode() {
return T::GetErrorCode(isac_state_);
}
template <typename T>
size_t AudioDecoderIsacT<T>::Channels() const {
return 1;
}
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_IMPL_H_

View File

@ -13,7 +13,6 @@
#include <vector>
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
#include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
@ -94,36 +93,5 @@ class AudioEncoderIsacT final : public AudioEncoder {
RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderIsacT);
};
template <typename T>
class AudioDecoderIsacT final : public AudioDecoder {
public:
AudioDecoderIsacT();
explicit AudioDecoderIsacT(LockedIsacBandwidthInfo* bwinfo);
~AudioDecoderIsacT() override;
bool HasDecodePlc() const override;
size_t DecodePlc(size_t num_frames, int16_t* decoded) override;
void Reset() override;
int IncomingPacket(const uint8_t* payload,
size_t payload_len,
uint16_t rtp_sequence_number,
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) override;
int ErrorCode() override;
size_t Channels() const override;
int DecodeInternal(const uint8_t* encoded,
size_t encoded_len,
int sample_rate_hz,
int16_t* decoded,
SpeechType* speech_type) override;
private:
typename T::instance_type* isac_state_;
LockedIsacBandwidthInfo* bwinfo_;
int decoder_sample_rate_hz_;
RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacT);
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_

View File

@ -13,10 +13,7 @@
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h"
#include <algorithm>
#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h"
namespace webrtc {
@ -193,92 +190,6 @@ void AudioEncoderIsacT<T>::RecreateEncoderInstance(const Config& config) {
config_ = config;
}
template <typename T>
AudioDecoderIsacT<T>::AudioDecoderIsacT()
: AudioDecoderIsacT(nullptr) {}
template <typename T>
AudioDecoderIsacT<T>::AudioDecoderIsacT(LockedIsacBandwidthInfo* bwinfo)
: bwinfo_(bwinfo), decoder_sample_rate_hz_(-1) {
RTC_CHECK_EQ(0, T::Create(&isac_state_));
T::DecoderInit(isac_state_);
if (bwinfo_) {
IsacBandwidthInfo bi;
T::GetBandwidthInfo(isac_state_, &bi);
bwinfo_->Set(bi);
}
}
template <typename T>
AudioDecoderIsacT<T>::~AudioDecoderIsacT() {
RTC_CHECK_EQ(0, T::Free(isac_state_));
}
template <typename T>
int AudioDecoderIsacT<T>::DecodeInternal(const uint8_t* encoded,
size_t encoded_len,
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_) {
RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, sample_rate_hz));
decoder_sample_rate_hz_ = sample_rate_hz;
}
int16_t temp_type = 1; // Default is speech.
int ret =
T::DecodeInternal(isac_state_, encoded, encoded_len, decoded, &temp_type);
*speech_type = ConvertSpeechType(temp_type);
return ret;
}
template <typename T>
bool AudioDecoderIsacT<T>::HasDecodePlc() const {
return false;
}
template <typename T>
size_t AudioDecoderIsacT<T>::DecodePlc(size_t num_frames, int16_t* decoded) {
return T::DecodePlc(isac_state_, decoded, num_frames);
}
template <typename T>
void AudioDecoderIsacT<T>::Reset() {
T::DecoderInit(isac_state_);
}
template <typename T>
int AudioDecoderIsacT<T>::IncomingPacket(const uint8_t* payload,
size_t payload_len,
uint16_t rtp_sequence_number,
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) {
int ret = T::UpdateBwEstimate(
isac_state_, payload, payload_len,
rtp_sequence_number, rtp_timestamp, arrival_timestamp);
if (bwinfo_) {
IsacBandwidthInfo bwinfo;
T::GetBandwidthInfo(isac_state_, &bwinfo);
bwinfo_->Set(bwinfo);
}
return ret;
}
template <typename T>
int AudioDecoderIsacT<T>::ErrorCode() {
return T::GetErrorCode(isac_state_);
}
template <typename T>
size_t AudioDecoderIsacT<T>::Channels() const {
return 1;
}
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_IMPL_H_

View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_DECODER_ISACFIX_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_DECODER_ISACFIX_H_
#include "webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/isac_fix_type.h"
namespace webrtc {
using AudioDecoderIsacFix = AudioDecoderIsacT<IsacFix>;
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_DECODER_ISACFIX_H_

View File

@ -11,116 +11,12 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_ISACFIX_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_ISACFIX_H_
#include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/isac_fix_type.h"
namespace webrtc {
struct IsacFix {
typedef ISACFIX_MainStruct instance_type;
static const bool has_swb = false;
static const uint16_t kFixSampleRate = 16000;
static inline int16_t Control(instance_type* inst,
int32_t rate,
int framesize) {
return WebRtcIsacfix_Control(inst, rate, framesize);
}
static inline int16_t ControlBwe(instance_type* inst,
int32_t rate_bps,
int frame_size_ms,
int16_t enforce_frame_size) {
return WebRtcIsacfix_ControlBwe(inst, rate_bps, frame_size_ms,
enforce_frame_size);
}
static inline int16_t Create(instance_type** inst) {
return WebRtcIsacfix_Create(inst);
}
static inline int DecodeInternal(instance_type* inst,
const uint8_t* encoded,
size_t len,
int16_t* decoded,
int16_t* speech_type) {
return WebRtcIsacfix_Decode(inst, encoded, len, decoded, speech_type);
}
static inline size_t DecodePlc(instance_type* inst,
int16_t* decoded,
size_t num_lost_frames) {
return WebRtcIsacfix_DecodePlc(inst, decoded, num_lost_frames);
}
static inline void DecoderInit(instance_type* inst) {
WebRtcIsacfix_DecoderInit(inst);
}
static inline int Encode(instance_type* inst,
const int16_t* speech_in,
uint8_t* encoded) {
return WebRtcIsacfix_Encode(inst, speech_in, encoded);
}
static inline int16_t EncoderInit(instance_type* inst, int16_t coding_mode) {
return WebRtcIsacfix_EncoderInit(inst, coding_mode);
}
static inline uint16_t EncSampRate(instance_type* inst) {
return kFixSampleRate;
}
static inline int16_t Free(instance_type* inst) {
return WebRtcIsacfix_Free(inst);
}
static inline void GetBandwidthInfo(instance_type* inst,
IsacBandwidthInfo* bwinfo) {
WebRtcIsacfix_GetBandwidthInfo(inst, bwinfo);
}
static inline int16_t GetErrorCode(instance_type* inst) {
return WebRtcIsacfix_GetErrorCode(inst);
}
static inline int16_t GetNewFrameLen(instance_type* inst) {
return WebRtcIsacfix_GetNewFrameLen(inst);
}
static inline void SetBandwidthInfo(instance_type* inst,
const IsacBandwidthInfo* bwinfo) {
WebRtcIsacfix_SetBandwidthInfo(inst, bwinfo);
}
static inline int16_t SetDecSampRate(instance_type* inst,
uint16_t sample_rate_hz) {
RTC_DCHECK_EQ(sample_rate_hz, kFixSampleRate);
return 0;
}
static inline int16_t SetEncSampRate(instance_type* inst,
uint16_t sample_rate_hz) {
RTC_DCHECK_EQ(sample_rate_hz, kFixSampleRate);
return 0;
}
static inline void SetEncSampRateInDecoder(instance_type* inst,
uint16_t sample_rate_hz) {
RTC_DCHECK_EQ(sample_rate_hz, kFixSampleRate);
}
static inline void SetInitialBweBottleneck(
instance_type* inst,
int bottleneck_bits_per_second) {
WebRtcIsacfix_SetInitialBweBottleneck(inst, bottleneck_bits_per_second);
}
static inline int16_t UpdateBwEstimate(instance_type* inst,
const uint8_t* encoded,
size_t packet_size,
uint16_t rtp_seq_number,
uint32_t send_ts,
uint32_t arr_ts) {
return WebRtcIsacfix_UpdateBwEstimate(inst, encoded, packet_size,
rtp_seq_number, send_ts, arr_ts);
}
static inline int16_t SetMaxPayloadSize(instance_type* inst,
int16_t max_payload_size_bytes) {
return WebRtcIsacfix_SetMaxPayloadSize(inst, max_payload_size_bytes);
}
static inline int16_t SetMaxRate(instance_type* inst, int32_t max_bit_rate) {
return WebRtcIsacfix_SetMaxRate(inst, max_bit_rate);
}
};
using AudioEncoderIsacFix = AudioEncoderIsacT<IsacFix>;
using AudioDecoderIsacFix = AudioDecoderIsacT<IsacFix>;
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_ISACFIX_H_

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_decoder_isacfix.h"
#include "webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h"
namespace webrtc {
// Explicit instantiation:
template class AudioDecoderIsacT<IsacFix>;
} // namespace webrtc

View File

@ -14,10 +14,7 @@
namespace webrtc {
const uint16_t IsacFix::kFixSampleRate;
// Explicit instantiation:
template class AudioEncoderIsacT<IsacFix>;
template class AudioDecoderIsacT<IsacFix>;
} // namespace webrtc

View File

@ -0,0 +1,123 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_ISAC_FIX_TYPE_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_ISAC_FIX_TYPE_H_
#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h"
namespace webrtc {
class IsacFix {
public:
using instance_type = ISACFIX_MainStruct;
static const bool has_swb = false;
static inline int16_t Control(instance_type* inst,
int32_t rate,
int framesize) {
return WebRtcIsacfix_Control(inst, rate, framesize);
}
static inline int16_t ControlBwe(instance_type* inst,
int32_t rate_bps,
int frame_size_ms,
int16_t enforce_frame_size) {
return WebRtcIsacfix_ControlBwe(inst, rate_bps, frame_size_ms,
enforce_frame_size);
}
static inline int16_t Create(instance_type** inst) {
return WebRtcIsacfix_Create(inst);
}
static inline int DecodeInternal(instance_type* inst,
const uint8_t* encoded,
size_t len,
int16_t* decoded,
int16_t* speech_type) {
return WebRtcIsacfix_Decode(inst, encoded, len, decoded, speech_type);
}
static inline size_t DecodePlc(instance_type* inst,
int16_t* decoded,
size_t num_lost_frames) {
return WebRtcIsacfix_DecodePlc(inst, decoded, num_lost_frames);
}
static inline void DecoderInit(instance_type* inst) {
WebRtcIsacfix_DecoderInit(inst);
}
static inline int Encode(instance_type* inst,
const int16_t* speech_in,
uint8_t* encoded) {
return WebRtcIsacfix_Encode(inst, speech_in, encoded);
}
static inline int16_t EncoderInit(instance_type* inst, int16_t coding_mode) {
return WebRtcIsacfix_EncoderInit(inst, coding_mode);
}
static inline uint16_t EncSampRate(instance_type* inst) {
return kFixSampleRate;
}
static inline int16_t Free(instance_type* inst) {
return WebRtcIsacfix_Free(inst);
}
static inline void GetBandwidthInfo(instance_type* inst,
IsacBandwidthInfo* bwinfo) {
WebRtcIsacfix_GetBandwidthInfo(inst, bwinfo);
}
static inline int16_t GetErrorCode(instance_type* inst) {
return WebRtcIsacfix_GetErrorCode(inst);
}
static inline int16_t GetNewFrameLen(instance_type* inst) {
return WebRtcIsacfix_GetNewFrameLen(inst);
}
static inline void SetBandwidthInfo(instance_type* inst,
const IsacBandwidthInfo* bwinfo) {
WebRtcIsacfix_SetBandwidthInfo(inst, bwinfo);
}
static inline int16_t SetDecSampRate(instance_type* inst,
uint16_t sample_rate_hz) {
RTC_DCHECK_EQ(sample_rate_hz, kFixSampleRate);
return 0;
}
static inline int16_t SetEncSampRate(instance_type* inst,
uint16_t sample_rate_hz) {
RTC_DCHECK_EQ(sample_rate_hz, kFixSampleRate);
return 0;
}
static inline void SetEncSampRateInDecoder(instance_type* inst,
uint16_t sample_rate_hz) {
RTC_DCHECK_EQ(sample_rate_hz, kFixSampleRate);
}
static inline void SetInitialBweBottleneck(instance_type* inst,
int bottleneck_bits_per_second) {
WebRtcIsacfix_SetInitialBweBottleneck(inst, bottleneck_bits_per_second);
}
static inline int16_t UpdateBwEstimate(instance_type* inst,
const uint8_t* encoded,
size_t packet_size,
uint16_t rtp_seq_number,
uint32_t send_ts,
uint32_t arr_ts) {
return WebRtcIsacfix_UpdateBwEstimate(inst, encoded, packet_size,
rtp_seq_number, send_ts, arr_ts);
}
static inline int16_t SetMaxPayloadSize(instance_type* inst,
int16_t max_payload_size_bytes) {
return WebRtcIsacfix_SetMaxPayloadSize(inst, max_payload_size_bytes);
}
static inline int16_t SetMaxRate(instance_type* inst, int32_t max_bit_rate) {
return WebRtcIsacfix_SetMaxRate(inst, max_bit_rate);
}
private:
enum { kFixSampleRate = 16000 };
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_ISAC_FIX_TYPE_H_

View File

@ -28,11 +28,13 @@
],
},
'sources': [
'main/interface/audio_decoder_isac.h',
'main/interface/audio_encoder_isac.h',
'main/interface/isac.h',
'main/source/arith_routines.c',
'main/source/arith_routines_hist.c',
'main/source/arith_routines_logist.c',
'main/source/audio_decoder_isac.cc',
'main/source/audio_encoder_isac.cc',
'main/source/bandwidth_estimator.c',
'main/source/crc.c',
@ -46,6 +48,7 @@
'main/source/filterbank_tables.c',
'main/source/intialize.c',
'main/source/isac.c',
'main/source/isac_float_type.h',
'main/source/filterbanks.c',
'main/source/pitch_lag_tables.c',
'main/source/lattice.c',

View File

@ -27,11 +27,13 @@
],
},
'sources': [
'fix/interface/audio_decoder_isacfix.h',
'fix/interface/audio_encoder_isacfix.h',
'fix/interface/isacfix.h',
'fix/source/arith_routines.c',
'fix/source/arith_routines_hist.c',
'fix/source/arith_routines_logist.c',
'fix/source/audio_decoder_isacfix.cc',
'fix/source/audio_encoder_isacfix.cc',
'fix/source/bandwidth_estimator.c',
'fix/source/decode.c',
@ -44,6 +46,7 @@
'fix/source/filterbanks.c',
'fix/source/filters.c',
'fix/source/initialize.c',
'fix/source/isac_fix_type.h',
'fix/source/isacfix.c',
'fix/source/lattice.c',
'fix/source/lattice_c.c',

View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_DECODER_ISAC_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_DECODER_ISAC_H_
#include "webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t.h"
#include "webrtc/modules/audio_coding/codecs/isac/main/source/isac_float_type.h"
namespace webrtc {
using AudioDecoderIsac = AudioDecoderIsacT<IsacFloat>;
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_ISAC_H_

View File

@ -11,114 +11,12 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_ISAC_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_ISAC_H_
#include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h"
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h"
#include "webrtc/modules/audio_coding/codecs/isac/main/source/isac_float_type.h"
namespace webrtc {
struct IsacFloat {
typedef ISACStruct instance_type;
static const bool has_swb = true;
static inline int16_t Control(instance_type* inst,
int32_t rate,
int framesize) {
return WebRtcIsac_Control(inst, rate, framesize);
}
static inline int16_t ControlBwe(instance_type* inst,
int32_t rate_bps,
int frame_size_ms,
int16_t enforce_frame_size) {
return WebRtcIsac_ControlBwe(inst, rate_bps, frame_size_ms,
enforce_frame_size);
}
static inline int16_t Create(instance_type** inst) {
return WebRtcIsac_Create(inst);
}
static inline int DecodeInternal(instance_type* inst,
const uint8_t* encoded,
size_t len,
int16_t* decoded,
int16_t* speech_type) {
return WebRtcIsac_Decode(inst, encoded, len, decoded, speech_type);
}
static inline size_t DecodePlc(instance_type* inst,
int16_t* decoded,
size_t num_lost_frames) {
return WebRtcIsac_DecodePlc(inst, decoded, num_lost_frames);
}
static inline void DecoderInit(instance_type* inst) {
WebRtcIsac_DecoderInit(inst);
}
static inline int Encode(instance_type* inst,
const int16_t* speech_in,
uint8_t* encoded) {
return WebRtcIsac_Encode(inst, speech_in, encoded);
}
static inline int16_t EncoderInit(instance_type* inst, int16_t coding_mode) {
return WebRtcIsac_EncoderInit(inst, coding_mode);
}
static inline uint16_t EncSampRate(instance_type* inst) {
return WebRtcIsac_EncSampRate(inst);
}
static inline int16_t Free(instance_type* inst) {
return WebRtcIsac_Free(inst);
}
static inline void GetBandwidthInfo(instance_type* inst,
IsacBandwidthInfo* bwinfo) {
WebRtcIsac_GetBandwidthInfo(inst, bwinfo);
}
static inline int16_t GetErrorCode(instance_type* inst) {
return WebRtcIsac_GetErrorCode(inst);
}
static inline int16_t GetNewFrameLen(instance_type* inst) {
return WebRtcIsac_GetNewFrameLen(inst);
}
static inline void SetBandwidthInfo(instance_type* inst,
const IsacBandwidthInfo* bwinfo) {
WebRtcIsac_SetBandwidthInfo(inst, bwinfo);
}
static inline int16_t SetDecSampRate(instance_type* inst,
uint16_t sample_rate_hz) {
return WebRtcIsac_SetDecSampRate(inst, sample_rate_hz);
}
static inline int16_t SetEncSampRate(instance_type* inst,
uint16_t sample_rate_hz) {
return WebRtcIsac_SetEncSampRate(inst, sample_rate_hz);
}
static inline void SetEncSampRateInDecoder(instance_type* inst,
uint16_t sample_rate_hz) {
WebRtcIsac_SetEncSampRateInDecoder(inst, sample_rate_hz);
}
static inline void SetInitialBweBottleneck(
instance_type* inst,
int bottleneck_bits_per_second) {
WebRtcIsac_SetInitialBweBottleneck(inst, bottleneck_bits_per_second);
}
static inline int16_t UpdateBwEstimate(instance_type* inst,
const uint8_t* encoded,
size_t packet_size,
uint16_t rtp_seq_number,
uint32_t send_ts,
uint32_t arr_ts) {
return WebRtcIsac_UpdateBwEstimate(inst, encoded, packet_size,
rtp_seq_number, send_ts, arr_ts);
}
static inline int16_t SetMaxPayloadSize(instance_type* inst,
int16_t max_payload_size_bytes) {
return WebRtcIsac_SetMaxPayloadSize(inst, max_payload_size_bytes);
}
static inline int16_t SetMaxRate(instance_type* inst, int32_t max_bit_rate) {
return WebRtcIsac_SetMaxRate(inst, max_bit_rate);
}
};
using AudioEncoderIsac = AudioEncoderIsacT<IsacFloat>;
using AudioDecoderIsac = AudioDecoderIsacT<IsacFloat>;
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_ISAC_H_

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/audio_decoder_isac.h"
#include "webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h"
namespace webrtc {
// Explicit instantiation:
template class AudioDecoderIsacT<IsacFloat>;
} // namespace webrtc

View File

@ -16,6 +16,5 @@ namespace webrtc {
// Explicit instantiation:
template class AudioEncoderIsacT<IsacFloat>;
template class AudioDecoderIsacT<IsacFloat>;
} // namespace webrtc

View File

@ -0,0 +1,117 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ISAC_FLOAT_TYPE_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ISAC_FLOAT_TYPE_H_
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h"
namespace webrtc {
struct IsacFloat {
using instance_type = ISACStruct;
static const bool has_swb = true;
static inline int16_t Control(instance_type* inst,
int32_t rate,
int framesize) {
return WebRtcIsac_Control(inst, rate, framesize);
}
static inline int16_t ControlBwe(instance_type* inst,
int32_t rate_bps,
int frame_size_ms,
int16_t enforce_frame_size) {
return WebRtcIsac_ControlBwe(inst, rate_bps, frame_size_ms,
enforce_frame_size);
}
static inline int16_t Create(instance_type** inst) {
return WebRtcIsac_Create(inst);
}
static inline int DecodeInternal(instance_type* inst,
const uint8_t* encoded,
size_t len,
int16_t* decoded,
int16_t* speech_type) {
return WebRtcIsac_Decode(inst, encoded, len, decoded, speech_type);
}
static inline size_t DecodePlc(instance_type* inst,
int16_t* decoded,
size_t num_lost_frames) {
return WebRtcIsac_DecodePlc(inst, decoded, num_lost_frames);
}
static inline void DecoderInit(instance_type* inst) {
WebRtcIsac_DecoderInit(inst);
}
static inline int Encode(instance_type* inst,
const int16_t* speech_in,
uint8_t* encoded) {
return WebRtcIsac_Encode(inst, speech_in, encoded);
}
static inline int16_t EncoderInit(instance_type* inst, int16_t coding_mode) {
return WebRtcIsac_EncoderInit(inst, coding_mode);
}
static inline uint16_t EncSampRate(instance_type* inst) {
return WebRtcIsac_EncSampRate(inst);
}
static inline int16_t Free(instance_type* inst) {
return WebRtcIsac_Free(inst);
}
static inline void GetBandwidthInfo(instance_type* inst,
IsacBandwidthInfo* bwinfo) {
WebRtcIsac_GetBandwidthInfo(inst, bwinfo);
}
static inline int16_t GetErrorCode(instance_type* inst) {
return WebRtcIsac_GetErrorCode(inst);
}
static inline int16_t GetNewFrameLen(instance_type* inst) {
return WebRtcIsac_GetNewFrameLen(inst);
}
static inline void SetBandwidthInfo(instance_type* inst,
const IsacBandwidthInfo* bwinfo) {
WebRtcIsac_SetBandwidthInfo(inst, bwinfo);
}
static inline int16_t SetDecSampRate(instance_type* inst,
uint16_t sample_rate_hz) {
return WebRtcIsac_SetDecSampRate(inst, sample_rate_hz);
}
static inline int16_t SetEncSampRate(instance_type* inst,
uint16_t sample_rate_hz) {
return WebRtcIsac_SetEncSampRate(inst, sample_rate_hz);
}
static inline void SetEncSampRateInDecoder(instance_type* inst,
uint16_t sample_rate_hz) {
WebRtcIsac_SetEncSampRateInDecoder(inst, sample_rate_hz);
}
static inline void SetInitialBweBottleneck(instance_type* inst,
int bottleneck_bits_per_second) {
WebRtcIsac_SetInitialBweBottleneck(inst, bottleneck_bits_per_second);
}
static inline int16_t UpdateBwEstimate(instance_type* inst,
const uint8_t* encoded,
size_t packet_size,
uint16_t rtp_seq_number,
uint32_t send_ts,
uint32_t arr_ts) {
return WebRtcIsac_UpdateBwEstimate(inst, encoded, packet_size,
rtp_seq_number, send_ts, arr_ts);
}
static inline int16_t SetMaxPayloadSize(instance_type* inst,
int16_t max_payload_size_bytes) {
return WebRtcIsac_SetMaxPayloadSize(inst, max_payload_size_bytes);
}
static inline int16_t SetMaxRate(instance_type* inst, int32_t max_bit_rate) {
return WebRtcIsac_SetMaxRate(inst, max_bit_rate);
}
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ISAC_FLOAT_TYPE_H_