I think you could just apply this logic when you output, unless when you use the cache again it starts flipping again, which would be utterly odd.
Unless you deal with a specific case of super high revolution, from one frame to the other it shouldn't spin more than 360 ... I guess. As for the flipping, I can't really tell, could be many things. Maybe other guys will have some points to add as well. Cheers!

