Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Unified Diff: webrtc/modules/audio_coding/neteq/time_stretch.h

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/time_stretch.h
diff --git a/webrtc/modules/audio_coding/neteq/time_stretch.h b/webrtc/modules/audio_coding/neteq/time_stretch.h
index 7c84e1a15347fb1f3ba0bce09f18b000475cbdbe..14383d8dd73494d303be5d4bceba1e273ec4c2f9 100644
--- a/webrtc/modules/audio_coding/neteq/time_stretch.h
+++ b/webrtc/modules/audio_coding/neteq/time_stretch.h
@@ -39,7 +39,7 @@ class TimeStretch {
const BackgroundNoise& background_noise)
: sample_rate_hz_(sample_rate_hz),
fs_mult_(sample_rate_hz / 8000),
- num_channels_(static_cast<int>(num_channels)),
+ num_channels_(num_channels),
master_channel_(0), // First channel is master.
background_noise_(background_noise),
max_input_value_(0) {
@@ -48,7 +48,7 @@ class TimeStretch {
sample_rate_hz_ == 32000 ||
sample_rate_hz_ == 48000);
assert(num_channels_ > 0);
- assert(static_cast<int>(master_channel_) < num_channels_);
+ assert(master_channel_ < num_channels_);
memset(auto_correlation_, 0, sizeof(auto_correlation_));
}
@@ -60,7 +60,7 @@ class TimeStretch {
size_t input_len,
bool fast_mode,
AudioMultiVector* output,
- int16_t* length_change_samples);
+ size_t* length_change_samples);
protected:
// Sets the parameters |best_correlation| and |peak_index| to suitable
@@ -68,7 +68,7 @@ class TimeStretch {
// implemented by the sub-classes.
virtual void SetParametersForPassiveSpeech(size_t input_length,
int16_t* best_correlation,
- int* peak_index) const = 0;
+ size_t* peak_index) const = 0;
// Checks the criteria for performing the time-stretching operation and,
// if possible, performs the time-stretching. This method must be implemented
@@ -82,16 +82,16 @@ class TimeStretch {
bool fast_mode,
AudioMultiVector* output) const = 0;
- static const int kCorrelationLen = 50;
- static const int kLogCorrelationLen = 6; // >= log2(kCorrelationLen).
- static const int kMinLag = 10;
- static const int kMaxLag = 60;
- static const int kDownsampledLen = kCorrelationLen + kMaxLag;
+ static const size_t kCorrelationLen = 50;
+ static const size_t kLogCorrelationLen = 6; // >= log2(kCorrelationLen).
+ static const size_t kMinLag = 10;
+ static const size_t kMaxLag = 60;
+ static const size_t kDownsampledLen = kCorrelationLen + kMaxLag;
static const int kCorrelationThreshold = 14746; // 0.9 in Q14.
const int sample_rate_hz_;
const int fs_mult_; // Sample rate multiplier = sample_rate_hz_ / 8000.
- const int num_channels_;
+ const size_t num_channels_;
const size_t master_channel_;
const BackgroundNoise& background_noise_;
int16_t max_input_value_;
@@ -107,7 +107,7 @@ class TimeStretch {
// Performs a simple voice-activity detection based on the input parameters.
bool SpeechDetection(int32_t vec1_energy, int32_t vec2_energy,
- int peak_index, int scaling) const;
+ size_t peak_index, int scaling) const;
DISALLOW_COPY_AND_ASSIGN(TimeStretch);
};
« no previous file with comments | « webrtc/modules/audio_coding/neteq/test/neteq_pcmu_quality_test.cc ('k') | webrtc/modules/audio_coding/neteq/time_stretch.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698