I don't really get the complex approach and the need for the middle. But if you want to put the uC to sleep then you, external filtering might be preferred to wake it up less frequency. Although it might still benefit from software filtering as well. And you don't need the middle and stuff. Just keeping time between a rising and a falling edge and counting them.
Sorry, I don't know what is it that you call 'middle'
So we need to wake up in sync with the middle [...]
if you put that into an algorithm which can detect