| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // | 62 // |
| 63 // 1) Consume input frames into r0 (r1 is zero-initialized). | 63 // 1) Consume input frames into r0 (r1 is zero-initialized). |
| 64 // 2) Position kernel centered at start of r0 (r2) and generate output frames un
til kernel is centered at start of r4. | 64 // 2) Position kernel centered at start of r0 (r2) and generate output frames un
til kernel is centered at start of r4. |
| 65 // or we've finished generating all the output frames. | 65 // or we've finished generating all the output frames. |
| 66 // 3) Copy r3 to r1 and r4 to r2. | 66 // 3) Copy r3 to r1 and r4 to r2. |
| 67 // 4) Consume input frames into r5 (zero-pad if we run out of input). | 67 // 4) Consume input frames into r5 (zero-pad if we run out of input). |
| 68 // 5) Goto (2) until all of input is consumed. | 68 // 5) Goto (2) until all of input is consumed. |
| 69 // | 69 // |
| 70 // note: we're glossing over how the sub-sample handling works with m_virtualSou
rceIndex, etc. | 70 // note: we're glossing over how the sub-sample handling works with m_virtualSou
rceIndex, etc. |
| 71 | 71 |
| 72 namespace WebCore { | 72 namespace blink { |
| 73 | 73 |
| 74 SincResampler::SincResampler(double scaleFactor, unsigned kernelSize, unsigned n
umberOfKernelOffsets) | 74 SincResampler::SincResampler(double scaleFactor, unsigned kernelSize, unsigned n
umberOfKernelOffsets) |
| 75 : m_scaleFactor(scaleFactor) | 75 : m_scaleFactor(scaleFactor) |
| 76 , m_kernelSize(kernelSize) | 76 , m_kernelSize(kernelSize) |
| 77 , m_numberOfKernelOffsets(numberOfKernelOffsets) | 77 , m_numberOfKernelOffsets(numberOfKernelOffsets) |
| 78 , m_kernelStorage(m_kernelSize * (m_numberOfKernelOffsets + 1)) | 78 , m_kernelStorage(m_kernelSize * (m_numberOfKernelOffsets + 1)) |
| 79 , m_virtualSourceIndex(0) | 79 , m_virtualSourceIndex(0) |
| 80 , m_blockSize(512) | 80 , m_blockSize(512) |
| 81 , m_inputBuffer(m_blockSize + m_kernelSize) // See input buffer layout above
. | 81 , m_inputBuffer(m_blockSize + m_kernelSize) // See input buffer layout above
. |
| 82 , m_source(0) | 82 , m_source(0) |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 // This wraps the last input frames back to the start of the buffer. | 463 // This wraps the last input frames back to the start of the buffer. |
| 464 memcpy(r1, r3, sizeof(float) * (m_kernelSize / 2)); | 464 memcpy(r1, r3, sizeof(float) * (m_kernelSize / 2)); |
| 465 memcpy(r2, r4, sizeof(float) * (m_kernelSize / 2)); | 465 memcpy(r2, r4, sizeof(float) * (m_kernelSize / 2)); |
| 466 | 466 |
| 467 // Step (4) | 467 // Step (4) |
| 468 // Refresh the buffer with more input. | 468 // Refresh the buffer with more input. |
| 469 consumeSource(r5, m_blockSize); | 469 consumeSource(r5, m_blockSize); |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 | 472 |
| 473 } // namespace WebCore | 473 } // namespace blink |
| 474 | 474 |
| 475 #endif // ENABLE(WEB_AUDIO) | 475 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |