fn clip(v: i32) -> u8
Expand description
This function has been rewritten to encourage auto-vectorization.
Based on src/dsp/yuv.h from the libwebp source.
const YUV_FIX2: i32 = 6;
const YUV_MASK2: i32 = (256 << YUV_FIX2) - 1;
fn clip(v: i32) -> u8 {
if (v & !YUV_MASK2) == 0 {
(v >> YUV_FIX2) as u8
} else if v < 0 {
0
} else {
255
}
}