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

Side by Side Diff: webrtc/common_audio/resampler/include/resampler.h

Issue 2739143002: Revert of Enable cpplint and fix cpplint errors in webrtc/*audio (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « webrtc/common_audio/real_fourier.h ('k') | webrtc/common_audio/resampler/push_resampler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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
11 11
12 /* 12 /*
13 * A wrapper for resampling a numerous amount of sampling combinations. 13 * A wrapper for resampling a numerous amount of sampling combinations.
14 */ 14 */
15 15
16 #ifndef WEBRTC_COMMON_AUDIO_RESAMPLER_INCLUDE_RESAMPLER_H_ 16 #ifndef WEBRTC_RESAMPLER_RESAMPLER_H_
17 #define WEBRTC_COMMON_AUDIO_RESAMPLER_INCLUDE_RESAMPLER_H_ 17 #define WEBRTC_RESAMPLER_RESAMPLER_H_
18 18
19 #include <stddef.h> 19 #include <stddef.h>
20 20
21 #include "webrtc/typedefs.h" 21 #include "webrtc/typedefs.h"
22 22
23 namespace webrtc { 23 namespace webrtc {
24 24
25 // All methods return 0 on success and -1 on failure. 25 // All methods return 0 on success and -1 on failure.
26 class Resampler { 26 class Resampler
27 public: 27 {
28 Resampler();
29 Resampler(int inFreq, int outFreq, size_t num_channels);
30 ~Resampler();
31 28
32 // Reset all states 29 public:
33 int Reset(int inFreq, int outFreq, size_t num_channels); 30 Resampler();
31 Resampler(int inFreq, int outFreq, size_t num_channels);
32 ~Resampler();
34 33
35 // Reset all states if any parameter has changed 34 // Reset all states
36 int ResetIfNeeded(int inFreq, int outFreq, size_t num_channels); 35 int Reset(int inFreq, int outFreq, size_t num_channels);
37 36
38 // Resample samplesIn to samplesOut. 37 // Reset all states if any parameter has changed
39 int Push(const int16_t* samplesIn, size_t lengthIn, int16_t* samplesOut, 38 int ResetIfNeeded(int inFreq, int outFreq, size_t num_channels);
40 size_t maxLen, size_t& outLen); // NOLINT: to avoid changing APIs
41 39
42 private: 40 // Resample samplesIn to samplesOut.
43 enum ResamplerMode { 41 int Push(const int16_t* samplesIn, size_t lengthIn, int16_t* samplesOut,
44 kResamplerMode1To1, 42 size_t maxLen, size_t &outLen);
45 kResamplerMode1To2,
46 kResamplerMode1To3,
47 kResamplerMode1To4,
48 kResamplerMode1To6,
49 kResamplerMode1To12,
50 kResamplerMode2To3,
51 kResamplerMode2To11,
52 kResamplerMode4To11,
53 kResamplerMode8To11,
54 kResamplerMode11To16,
55 kResamplerMode11To32,
56 kResamplerMode2To1,
57 kResamplerMode3To1,
58 kResamplerMode4To1,
59 kResamplerMode6To1,
60 kResamplerMode12To1,
61 kResamplerMode3To2,
62 kResamplerMode11To2,
63 kResamplerMode11To4,
64 kResamplerMode11To8
65 };
66 43
67 // Generic pointers since we don't know what states we'll need 44 private:
68 void* state1_; 45 enum ResamplerMode
69 void* state2_; 46 {
70 void* state3_; 47 kResamplerMode1To1,
48 kResamplerMode1To2,
49 kResamplerMode1To3,
50 kResamplerMode1To4,
51 kResamplerMode1To6,
52 kResamplerMode1To12,
53 kResamplerMode2To3,
54 kResamplerMode2To11,
55 kResamplerMode4To11,
56 kResamplerMode8To11,
57 kResamplerMode11To16,
58 kResamplerMode11To32,
59 kResamplerMode2To1,
60 kResamplerMode3To1,
61 kResamplerMode4To1,
62 kResamplerMode6To1,
63 kResamplerMode12To1,
64 kResamplerMode3To2,
65 kResamplerMode11To2,
66 kResamplerMode11To4,
67 kResamplerMode11To8
68 };
71 69
72 // Storage if needed 70 // Generic pointers since we don't know what states we'll need
73 int16_t* in_buffer_; 71 void* state1_;
74 int16_t* out_buffer_; 72 void* state2_;
75 size_t in_buffer_size_; 73 void* state3_;
76 size_t out_buffer_size_;
77 size_t in_buffer_size_max_;
78 size_t out_buffer_size_max_;
79 74
80 int my_in_frequency_khz_; 75 // Storage if needed
81 int my_out_frequency_khz_; 76 int16_t* in_buffer_;
82 ResamplerMode my_mode_; 77 int16_t* out_buffer_;
83 size_t num_channels_; 78 size_t in_buffer_size_;
79 size_t out_buffer_size_;
80 size_t in_buffer_size_max_;
81 size_t out_buffer_size_max_;
84 82
85 // Extra instance for stereo 83 int my_in_frequency_khz_;
86 Resampler* slave_left_; 84 int my_out_frequency_khz_;
87 Resampler* slave_right_; 85 ResamplerMode my_mode_;
86 size_t num_channels_;
87
88 // Extra instance for stereo
89 Resampler* slave_left_;
90 Resampler* slave_right_;
88 }; 91 };
89 92
90 } // namespace webrtc 93 } // namespace webrtc
91 94
92 #endif // WEBRTC_COMMON_AUDIO_RESAMPLER_INCLUDE_RESAMPLER_H_ 95 #endif // WEBRTC_RESAMPLER_RESAMPLER_H_
OLDNEW
« no previous file with comments | « webrtc/common_audio/real_fourier.h ('k') | webrtc/common_audio/resampler/push_resampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698