change all the occurrences of "FFMIN(FFMAX())" to clip_uint8() or clip()