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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 SincResampler::SincResampler(double scaleFactor, | 69 SincResampler::SincResampler(double scaleFactor, |
70 unsigned kernelSize, | 70 unsigned kernelSize, |
71 unsigned numberOfKernelOffsets) | 71 unsigned numberOfKernelOffsets) |
72 : m_scaleFactor(scaleFactor), | 72 : m_scaleFactor(scaleFactor), |
73 m_kernelSize(kernelSize), | 73 m_kernelSize(kernelSize), |
74 m_numberOfKernelOffsets(numberOfKernelOffsets), | 74 m_numberOfKernelOffsets(numberOfKernelOffsets), |
75 m_kernelStorage(m_kernelSize * (m_numberOfKernelOffsets + 1)), | 75 m_kernelStorage(m_kernelSize * (m_numberOfKernelOffsets + 1)), |
76 m_virtualSourceIndex(0), | 76 m_virtualSourceIndex(0), |
77 m_blockSize(512), | 77 m_blockSize(512), |
78 m_inputBuffer(m_blockSize + | 78 // See input buffer layout above. |
79 m_kernelSize) // See input buffer layout above. | 79 m_inputBuffer(m_blockSize + m_kernelSize), |
80 , | |
81 m_source(nullptr), | 80 m_source(nullptr), |
82 m_sourceFramesAvailable(0), | 81 m_sourceFramesAvailable(0), |
83 m_sourceProvider(nullptr), | 82 m_sourceProvider(nullptr), |
84 m_isBufferPrimed(false) { | 83 m_isBufferPrimed(false) { |
85 initializeKernel(); | 84 initializeKernel(); |
86 } | 85 } |
87 | 86 |
88 void SincResampler::initializeKernel() { | 87 void SincResampler::initializeKernel() { |
89 // Blackman window parameters. | 88 // Blackman window parameters. |
90 double alpha = 0.16; | 89 double alpha = 0.16; |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 memcpy(r1, r3, sizeof(float) * (m_kernelSize / 2)); | 474 memcpy(r1, r3, sizeof(float) * (m_kernelSize / 2)); |
476 memcpy(r2, r4, sizeof(float) * (m_kernelSize / 2)); | 475 memcpy(r2, r4, sizeof(float) * (m_kernelSize / 2)); |
477 | 476 |
478 // Step (4) | 477 // Step (4) |
479 // Refresh the buffer with more input. | 478 // Refresh the buffer with more input. |
480 consumeSource(r5, m_blockSize); | 479 consumeSource(r5, m_blockSize); |
481 } | 480 } |
482 } | 481 } |
483 | 482 |
484 } // namespace blink | 483 } // namespace blink |
OLD | NEW |