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

Unified Diff: webrtc/modules/audio_coding/neteq/audio_classifier.cc

Issue 2615983002: Remove AudioClassifier (Closed)
Patch Set: Created 3 years, 11 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/audio_classifier.cc
diff --git a/webrtc/modules/audio_coding/neteq/audio_classifier.cc b/webrtc/modules/audio_coding/neteq/audio_classifier.cc
deleted file mode 100644
index 4a8c6fb974ed539c8462c78f477bf8cf085c4365..0000000000000000000000000000000000000000
--- a/webrtc/modules/audio_coding/neteq/audio_classifier.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2014 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/neteq/audio_classifier.h"
-
-#include <assert.h>
-#include <string.h>
-
-namespace webrtc {
-
-static const int kDefaultSampleRateHz = 48000;
-static const int kDefaultFrameRateHz = 50;
-static const int kDefaultFrameSizeSamples =
- kDefaultSampleRateHz / kDefaultFrameRateHz;
-static const float kDefaultThreshold = 0.5f;
-
-AudioClassifier::AudioClassifier()
- : analysis_info_(),
- is_music_(false),
- music_probability_(0),
- // This actually assigns the pointer to a static constant struct
- // rather than creates a struct and |celt_mode_| does not need
- // to be deleted.
- celt_mode_(opus_custom_mode_create(kDefaultSampleRateHz,
- kDefaultFrameSizeSamples,
- NULL)),
- analysis_state_() {
- assert(celt_mode_);
-}
-
-AudioClassifier::~AudioClassifier() {}
-
-bool AudioClassifier::Analysis(const int16_t* input,
- int input_length,
- int channels) {
- // Must be 20 ms frames at 48 kHz sampling.
- assert((input_length / channels) == kDefaultFrameSizeSamples);
-
- // Only mono or stereo are allowed.
- assert(channels == 1 || channels == 2);
-
- // Call Opus' classifier, defined in
- // "third_party/opus/src/src/analysis.h", with lsb_depth = 16.
- // Also uses a down-mixing function downmix_int, defined in
- // "third_party/opus/src/src/opus_private.h", with
- // constants c1 = 0, and c2 = -2.
- run_analysis(&analysis_state_,
- celt_mode_,
- input,
- kDefaultFrameSizeSamples,
- kDefaultFrameSizeSamples,
- 0,
- -2,
- channels,
- kDefaultSampleRateHz,
- 16,
- downmix_int,
- &analysis_info_);
- music_probability_ = analysis_info_.music_prob;
- is_music_ = music_probability_ > kDefaultThreshold;
- return is_music_;
-}
-
-bool AudioClassifier::is_music() const {
- return is_music_;
-}
-
-} // namespace webrtc
« no previous file with comments | « webrtc/modules/audio_coding/neteq/audio_classifier.h ('k') | webrtc/modules/audio_coding/neteq/audio_classifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698