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

Side by Side Diff: Source/platform/audio/android/FFTFrameOpenMAXDLAndroid.cpp

Issue 176843021: Remove redundancies of multiply() in FFTFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/platform/audio/FFTFrameStub.cpp ('k') | Source/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (C) 2013 Google Inc. All rights reserved. 1 /* Copyright (C) 2013 Google Inc. All rights reserved.
2 * 2 *
3 * Redistribution and use in source and binary forms, with or without 3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions 4 * modification, are permitted provided that the following conditions
5 * are met: 5 * are met:
6 * 6 *
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 13 matching lines...) Expand all
24 24
25 #include "config.h" 25 #include "config.h"
26 26
27 #if ENABLE(WEB_AUDIO) 27 #if ENABLE(WEB_AUDIO)
28 28
29 #if OS(ANDROID) && USE(WEBAUDIO_OPENMAX_DL_FFT) 29 #if OS(ANDROID) && USE(WEBAUDIO_OPENMAX_DL_FFT)
30 30
31 #include "platform/audio/FFTFrame.h" 31 #include "platform/audio/FFTFrame.h"
32 32
33 #include "platform/audio/AudioArray.h" 33 #include "platform/audio/AudioArray.h"
34 #include "platform/audio/VectorMath.h"
35 #include "wtf/MathExtras.h" 34 #include "wtf/MathExtras.h"
36 #include <dl/sp/api/armSP.h> 35 #include <dl/sp/api/armSP.h>
37 #include <dl/sp/api/omxSP.h> 36 #include <dl/sp/api/omxSP.h>
38 37
39 namespace WebCore { 38 namespace WebCore {
40 39
41 #if !ASSERT_DISABLED 40 #if !ASSERT_DISABLED
42 const unsigned kMaxFFTPow2Size = 15; 41 const unsigned kMaxFFTPow2Size = 15;
43 #endif 42 #endif
44 43
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 95 }
97 96
98 FFTFrame::~FFTFrame() 97 FFTFrame::~FFTFrame()
99 { 98 {
100 if (m_forwardContext) 99 if (m_forwardContext)
101 free(m_forwardContext); 100 free(m_forwardContext);
102 if (m_inverseContext) 101 if (m_inverseContext)
103 free(m_inverseContext); 102 free(m_inverseContext);
104 } 103 }
105 104
106 void FFTFrame::multiply(const FFTFrame& frame)
107 {
108 FFTFrame& frame1 = *this;
109 FFTFrame& frame2 = const_cast<FFTFrame&>(frame);
110
111 float* realP1 = frame1.realData();
112 float* imagP1 = frame1.imagData();
113 const float* realP2 = frame2.realData();
114 const float* imagP2 = frame2.imagData();
115
116 unsigned halfSize = fftSize() / 2;
117 float real0 = realP1[0];
118 float imag0 = imagP1[0];
119
120 VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize);
121
122 // Multiply the packed DC/nyquist component
123 realP1[0] = real0 * realP2[0];
124 imagP1[0] = imag0 * imagP2[0];
125 }
126
127 void FFTFrame::doFFT(const float* data) 105 void FFTFrame::doFFT(const float* data)
128 { 106 {
129 ASSERT(m_forwardContext); 107 ASSERT(m_forwardContext);
130 108
131 if (m_forwardContext) { 109 if (m_forwardContext) {
132 AudioFloatArray complexFFT(m_FFTSize + 2); 110 AudioFloatArray complexFFT(m_FFTSize + 2);
133 111
134 omxSP_FFTFwd_RToCCS_F32(data, complexFFT.data(), m_forwardContext); 112 omxSP_FFTFwd_RToCCS_F32(data, complexFFT.data(), m_forwardContext);
135 113
136 unsigned len = m_FFTSize / 2; 114 unsigned len = m_FFTSize / 2;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 178 }
201 179
202 return 0; 180 return 0;
203 } 181 }
204 182
205 } // namespace WebCore 183 } // namespace WebCore
206 184
207 #endif // #if OS(ANDROID) && !USE(WEBAUDIO_OPENMAX_DL_FFT) 185 #endif // #if OS(ANDROID) && !USE(WEBAUDIO_OPENMAX_DL_FFT)
208 186
209 #endif // ENABLE(WEB_AUDIO) 187 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/platform/audio/FFTFrameStub.cpp ('k') | Source/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698