From aba88fb2eea6d304d14610d169ebb8132ca6d740 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Tue, 30 Jan 2024 16:21:36 +0100 Subject: [PATCH 1/2] Allow any higher `half` crate version, not bound by `<2.3` --- Cargo.toml | 2 +- README.md | 45 +++++++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6c5dd75..b110238 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ proc-macro = false [dependencies] lebe = "^0.5.2" # generic binary serialization -half = ">=2.1.0, <2.3" # 16 bit float pixel data type +half = "2.1.0" # 16 bit float pixel data type bit_field = "^0.10.1" # exr file version bit flags miniz_oxide = "^0.7.1" # zip compression for pxr24 smallvec = "^1.7.0" # make cache-friendly allocations TODO profile if smallvec is really an improvement! diff --git a/README.md b/README.md index 8a8d6d5..62dc511 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![Rust Docs](https://docs.rs/exr/badge.svg)](https://docs.rs/exr) +[![Rust Docs](https://docs.rs/exr/badge.svg)](https://docs.rs/exr) [![Rust Crate](https://img.shields.io/crates/v/exr.svg)](https://crates.io/crates/exr) -[![Rust Lang Version](https://img.shields.io/badge/rustc-1.59.0-lightgray.svg)](https://blog.rust-lang.org/2022/02/24/Rust-1.59.0.html) +[![Rust Lang Version](https://img.shields.io/badge/rustc-1.61.0-lightgray.svg)](https://blog.rust-lang.org/2022/05/19/Rust-1.61.0.html) [![Wasm Ready](https://img.shields.io/badge/wasm-supported-%236d0)](https://github.com/johannesvollmer/exrs/actions?query=branch%3Amaster) [![downloads](https://img.shields.io/crates/d/exr)](https://crates.io/crates/exr) [![Lines of Code](https://tokei.rs/b1/github/johannesvollmer/exrs?category=code)](https://tokei.rs) @@ -8,7 +8,7 @@ # EXRS This library is a 100% Rust and 100% safe code library for -reading and writing OpenEXR images. +reading and writing OpenEXR images. [OpenEXR](http://www.openexr.com/) is the de-facto standard image format in animation, VFX, and @@ -28,13 +28,18 @@ Features include: ### Current Status -This library has matured quite a bit, but should still be considered incomplete. +> [!TIP] +> MSRV Note: This crate is now on Rust `1.70.0`. If you want to use the +> newest version of `exrs` with an older Rust version, you can still do that: +> By specifying a version `half = "2.1.0"` in your project, the crate will work with Rust `1.59.0`. + +This library has matured quite a bit, but should still be considered incomplete. For example, deep data and DWA compression algorithms are not supported yet. If you encounter an exr file that cannot be opened by this crate but should be, please leave an issue on this repository, containing the image file. -The focus is set on supporting all feature and correctness; +The focus is set on supporting all feature and correctness; some performance optimizations are to be done. __What we can do:__ @@ -44,7 +49,7 @@ __What we can do:__ - [x] multi-part images (multiple layers, like Photoshop) - [x] multi-resolution images (mip maps, rip maps) - [x] access meta data and raw pixel blocks independently - - [x] automatically crop away transparent pixels of an image (opt-in) + - [x] automatically crop away transparent pixels of an image (opt-in) - [ ] channel subsampling - [ ] deep data - [x] compression methods @@ -68,14 +73,14 @@ __What we can do:__ - [x] a full-fledged image data structure that can contain any exr image, can open any image with a single function call (`read_all_data_from_file`) without knowing anything about the file in advance - - [x] decompress and decompress image sections either + - [x] decompress and decompress image sections either in parallel or with low memory overhead - [x] read and write progress callback - [x] write blocks streams, one after another - - [x] memory mapping automatically supported + - [x] memory mapping automatically supported by using the generic `std::io::Read` and `std::io::Write` traits - + - + ### Usage @@ -163,13 +168,13 @@ Add this to your `Cargo.toml`: [dependencies] exr = "1.71.0" -# also, optionally add this to your crate for smaller binary size +# also, optionally add this to your crate for smaller binary size # and better runtime performance [profile.release] lto = true ``` -The master branch of this repository always matches the `crates.io` version, +The master branch of this repository always matches the `crates.io` version, so you could also link the github repository master branch. ### Example @@ -216,8 +221,8 @@ Or read [the guide](https://github.com/johannesvollmer/exrs/tree/master/GUIDE.md ### Goals -`exrs` aims to provide a safe and convenient -interface to the OpenEXR file format. It is designed +`exrs` aims to provide a safe and convenient +interface to the OpenEXR file format. It is designed to minimize the possibility of invalid files and runtime errors. It contains a full-fledged image data structure that can contain any exr image, but also grants access a low level block interface. @@ -234,7 +239,7 @@ This library uses no unsafe code. In fact, this crate is annotated with `#[forbi Some dependencies use unsafe code, though this is minimized by selecting dependencies carefully. All information from a file is handled with caution. -Allocations have a safe maximum size that will not be exceeded at once, +Allocations have a safe maximum size that will not be exceeded at once, to reduce memory exhaustion attacks. ### What I am proud of @@ -272,7 +277,7 @@ and they offer several advantages over this Rust implementation: ### Specification -This library is modeled after the +This library is modeled after the official [`OpenEXRFileLayout.pdf`](http://www.openexr.com/documentation.html) document. Unspecified behavior is concluded from the C++ library. @@ -300,4 +305,4 @@ Each command requires a running `docker` instance, and `cross-rs` to be installed on your machine (`cargo install cross`). - Mips (Big Endian) `cross test --target mips-unknown-linux-gnu --verbose` -To benchmark the library, simply run `cargo bench`. \ No newline at end of file +To benchmark the library, simply run `cargo bench`. From 15333e6cc24e35e2b61190619bbeb406f807304e Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Tue, 30 Jan 2024 16:22:29 +0100 Subject: [PATCH 2/2] Only test MSRV with minimal versions --- .github/workflows/rust.yml | 28 ++++++++++++++++------------ README.md | 8 +++----- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 729e0be..506ef5d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -37,8 +37,11 @@ jobs: run: cargo test --verbose verify-msrv: - runs-on: ubuntu-latest - name: verify minimum supported rust version (ubuntu) + strategy: + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + name: verify minimum supported rust version without cache (takes longer, but caching produces unexpected behaviour) timeout-minutes: 30 # we are using the `cargo-msrv` app @@ -47,14 +50,15 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install foresterre/cargo-msrv without cache (takes longer, but caching produces unexpected behaviour) + - name: Install foresterre/cargo-msrv run: cargo install cargo-msrv - - name: Verify the Rustc version declared in `cargo.toml` without cache (takes longer, but caching produces unexpected behaviour) - run: | - rm -f Cargo.lock - cargo update - cargo-msrv verify + - uses: dtolnay/rust-toolchain@nightly + - name: Generate Cargo.lock with minimal-version dependencies + run: cargo -Zminimal-versions generate-lockfile + + - name: Verify the Rustc version declared in `Cargo.toml` with `minimal-versions` + run: cargo-msrv verify # github actions does not support big endian systems directly, but it does support QEMU. # so we use cross-rs, which uses QEMU internally. @@ -94,16 +98,16 @@ jobs: steps: - uses: actions/checkout@v2 - + - name: Cache Cargo Dependencies uses: Swatinem/rust-cache@v1.3.0 - + - name: Add wasm32 Target run: rustup target add wasm32-unknown-unknown - + - name: Build without default features run: cargo build --verbose --no-default-features --target wasm32-unknown-unknown - + - name: Run tests without default features run: cargo test --verbose --no-default-features diff --git a/README.md b/README.md index 62dc511..3db44d6 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,6 @@ Features include: ### Current Status -> [!TIP] -> MSRV Note: This crate is now on Rust `1.70.0`. If you want to use the -> newest version of `exrs` with an older Rust version, you can still do that: -> By specifying a version `half = "2.1.0"` in your project, the crate will work with Rust `1.59.0`. - This library has matured quite a bit, but should still be considered incomplete. For example, deep data and DWA compression algorithms are not supported yet. @@ -163,6 +158,9 @@ __What we can do:__ ### Usage +> [!TIP] +> If you want to use the newest version of `exrs` with an older Rust version, you can still do that, by forcing Rust to use a an older version of the `half` crate via `cargo update -p half --precise 2.2.1`, or downgrade all dependencies via `cargo +nightly -Zminimal-versions generate-lockfile`. `half 2.3.0` and higher have an MSRV above 1.61. + Add this to your `Cargo.toml`: ```toml [dependencies]