This article was first published in October 2005. I have copied it over from the wayback archive as at some point this winter I’ll make another batch.
During the course of a PhD there are many ups and downs in activity, emotions, and interest. But this latest lull, two and a half years through the project, has lasted the longest of them all so far.
Over the course of the last couple of years I’ve been gradually building and refining a software framework for the purpose of creating signal processing receiver structures in C++. But as new analysis programs have been built I’ve just copied the files over to start afresh. Improvements to the framework have only really been captured in the absolute latest analysis program. It didn’t make sense to create a standalone library before as the compile-time options vary from analysis program to analysis program.
For an audio processing application I am sampling audio data into a delay line then convolving or cross-correlating in the time domain. For short delay lines it is possible to use the memmove function without having too great an impact on processor time. However, when the delay length increases to several thousand values the processing time required just to append a new sample can have a major impact on the application. I have a requirement to operate in real-time on delay lines of around 8000 values. Looking at the results below we can see how the append operation time varies with delay line length. The Mirrored Delay Line trades processing time for memory, needing double the memory but reducing the append operation time to a constant amount regardless of delay line length.
For a side project involving real-time audio processing I needed a FIFO or Circular Buffer to pass sample data from the microphone sampling thread to the processing thread. The sampling thread happens more often with smaller number of samples to put into the FIFO. The processing thread happens less frequently so requires a faster way to bulk read from the FIFO. The mirroring technique used in this FIFO reduces the bulk read operation to a single memcpy of contiguous memory without worrying about wrap around.