Skip to content

Commit

Permalink
Merge pull request #2164 from image-rs/next-version-0.25
Browse files Browse the repository at this point in the history
Release 0.25.0
  • Loading branch information
fintelia authored Mar 10, 2024
2 parents 2b513ae + c5a1be7 commit 6edf8ae
Show file tree
Hide file tree
Showing 81 changed files with 1,400 additions and 10,546 deletions.
84 changes: 30 additions & 54 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Rust CI

on:
push:
branches: [ master, main, next ]
branches: [ master, main, next-version-0.25 ]
pull_request:
branches: [ master, main, next ]
branches: [ master, main, next-version-0.25 ]
schedule:
- cron: '5 16 * * 6'

Expand All @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
features: ['', default, gif, jpeg, png, tiff, ico, pnm, tga, webp, bmp, hdr, dxt, dds, farbfeld, openexr, jpeg_rayon, webp-encoder]
features: ['', default, rayon, avif, bmp, dds, exr, ff, gif, hdr, ico, jpeg, png, pnm, qoi, tga, tiff, webp]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -38,14 +38,14 @@ jobs:
strategy:
fail-fast: false
matrix:
rust: ["1.63.0", nightly, beta]
rust: ["1.67.1", nightly, beta]
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@nightly
if: ${{ matrix.rust == '1.63.0' }}
if: ${{ matrix.rust == '1.67.1' }}
- name: Generate Cargo.lock with minimal-version dependencies
if: ${{ matrix.rust == '1.63.0' }}
if: ${{ matrix.rust == '1.67.1' }}
run: cargo -Zminimal-versions generate-lockfile

- uses: dtolnay/rust-toolchain@v1
Expand All @@ -56,12 +56,10 @@ jobs:
with:
cache-on-failure: true
- name: build
run: cargo build -v --features webp,webp-encoder
run: cargo build -v
- name: test
if: ${{ matrix.rust != '1.63.0' }}
run: >
cargo test -v --features webp,webp-encoder &&
cargo doc -v --features webp,webp-encoder
if: ${{ matrix.rust != '1.67.1' }}
run: cargo test -v && cargo doc -v

test_other_archs:
# github actions does not support 32-bit or big endian systems directly, but
Expand All @@ -73,7 +71,6 @@ jobs:
fail-fast: false
matrix:
arch: [powerpc-unknown-linux-gnu, i686-unknown-linux-gnu]
features: [default, webp-encoder]
steps:
- uses: actions/checkout@v4
- name: Install or use cached cross-rs/cross
Expand All @@ -84,23 +81,11 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
key: ${{ matrix.arch }}
- name: Start Docker (required for cross-rs)
run: sudo systemctl start docker
- name: Cross-Run Tests using QEMU
run: |
cross test --target ${{ matrix.arch }} --verbose -v --no-default-features --features "$FEATURES"
env:
FEATURES: ${{ matrix.features }}

test_avif:
runs-on: ubuntu-latest
steps:
- name: install-dependencies
run: sudo apt update && sudo apt install nasm
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: build
run: cargo build -v --no-default-features --features="avif"
run: cross test --target ${{ matrix.arch }}

test_avif_decoding:
runs-on: ubuntu-latest
Expand All @@ -110,7 +95,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: build
run: cargo build -v --no-default-features --features="avif,avif-decoder"
run: cargo build -v --no-default-features --features="avif,avif-native"
env:
SYSTEM_DEPS_DAV1D_BUILD_INTERNAL: always

Expand All @@ -135,9 +120,16 @@ jobs:
- uses: dtolnay/rust-toolchain@nightly
- name: install-deps
run: sudo apt-get -y install clang llvm
- name: Cache Cargo Registry
uses: Swatinem/rust-cache@v2
with:
cache-targets: false
cache-all-crates: true
cache-on-failure: true
- name: Install cargo-afl
run: cargo install --locked -f cargo-afl
- name: build
run: |
cargo install cargo-afl
cd fuzz-afl
cargo check --bin reproduce_webp
cargo check --bin reproduce_pnm
Expand All @@ -152,15 +144,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: build
run: |
cargo install cargo-fuzz
cargo fuzz build
- name: fuzz
run: |
for format in $(cargo fuzz list); do
cargo fuzz run "$format" -- -runs=0;
done
- name: Install cargo-fuzz
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-fuzz
- name: check
run: cargo fuzz check
env:
CARGO_INCREMENTAL: 0

public_private_dependencies:
runs-on: ubuntu-latest
Expand All @@ -169,9 +160,10 @@ jobs:
- uses: dtolnay/rust-toolchain@nightly
- name: build
run: |
mv ./Cargo.toml.public-private-dependencies ./Cargo.toml
echo "#![deny(exported_private_dependencies)]" | cat - src/lib.rs > src/lib.rs.0
mv src/lib.rs.0 src/lib.rs
echo 'cargo-features = ["public-dependency"]' | cat - Cargo.toml > Cargo.toml.0
mv Cargo.toml.0 Cargo.toml
cargo check
build_benchmarks:
Expand All @@ -197,19 +189,3 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1

verify_msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install or use cached `cargo-msrv`
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-msrv

- uses: dtolnay/rust-toolchain@nightly
- name: Generate Cargo.lock with minimal-version dependencies
run: cargo -Zminimal-versions generate-lockfile

- name: Verify Minimum Rust Version against `-Zminimal-versions` dependencies
run: cargo-msrv verify
21 changes: 21 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@

## Changes

### Version 0.25.0

Breaking changes:
- Added `BufRead` + `Seek` bound on many decoders.
- Use `ExtendedColorType` instead of `ColorType` when encoding.
- Removed `ImageOutputFormat`, `GenericImageView::bounds`, and several other
deprecated items.
- Removed incremental decoding support and changed `ImageDecoder` so the trait
is object safe.
- Pixel types are now `repr(transparent)` rather than `repr(C)`.
- Made color_quant dependency optional.
- Renamed some feature flags.

Structural changes:
- Increased MSRV to 1.67.1

Codec changes:
- Switched to image-webp for WebP encoding.
- Switched to zune-jpeg for JPEG decoding.
- Made the HDR decoder produce f32 images.

### Version 0.24.9

Structural changes:
Expand Down
80 changes: 37 additions & 43 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "image"
version = "0.24.9"
version = "0.25.0"
edition = "2021"
resolver = "2"

# note: when changed, also update test runner in `.github/workflows/rust.yml`
rust-version = "1.63.0"
rust-version = "1.67.1"

license = "MIT OR Apache-2.0"
description = "Imaging library. Provides basic image processing and encoders/decoders for common image formats."
Expand All @@ -31,69 +31,63 @@ include = [
"/benches/",
]

# Crate build related
exclude = ["src/png/testdata/*", "examples/*", "tests/*"]

[dependencies]
bytemuck = { version = "1.8.0", features = ["extern_crate_alloc"] } # includes cast_vec
byteorder = "1.3.2"
num-traits = "0.2.0"
gif = { version = "0.13", optional = true }
jpeg = { package = "jpeg-decoder", version = "0.3.0", default-features = false, optional = true }
png = { version = "0.17.6", optional = true }
tiff = { version = "0.9.0", optional = true }
ravif = { version = "0.11.0", optional = true }
rgb = { version = "0.8.25", optional = true }
mp4parse = { version = "0.17.0", optional = true }
num-traits = { version = "0.2.0" }

# Optional dependencies
color_quant = { version = "1.1", optional = true }
dav1d = { version = "0.10.2", optional = true }
dcv-color-primitives = { version = "0.6.1", optional = true }
color_quant = "1.1"
exr = { version = "1.5.0", optional = true }
gif = { version = "0.13", optional = true }
image-webp = { version = "0.1.0", optional = true }
mp4parse = { version = "0.17.0", optional = true }
png = { version = "0.17.6", optional = true }
qoi = { version = "0.4", optional = true }
libwebp = { package = "webp", version = "0.2.2", default-features = false, optional = true }
ravif = { version = "0.11.2", default-features = false, optional = true }
rayon = { version = "1.7.0", optional = true }
rgb = { version = "0.8.25", optional = true }
tiff = { version = "0.9.0", optional = true }
zune-core = { version = "0.4.11", default-features = false, optional = true }
zune-jpeg = { version = "0.4.11", optional = true }

[dev-dependencies]
crc32fast = "1.2.0"
num-complex = "0.4"
glob = "0.3"
quickcheck = "1"
criterion = "0.5.0"
# Keep this in sync with the jpeg dependency above. This is used to enable the platform_independent
# feature when testing, so `cargo test` works correctly.
jpeg = { package = "jpeg-decoder", version = "0.3.0", default-features = false, features = ["platform_independent"] }

[features]
# TODO: Add "avif" to this list while preparing for 0.24.0
default = ["gif", "jpeg", "ico", "png", "pnm", "tga", "tiff", "webp", "bmp", "hdr", "dxt", "dds", "farbfeld", "jpeg_rayon", "openexr", "qoi"]
default = ["rayon", "default-formats"]

ico = ["bmp", "png"]
pnm = []
tga = []
# Format features
default-formats = ["avif", "bmp", "dds", "exr", "ff", "gif", "hdr", "ico", "jpeg", "png", "pnm", "qoi", "tga", "tiff", "webp"]
avif = ["dep:ravif", "dep:rgb"]
bmp = []
dds = []
exr = ["dep:exr"]
ff = [] # Farbfeld image format
gif = ["dep:gif", "dep:color_quant"]
hdr = []
dxt = []
dds = ["dxt"]
farbfeld = []
openexr = ["exr"]
ico = ["bmp", "png"]
jpeg = ["dep:zune-core", "dep:zune-jpeg"]
png = ["dep:png"]
pnm = []
qoi = ["dep:qoi"]
tga = []
tiff = ["dep:tiff"]
webp = ["dep:image-webp"]

# Enables WebP decoder support.
webp = []
# Non-default, not included in `webp`. Requires native dependency libwebp.
webp-encoder = ["libwebp", "webp"]

# Enables multi-threading.
# Requires latest stable Rust.
jpeg_rayon = ["jpeg/rayon"]
# Non-default, enables avif support.
# Requires latest stable Rust.
avif = ["avif-encoder"]
# Requires latest stable Rust and recent nasm (>= 2.14).
avif-encoder = ["ravif", "rgb"]
# Non-default, even in `avif`. Requires stable Rust and native dependency libdav1d.
avif-decoder = ["mp4parse", "dcv-color-primitives", "dav1d"]

# Build some inline benchmarks. Useful only during development.
# Requires rustc nightly for feature test.
benchmarks = []
# Other features
rayon = ["dep:rayon"] # Enables multi-threading
avif-native = ["dep:mp4parse", "dep:dcv-color-primitives", "dep:dav1d"] # Enable native dependency libdav1d
benchmarks = [] # Build some inline benchmarks. Useful only during development (requires nightly Rust)

[[bench]]
path = "benches/decode.rs"
Expand Down
Loading

0 comments on commit 6edf8ae

Please sign in to comment.