diff --git a/crates/ec-mpeg4/src/core.rs b/crates/ec-mpeg4/src/core.rs index 99fff951..b4a0676c 100644 --- a/crates/ec-mpeg4/src/core.rs +++ b/crates/ec-mpeg4/src/core.rs @@ -364,12 +364,12 @@ impl Core { } } let wc = self.wc as isize; - for p in 1..3 { + for ac in self.ac[1..3].iter_mut() { let start = (my - 1 + 1) * wc + (mx - 1 + 1); for k in 0..(wc + 1) { let i = (start + k) as usize; - if i < self.ac[p].len() { - self.ac[p][i] = [0; 16]; + if i < ac.len() { + ac[i] = [0; 16]; } } } diff --git a/crates/ec-mpeg4/src/dsp.rs b/crates/ec-mpeg4/src/dsp.rs index 7ebd875e..69b65ed7 100644 --- a/crates/ec-mpeg4/src/dsp.rs +++ b/crates/ec-mpeg4/src/dsp.rs @@ -483,6 +483,7 @@ fn hpel_mode( /// the full (w+1)x(h+1). ffmpeg only has `put_no_rnd` tables for w = 16 and 8, so /// `no_rnd` is ignored (rounding variant used) for w = 4 and 2. /// Rounding: x2/y2 = (a+b+1)>>1 (no_rnd: (a+b)>>1); xy2 = (a+b+c+d+2)>>2 (no_rnd: +1). +#[allow(clippy::too_many_arguments)] pub fn put_hpel( dst: &mut [u8], dst_stride: usize, @@ -513,6 +514,7 @@ pub fn put_hpel( /// is avg_pixels16). For w = 8/4/2 `no_rnd` is ignored. /// Quirk reproduced from the C: `avg_pixels2_xy2_8_c` does NOT average with dst (it just /// stores, like put) -- the hand-written 2-wide xy2 loop has `/* FIXME non put */`. +#[allow(clippy::too_many_arguments)] pub fn avg_hpel( dst: &mut [u8], dst_stride: usize, @@ -799,6 +801,7 @@ pub fn avg_qpel( /// gmc1_c: 8-wide, `h` rows. Reads 9 columns x (h+1) rows of `src` starting at src[0]. /// dst = (A*s[0] + B*s[1] + C*s[stride] + D*s[stride+1] + rounder) >> 8 (truncated to u8). +#[allow(clippy::too_many_arguments)] pub fn gmc1( dst: &mut [u8], dst_stride: usize, diff --git a/crates/ec-mpeg4/src/h263.rs b/crates/ec-mpeg4/src/h263.rs index 35c3b139..6fce5c24 100644 --- a/crates/ec-mpeg4/src/h263.rs +++ b/crates/ec-mpeg4/src/h263.rs @@ -290,11 +290,11 @@ impl Core { } else { kind = K_8X8; w.mvt = Mvt::M8; - for i in 0..4 { + for (i, mv) in w.mv[0].iter_mut().enumerate() { let (px, py) = self.pred_motion(i); let mx = self.decode_motion(br, px, 1)?; let my = self.decode_motion(br, py, 1)?; - w.mv[0][i] = [mx, my]; + *mv = [mx, my]; let bx = 2 * self.mb_x as isize + (i & 1) as isize; let by = 2 * self.mb_y as isize + (i >> 1) as isize; let ci = self.mvi(bx, by); diff --git a/crates/ec-mpeg4/src/h263data.rs b/crates/ec-mpeg4/src/h263data.rs index 0f5cf7cf..2852f95c 100644 --- a/crates/ec-mpeg4/src/h263data.rs +++ b/crates/ec-mpeg4/src/h263data.rs @@ -489,8 +489,8 @@ mod spec_tests { (c, n) ); } - for slot in 21..24 { - assert_eq!(H263_INTER_MCBPC_BITS[slot], 0); + for &bits in &H263_INTER_MCBPC_BITS[21..24] { + assert_eq!(bits, 0); } } diff --git a/crates/ec-mpeg4/src/header.rs b/crates/ec-mpeg4/src/header.rs index 5c8ba581..156138bb 100644 --- a/crates/ec-mpeg4/src/header.rs +++ b/crates/ec-mpeg4/src/header.rs @@ -700,6 +700,7 @@ pub fn parse_sprite_trajectory( let vlc = &vlcs().sprite_traj; let div500_413 = ident.divx_version == 500 && ident.divx_build == 413; let mut d = [[0i64; 2]; 4]; + #[allow(clippy::needless_range_loop)] for i in 0..npts { let mut x = 0; let mut y = 0; diff --git a/crates/ec-mpeg4/src/lib.rs b/crates/ec-mpeg4/src/lib.rs index 5b3302a9..857cc357 100644 --- a/crates/ec-mpeg4/src/lib.rs +++ b/crates/ec-mpeg4/src/lib.rs @@ -1,8 +1,3 @@ -#![allow( - clippy::needless_range_loop, - clippy::too_many_arguments, - clippy::type_complexity -)] #![forbid(unsafe_code)] //! MPEG-4 Part 2 Visual (Simple and Advanced Simple profile) and H.263 baseline decoder. diff --git a/crates/ec-mpeg4/src/mb.rs b/crates/ec-mpeg4/src/mb.rs index cdd2e40b..d4f120e7 100644 --- a/crates/ec-mpeg4/src/mb.rs +++ b/crates/ec-mpeg4/src/mb.rs @@ -775,10 +775,10 @@ impl Core { w.field_select[0][0] = br.bit() as u8; w.field_select[0][1] = br.bit() as u8; let (px, py) = self.pred_motion(0); - for i in 0..2 { + for mv in &mut w.mv[0][..2] { let mx = self.decode_motion(br, px, self.f_code)?; let my = self.decode_motion(br, py / 2, self.f_code)?; - w.mv[0][i] = [mx, my]; + *mv = [mx, my]; } } else { w.mvt = Mvt::M16; @@ -790,11 +790,11 @@ impl Core { } else { kind = K_8X8; w.mvt = Mvt::M8; - for i in 0..4 { + for (i, mv) in w.mv[0].iter_mut().enumerate() { let (px, py) = self.pred_motion(i); let mx = self.decode_motion(br, px, self.f_code)?; let my = self.decode_motion(br, py, self.f_code)?; - w.mv[0][i] = [mx, my]; + *mv = [mx, my]; let bx = 2 * self.mb_x as isize + (i & 1) as isize; let by = 2 * self.mb_y as isize + (i >> 1) as isize; let ci = self.mvi(bx, by); diff --git a/crates/ec-mpeg4/src/recon.rs b/crates/ec-mpeg4/src/recon.rs index e9ef5a9b..128b15cb 100644 --- a/crates/ec-mpeg4/src/recon.rs +++ b/crates/ec-mpeg4/src/recon.rs @@ -25,6 +25,7 @@ struct Geo { } /// A source window: either a view straight into the plane or a clamped copy. +#[allow(clippy::too_many_arguments)] fn window<'a>( plane: &'a [u8], stride: usize, @@ -54,6 +55,7 @@ fn window<'a>( (&buf[..], WS) } +#[allow(clippy::too_many_arguments)] fn put_or_avg_hpel( avg: bool, dst: &mut [u8], @@ -72,6 +74,7 @@ fn put_or_avg_hpel( } } +#[allow(clippy::too_many_arguments)] fn put_or_avg_qpel( avg: bool, dst: &mut [u8], @@ -351,8 +354,8 @@ fn apply_8x8( ) { let aw = g.aw; let (mut sx, mut sy) = (0, 0); - for i in 0..4 { - let (mx, my) = (mv[i][0], mv[i][1]); + for (i, m) in mv.iter().enumerate() { + let (mx, my) = (m[0], m[1]); let bx = (i & 1) as i32 * 8; let by = (i >> 1) as i32 * 8; let doff = (g.mb_y as usize * 16 + by as usize) * aw + g.mb_x as usize * 16 + bx as usize;