From 81ec02d29afbfa503997a56d3fb7c3f039030d8d Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Fri, 17 Feb 2023 00:54:53 +0100 Subject: [PATCH 3/3] Disambiguate ILog::ilog calls from {integer}::ilog from Rust 1.67+ --- src/deblock.rs | 4 ++-- src/ec.rs | 8 ++++---- src/encoder.rs | 2 +- src/lrf.rs | 4 ++-- src/me.rs | 2 +- src/rate.rs | 2 +- src/transform/inverse.rs | 4 ++-- src/transform/mod.rs | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/deblock.rs b/src/deblock.rs index 61b7cd4..03048a5 100644 --- a/src/deblock.rs +++ b/src/deblock.rs @@ -1578,8 +1578,8 @@ fn sse_optimize( ) -> [u8; 4] { // i64 allows us to accumulate a total of ~ 35 bits worth of pixels assert!( - input.planes[0].plane_cfg.width.ilog() - + input.planes[0].plane_cfg.height.ilog() + ILog::ilog(input.planes[0].plane_cfg.width) + + ILog::ilog(input.planes[0].plane_cfg.height) < 35 ); let mut level = [0; 4]; diff --git a/src/ec.rs b/src/ec.rs index 5d02ffd..c8abc62 100644 --- a/src/ec.rs +++ b/src/ec.rs @@ -192,7 +192,7 @@ impl StorageBackend for WriterBase { #[inline] fn store(&mut self, fl: u16, fh: u16, nms: u16) { let (_l, r) = self.lr_compute(fl, fh, nms); - let d = 16 - r.ilog(); + let d = 16 - ILog::ilog(r); let mut s = self.cnt + (d as i16); self.s.bytes += (s >= 0) as usize + (s >= 8) as usize; @@ -230,7 +230,7 @@ impl StorageBackend for WriterBase { #[inline] fn store(&mut self, fl: u16, fh: u16, nms: u16) { let (_l, r) = self.lr_compute(fl, fh, nms); - let d = 16 - r.ilog(); + let d = 16 - ILog::ilog(r); let mut s = self.cnt + (d as i16); self.s.bytes += (s >= 0) as usize + (s >= 8) as usize; @@ -271,7 +271,7 @@ impl StorageBackend for WriterBase { let (l, r) = self.lr_compute(fl, fh, nms); let mut low = l + self.s.low; let mut c = self.cnt; - let d = 16 - r.ilog(); + let d = 16 - ILog::ilog(r); let mut s = c + (d as i16); if s >= 0 { @@ -584,7 +584,7 @@ where // The 9 here counteracts the offset of -9 baked into cnt. Don't include a termination bit. let pre = Self::frac_compute((self.cnt + 9) as u32, self.rng as u32); - let d = 16 - r.ilog(); + let d = 16 - ILog::ilog(r); let mut c = self.cnt; let mut sh = c + (d as i16); if sh >= 0 { diff --git a/src/encoder.rs b/src/encoder.rs index 5fc753f..b5995ed 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -3051,7 +3051,7 @@ fn encode_tile_group( fs.cdfs.reset_counts(); } - let max_tile_size_bytes = ((max_len.ilog() + 7) / 8) as u32; + let max_tile_size_bytes = ((ILog::ilog(max_len) + 7) / 8) as u32; debug_assert!(max_tile_size_bytes > 0 && max_tile_size_bytes <= 4); fs.max_tile_size_bytes = max_tile_size_bytes; diff --git a/src/lrf.rs b/src/lrf.rs index 4399c4c..bf59647 100644 --- a/src/lrf.rs +++ b/src/lrf.rs @@ -1408,8 +1408,8 @@ impl RestorationState { } // derive the rest - let y_unit_log2 = y_unit_size.ilog() - 1; - let uv_unit_log2 = uv_unit_size.ilog() - 1; + let y_unit_log2 = ILog::ilog(y_unit_size) - 1; + let uv_unit_log2 = ILog::ilog(uv_unit_size) - 1; let y_cols = ((fi.width + (y_unit_size >> 1)) / y_unit_size).max(1); let y_rows = ((fi.height + (y_unit_size >> 1)) / y_unit_size).max(1); let uv_cols = ((((fi.width + (1 << xdec >> 1)) >> xdec) diff --git a/src/me.rs b/src/me.rs index 7ed64e4..3acdb07 100644 --- a/src/me.rs +++ b/src/me.rs @@ -1065,7 +1065,7 @@ fn get_mv_rate( #[inline(always)] fn diff_to_rate(diff: i16, allow_high_precision_mv: bool) -> u32 { let d = if allow_high_precision_mv { diff } else { diff >> 1 }; - 2 * d.abs().ilog() as u32 + 2 * ILog::ilog(d.abs()) as u32 } diff_to_rate(a.row - b.row, allow_high_precision_mv) diff --git a/src/rate.rs b/src/rate.rs index 6bc23f3..1a94f08 100644 --- a/src/rate.rs +++ b/src/rate.rs @@ -234,7 +234,7 @@ fn blog64(w: i64) -> i64 { if w <= 0 { return -1; } - let ipart = w.ilog() as i32 - 1; + let ipart = ILog::ilog(w) as i32 - 1; if ipart > 61 { w >>= ipart - 61; } else { diff --git a/src/transform/inverse.rs b/src/transform/inverse.rs index 3bf3286..813c784 100644 --- a/src/transform/inverse.rs +++ b/src/transform/inverse.rs @@ -1608,7 +1608,7 @@ pub(crate) mod rust { // perform inv txfm on every row let range = bd + 8; - let txfm_fn = INV_TXFM_FNS[tx_types_1d.1 as usize][width.ilog() - 3]; + let txfm_fn = INV_TXFM_FNS[tx_types_1d.1 as usize][ILog::ilog(width) - 3]; // 64 point transforms only signal 32 coeffs. We only take chunks of 32 // and skip over the last 32 transforms here. for (r, buffer_slice) in (0..height.min(32)).zip(buffer.chunks_mut(width)) @@ -1634,7 +1634,7 @@ pub(crate) mod rust { // perform inv txfm on every col let range = cmp::max(bd + 6, 16); - let txfm_fn = INV_TXFM_FNS[tx_types_1d.0 as usize][height.ilog() - 3]; + let txfm_fn = INV_TXFM_FNS[tx_types_1d.0 as usize][ILog::ilog(height) - 3]; for c in 0..width { let mut temp_in: [i32; 64] = [0; 64]; let mut temp_out: [i32; 64] = [0; 64]; diff --git a/src/transform/mod.rs b/src/transform/mod.rs index 304df73..96e9457 100644 --- a/src/transform/mod.rs +++ b/src/transform/mod.rs @@ -288,7 +288,7 @@ pub enum TxSet { #[inline] pub fn get_rect_tx_log_ratio(col: usize, row: usize) -> i8 { debug_assert!(col > 0 && row > 0); - col.ilog() as i8 - row.ilog() as i8 + ILog::ilog(col) as i8 - ILog::ilog(row) as i8 } // performs half a butterfly -- 2.39.2