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

Side by Side Diff: webrtc/modules/audio_processing/three_band_filter_bank.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, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 16 matching lines...) Expand all
27 // * Pass-band frequency = 0.147 (7kHz at 48kHz) 27 // * Pass-band frequency = 0.147 (7kHz at 48kHz)
28 // * Stop-band attenuation = 40dB 28 // * Stop-band attenuation = 40dB
29 // * Stop-band frequency = 0.192 (9.2kHz at 48kHz) 29 // * Stop-band frequency = 0.192 (9.2kHz at 48kHz)
30 // * Delay = 24 samples (500us at 48kHz) 30 // * Delay = 24 samples (500us at 48kHz)
31 // * Linear phase 31 // * Linear phase
32 // This filter bank does not satisfy perfect reconstruction. The SNR after 32 // This filter bank does not satisfy perfect reconstruction. The SNR after
33 // analysis and synthesis (with no processing in between) is approximately 9.5dB 33 // analysis and synthesis (with no processing in between) is approximately 9.5dB
34 // depending on the input signal after compensating for the delay. 34 // depending on the input signal after compensating for the delay.
35 class ThreeBandFilterBank final { 35 class ThreeBandFilterBank final {
36 public: 36 public:
37 explicit ThreeBandFilterBank(int length); 37 explicit ThreeBandFilterBank(size_t length);
38 38
39 // Splits |in| into 3 downsampled frequency bands in |out|. 39 // Splits |in| into 3 downsampled frequency bands in |out|.
40 // |length| is the |in| length. Each of the 3 bands of |out| has to have a 40 // |length| is the |in| length. Each of the 3 bands of |out| has to have a
41 // length of |length| / 3. 41 // length of |length| / 3.
42 void Analysis(const float* in, int length, float* const* out); 42 void Analysis(const float* in, size_t length, float* const* out);
43 43
44 // Merges the 3 downsampled frequency bands in |in| into |out|. 44 // Merges the 3 downsampled frequency bands in |in| into |out|.
45 // |split_length| is the length of each band of |in|. |out| has to have at 45 // |split_length| is the length of each band of |in|. |out| has to have at
46 // least a length of 3 * |split_length|. 46 // least a length of 3 * |split_length|.
47 void Synthesis(const float* const* in, int split_length, float* out); 47 void Synthesis(const float* const* in, size_t split_length, float* out);
48 48
49 private: 49 private:
50 void DownModulate(const float* in, 50 void DownModulate(const float* in,
51 int split_length, 51 size_t split_length,
52 int offset, 52 size_t offset,
53 float* const* out); 53 float* const* out);
54 void UpModulate(const float* const* in, 54 void UpModulate(const float* const* in,
55 int split_length, 55 size_t split_length,
56 int offset, 56 size_t offset,
57 float* out); 57 float* out);
58 58
59 std::vector<float> in_buffer_; 59 std::vector<float> in_buffer_;
60 std::vector<float> out_buffer_; 60 std::vector<float> out_buffer_;
61 ScopedVector<SparseFIRFilter> analysis_filters_; 61 ScopedVector<SparseFIRFilter> analysis_filters_;
62 ScopedVector<SparseFIRFilter> synthesis_filters_; 62 ScopedVector<SparseFIRFilter> synthesis_filters_;
63 std::vector<std::vector<float>> dct_modulation_; 63 std::vector<std::vector<float>> dct_modulation_;
64 }; 64 };
65 65
66 } // namespace webrtc 66 } // namespace webrtc
67 67
68 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_THREE_BAND_FILTER_BANK_H_ 68 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_THREE_BAND_FILTER_BANK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698