S12: mpeg4 crate clippy allow list dropped; index loops as iterators (same order); arg-count fns keep item-level allow
Browse files at this commitd0cb9ef2e2282df2be427d76341d232dd33f8ac0Parent: 758bda48 changed files +20 -18
- crates/ec-mpeg4/src/core.rs +3 -3
- crates/ec-mpeg4/src/dsp.rs +3 -0
- crates/ec-mpeg4/src/h263.rs +2 -2
- crates/ec-mpeg4/src/h263data.rs +2 -2
- crates/ec-mpeg4/src/header.rs +1 -0
- crates/ec-mpeg4/src/lib.rs +0 -5
- crates/ec-mpeg4/src/mb.rs +4 -4
- crates/ec-mpeg4/src/recon.rs +5 -2
crates/ec-mpeg4/src/core.rsmodified+3 -3
| @@ -364,12 +364,12 @@ impl Core { | ||
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | let wc = self.wc as isize; |
| 367 | - for p in 1..3 { | |
| 367 | + for ac in self.ac[1..3].iter_mut() { | |
| 368 | 368 | let start = (my - 1 + 1) * wc + (mx - 1 + 1); |
| 369 | 369 | for k in 0..(wc + 1) { |
| 370 | 370 | let i = (start + k) as usize; |
| 371 | - if i < self.ac[p].len() { | |
| 372 | - self.ac[p][i] = [0; 16]; | |
| 371 | + if i < ac.len() { | |
| 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 | 483 | /// the full (w+1)x(h+1). ffmpeg only has `put_no_rnd` tables for w = 16 and 8, so |
| 484 | 484 | /// `no_rnd` is ignored (rounding variant used) for w = 4 and 2. |
| 485 | 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 | 487 | pub fn put_hpel( |
| 487 | 488 | dst: &mut [u8], |
| 488 | 489 | dst_stride: usize, |
| @@ -513,6 +514,7 @@ pub fn put_hpel( | ||
| 513 | 514 | /// is avg_pixels16). For w = 8/4/2 `no_rnd` is ignored. |
| 514 | 515 | /// Quirk reproduced from the C: `avg_pixels2_xy2_8_c` does NOT average with dst (it just |
| 515 | 516 | /// stores, like put) -- the hand-written 2-wide xy2 loop has `/* FIXME non put */`. |
| 517 | +#[allow(clippy::too_many_arguments)] | |
| 516 | 518 | pub fn avg_hpel( |
| 517 | 519 | dst: &mut [u8], |
| 518 | 520 | dst_stride: usize, |
| @@ -799,6 +801,7 @@ pub fn avg_qpel( | ||
| 799 | 801 | |
| 800 | 802 | /// gmc1_c: 8-wide, `h` rows. Reads 9 columns x (h+1) rows of `src` starting at src[0]. |
| 801 | 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 | 805 | pub fn gmc1( |
| 803 | 806 | dst: &mut [u8], |
| 804 | 807 | dst_stride: usize, |
crates/ec-mpeg4/src/h263.rsmodified+2 -2
| @@ -290,11 +290,11 @@ impl Core { | ||
| 290 | 290 | } else { |
| 291 | 291 | kind = K_8X8; |
| 292 | 292 | w.mvt = Mvt::M8; |
| 293 | - for i in 0..4 { | |
| 293 | + for (i, mv) in w.mv[0].iter_mut().enumerate() { | |
| 294 | 294 | let (px, py) = self.pred_motion(i); |
| 295 | 295 | let mx = self.decode_motion(br, px, 1)?; |
| 296 | 296 | let my = self.decode_motion(br, py, 1)?; |
| 297 | - w.mv[0][i] = [mx, my]; | |
| 297 | + *mv = [mx, my]; | |
| 298 | 298 | let bx = 2 * self.mb_x as isize + (i & 1) as isize; |
| 299 | 299 | let by = 2 * self.mb_y as isize + (i >> 1) as isize; |
| 300 | 300 | let ci = self.mvi(bx, by); |
crates/ec-mpeg4/src/h263data.rsmodified+2 -2
| @@ -489,8 +489,8 @@ mod spec_tests { | ||
| 489 | 489 | (c, n) |
| 490 | 490 | ); |
| 491 | 491 | } |
| 492 | - for slot in 21..24 { | |
| 493 | - assert_eq!(H263_INTER_MCBPC_BITS[slot], 0); | |
| 492 | + for &bits in &H263_INTER_MCBPC_BITS[21..24] { | |
| 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 | 700 | let vlc = &vlcs().sprite_traj; |
| 701 | 701 | let div500_413 = ident.divx_version == 500 && ident.divx_build == 413; |
| 702 | 702 | let mut d = [[0i64; 2]; 4]; |
| 703 | + #[allow(clippy::needless_range_loop)] | |
| 703 | 704 | for i in 0..npts { |
| 704 | 705 | let mut x = 0; |
| 705 | 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 | 1 | #![forbid(unsafe_code)] |
| 7 | 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 | 775 | w.field_select[0][0] = br.bit() as u8; |
| 776 | 776 | w.field_select[0][1] = br.bit() as u8; |
| 777 | 777 | let (px, py) = self.pred_motion(0); |
| 778 | - for i in 0..2 { | |
| 778 | + for mv in &mut w.mv[0][..2] { | |
| 779 | 779 | let mx = self.decode_motion(br, px, self.f_code)?; |
| 780 | 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 | 783 | } else { |
| 784 | 784 | w.mvt = Mvt::M16; |
| @@ -790,11 +790,11 @@ impl Core { | ||
| 790 | 790 | } else { |
| 791 | 791 | kind = K_8X8; |
| 792 | 792 | w.mvt = Mvt::M8; |
| 793 | - for i in 0..4 { | |
| 793 | + for (i, mv) in w.mv[0].iter_mut().enumerate() { | |
| 794 | 794 | let (px, py) = self.pred_motion(i); |
| 795 | 795 | let mx = self.decode_motion(br, px, self.f_code)?; |
| 796 | 796 | let my = self.decode_motion(br, py, self.f_code)?; |
| 797 | - w.mv[0][i] = [mx, my]; | |
| 797 | + *mv = [mx, my]; | |
| 798 | 798 | let bx = 2 * self.mb_x as isize + (i & 1) as isize; |
| 799 | 799 | let by = 2 * self.mb_y as isize + (i >> 1) as isize; |
| 800 | 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 | 27 | /// A source window: either a view straight into the plane or a clamped copy. |
| 28 | +#[allow(clippy::too_many_arguments)] | |
| 28 | 29 | fn window<'a>( |
| 29 | 30 | plane: &'a [u8], |
| 30 | 31 | stride: usize, |
| @@ -54,6 +55,7 @@ fn window<'a>( | ||
| 54 | 55 | (&buf[..], WS) |
| 55 | 56 | } |
| 56 | 57 | |
| 58 | +#[allow(clippy::too_many_arguments)] | |
| 57 | 59 | fn put_or_avg_hpel( |
| 58 | 60 | avg: bool, |
| 59 | 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 | 78 | fn put_or_avg_qpel( |
| 76 | 79 | avg: bool, |
| 77 | 80 | dst: &mut [u8], |
| @@ -351,8 +354,8 @@ fn apply_8x8( | ||
| 351 | 354 | ) { |
| 352 | 355 | let aw = g.aw; |
| 353 | 356 | let (mut sx, mut sy) = (0, 0); |
| 354 | - for i in 0..4 { | |
| 355 | - let (mx, my) = (mv[i][0], mv[i][1]); | |
| 357 | + for (i, m) in mv.iter().enumerate() { | |
| 358 | + let (mx, my) = (m[0], m[1]); | |
| 356 | 359 | let bx = (i & 1) as i32 * 8; |
| 357 | 360 | let by = (i >> 1) as i32 * 8; |
| 358 | 361 | let doff = (g.mb_y as usize * 16 + by as usize) * aw + g.mb_x as usize * 16 + bx as usize; |