downsamling and frame cutting defined in separate functions