-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
139 lines (127 loc) · 4.93 KB
/
Cargo.toml
File metadata and controls
139 lines (127 loc) · 4.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
[package]
name = "mozjpeg-rs"
version = "0.9.2"
edition = "2024"
rust-version = "1.89"
license = "BSD-3-Clause"
repository = "https://github.com/imazen/mozjpeg-rs"
description = "Pure Rust JPEG encoder based on Mozilla's mozjpeg with trellis quantization"
homepage = "https://github.com/imazen/mozjpeg-rs"
documentation = "https://docs.rs/mozjpeg-rs"
readme = "README.md"
keywords = ["jpeg", "encoder", "mozjpeg", "compression", "image"]
categories = ["encoding", "multimedia::images"]
include = [
"/src/**",
"/tests/*.rs",
"/benches/**",
"/examples/**",
"/README.md",
"/CHANGELOG.md",
"/LICENSE*",
]
[workspace]
members = ["crates/*"]
[features]
default = ["fast-yuv", "imgref"]
# Use `zenyuv` for SIMD color conversion (AVX2/NEON/WASM SIMD128 with scalar fallback).
# Comparable perf to the `yuv` crate, with ±1 level precision (invisible after JPEG quantization).
fast-yuv = ["dep:zenyuv"]
# Use hand-written SIMD intrinsics for ~15% better DCT/color performance.
# Without this, uses `autoversion` autovectorization (safe, ~87% of intrinsics perf).
simd-intrinsics = []
# Legacy alias
simd = ["simd-intrinsics"]
# Enable PNG loading in corpus module (enabled by default in dev)
png = ["dep:png"]
# Enables granular FFI tests against instrumented C mozjpeg internals (DCT, quant, etc.)
# Requires imazen/mozjpeg fork with test exports at ../mozjpeg - use scripts/setup-instrumented-mozjpeg.sh
# NOTE: This feature only works with local development (sys-local not on crates.io)
_instrument-c-mozjpeg-internals = []
# Enables mozjpeg-sys configuration: configure a C mozjpeg encoder from our Encoder
mozjpeg-sys-config = ["dep:mozjpeg-sys", "dep:libc"]
# Enables imgref integration for type-safe pixel formats with automatic stride handling.
# Provides encode() method that accepts ImgRef<RGB8>, ImgRef<RGBA8>, etc.
imgref = ["dep:imgref", "dep:rgb"]
# zencodec trait implementations (EncoderConfig, EncodeJob, Encoder).
# Provides MozjpegEncoderConfig for use in the zen codec ecosystem.
zencodec = ["dep:zencodec", "dep:zenpixels", "dep:garb"]
[dependencies]
bytemuck = "1.25.0"
# Optional PNG support for corpus loading
png = { version = "0.18.1", optional = true }
# Used by dct.rs and color.rs for portable SIMD
wide = "1.2.0"
# Safe SIMD with capability tokens
archmage = { version = "0.9.17", features = ["macros"] }
# Safe unaligned SIMD memory operations (no token parameter needed)
safe_unaligned_simd = "0.2.5"
# Optional: mozjpeg-sys configuration (configure C encoder from our settings)
mozjpeg-sys = { version = "2.2", optional = true }
libc = { version = "0.2.183", optional = true }
# Optional: zenyuv for fast SIMD color conversion (AVX2/NEON/WASM + scalar)
zenyuv = { version = "0.1.0", optional = true, default-features = false, features = ["std"] }
# Optional: imgref integration for type-safe pixel formats
imgref = { version = "1.12.0", optional = true }
rgb = { version = "0.8", optional = true }
# Cooperative cancellation trait (zero-cost when using Unstoppable)
enough = { version = "0.4.2", features = ["std"] }
# Optional: zencodec trait implementations for zen codec ecosystem
zencodec = { version = "0.1.19", optional = true }
zenpixels = { version = "0.2.10", optional = true }
# Optional: SIMD-optimized pixel format conversions (BGRA↔RGB swizzle)
garb = { version = "0.2.5", optional = true, default-features = false }
[dev-dependencies]
dssim = "3.4.0"
yuv = "0.8.12"
rgb = "0.8"
imgref = "1.12.0"
ssimulacra2 = "0.5.1"
png = "0.18.1"
proptest = "1.11.0"
criterion = "0.8.2"
jpeg-decoder = "0.3.2"
zune-jpeg = "0.5.15"
libc = "0.2.183"
# Use existing mozjpeg-sys from crates.io for basic FFI validation
mozjpeg-sys = "2.2"
# High-level mozjpeg wrapper for parity testing
mozjpeg = "0.10.13"
# Codec testing infrastructure (provides DSSIM, SSIMULACRA2, Butteraugli metrics, ICC support)
codec-eval = { git = "https://github.com/imazen/codec-eval", rev = "0ee46bc" }
# Butteraugli perceptual image quality metric
butteraugli = "0.9.0"
chrono = { version = "0.4.44", features = ["serde"] }
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
[[bench]]
name = "encode"
harness = false
[[bench]]
name = "dct"
harness = false
[[bench]]
name = "color"
harness = false
[[bench]]
name = "entropy"
harness = false
# Examples that require instrumented C mozjpeg (sys-local crate)
[[example]]
name = "trace_pipeline"
required-features = ["_instrument-c-mozjpeg-internals"]
[[example]]
name = "quant_ffi_compare"
required-features = ["_instrument-c-mozjpeg-internals"]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(feature, values(\"_instrument-c-mozjpeg-internals\", \"ffi-test\", \"avx512\", \"zencodec\"))"] }
[lints.clippy]
all = { level = "warn", priority = -1 }
# Allow common patterns in test/example code
unnecessary_cast = "allow"
needless_borrows_for_generic_args = "allow"
needless_range_loop = "allow"
manual_div_ceil = "allow"
manual_range_contains = "allow"
expect_fun_call = "allow"
absurd_extreme_comparisons = "allow"