knockout matting algorithm