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

Side by Side Diff: webrtc/common_audio/real_fourier.h

Issue 1227203003: Update audio code to use size_t more correctly, webrtc/common_audio/ portion. (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 unified diff | Download patch
« no previous file with comments | « webrtc/common_audio/lapped_transform_unittest.cc ('k') | webrtc/common_audio/real_fourier.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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 21 matching lines...) Expand all
32 // The alignment required for all input and output buffers, in bytes. 32 // The alignment required for all input and output buffers, in bytes.
33 static const int kFftBufferAlignment; 33 static const int kFftBufferAlignment;
34 34
35 // Construct a wrapper instance for the given input order, which must be 35 // Construct a wrapper instance for the given input order, which must be
36 // between 1 and kMaxFftOrder, inclusively. 36 // between 1 and kMaxFftOrder, inclusively.
37 static rtc::scoped_ptr<RealFourier> Create(int fft_order); 37 static rtc::scoped_ptr<RealFourier> Create(int fft_order);
38 virtual ~RealFourier() {}; 38 virtual ~RealFourier() {};
39 39
40 // Helper to compute the smallest FFT order (a power of 2) which will contain 40 // Helper to compute the smallest FFT order (a power of 2) which will contain
41 // the given input length. 41 // the given input length.
42 static int FftOrder(int length); 42 static int FftOrder(size_t length);
43 43
44 // Helper to compute the input length from the FFT order. 44 // Helper to compute the input length from the FFT order.
45 static int FftLength(int order); 45 static size_t FftLength(int order);
46 46
47 // Helper to compute the exact length, in complex floats, of the transform 47 // Helper to compute the exact length, in complex floats, of the transform
48 // output (i.e. |2^order / 2 + 1|). 48 // output (i.e. |2^order / 2 + 1|).
49 static int ComplexLength(int order); 49 static size_t ComplexLength(int order);
50 50
51 // Buffer allocation helpers. The buffers are large enough to hold |count| 51 // Buffer allocation helpers. The buffers are large enough to hold |count|
52 // floats/complexes and suitably aligned for use by the implementation. 52 // floats/complexes and suitably aligned for use by the implementation.
53 // The returned scopers are set up with proper deleters; the caller owns 53 // The returned scopers are set up with proper deleters; the caller owns
54 // the allocated memory. 54 // the allocated memory.
55 static fft_real_scoper AllocRealBuffer(int count); 55 static fft_real_scoper AllocRealBuffer(int count);
56 static fft_cplx_scoper AllocCplxBuffer(int count); 56 static fft_cplx_scoper AllocCplxBuffer(int count);
57 57
58 // Main forward transform interface. The output array need only be big 58 // Main forward transform interface. The output array need only be big
59 // enough for |2^order / 2 + 1| elements - the conjugate pairs are not 59 // enough for |2^order / 2 + 1| elements - the conjugate pairs are not
60 // returned. Input and output must be properly aligned (e.g. through 60 // returned. Input and output must be properly aligned (e.g. through
61 // AllocRealBuffer and AllocCplxBuffer) and input length must be 61 // AllocRealBuffer and AllocCplxBuffer) and input length must be
62 // |2^order| (same as given at construction time). 62 // |2^order| (same as given at construction time).
63 virtual void Forward(const float* src, std::complex<float>* dest) const = 0; 63 virtual void Forward(const float* src, std::complex<float>* dest) const = 0;
64 64
65 // Inverse transform. Same input format as output above, conjugate pairs 65 // Inverse transform. Same input format as output above, conjugate pairs
66 // not needed. 66 // not needed.
67 virtual void Inverse(const std::complex<float>* src, float* dest) const = 0; 67 virtual void Inverse(const std::complex<float>* src, float* dest) const = 0;
68 68
69 virtual int order() const = 0; 69 virtual int order() const = 0;
70 }; 70 };
71 71
72 } // namespace webrtc 72 } // namespace webrtc
73 73
74 #endif // WEBRTC_COMMON_AUDIO_REAL_FOURIER_H_ 74 #endif // WEBRTC_COMMON_AUDIO_REAL_FOURIER_H_
75 75
OLDNEW
« no previous file with comments | « webrtc/common_audio/lapped_transform_unittest.cc ('k') | webrtc/common_audio/real_fourier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698