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

Side by Side Diff: Source/platform/audio/HRTFElevation.cpp

Issue 511333002: Removing "using" declarations that import names in the C++ Standard library.(Source/platform/audio) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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/HRTFDatabase.cpp ('k') | Source/platform/audio/HRTFKernel.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 /* 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 21 matching lines...) Expand all
32 32
33 #include "platform/audio/HRTFElevation.h" 33 #include "platform/audio/HRTFElevation.h"
34 34
35 #include <math.h> 35 #include <math.h>
36 #include <algorithm> 36 #include <algorithm>
37 #include "platform/audio/AudioBus.h" 37 #include "platform/audio/AudioBus.h"
38 #include "platform/audio/HRTFPanner.h" 38 #include "platform/audio/HRTFPanner.h"
39 #include "wtf/ThreadingPrimitives.h" 39 #include "wtf/ThreadingPrimitives.h"
40 #include "wtf/text/StringHash.h" 40 #include "wtf/text/StringHash.h"
41 41
42 using namespace std;
43
44 namespace blink { 42 namespace blink {
45 43
46 const unsigned HRTFElevation::AzimuthSpacing = 15; 44 const unsigned HRTFElevation::AzimuthSpacing = 15;
47 const unsigned HRTFElevation::NumberOfRawAzimuths = 360 / AzimuthSpacing; 45 const unsigned HRTFElevation::NumberOfRawAzimuths = 360 / AzimuthSpacing;
48 const unsigned HRTFElevation::InterpolationFactor = 8; 46 const unsigned HRTFElevation::InterpolationFactor = 8;
49 const unsigned HRTFElevation::NumberOfTotalAzimuths = NumberOfRawAzimuths * Inte rpolationFactor; 47 const unsigned HRTFElevation::NumberOfTotalAzimuths = NumberOfRawAzimuths * Inte rpolationFactor;
50 48
51 // Total number of components of an HRTF database. 49 // Total number of components of an HRTF database.
52 const size_t TotalNumberOfResponses = 240; 50 const size_t TotalNumberOfResponses = 240;
53 51
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 return nullptr; 240 return nullptr;
243 241
244 OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTot alAzimuths)); 242 OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTot alAzimuths));
245 OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTot alAzimuths)); 243 OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTot alAzimuths));
246 244
247 // Load convolution kernels from HRTF files. 245 // Load convolution kernels from HRTF files.
248 int interpolatedIndex = 0; 246 int interpolatedIndex = 0;
249 for (unsigned rawIndex = 0; rawIndex < NumberOfRawAzimuths; ++rawIndex) { 247 for (unsigned rawIndex = 0; rawIndex < NumberOfRawAzimuths; ++rawIndex) {
250 // Don't let elevation exceed maximum for this azimuth. 248 // Don't let elevation exceed maximum for this azimuth.
251 int maxElevation = maxElevations[rawIndex]; 249 int maxElevation = maxElevations[rawIndex];
252 int actualElevation = min(elevation, maxElevation); 250 int actualElevation = std::min(elevation, maxElevation);
253 251
254 bool success = calculateKernelsForAzimuthElevation(rawIndex * AzimuthSpa cing, actualElevation, sampleRate, subjectName, kernelListL->at(interpolatedInde x), kernelListR->at(interpolatedIndex)); 252 bool success = calculateKernelsForAzimuthElevation(rawIndex * AzimuthSpa cing, actualElevation, sampleRate, subjectName, kernelListL->at(interpolatedInde x), kernelListR->at(interpolatedIndex));
255 if (!success) 253 if (!success)
256 return nullptr; 254 return nullptr;
257 255
258 interpolatedIndex += InterpolationFactor; 256 interpolatedIndex += InterpolationFactor;
259 } 257 }
260 258
261 // Now go back and interpolate intermediate azimuth values. 259 // Now go back and interpolate intermediate azimuth values.
262 for (unsigned i = 0; i < NumberOfTotalAzimuths; i += InterpolationFactor) { 260 for (unsigned i = 0; i < NumberOfTotalAzimuths; i += InterpolationFactor) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay(); 331 double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay();
334 332
335 // Linearly interpolate delays. 333 // Linearly interpolate delays.
336 frameDelayL = (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay 2L; 334 frameDelayL = (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay 2L;
337 frameDelayR = (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay 2R; 335 frameDelayR = (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay 2R;
338 } 336 }
339 337
340 } // namespace blink 338 } // namespace blink
341 339
342 #endif // ENABLE(WEB_AUDIO) 340 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/platform/audio/HRTFDatabase.cpp ('k') | Source/platform/audio/HRTFKernel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698