We’re rewarding the question askers & reputations are being recalculated! Read more.
2 of 2 added 4 characters in body

You could use the (fast :) ) discrete wavelet transform. The package wavethresh under R will do all the work. Anyway, I like the solution of @James because it is simple and seems to go straigh to the point.