OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void FFTFrame::cleanup() | 100 void FFTFrame::cleanup() |
101 { | 101 { |
102 } | 102 } |
103 | 103 |
104 FFTFrame::~FFTFrame() | 104 FFTFrame::~FFTFrame() |
105 { | 105 { |
106 av_rdft_end(m_forwardContext); | 106 av_rdft_end(m_forwardContext); |
107 av_rdft_end(m_inverseContext); | 107 av_rdft_end(m_inverseContext); |
108 } | 108 } |
109 | 109 |
110 void FFTFrame::multiply(const FFTFrame& frame) | |
111 { | |
112 FFTFrame& frame1 = *this; | |
113 FFTFrame& frame2 = const_cast<FFTFrame&>(frame); | |
114 | |
115 float* realP1 = frame1.realData(); | |
116 float* imagP1 = frame1.imagData(); | |
117 const float* realP2 = frame2.realData(); | |
118 const float* imagP2 = frame2.imagData(); | |
119 | |
120 unsigned halfSize = fftSize() / 2; | |
121 float real0 = realP1[0]; | |
122 float imag0 = imagP1[0]; | |
123 | |
124 VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize); | |
125 | |
126 // Multiply the packed DC/nyquist component | |
127 realP1[0] = real0 * realP2[0]; | |
128 imagP1[0] = imag0 * imagP2[0]; | |
129 } | |
130 | |
131 #if OS(WIN) | 110 #if OS(WIN) |
132 // On Windows, the following pragmas are equivalent to compiling the code with /
fp:fast. The | 111 // On Windows, the following pragmas are equivalent to compiling the code with /
fp:fast. The |
133 // following code does not need precise FP semantics, and speed is critical here
. See | 112 // following code does not need precise FP semantics, and speed is critical here
. See |
134 // crbug.com/316740 and crrev.com/116823002. | 113 // crbug.com/316740 and crrev.com/116823002. |
135 #pragma float_control(except, off, push) | 114 #pragma float_control(except, off, push) |
136 #pragma float_control(precise, off, push) | 115 #pragma float_control(precise, off, push) |
137 #pragma fp_contract(on) | 116 #pragma fp_contract(on) |
138 #pragma fenv_access(off) | 117 #pragma fenv_access(off) |
139 #endif | 118 #endif |
140 | 119 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 192 |
214 RDFTContext* context = av_rdft_init(pow2size, (RDFTransformType)trans); | 193 RDFTContext* context = av_rdft_init(pow2size, (RDFTransformType)trans); |
215 return context; | 194 return context; |
216 } | 195 } |
217 | 196 |
218 } // namespace WebCore | 197 } // namespace WebCore |
219 | 198 |
220 #endif // USE(WEBAUDIO_FFMPEG) | 199 #endif // USE(WEBAUDIO_FFMPEG) |
221 | 200 |
222 #endif // ENABLE(WEB_AUDIO) | 201 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |