forge
Explore
Log in

Don't you dare go Hollow

S12: mpeg4 crate clippy allow list dropped; index loops as iterators (same order); arg-count fns keep item-level allow

Browse files at this commit

d0cb9ef2e2282df2be427d76341d232dd33f8ac0Ahmet Kaan GümüşParent: 758bda4
crates/ec-mpeg4/src/core.rsmodified+3 -3
@@ -364,12 +364,12 @@ impl Core {
364 }364 }
365 }365 }
366 let wc = self.wc as isize;366 let wc = self.wc as isize;
367- for p in 1..3 {367+ for ac in self.ac[1..3].iter_mut() {
368 let start = (my - 1 + 1) * wc + (mx - 1 + 1);368 let start = (my - 1 + 1) * wc + (mx - 1 + 1);
369 for k in 0..(wc + 1) {369 for k in 0..(wc + 1) {
370 let i = (start + k) as usize;370 let i = (start + k) as usize;
371- if i < self.ac[p].len() {371+ if i < ac.len() {
372- self.ac[p][i] = [0; 16];372+ ac[i] = [0; 16];
373 }373 }
374 }374 }
375 }375 }
crates/ec-mpeg4/src/dsp.rsmodified+3 -0
@@ -483,6 +483,7 @@ fn hpel_mode<const W: usize, const AVG: bool>(
483 /// the full (w+1)x(h+1). ffmpeg only has `put_no_rnd` tables for w = 16 and 8, so483 /// the full (w+1)x(h+1). ffmpeg only has `put_no_rnd` tables for w = 16 and 8, so
484 /// `no_rnd` is ignored (rounding variant used) for w = 4 and 2.484 /// `no_rnd` is ignored (rounding variant used) for w = 4 and 2.
485 /// Rounding: x2/y2 = (a+b+1)>>1 (no_rnd: (a+b)>>1); xy2 = (a+b+c+d+2)>>2 (no_rnd: +1).485 /// Rounding: x2/y2 = (a+b+1)>>1 (no_rnd: (a+b)>>1); xy2 = (a+b+c+d+2)>>2 (no_rnd: +1).
486+#[allow(clippy::too_many_arguments)]
486 pub fn put_hpel(487 pub fn put_hpel(
487 dst: &mut [u8],488 dst: &mut [u8],
488 dst_stride: usize,489 dst_stride: usize,
@@ -513,6 +514,7 @@ pub fn put_hpel(
513 /// is avg_pixels16). For w = 8/4/2 `no_rnd` is ignored.514 /// is avg_pixels16). For w = 8/4/2 `no_rnd` is ignored.
514 /// Quirk reproduced from the C: `avg_pixels2_xy2_8_c` does NOT average with dst (it just515 /// Quirk reproduced from the C: `avg_pixels2_xy2_8_c` does NOT average with dst (it just
515 /// stores, like put) -- the hand-written 2-wide xy2 loop has `/* FIXME non put */`.516 /// stores, like put) -- the hand-written 2-wide xy2 loop has `/* FIXME non put */`.
517+#[allow(clippy::too_many_arguments)]
516 pub fn avg_hpel(518 pub fn avg_hpel(
517 dst: &mut [u8],519 dst: &mut [u8],
518 dst_stride: usize,520 dst_stride: usize,
@@ -799,6 +801,7 @@ pub fn avg_qpel(
799 801
800 /// gmc1_c: 8-wide, `h` rows. Reads 9 columns x (h+1) rows of `src` starting at src[0].802 /// gmc1_c: 8-wide, `h` rows. Reads 9 columns x (h+1) rows of `src` starting at src[0].
801 /// dst = (A*s[0] + B*s[1] + C*s[stride] + D*s[stride+1] + rounder) >> 8 (truncated to u8).803 /// dst = (A*s[0] + B*s[1] + C*s[stride] + D*s[stride+1] + rounder) >> 8 (truncated to u8).
804+#[allow(clippy::too_many_arguments)]
802 pub fn gmc1(805 pub fn gmc1(
803 dst: &mut [u8],806 dst: &mut [u8],
804 dst_stride: usize,807 dst_stride: usize,
crates/ec-mpeg4/src/h263.rsmodified+2 -2
@@ -290,11 +290,11 @@ impl Core {
290 } else {290 } else {
291 kind = K_8X8;291 kind = K_8X8;
292 w.mvt = Mvt::M8;292 w.mvt = Mvt::M8;
293- for i in 0..4 {293+ for (i, mv) in w.mv[0].iter_mut().enumerate() {
294 let (px, py) = self.pred_motion(i);294 let (px, py) = self.pred_motion(i);
295 let mx = self.decode_motion(br, px, 1)?;295 let mx = self.decode_motion(br, px, 1)?;
296 let my = self.decode_motion(br, py, 1)?;296 let my = self.decode_motion(br, py, 1)?;
297- w.mv[0][i] = [mx, my];297+ *mv = [mx, my];
298 let bx = 2 * self.mb_x as isize + (i & 1) as isize;298 let bx = 2 * self.mb_x as isize + (i & 1) as isize;
299 let by = 2 * self.mb_y as isize + (i >> 1) as isize;299 let by = 2 * self.mb_y as isize + (i >> 1) as isize;
300 let ci = self.mvi(bx, by);300 let ci = self.mvi(bx, by);
crates/ec-mpeg4/src/h263data.rsmodified+2 -2
@@ -489,8 +489,8 @@ mod spec_tests {
489 (c, n)489 (c, n)
490 );490 );
491 }491 }
492- for slot in 21..24 {492+ for &bits in &H263_INTER_MCBPC_BITS[21..24] {
493- assert_eq!(H263_INTER_MCBPC_BITS[slot], 0);493+ assert_eq!(bits, 0);
494 }494 }
495 }495 }
496 496
crates/ec-mpeg4/src/header.rsmodified+1 -0
@@ -700,6 +700,7 @@ pub fn parse_sprite_trajectory(
700 let vlc = &vlcs().sprite_traj;700 let vlc = &vlcs().sprite_traj;
701 let div500_413 = ident.divx_version == 500 && ident.divx_build == 413;701 let div500_413 = ident.divx_version == 500 && ident.divx_build == 413;
702 let mut d = [[0i64; 2]; 4];702 let mut d = [[0i64; 2]; 4];
703+ #[allow(clippy::needless_range_loop)]
703 for i in 0..npts {704 for i in 0..npts {
704 let mut x = 0;705 let mut x = 0;
705 let mut y = 0;706 let mut y = 0;
crates/ec-mpeg4/src/lib.rsmodified+0 -5
@@ -1,8 +1,3 @@
1-#![allow(
2- clippy::needless_range_loop,
3- clippy::too_many_arguments,
4- clippy::type_complexity
5-)]
6 #![forbid(unsafe_code)]1 #![forbid(unsafe_code)]
7 //! MPEG-4 Part 2 Visual (Simple and Advanced Simple profile) and H.263 baseline decoder.2 //! MPEG-4 Part 2 Visual (Simple and Advanced Simple profile) and H.263 baseline decoder.
8 3
crates/ec-mpeg4/src/mb.rsmodified+4 -4
@@ -775,10 +775,10 @@ impl Core {
775 w.field_select[0][0] = br.bit() as u8;775 w.field_select[0][0] = br.bit() as u8;
776 w.field_select[0][1] = br.bit() as u8;776 w.field_select[0][1] = br.bit() as u8;
777 let (px, py) = self.pred_motion(0);777 let (px, py) = self.pred_motion(0);
778- for i in 0..2 {778+ for mv in &mut w.mv[0][..2] {
779 let mx = self.decode_motion(br, px, self.f_code)?;779 let mx = self.decode_motion(br, px, self.f_code)?;
780 let my = self.decode_motion(br, py / 2, self.f_code)?;780 let my = self.decode_motion(br, py / 2, self.f_code)?;
781- w.mv[0][i] = [mx, my];781+ *mv = [mx, my];
782 }782 }
783 } else {783 } else {
784 w.mvt = Mvt::M16;784 w.mvt = Mvt::M16;
@@ -790,11 +790,11 @@ impl Core {
790 } else {790 } else {
791 kind = K_8X8;791 kind = K_8X8;
792 w.mvt = Mvt::M8;792 w.mvt = Mvt::M8;
793- for i in 0..4 {793+ for (i, mv) in w.mv[0].iter_mut().enumerate() {
794 let (px, py) = self.pred_motion(i);794 let (px, py) = self.pred_motion(i);
795 let mx = self.decode_motion(br, px, self.f_code)?;795 let mx = self.decode_motion(br, px, self.f_code)?;
796 let my = self.decode_motion(br, py, self.f_code)?;796 let my = self.decode_motion(br, py, self.f_code)?;
797- w.mv[0][i] = [mx, my];797+ *mv = [mx, my];
798 let bx = 2 * self.mb_x as isize + (i & 1) as isize;798 let bx = 2 * self.mb_x as isize + (i & 1) as isize;
799 let by = 2 * self.mb_y as isize + (i >> 1) as isize;799 let by = 2 * self.mb_y as isize + (i >> 1) as isize;
800 let ci = self.mvi(bx, by);800 let ci = self.mvi(bx, by);
crates/ec-mpeg4/src/recon.rsmodified+5 -2
@@ -25,6 +25,7 @@ struct Geo {
25 }25 }
26 26
27 /// A source window: either a view straight into the plane or a clamped copy.27 /// A source window: either a view straight into the plane or a clamped copy.
28+#[allow(clippy::too_many_arguments)]
28 fn window<'a>(29 fn window<'a>(
29 plane: &'a [u8],30 plane: &'a [u8],
30 stride: usize,31 stride: usize,
@@ -54,6 +55,7 @@ fn window<'a>(
54 (&buf[..], WS)55 (&buf[..], WS)
55 }56 }
56 57
58+#[allow(clippy::too_many_arguments)]
57 fn put_or_avg_hpel(59 fn put_or_avg_hpel(
58 avg: bool,60 avg: bool,
59 dst: &mut [u8],61 dst: &mut [u8],
@@ -72,6 +74,7 @@ fn put_or_avg_hpel(
72 }74 }
73 }75 }
74 76
77+#[allow(clippy::too_many_arguments)]
75 fn put_or_avg_qpel(78 fn put_or_avg_qpel(
76 avg: bool,79 avg: bool,
77 dst: &mut [u8],80 dst: &mut [u8],
@@ -351,8 +354,8 @@ fn apply_8x8(
351 ) {354 ) {
352 let aw = g.aw;355 let aw = g.aw;
353 let (mut sx, mut sy) = (0, 0);356 let (mut sx, mut sy) = (0, 0);
354- for i in 0..4 {357+ for (i, m) in mv.iter().enumerate() {
355- let (mx, my) = (mv[i][0], mv[i][1]);358+ let (mx, my) = (m[0], m[1]);
356 let bx = (i & 1) as i32 * 8;359 let bx = (i & 1) as i32 * 8;
357 let by = (i >> 1) as i32 * 8;360 let by = (i >> 1) as i32 * 8;
358 let doff = (g.mb_y as usize * 16 + by as usize) * aw + g.mb_x as usize * 16 + bx as usize;361 let doff = (g.mb_y as usize * 16 + by as usize) * aw + g.mb_x as usize * 16 + bx as usize;