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

Side by Side Diff: third_party/WebKit/Source/platform/audio/FFTFrame.h

Issue 2384073002: reflow comments in platform/audio (Closed)
Patch Set: Created 4 years, 2 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 28 matching lines...) Expand all
39 #if OS(MACOSX) 39 #if OS(MACOSX)
40 #include <Accelerate/Accelerate.h> 40 #include <Accelerate/Accelerate.h>
41 #elif USE(WEBAUDIO_OPENMAX_DL_FFT) 41 #elif USE(WEBAUDIO_OPENMAX_DL_FFT)
42 #include <dl/sp/api/omxSP.h> 42 #include <dl/sp/api/omxSP.h>
43 #elif USE(WEBAUDIO_FFMPEG) 43 #elif USE(WEBAUDIO_FFMPEG)
44 struct RDFTContext; 44 struct RDFTContext;
45 #endif 45 #endif
46 46
47 namespace blink { 47 namespace blink {
48 48
49 // Defines the interface for an "FFT frame", an object which is able to perform a forward 49 // Defines the interface for an "FFT frame", an object which is able to perform
50 // and reverse FFT, internally storing the resultant frequency-domain data. 50 // a forward and reverse FFT, internally storing the resultant frequency-domain
51 // data.
51 52
52 class PLATFORM_EXPORT FFTFrame { 53 class PLATFORM_EXPORT FFTFrame {
53 USING_FAST_MALLOC(FFTFrame); 54 USING_FAST_MALLOC(FFTFrame);
54 55
55 public: 56 public:
56 // The constructors, destructor, and methods up to the CROSS-PLATFORM section have platform-dependent implementations. 57 // The constructors, destructor, and methods up to the CROSS-PLATFORM section
58 // have platform-dependent implementations.
57 59
58 FFTFrame(unsigned fftSize); 60 FFTFrame(unsigned fftSize);
59 FFTFrame(); // creates a blank/empty frame for later use with createInterpola tedFrame() 61 // creates a blank/empty frame for later use with createInterpolatedFrame()
62 FFTFrame();
60 FFTFrame(const FFTFrame& frame); 63 FFTFrame(const FFTFrame& frame);
61 ~FFTFrame(); 64 ~FFTFrame();
62 65
63 static void initialize(); 66 static void initialize();
64 static void cleanup(); 67 static void cleanup();
65 void doFFT(const float* data); 68 void doFFT(const float* data);
66 void doInverseFFT(float* data); 69 void doInverseFFT(float* data);
67 70
68 float* realData() const { return const_cast<float*>(m_realData.data()); } 71 float* realData() const { return const_cast<float*>(m_realData.data()); }
69 float* imagData() const { return const_cast<float*>(m_imagData.data()); } 72 float* imagData() const { return const_cast<float*>(m_imagData.data()); }
70 73
71 unsigned fftSize() const { return m_FFTSize; } 74 unsigned fftSize() const { return m_FFTSize; }
72 unsigned log2FFTSize() const { return m_log2FFTSize; } 75 unsigned log2FFTSize() const { return m_log2FFTSize; }
73 76
74 // CROSS-PLATFORM 77 // CROSS-PLATFORM
75 // The remaining public methods have cross-platform implementations: 78 // The remaining public methods have cross-platform implementations:
76 79
77 // Interpolates from frame1 -> frame2 as x goes from 0.0 -> 1.0 80 // Interpolates from frame1 -> frame2 as x goes from 0.0 -> 1.0
78 static std::unique_ptr<FFTFrame> createInterpolatedFrame( 81 static std::unique_ptr<FFTFrame> createInterpolatedFrame(
79 const FFTFrame& frame1, 82 const FFTFrame& frame1,
80 const FFTFrame& frame2, 83 const FFTFrame& frame2,
81 double x); 84 double x);
82 void doPaddedFFT(const float* data, 85 // zero-padding with dataSize <= fftSize
83 size_t dataSize); // zero-padding with dataSize <= fftSize 86 void doPaddedFFT(const float* data, size_t dataSize);
84 double extractAverageGroupDelay(); 87 double extractAverageGroupDelay();
85 void addConstantGroupDelay(double sampleFrameDelay); 88 void addConstantGroupDelay(double sampleFrameDelay);
86 void multiply( 89 // multiplies ourself with frame : effectively operator*=()
87 const FFTFrame&); // multiplies ourself with frame : effectively operator *=() 90 void multiply(const FFTFrame&);
88 91
89 private: 92 private:
90 void interpolateFrequencyComponents(const FFTFrame& frame1, 93 void interpolateFrequencyComponents(const FFTFrame& frame1,
91 const FFTFrame& frame2, 94 const FFTFrame& frame2,
92 double x); 95 double x);
93 96
94 unsigned m_FFTSize; 97 unsigned m_FFTSize;
95 unsigned m_log2FFTSize; 98 unsigned m_log2FFTSize;
96 AudioFloatArray m_realData; 99 AudioFloatArray m_realData;
97 AudioFloatArray m_imagData; 100 AudioFloatArray m_imagData;
(...skipping 15 matching lines...) Expand all
113 static OMXFFTSpec_R_F32* contextForSize(unsigned log2FFTSize); 116 static OMXFFTSpec_R_F32* contextForSize(unsigned log2FFTSize);
114 OMXFFTSpec_R_F32* m_forwardContext; 117 OMXFFTSpec_R_F32* m_forwardContext;
115 OMXFFTSpec_R_F32* m_inverseContext; 118 OMXFFTSpec_R_F32* m_inverseContext;
116 AudioFloatArray m_complexData; 119 AudioFloatArray m_complexData;
117 #endif 120 #endif
118 }; 121 };
119 122
120 } // namespace blink 123 } // namespace blink
121 124
122 #endif // FFTFrame_h 125 #endif // FFTFrame_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698