Make TV-L1 rescaling flexible and add median filtering [with GPU and test updates]

For https://github.com/Itseez/opencv/pull/724