| 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 24 matching lines...) Expand all Loading... |
| 35 #include "platform/audio/FFTFrame.h" | 35 #include "platform/audio/FFTFrame.h" |
| 36 | 36 |
| 37 #include "platform/audio/VectorMath.h" | 37 #include "platform/audio/VectorMath.h" |
| 38 | 38 |
| 39 extern "C" { | 39 extern "C" { |
| 40 #include <libavcodec/avfft.h> | 40 #include <libavcodec/avfft.h> |
| 41 } | 41 } |
| 42 | 42 |
| 43 #include "wtf/MathExtras.h" | 43 #include "wtf/MathExtras.h" |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace blink { |
| 46 | 46 |
| 47 #if ENABLE(ASSERT) | 47 #if ENABLE(ASSERT) |
| 48 const int kMaxFFTPow2Size = 24; | 48 const int kMaxFFTPow2Size = 24; |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 // Normal constructor: allocates for a given fftSize. | 51 // Normal constructor: allocates for a given fftSize. |
| 52 FFTFrame::FFTFrame(unsigned fftSize) | 52 FFTFrame::FFTFrame(unsigned fftSize) |
| 53 : m_FFTSize(fftSize) | 53 : m_FFTSize(fftSize) |
| 54 , m_log2FFTSize(static_cast<unsigned>(log2(fftSize))) | 54 , m_log2FFTSize(static_cast<unsigned>(log2(fftSize))) |
| 55 , m_forwardContext(0) | 55 , m_forwardContext(0) |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // But FFmpeg's RDFT uses a scratch buffer inside the context and so they ar
e not thread-safe. | 177 // But FFmpeg's RDFT uses a scratch buffer inside the context and so they ar
e not thread-safe. |
| 178 // We could improve this by sharing the FFTFrames on a per-thread basis. | 178 // We could improve this by sharing the FFTFrames on a per-thread basis. |
| 179 ASSERT(fftSize); | 179 ASSERT(fftSize); |
| 180 int pow2size = static_cast<int>(log2(fftSize)); | 180 int pow2size = static_cast<int>(log2(fftSize)); |
| 181 ASSERT(pow2size < kMaxFFTPow2Size); | 181 ASSERT(pow2size < kMaxFFTPow2Size); |
| 182 | 182 |
| 183 RDFTContext* context = av_rdft_init(pow2size, (RDFTransformType)trans); | 183 RDFTContext* context = av_rdft_init(pow2size, (RDFTransformType)trans); |
| 184 return context; | 184 return context; |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace WebCore | 187 } // namespace blink |
| 188 | 188 |
| 189 #endif // USE(WEBAUDIO_FFMPEG) | 189 #endif // USE(WEBAUDIO_FFMPEG) |
| 190 | 190 |
| 191 #endif // ENABLE(WEB_AUDIO) | 191 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |