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

Side by Side Diff: third_party/WebKit/Source/platform/audio/mac/FFTFrameMac.cpp

Issue 2384073002: reflow comments in platform/audio (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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 | « third_party/WebKit/Source/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp ('k') | no next file » | 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Copy/setup frame data 83 // Copy/setup frame data
84 unsigned nbytes = sizeof(float) * m_FFTSize; 84 unsigned nbytes = sizeof(float) * m_FFTSize;
85 memcpy(realData(), frame.m_frame.realp, nbytes); 85 memcpy(realData(), frame.m_frame.realp, nbytes);
86 memcpy(imagData(), frame.m_frame.imagp, nbytes); 86 memcpy(imagData(), frame.m_frame.imagp, nbytes);
87 } 87 }
88 88
89 FFTFrame::~FFTFrame() {} 89 FFTFrame::~FFTFrame() {}
90 90
91 void FFTFrame::doFFT(const float* data) { 91 void FFTFrame::doFFT(const float* data) {
92 AudioFloatArray scaledData(m_FFTSize); 92 AudioFloatArray scaledData(m_FFTSize);
93 // veclib fft returns a result that is twice as large as would be expected. Co mpensate for that 93 // veclib fft returns a result that is twice as large as would be expected.
94 // by scaling the input by half so the FFT has the correct scaling. 94 // Compensate for that by scaling the input by half so the FFT has the
95 // correct scaling.
95 float scale = 0.5f; 96 float scale = 0.5f;
96 VectorMath::vsmul(data, 1, &scale, scaledData.data(), 1, m_FFTSize); 97 VectorMath::vsmul(data, 1, &scale, scaledData.data(), 1, m_FFTSize);
97 98
98 vDSP_ctoz((DSPComplex*)scaledData.data(), 2, &m_frame, 1, m_FFTSize / 2); 99 vDSP_ctoz((DSPComplex*)scaledData.data(), 2, &m_frame, 1, m_FFTSize / 2);
99 vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_FORWARD); 100 vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_FORWARD);
100 } 101 }
101 102
102 void FFTFrame::doInverseFFT(float* data) { 103 void FFTFrame::doInverseFFT(float* data) {
103 vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_INVERSE); 104 vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_INVERSE);
104 vDSP_ztoc(&m_frame, 1, (DSPComplex*)data, 2, m_FFTSize / 2); 105 vDSP_ztoc(&m_frame, 1, (DSPComplex*)data, 2, m_FFTSize / 2);
(...skipping 28 matching lines...) Expand all
133 vDSP_destroy_fftsetup(fftSetups[i]); 134 vDSP_destroy_fftsetup(fftSetups[i]);
134 } 135 }
135 136
136 free(fftSetups); 137 free(fftSetups);
137 fftSetups = nullptr; 138 fftSetups = nullptr;
138 } 139 }
139 140
140 } // namespace blink 141 } // namespace blink
141 142
142 #endif // #if OS(MACOSX) 143 #endif // #if OS(MACOSX)
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698