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

Side by Side Diff: third_party/WebKit/Source/platform/audio/SincResampler.h

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
OLDNEW
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 28 matching lines...) Expand all
39 39
40 // SincResampler is a high-quality sample-rate converter. 40 // SincResampler is a high-quality sample-rate converter.
41 41
42 class PLATFORM_EXPORT SincResampler { 42 class PLATFORM_EXPORT SincResampler {
43 USING_FAST_MALLOC(SincResampler); 43 USING_FAST_MALLOC(SincResampler);
44 WTF_MAKE_NONCOPYABLE(SincResampler); 44 WTF_MAKE_NONCOPYABLE(SincResampler);
45 45
46 public: 46 public:
47 // scaleFactor == sourceSampleRate / destinationSampleRate 47 // scaleFactor == sourceSampleRate / destinationSampleRate
48 // kernelSize can be adjusted for quality (higher is better) 48 // kernelSize can be adjusted for quality (higher is better)
49 // numberOfKernelOffsets is used for interpolation and is the number of sub-sa mple kernel shifts. 49 // numberOfKernelOffsets is used for interpolation and is the number of
50 // sub-sample kernel shifts.
50 SincResampler(double scaleFactor, 51 SincResampler(double scaleFactor,
51 unsigned kernelSize = 32, 52 unsigned kernelSize = 32,
52 unsigned numberOfKernelOffsets = 32); 53 unsigned numberOfKernelOffsets = 32);
53 54
54 // Processes numberOfSourceFrames from source to produce numberOfSourceFrames / scaleFactor frames in destination. 55 // Processes numberOfSourceFrames from source to produce numberOfSourceFrames
56 // / scaleFactor frames in destination.
55 void process(const float* source, 57 void process(const float* source,
56 float* destination, 58 float* destination,
57 unsigned numberOfSourceFrames); 59 unsigned numberOfSourceFrames);
58 60
59 // Process with input source callback function for streaming applications. 61 // Process with input source callback function for streaming applications.
60 void process(AudioSourceProvider*, 62 void process(AudioSourceProvider*,
61 float* destination, 63 float* destination,
62 size_t framesToProcess); 64 size_t framesToProcess);
63 65
64 protected: 66 protected:
65 void initializeKernel(); 67 void initializeKernel();
66 void consumeSource(float* buffer, unsigned numberOfSourceFrames); 68 void consumeSource(float* buffer, unsigned numberOfSourceFrames);
67 69
68 double m_scaleFactor; 70 double m_scaleFactor;
69 unsigned m_kernelSize; 71 unsigned m_kernelSize;
70 unsigned m_numberOfKernelOffsets; 72 unsigned m_numberOfKernelOffsets;
71 73
72 // m_kernelStorage has m_numberOfKernelOffsets kernels back-to-back, each of s ize m_kernelSize. 74 // m_kernelStorage has m_numberOfKernelOffsets kernels back-to-back, each of
73 // The kernel offsets are sub-sample shifts of a windowed sinc() shifted from 0.0 to 1.0 sample. 75 // size m_kernelSize. The kernel offsets are sub-sample shifts of a windowed
76 // sinc() shifted from 0.0 to 1.0 sample.
74 AudioFloatArray m_kernelStorage; 77 AudioFloatArray m_kernelStorage;
75 78
76 // m_virtualSourceIndex is an index on the source input buffer with sub-sample precision. 79 // m_virtualSourceIndex is an index on the source input buffer with sub-sample
77 // It must be double precision to avoid drift. 80 // precision. It must be double precision to avoid drift.
78 double m_virtualSourceIndex; 81 double m_virtualSourceIndex;
79 82
80 // This is the number of destination frames we generate per processing pass on the buffer. 83 // This is the number of destination frames we generate per processing pass on
84 // the buffer.
81 unsigned m_blockSize; 85 unsigned m_blockSize;
82 86
83 // Source is copied into this buffer for each processing pass. 87 // Source is copied into this buffer for each processing pass.
84 AudioFloatArray m_inputBuffer; 88 AudioFloatArray m_inputBuffer;
85 89
86 const float* m_source; 90 const float* m_source;
87 unsigned m_sourceFramesAvailable; 91 unsigned m_sourceFramesAvailable;
88 92
89 // m_sourceProvider is used to provide the audio input stream to the resampler . 93 // m_sourceProvider is used to provide the audio input stream to the
94 // resampler.
90 AudioSourceProvider* m_sourceProvider; 95 AudioSourceProvider* m_sourceProvider;
91 96
92 // The buffer is primed once at the very beginning of processing. 97 // The buffer is primed once at the very beginning of processing.
93 bool m_isBufferPrimed; 98 bool m_isBufferPrimed;
94 }; 99 };
95 100
96 } // namespace blink 101 } // namespace blink
97 102
98 #endif // SincResampler_h 103 #endif // SincResampler_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698