Move filter and downsampling to preprocessing.