Skip to content

Commit 3a1aa74

Browse files
committed
chore: bump to 0.5.4, fix clippy in benches/examples
- Version bump from 0.5.3 to 0.5.4 - Migrate remaining archmage 0.1 references in benches/examples to 0.4 (Avx2Token → X64V3Token) - Fix clippy lints: is_multiple_of, needless_borrow, allow(deprecated)
1 parent 344ed24 commit 3a1aa74

File tree

8 files changed

+23
-23
lines changed

8 files changed

+23
-23
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mozjpeg-rs"
3-
version = "0.5.3"
3+
version = "0.5.4"
44
edition = "2021"
55
rust-version = "1.89.0"
66
license = "BSD-3-Clause"

benches/dct.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,10 @@ fn bench_dct_combined(c: &mut Criterion) {
8888

8989
#[cfg(target_arch = "x86_64")]
9090
fn bench_dct_archmage(c: &mut Criterion) {
91-
use archmage::tokens::x86::Avx2Token;
92-
use archmage::SimdToken;
91+
use archmage::{SimdToken, X64V3Token};
9392
use mozjpeg_rs::dct::avx2_archmage::forward_dct_8x8_i32;
9493

95-
let Some(token) = Avx2Token::try_new() else {
94+
let Some(token) = X64V3Token::try_new() else {
9695
eprintln!("AVX2 not available, skipping benchmark");
9796
return;
9897
};
@@ -113,11 +112,10 @@ fn bench_dct_archmage(c: &mut Criterion) {
113112

114113
#[cfg(target_arch = "x86_64")]
115114
fn bench_dct_archmage_i16(c: &mut Criterion) {
116-
use archmage::tokens::x86::Avx2Token;
117-
use archmage::SimdToken;
115+
use archmage::{SimdToken, X64V3Token};
118116
use mozjpeg_rs::dct::avx2_archmage::forward_dct_8x8_i16;
119117

120-
let Some(token) = Avx2Token::try_new() else {
118+
let Some(token) = X64V3Token::try_new() else {
121119
eprintln!("AVX2 not available, skipping benchmark");
122120
return;
123121
};
@@ -215,11 +213,10 @@ fn bench_dct_batch_1000(c: &mut Criterion) {
215213

216214
#[cfg(target_arch = "x86_64")]
217215
{
218-
use archmage::tokens::x86::Avx2Token;
219-
use archmage::SimdToken;
216+
use archmage::{SimdToken, X64V3Token};
220217
use mozjpeg_rs::dct::avx2_archmage::{forward_dct_8x8_i16, forward_dct_8x8_i32};
221218

222-
if let Some(token) = Avx2Token::try_new() {
219+
if let Some(token) = X64V3Token::try_new() {
223220
group.bench_function("archmage_i32", |b| {
224221
b.iter(|| {
225222
let mut coeffs = [0i16; 64];

examples/debug_dct.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! Debug DCT by tracing intermediate values
22
3-
#[cfg(all(target_arch = "x86_64", target_feature = "avx2"))]
4-
use archmage::tokens::x86::Avx2Token;
53
#[cfg(all(target_arch = "x86_64", target_feature = "avx2"))]
64
use archmage::SimdToken;
5+
#[cfg(all(target_arch = "x86_64", target_feature = "avx2"))]
6+
use archmage::X64V3Token;
77

88
const DCTSIZE: usize = 8;
99
const DCTSIZE2: usize = 64;
@@ -212,7 +212,7 @@ fn scalar_dct(samples: &[i16; DCTSIZE2], coeffs: &mut [i16; DCTSIZE2]) {
212212
#[target_feature(enable = "avx2")]
213213
unsafe fn avx2_i16_dct_debug(samples: &[i16; DCTSIZE2], coeffs: &mut [i16; DCTSIZE2]) {
214214
// SAFETY: We're inside a #[target_feature(enable = "avx2")] function
215-
let token = Avx2Token::new_unchecked();
215+
let token = X64V3Token::try_new().unwrap();
216216
mozjpeg_rs::dct::avx2::forward_dct_8x8_avx2_i16(token, samples, coeffs);
217217
}
218218

examples/profile_dct.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,9 @@ fn main() {
8080
// Profile AVX2 archmage intrinsics
8181
#[cfg(all(target_arch = "x86_64", target_feature = "avx2"))]
8282
{
83-
use archmage::tokens::x86::Avx2Token;
84-
use archmage::SimdToken;
83+
use archmage::{SimdToken, X64V3Token};
8584

86-
if let Some(token) = Avx2Token::try_new() {
85+
if let Some(token) = X64V3Token::try_new() {
8786
let start = Instant::now();
8887
for _ in 0..ITERATIONS {
8988
forward_dct_8x8_i32(token, black_box(&samples), black_box(&mut coeffs));

examples/synth_dct_overflow.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(deprecated)] // Uses deprecated avx2_archmage module for overflow testing
12
//! Detect i16 DCT overflow with synthetic worst-case patterns.
23
//!
34
//! Half-black/half-white blocks within a single 8x8 DCT block produce the largest
@@ -96,7 +97,7 @@ fn main() {
9697
}
9798

9899
use archmage::SimdToken;
99-
let token = archmage::Avx2Token::try_new().unwrap();
100+
let token = archmage::X64V3Token::try_new().unwrap();
100101
let mut coeffs_i16 = [0i16; DCTSIZE2];
101102
let mut coeffs_i32 = [0i16; DCTSIZE2];
102103
#[allow(deprecated)]

examples/trellis_noise_bench.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,11 @@ fn make_high_freq_checker(w: u32, h: u32) -> Vec<u8> {
324324
let mut rgb = vec![0u8; (w * h * 3) as usize];
325325
for y in 0..h {
326326
for x in 0..w {
327-
let val = if (x + y) % 2 == 0 { 200u8 } else { 55u8 };
327+
let val = if (x + y).is_multiple_of(2) {
328+
200u8
329+
} else {
330+
55u8
331+
};
328332
let i = (y * w + x) as usize * 3;
329333
rgb[i] = val;
330334
rgb[i + 1] = val;
@@ -382,7 +386,7 @@ fn make_salt_pepper(w: u32, h: u32, density: f64, seed: u64) -> Vec<u8> {
382386
for pixel in rgb.chunks_mut(3) {
383387
let r = lcg(&mut s);
384388
if r < threshold {
385-
let val = if r % 2 == 0 { 0u8 } else { 255u8 };
389+
let val = if r.is_multiple_of(2) { 0u8 } else { 255u8 };
386390
pixel[0] = val;
387391
pixel[1] = val;
388392
pixel[2] = val;

examples/trellis_speed_bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn main() {
4242

4343
let png_files = png_files_in_dir(&cid22_dir);
4444
for path in &png_files {
45-
if let Some((rgb, w, h)) = load_png(&path) {
45+
if let Some((rgb, w, h)) = load_png(path) {
4646
let name = path
4747
.file_name()
4848
.unwrap_or_default()

examples/verify_dct.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ fn main() {
2020

2121
#[cfg(target_arch = "x86_64")]
2222
{
23-
use archmage::tokens::x86::Avx2Token;
24-
use archmage::SimdToken;
23+
use archmage::{SimdToken, X64V3Token};
2524

26-
if let Some(token) = Avx2Token::try_new() {
25+
if let Some(token) = X64V3Token::try_new() {
2726
mozjpeg_rs::dct::avx2_archmage::forward_dct_8x8_i32(token, &samples, &mut coeffs_new);
2827
println!(
2928
"\nNew (archmage) DCT output (first 8): {:?}",

0 commit comments

Comments
 (0)