pat8901 / aptdemod

Lightweight Automatic Picture Transmission (APT) radio signal decoder for NOAA weather satellites
GNU General Public License v3.0
0 stars 0 forks source link

In "am_demodulate()" current implementation for shifting 2400hz down to 0hz may be inefficient #15

Open pat8901 opened 1 week ago

pat8901 commented 1 week ago

Problem

Current implementation runs in O(n*k) time. Each element in the buffer is moved down an index one by one.

Solution

It could be possible to use a ring buffer. Instead of shifting every element down by one continuously, just change where the front and rear pointers point to. This will effectively give the illusion of shifting all the elements. This process could run in O(1) time.