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

Side by Side Diff: Source/core/platform/audio/FFTFrame.cpp

Issue 13973026: remove memoryinstrumentation Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove the rest part of MemoryInstrumentation Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/platform/audio/FFTFrame.h ('k') | Source/core/platform/audio/HRTFDatabase.h » ('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) 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 19 matching lines...) Expand all
30 30
31 #if ENABLE(WEB_AUDIO) 31 #if ENABLE(WEB_AUDIO)
32 32
33 #include "FFTFrame.h" 33 #include "FFTFrame.h"
34 34
35 #ifndef NDEBUG 35 #ifndef NDEBUG
36 #include <stdio.h> 36 #include <stdio.h>
37 #endif 37 #endif
38 38
39 #include "Logging.h" 39 #include "Logging.h"
40 #include "PlatformMemoryInstrumentation.h"
41 #include <wtf/Complex.h> 40 #include <wtf/Complex.h>
42 #include <wtf/MathExtras.h> 41 #include <wtf/MathExtras.h>
43 #include <wtf/MemoryObjectInfo.h>
44 #include <wtf/OwnPtr.h> 42 #include <wtf/OwnPtr.h>
45 43
46 #if !USE_ACCELERATE_FFT && USE(WEBAUDIO_FFMPEG)
47 void reportMemoryUsage(const RDFTContext* const&, WTF::MemoryObjectInfo*);
48 #endif // USE(WEBAUDIO_FFMPEG)
49
50 namespace WebCore { 44 namespace WebCore {
51 45
52 void FFTFrame::doPaddedFFT(const float* data, size_t dataSize) 46 void FFTFrame::doPaddedFFT(const float* data, size_t dataSize)
53 { 47 {
54 // Zero-pad the impulse response 48 // Zero-pad the impulse response
55 AudioFloatArray paddedResponse(fftSize()); // zero-initialized 49 AudioFloatArray paddedResponse(fftSize()); // zero-initialized
56 paddedResponse.copyToRange(data, 0, dataSize); 50 paddedResponse.copyToRange(data, 0, dataSize);
57 51
58 // Get the frequency-domain version of padded response 52 // Get the frequency-domain version of padded response
59 doFFT(paddedResponse.data()); 53 doFFT(paddedResponse.data());
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 241
248 phase += i * phaseAdj; 242 phase += i * phaseAdj;
249 243
250 Complex c2 = complexFromMagnitudePhase(mag, phase); 244 Complex c2 = complexFromMagnitudePhase(mag, phase);
251 245
252 realP[i] = static_cast<float>(c2.real()); 246 realP[i] = static_cast<float>(c2.real());
253 imagP[i] = static_cast<float>(c2.imag()); 247 imagP[i] = static_cast<float>(c2.imag());
254 } 248 }
255 } 249 }
256 250
257 void FFTFrame::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
258 {
259 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::AudioShare dData);
260 #if USE_ACCELERATE_FFT
261 info.addMember(m_frame, "frame");
262 info.addMember(m_realData, "realData");
263 info.addMember(m_imagData, "imagData");
264 #else // !USE_ACCELERATE_FFT
265
266 #if USE(WEBAUDIO_MKL)
267 info.addMember(m_handle, "handle");
268 info.addMember(m_complexData, "complexData");
269 info.addMember(m_realData, "realData");
270 info.addMember(m_imagData, "imagData");
271 #endif // USE(WEBAUDIO_MKL)
272
273 #if USE(WEBAUDIO_FFMPEG)
274 info.addMember(m_forwardContext, "forwardContext");
275 info.addMember(m_inverseContext, "inverseContext");
276 info.addMember(m_complexData, "complexData");
277 info.addMember(m_realData, "realData");
278 info.addMember(m_imagData, "imagData");
279 #endif // USE(WEBAUDIO_FFMPEG)
280
281 #if USE(WEBAUDIO_IPP)
282 int size = 0;
283 ippsDFTGetBufSize_R_32f(m_DFTSpec, &size);
284 info.addRawBuffer(m_buffer, size * sizeof(Ipp8u), "buffer");
285 ippsDFTGetSize_R_32f(m_FFTSize, IPP_FFT_NODIV_BY_ANY, ippAlgHintFast, &size, 0, 0);
286 info.addRawBuffer(m_DFTSpec, size, "DFTSpec");
287 info.addMember(m_complexData, "complexData");
288 info.addMember(m_realData, "realData");
289 info.addMember(m_imagData, "imagData");
290 #endif // USE(WEBAUDIO_IPP)
291
292 #endif // !USE_ACCELERATE_FFT
293 }
294
295 #ifndef NDEBUG 251 #ifndef NDEBUG
296 void FFTFrame::print() 252 void FFTFrame::print()
297 { 253 {
298 FFTFrame& frame = *this; 254 FFTFrame& frame = *this;
299 float* realP = frame.realData(); 255 float* realP = frame.realData();
300 float* imagP = frame.imagData(); 256 float* imagP = frame.imagData();
301 LOG(WebAudio, "**** \n"); 257 LOG(WebAudio, "**** \n");
302 LOG(WebAudio, "DC = %f : nyquist = %f\n", realP[0], imagP[0]); 258 LOG(WebAudio, "DC = %f : nyquist = %f\n", realP[0], imagP[0]);
303 259
304 int n = m_FFTSize / 2; 260 int n = m_FFTSize / 2;
305 261
306 for (int i = 1; i < n; i++) { 262 for (int i = 1; i < n; i++) {
307 double mag = sqrt(realP[i] * realP[i] + imagP[i] * imagP[i]); 263 double mag = sqrt(realP[i] * realP[i] + imagP[i] * imagP[i]);
308 double phase = atan2(realP[i], imagP[i]); 264 double phase = atan2(realP[i], imagP[i]);
309 265
310 LOG(WebAudio, "[%d] (%f %f)\n", i, mag, phase); 266 LOG(WebAudio, "[%d] (%f %f)\n", i, mag, phase);
311 } 267 }
312 LOG(WebAudio, "****\n"); 268 LOG(WebAudio, "****\n");
313 } 269 }
314 #endif // NDEBUG 270 #endif // NDEBUG
315 271
316 } // namespace WebCore 272 } // namespace WebCore
317 273
318 #endif // ENABLE(WEB_AUDIO) 274 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/core/platform/audio/FFTFrame.h ('k') | Source/core/platform/audio/HRTFDatabase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698