Based on a somewhat similar idea in FFmpeg's swscale.
Attach a file by drag & drop or click to upload