jan.skoglund@webrtc.org | c3d13d3 | 2014-03-10 22:50:19 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
henrik.lundin@webrtc.org | 9c55f0f | 2014-06-09 08:10:28 +0000 | [diff] [blame] | 11 | #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_CLASSIFIER_H_ |
| 12 | #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_CLASSIFIER_H_ |
jan.skoglund@webrtc.org | c3d13d3 | 2014-03-10 22:50:19 +0000 | [diff] [blame] | 13 | |
kwiberg | 77eab70 | 2016-09-28 17:42:01 -0700 | [diff] [blame] | 14 | #include "webrtc/base/ignore_wundef.h" |
| 15 | |
jan.skoglund@webrtc.org | c3d13d3 | 2014-03-10 22:50:19 +0000 | [diff] [blame] | 16 | extern "C" { |
kwiberg | 77eab70 | 2016-09-28 17:42:01 -0700 | [diff] [blame] | 17 | RTC_PUSH_IGNORING_WUNDEF() |
sprang@webrtc.org | cf6f46d | 2014-03-14 16:22:18 +0000 | [diff] [blame] | 18 | #include "celt.h" |
kwiberg | 77eab70 | 2016-09-28 17:42:01 -0700 | [diff] [blame] | 19 | RTC_POP_IGNORING_WUNDEF() |
sprang@webrtc.org | cf6f46d | 2014-03-14 16:22:18 +0000 | [diff] [blame] | 20 | #include "analysis.h" |
| 21 | #include "opus_private.h" |
jan.skoglund@webrtc.org | c3d13d3 | 2014-03-10 22:50:19 +0000 | [diff] [blame] | 22 | } |
jan.skoglund@webrtc.org | c3d13d3 | 2014-03-10 22:50:19 +0000 | [diff] [blame] | 23 | |
jan.skoglund@webrtc.org | c3d13d3 | 2014-03-10 22:50:19 +0000 | [diff] [blame] | 24 | #include "webrtc/typedefs.h" |
| 25 | |
| 26 | namespace webrtc { |
| 27 | |
| 28 | // This class provides a speech/music classification and is a wrapper over the |
| 29 | // Opus classifier. It currently only supports 48 kHz mono or stereo with a |
| 30 | // frame size of 20 ms. |
| 31 | |
| 32 | class AudioClassifier { |
| 33 | public: |
| 34 | AudioClassifier(); |
| 35 | virtual ~AudioClassifier(); |
| 36 | |
| 37 | // Classifies one frame of audio data in input, |
| 38 | // input_length : must be channels * 960; |
| 39 | // channels : must be 1 (mono) or 2 (stereo). |
| 40 | bool Analysis(const int16_t* input, int input_length, int channels); |
| 41 | |
| 42 | // Gets the current classification : true = music, false = speech. |
Karl Wiberg | 7f6c4d4 | 2015-04-09 15:44:22 +0200 | [diff] [blame] | 43 | virtual bool is_music() const; |
jan.skoglund@webrtc.org | c3d13d3 | 2014-03-10 22:50:19 +0000 | [diff] [blame] | 44 | |
| 45 | // Gets the current music probability. |
| 46 | float music_probability() const { return music_probability_; } |
| 47 | |
| 48 | private: |
| 49 | AnalysisInfo analysis_info_; |
| 50 | bool is_music_; |
| 51 | float music_probability_; |
| 52 | const CELTMode* celt_mode_; |
| 53 | TonalityAnalysisState analysis_state_; |
| 54 | }; |
| 55 | |
| 56 | } // namespace webrtc |
| 57 | |
henrik.lundin@webrtc.org | 9c55f0f | 2014-06-09 08:10:28 +0000 | [diff] [blame] | 58 | #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_CLASSIFIER_H_ |