added some utility classes for up/downsampling. TO be finished / optimized.