diff --git a/0001-remove-unused-hawktracer-usage.patch b/0001-remove-unused-hawktracer-usage.patch index 3ccb428..fc92b16 100644 --- a/0001-remove-unused-hawktracer-usage.patch +++ b/0001-remove-unused-hawktracer-usage.patch @@ -1,7 +1,7 @@ -From 250bdde944cfb1ad3200df8c77150ca25bb32b58 Mon Sep 17 00:00:00 2001 +From 0dc6dc69be65915666c3d70455d181d4d1b5b78c Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Mon, 8 Aug 2022 20:48:47 +0200 -Subject: [PATCH] remove unused hawktracer usage +Subject: [PATCH 1/3] remove unused hawktracer usage --- src/activity.rs | 3 --- @@ -431,5 +431,5 @@ index 20479f0..126329d 100644 let mut delta = 0; -- -2.37.1 +2.39.2 diff --git a/0001-Fix-UB-in-pred_max-test.patch b/0002-Fix-UB-in-pred_max-test.patch similarity index 83% rename from 0001-Fix-UB-in-pred_max-test.patch rename to 0002-Fix-UB-in-pred_max-test.patch index 852a238..3f8f29c 100644 --- a/0001-Fix-UB-in-pred_max-test.patch +++ b/0002-Fix-UB-in-pred_max-test.patch @@ -1,7 +1,7 @@ -From 1596b669d73579c22c8fbd1cd2ef0743bb50fdce Mon Sep 17 00:00:00 2001 +From c867cd96956a2c5034496362c4a530b97fefe4b8 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Fri, 13 Jan 2023 17:35:44 +0100 -Subject: [PATCH] Fix UB in pred_max test +Subject: [PATCH 2/3] Fix UB in pred_max test Backport of upstream commit: https://github.com/xiph/rav1e/commit/d56fe642bbbd8fe3d20c851b950db3fcaea53c7a @@ -23,5 +23,5 @@ index 8e0108a..6058ccb 100644 pred_paeth( &mut o.as_region_mut(), -- -2.39.0 +2.39.2 diff --git a/0003-Disambiguate-ILog-ilog-calls-from-integer-ilog-from-.patch b/0003-Disambiguate-ILog-ilog-calls-from-integer-ilog-from-.patch new file mode 100644 index 0000000..44758cd --- /dev/null +++ b/0003-Disambiguate-ILog-ilog-calls-from-integer-ilog-from-.patch @@ -0,0 +1,164 @@ +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 + diff --git a/rust-rav1e.spec b/rust-rav1e.spec index 9a51edb..0493450 100644 --- a/rust-rav1e.spec +++ b/rust-rav1e.spec @@ -36,7 +36,10 @@ Patch: rav1e-fix-metadata.diff Patch: 0001-remove-unused-hawktracer-usage.patch # * Backported patch to fix UB / crash in test code # https://github.com/xiph/rav1e/commit/d56fe64: -Patch: 0001-Fix-UB-in-pred_max-test.patch +Patch: 0002-Fix-UB-in-pred_max-test.patch +# * Disambiguate code which is ambiguous with Rust 1.67+ due to the +# stabilization of {integer}::ilog +Patch: 0003-Disambiguate-ILog-ilog-calls-from-integer-ilog-from-.patch ExclusiveArch: %{rust_arches}