X-Git-Url: https://git.nihav.org/?p=nihav.git;a=blobdiff_plain;f=nihav-core%2Fsrc%2Fscale%2Fcolorcvt.rs;h=d29b2343bf5398b0270bba663630bd29935a882c;hp=efe3ebc69814fe5ddfe03c1d9e81e4e5a1c4388a;hb=e243ceb4d694cc08767ad70027bb6963f4cefea3;hpb=250c49f64633580d3e294a7b871fad4618694209 diff --git a/nihav-core/src/scale/colorcvt.rs b/nihav-core/src/scale/colorcvt.rs index efe3ebc..d29b234 100644 --- a/nihav-core/src/scale/colorcvt.rs +++ b/nihav-core/src/scale/colorcvt.rs @@ -167,6 +167,7 @@ impl RgbToYuv { fn new() -> Self { Self::default() } } +#[allow(clippy::many_single_char_names)] impl Kernel for RgbToYuv { fn init(&mut self, in_fmt: &ScaleInfo, dest_fmt: &ScaleInfo) -> ScaleResult { let mut df = dest_fmt.fmt; @@ -210,9 +211,9 @@ println!(" [intermediate format {}]", df); let dst = dbuf.get_data_mut().unwrap(); for _y in 0..h { for x in 0..w { - let r = src[roff + x] as f32; - let g = src[goff + x] as f32; - let b = src[boff + x] as f32; + let r = f32::from(src[roff + x]); + let g = f32::from(src[goff + x]); + let b = f32::from(src[boff + x]); let (y, u, v) = matrix_mul(&self.matrix, r, g, b); dst[yoff + x] = (y as i16).max(0).min(255) as u8; @@ -243,6 +244,7 @@ impl YuvToRgb { fn new() -> Self { Self::default() } } +#[allow(clippy::many_single_char_names)] impl Kernel for YuvToRgb { fn init(&mut self, in_fmt: &ScaleInfo, dest_fmt: &ScaleInfo) -> ScaleResult { let mut df = dest_fmt.fmt; @@ -294,9 +296,9 @@ println!(" [intermediate format {}]", df); let dst = dbuf.get_data_mut().unwrap(); for y in 0..h { for x in 0..w { - let y = src[yoff + x] as f32; - let u = ((src[uoff + (x >> sv0)] as i16) - 128) as f32; - let v = ((src[voff + (x >> sv1)] as i16) - 128) as f32; + let y = f32::from(src[yoff + x]); + let u = f32::from(i16::from(src[uoff + (x >> sv0)]) - 128); + let v = f32::from(i16::from(src[voff + (x >> sv1)]) - 128); let (r, g, b) = matrix_mul(&self.matrix, y, u, v); dst[roff + x] = (r as i16).max(0).min(255) as u8;