OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 FFTFrame(unsigned fftSize); | 60 FFTFrame(unsigned fftSize); |
61 FFTFrame(); // creates a blank/empty frame for later use with createInterpol
atedFrame() | 61 FFTFrame(); // creates a blank/empty frame for later use with createInterpol
atedFrame() |
62 FFTFrame(const FFTFrame& frame); | 62 FFTFrame(const FFTFrame& frame); |
63 ~FFTFrame(); | 63 ~FFTFrame(); |
64 | 64 |
65 static void initialize(); | 65 static void initialize(); |
66 static void cleanup(); | 66 static void cleanup(); |
67 void doFFT(const float* data); | 67 void doFFT(const float* data); |
68 void doInverseFFT(float* data); | 68 void doInverseFFT(float* data); |
69 void multiply(const FFTFrame& frame); // multiplies ourself with frame : eff
ectively operator*=() | |
70 | 69 |
71 float* realData() const; | 70 float* realData() const; |
72 float* imagData() const; | 71 float* imagData() const; |
73 | 72 |
74 void print(); // for debugging | 73 void print(); // for debugging |
75 | 74 |
76 // CROSS-PLATFORM | 75 // CROSS-PLATFORM |
77 // The remaining public methods have cross-platform implementations: | 76 // The remaining public methods have cross-platform implementations: |
78 | 77 |
79 // Interpolates from frame1 -> frame2 as x goes from 0.0 -> 1.0 | 78 // Interpolates from frame1 -> frame2 as x goes from 0.0 -> 1.0 |
80 static PassOwnPtr<FFTFrame> createInterpolatedFrame(const FFTFrame& frame1,
const FFTFrame& frame2, double x); | 79 static PassOwnPtr<FFTFrame> createInterpolatedFrame(const FFTFrame& frame1,
const FFTFrame& frame2, double x); |
81 | 80 |
82 void doPaddedFFT(const float* data, size_t dataSize); // zero-padding with d
ataSize <= fftSize | 81 void doPaddedFFT(const float* data, size_t dataSize); // zero-padding with d
ataSize <= fftSize |
83 double extractAverageGroupDelay(); | 82 double extractAverageGroupDelay(); |
84 void addConstantGroupDelay(double sampleFrameDelay); | 83 void addConstantGroupDelay(double sampleFrameDelay); |
| 84 void multiply(const FFTFrame&); // multiplies ourself with frame : effective
ly operator*=() |
85 | 85 |
86 unsigned fftSize() const { return m_FFTSize; } | 86 unsigned fftSize() const { return m_FFTSize; } |
87 unsigned log2FFTSize() const { return m_log2FFTSize; } | 87 unsigned log2FFTSize() const { return m_log2FFTSize; } |
88 | 88 |
89 private: | 89 private: |
90 unsigned m_FFTSize; | 90 unsigned m_FFTSize; |
91 unsigned m_log2FFTSize; | 91 unsigned m_log2FFTSize; |
92 | 92 |
93 void interpolateFrequencyComponents(const FFTFrame& frame1, const FFTFrame&
frame2, double x); | 93 void interpolateFrequencyComponents(const FFTFrame& frame1, const FFTFrame&
frame2, double x); |
94 | 94 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 AudioFloatArray m_realData; | 139 AudioFloatArray m_realData; |
140 AudioFloatArray m_imagData; | 140 AudioFloatArray m_imagData; |
141 #endif | 141 #endif |
142 | 142 |
143 #endif // !OS(MACOSX) | 143 #endif // !OS(MACOSX) |
144 }; | 144 }; |
145 | 145 |
146 } // namespace WebCore | 146 } // namespace WebCore |
147 | 147 |
148 #endif // FFTFrame_h | 148 #endif // FFTFrame_h |
OLD | NEW |