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 16 matching lines...) Expand all Loading... |
27 // suitable for use on Windows and Linux. | 27 // suitable for use on Windows and Linux. |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 | 30 |
31 #if ENABLE(WEB_AUDIO) | 31 #if ENABLE(WEB_AUDIO) |
32 | 32 |
33 #if USE(WEBAUDIO_FFMPEG) | 33 #if USE(WEBAUDIO_FFMPEG) |
34 | 34 |
35 #include "FFTFrame.h" | 35 #include "FFTFrame.h" |
36 | 36 |
37 #include "PlatformMemoryInstrumentation.h" | |
38 #include "VectorMath.h" | 37 #include "VectorMath.h" |
39 | 38 |
40 extern "C" { | 39 extern "C" { |
41 #include <libavcodec/avfft.h> | 40 #include <libavcodec/avfft.h> |
42 } | 41 } |
43 | 42 |
44 #include <wtf/MathExtras.h> | 43 #include <wtf/MathExtras.h> |
45 | 44 |
46 namespace { | 45 namespace { |
47 | 46 |
(...skipping 26 matching lines...) Expand all Loading... |
74 int inverse; | 73 int inverse; |
75 int signConvention; | 74 int signConvention; |
76 const void* tcos; | 75 const void* tcos; |
77 const void* tsin; | 76 const void* tsin; |
78 FFTContextProxy fft; | 77 FFTContextProxy fft; |
79 void (*rdft_calc)(); | 78 void (*rdft_calc)(); |
80 }; | 79 }; |
81 | 80 |
82 } | 81 } |
83 | 82 |
84 void reportMemoryUsage(const struct RDFTContext* const& object, WTF::MemoryObjec
tInfo* memoryObjectInfo) | |
85 { | |
86 const RDFTContextProxy* proxyObject = reinterpret_cast<const RDFTContextProx
y*>(object); | |
87 | |
88 WTF::MemoryClassInfo info(memoryObjectInfo, proxyObject, 0, sizeof(RDFTConte
xtProxy)); | |
89 | |
90 // The size of buffers is counted the same way as it is counted in ff_rdft_i
nit && ff_fft_init. | |
91 size_t count = 1 << (proxyObject->nbits - 1); | |
92 info.addRawBuffer(proxyObject->fft.revtab, count * sizeof(uint16_t), "FFTBuf
fer", "revtab"); | |
93 info.addRawBuffer(proxyObject->fft.tmpBuf, count * sizeof(FFTComplex), "FFTB
uffer", "tmpBuf"); | |
94 } | |
95 | |
96 namespace WebCore { | 83 namespace WebCore { |
97 | 84 |
98 const int kMaxFFTPow2Size = 24; | 85 const int kMaxFFTPow2Size = 24; |
99 | 86 |
100 // Normal constructor: allocates for a given fftSize. | 87 // Normal constructor: allocates for a given fftSize. |
101 FFTFrame::FFTFrame(unsigned fftSize) | 88 FFTFrame::FFTFrame(unsigned fftSize) |
102 : m_FFTSize(fftSize) | 89 : m_FFTSize(fftSize) |
103 , m_log2FFTSize(static_cast<unsigned>(log2(fftSize))) | 90 , m_log2FFTSize(static_cast<unsigned>(log2(fftSize))) |
104 , m_forwardContext(0) | 91 , m_forwardContext(0) |
105 , m_inverseContext(0) | 92 , m_inverseContext(0) |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 244 |
258 RDFTContext* context = av_rdft_init(pow2size, (RDFTransformType)trans); | 245 RDFTContext* context = av_rdft_init(pow2size, (RDFTransformType)trans); |
259 return context; | 246 return context; |
260 } | 247 } |
261 | 248 |
262 } // namespace WebCore | 249 } // namespace WebCore |
263 | 250 |
264 #endif // !OS(DARWIN) && USE(WEBAUDIO_FFMPEG) | 251 #endif // !OS(DARWIN) && USE(WEBAUDIO_FFMPEG) |
265 | 252 |
266 #endif // ENABLE(WEB_AUDIO) | 253 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |