@Bach: Looks very good - I don't have any sources to test on myself - but they'll probably turn up.
Potential problems:
- Don't assume pitches are the same for all frames. Your findanchor loop assumes that pitch is the same for all the frames it recieves. This may however not be the case. So store the pitch along with the pointers to avoid any potential problems here.
Optimizations for your FindAnchor loop:
- Instead of /2 and /8, use bitshifting (>>1 and >>3 respectively). You cannot trust the compiler to do this as you work on signed ints. It is much faster - especially in inner loops. This can however only be used when the divisor is a power of 2. A clever compiler might however see that the entire line is a constant within the loop, and therefore calculate it before it enters the loop. However you should probably do this manually just to be sure.
- Instead of %8, use &7. Again much faster. Again only valid for divisors that are multiple of 2.