From 03de9a83c186967b64e64d8db1295646eb9568f4 Mon Sep 17 00:00:00 2001 From: Inflation <2375962+inflation@users.noreply.github.com> Date: Fri, 11 Oct 2024 11:34:18 +0800 Subject: [PATCH] feat: Add `Session` to expose decoding steps --- .markdownlint.json | 6 + jpegxl-rs/CHANGELOG.md | 98 +++++------ jpegxl-rs/Cargo.toml | 142 ++++++++-------- jpegxl-rs/src/decode.rs | 22 +++ jpegxl-rs/src/decode/event.rs | 55 ++++++ jpegxl-rs/src/decode/session.rs | 290 ++++++++++++++++++++++++++++++++ jpegxl-src/CHANGELOG.md | 22 +-- jpegxl-src/Cargo.toml | 94 +++++------ jpegxl-sys/CHANGELOG.md | 86 +++++----- jpegxl-sys/Cargo.toml | 90 +++++----- 10 files changed, 639 insertions(+), 266 deletions(-) create mode 100644 .markdownlint.json create mode 100644 jpegxl-rs/src/decode/event.rs create mode 100644 jpegxl-rs/src/decode/session.rs diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..36eb18a --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,6 @@ +{ + "default": true, + "MD024": { + "siblings_only": true + } +} \ No newline at end of file diff --git a/jpegxl-rs/CHANGELOG.md b/jpegxl-rs/CHANGELOG.md index e673563..d5aa047 100644 --- a/jpegxl-rs/CHANGELOG.md +++ b/jpegxl-rs/CHANGELOG.md @@ -1,49 +1,49 @@ -# Changelog - -## [Unreleased] - -## [0.11.1+libjxl-0.11.0](https://github.com/inflation/jpegxl-rs/compare/jpegxl-rs-v0.11.0+libjxl-0.11.0...jpegxl-rs-v0.11.1+libjxl-0.11.0) - 2024-10-01 - -### 🐛 Bug Fixes - -- Fix doc gen - -### 📚 Documentation - -- Remove docsrs-specific reference to deleted "threads" feature - -## [0.11.0+libjxl-0.11.0](https://github.com/inflation/jpegxl-rs/compare/jpegxl-rs-v0.10.4+libjxl-0.10.3...jpegxl-rs-v0.11.0+libjxl-0.11.0) - 2024-09-27 - -### ⛰️ Features - -- Update JPEG quality setting in encoder ([#74](https://github.com/inflation/jpegxl-rs/pull/74)) - -### 🐛 Bug Fixes - -- Update release configuration for jpegxl-rs and jpegxl-sys packages -- Change ffi function types to use `c-unwind` ABI -- Change `JxlBoxType` to use system char type - -### 🚜 Refactor - -- Move `libjxl` functions into modules -- Remove threads feature and update dependencies. -- Don't use `-sys` in `-rs` with default features enabled - -### 📚 Documentation - -- Convert `libjxl` doc to rustdoc format with help from @copilot -- Remove unnecessary feature attribute in thread pool implementations -- Update how docs are generated ([#73](https://github.com/inflation/jpegxl-rs/pull/73)) - -### 📦 Dependencies - -- Bump thiserror from 1.0.61 to 1.0.64 -- Bump pretty_assertions from 1.4.0 to 1.4.1 -- Bump derive_builder from 0.20.0 to 0.20.1 -- Bump testresult from 0.4.0 to 0.4.1 -- Bump image from 0.25.1 to 0.25.2 - -### ⚙️ Miscellaneous Tasks - -- Update release-plz workflow and config +# Changelog + +## [Unreleased] + +## [0.11.1+libjxl-0.11.0](https://github.com/inflation/jpegxl-rs/compare/jpegxl-rs-v0.11.0+libjxl-0.11.0...jpegxl-rs-v0.11.1+libjxl-0.11.0) - 2024-10-01 + +### 🐛 Bug Fixes + +- Fix doc gen + +### 📚 Documentation + +- Remove docsrs-specific reference to deleted "threads" feature + +## [0.11.0+libjxl-0.11.0](https://github.com/inflation/jpegxl-rs/compare/jpegxl-rs-v0.10.4+libjxl-0.10.3...jpegxl-rs-v0.11.0+libjxl-0.11.0) - 2024-09-27 + +### ⛰️ Features + +- Update JPEG quality setting in encoder ([#74](https://github.com/inflation/jpegxl-rs/pull/74)) + +### 🐛 Bug Fixes + +- Update release configuration for jpegxl-rs and jpegxl-sys packages +- Change ffi function types to use `c-unwind` ABI +- Change `JxlBoxType` to use system char type + +### 🚜 Refactor + +- Move `libjxl` functions into modules +- Remove threads feature and update dependencies. +- Don't use `-sys` in `-rs` with default features enabled + +### 📚 Documentation + +- Convert `libjxl` doc to rustdoc format with help from @copilot +- Remove unnecessary feature attribute in thread pool implementations +- Update how docs are generated ([#73](https://github.com/inflation/jpegxl-rs/pull/73)) + +### 📦 Dependencies + +- Bump thiserror from 1.0.61 to 1.0.64 +- Bump pretty_assertions from 1.4.0 to 1.4.1 +- Bump derive_builder from 0.20.0 to 0.20.1 +- Bump testresult from 0.4.0 to 0.4.1 +- Bump image from 0.25.1 to 0.25.2 + +### ⚙️ Miscellaneous Tasks + +- Update release-plz workflow and config diff --git a/jpegxl-rs/Cargo.toml b/jpegxl-rs/Cargo.toml index 834d8d1..fce8cd5 100644 --- a/jpegxl-rs/Cargo.toml +++ b/jpegxl-rs/Cargo.toml @@ -1,71 +1,71 @@ -[package] -authors = ["Inflation "] -categories = ["api-bindings", "encoding", "multimedia::images"] -description = "Safe Rust wrapper for JPEG XL reference implementation" -edition = "2021" -keywords = ["jpeg-xl", "jxl"] -license = "GPL-3.0-or-later" -name = "jpegxl-rs" -readme = "README.md" -repository = "https://github.com/inflation/jpegxl-rs" -version = "0.11.1+libjxl-0.11.0" -rust-version.workspace = true - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lints.rust] -missing_docs = "warn" -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } - -[lints.clippy] -pedantic = "warn" - -[features] -default = ["image"] -image = ["dep:image"] -vendored = ["jpegxl-sys/vendored"] -docs = ["jpegxl-sys/docs"] -bench = [] - -[dependencies] -derive_builder = "0.20.1" -image = { version = "0.25.2", optional = true, default-features = false } -thiserror = "1.0.64" -half = "2.4.1" -byteorder = "1.5.0" - -[dependencies.jpegxl-sys] -version = "0.11.1" -path = "../jpegxl-sys" -default-features = false - -[dev-dependencies] -image = { version = "0.25.2", default-features = false, features = [ - "jpeg", - "png", -] } -lcms2 = "6.1.0" -pretty_assertions = "1.4.1" -testresult = "0.4.1" - -[target.'cfg(not(target_family = "wasm"))'.dev-dependencies] -criterion = "0.5.1" - - -[package.metadata.docs.rs] -rustdoc-args = ["--cfg", "docsrs"] -features = ["docs"] - -[lib] -bench = false -path = "src/lib.rs" - -[[bench]] -harness = false -name = "decode" -required-features = ["bench"] - -[[bench]] -harness = false -name = "encode" -required-features = ["bench"] +[package] +authors = ["Inflation "] +categories = ["api-bindings", "encoding", "multimedia::images"] +description = "Safe Rust wrapper for JPEG XL reference implementation" +edition = "2021" +keywords = ["jpeg-xl", "jxl"] +license = "GPL-3.0-or-later" +name = "jpegxl-rs" +readme = "README.md" +repository = "https://github.com/inflation/jpegxl-rs" +version = "0.11.1+libjxl-0.11.0" +rust-version.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lints.rust] +missing_docs = "warn" +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } + +[lints.clippy] +pedantic = "warn" + +[features] +default = ["image"] +image = ["dep:image"] +vendored = ["jpegxl-sys/vendored"] +docs = ["jpegxl-sys/docs"] +bench = [] + +[dependencies] +derive_builder = "0.20.1" +image = { version = "0.25.2", optional = true, default-features = false } +thiserror = "1.0.64" +half = "2.4.1" +byteorder = "1.5.0" + +[dependencies.jpegxl-sys] +version = "0.11.1" +path = "../jpegxl-sys" +default-features = false + +[dev-dependencies] +image = { version = "0.25.2", default-features = false, features = [ + "jpeg", + "png", +] } +lcms2 = "6.1.0" +pretty_assertions = "1.4.1" +testresult = "0.4.1" + +[target.'cfg(not(target_family = "wasm"))'.dev-dependencies] +criterion = "0.5.1" + + +[package.metadata.docs.rs] +rustdoc-args = ["--cfg", "docsrs"] +features = ["docs"] + +[lib] +bench = false +path = "src/lib.rs" + +[[bench]] +harness = false +name = "decode" +required-features = ["bench"] + +[[bench]] +harness = false +name = "encode" +required-features = ["bench"] diff --git a/jpegxl-rs/src/decode.rs b/jpegxl-rs/src/decode.rs index 856a54f..2e57181 100644 --- a/jpegxl-rs/src/decode.rs +++ b/jpegxl-rs/src/decode.rs @@ -34,8 +34,12 @@ use crate::{ utils::check_valid_signature, }; +mod event; +pub use event::*; mod result; pub use result::*; +mod session; +pub use session::*; /// Basic information pub type BasicInfo = JxlBasicInfo; @@ -414,6 +418,24 @@ impl<'pr, 'mm> JxlDecoder<'pr, 'mm> { Ok(()) } + /// Start a new decoding session. + /// + /// Later event will overwrite the previous one if they are the same. + /// + /// # Arguments + /// + /// * `events` - The events to subscribe to during the session. + /// + /// # Errors + /// + /// Returns a [`DecodeError`] if the decoding session encounters an error. + pub fn session(&mut self, events: I) -> Result, DecodeError> + where + I: IntoIterator, + { + Session::new(self, events) + } + /// Decode a JPEG XL image /// /// # Errors diff --git a/jpegxl-rs/src/decode/event.rs b/jpegxl-rs/src/decode/event.rs new file mode 100644 index 0000000..1413a34 --- /dev/null +++ b/jpegxl-rs/src/decode/event.rs @@ -0,0 +1,55 @@ +use std::ffi::c_int; + +use jpegxl_sys::common::types::JxlPixelFormat; +/// Target of the color profile. +pub use jpegxl_sys::decode::JxlColorProfileTarget as ColorProfileTarget; + +use super::{ColorEncodingConfig, Config}; + +/// Events that can be subscribed to. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Event { + /// Basic information. + BasicInfo, + /// Color encoding. + ColorEncoding(ColorEncodingConfig), + /// Preview image. + PreviewImage { + /// Pixel format. + pixel_format: JxlPixelFormat, + }, + /// JPEG reconstruction. + JpegReconstruction { + /// Initial buffer size. Increase it to reduce the number of reallocations. + init_buffer_size: usize, + }, +} + +impl From for c_int { + fn from(value: Event) -> Self { + match value { + Event::BasicInfo => 0x40, + Event::ColorEncoding(_) => 0x100, + Event::PreviewImage { .. } => 0x200, + Event::JpegReconstruction { .. } => 0x2000, + } + } +} + +pub(crate) fn parse_events(iter: I) -> (c_int, Config) +where + I: IntoIterator, +{ + iter.into_iter() + .fold((0, Config::default()), |(flag, mut config), x| { + let flag = flag | c_int::from(x); + let config = match x { + Event::ColorEncoding(val) => { + config.color_profile = Some(val); + config + } + _ => config, + }; + (flag, config) + }) +} diff --git a/jpegxl-rs/src/decode/session.rs b/jpegxl-rs/src/decode/session.rs new file mode 100644 index 0000000..da1eef8 --- /dev/null +++ b/jpegxl-rs/src/decode/session.rs @@ -0,0 +1,290 @@ +use std::{ffi::CString, mem::MaybeUninit, sync::Arc}; + +use jpegxl_sys::{ + color::color_encoding::JxlColorEncoding, common::types::JxlPixelFormat, decode as d, +}; + +use super::{BasicInfo, ColorProfileTarget, Event, JxlDecoder, Pixels}; +use crate::{decode::parse_events, errors::check_dec_status, DecodeError}; + +/// Represents the state of the session. +pub enum State { + /// Waiting for the next event. + Continue, + /// Basic information such as image dimensions and extra channels. + /// This event occurs max once per image. + BasicInfo(Arc), + /// ICC color profile . + IccProfile(Vec), + /// Color profile. + ColorProfile(Box), + /// Preview image. Dimensions can be accessed from [`BasicInfo::preview`] + PreviewImage(Pixels), + /// Begining of a frame + Frame, + /// JPEG reconstruction. + JpegReconstruction(Vec), +} + +#[derive(Debug, Default)] +pub(crate) struct Config { + pub color_profile: Option, + pub preview: Option, + pub frame: Option, + pub jpeg_reconstruction: Option, +} + +/// Configuration for color encoding. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct ColorEncodingConfig { + target: ColorProfileTarget, + icc_profile: bool, +} + +/// Represents a session for decoding JPEG XL images. +pub struct Session<'dec, 'pr, 'mm> { + dec: &'dec mut JxlDecoder<'pr, 'mm>, + basic_info: Option>, + jpeg_buffer: Vec, + config: Config, + state: State, +} + +impl<'dec, 'pr, 'mm> Session<'dec, 'pr, 'mm> { + pub(crate) fn new( + dec: &'dec mut JxlDecoder<'pr, 'mm>, + registered_events: I, + ) -> Result + where + I: IntoIterator, + { + use jpegxl_sys::decode::{JxlDecoderSetParallelRunner, JxlDecoderSubscribeEvents}; + + if let Some(runner) = dec.parallel_runner { + check_dec_status(unsafe { + JxlDecoderSetParallelRunner(dec.ptr, runner.runner(), runner.as_opaque_ptr()) + })?; + } + + let (flags, config) = parse_events(registered_events); + check_dec_status(unsafe { JxlDecoderSubscribeEvents(dec.ptr, flags) })?; + + macro_rules! set_value { + ( $( ($name:ident, $fn:ident) $(,)? )* ) => { + $( + if let Some(val) = dec.$name { + check_dec_status(unsafe { jpegxl_sys::decode::$fn(dec.ptr, val.into()) })?; + } + )* + }; + } + + set_value! { + (skip_reorientation, JxlDecoderSetKeepOrientation), + (unpremul_alpha, JxlDecoderSetUnpremultiplyAlpha), + (render_spotcolors, JxlDecoderSetRenderSpotcolors), + (coalescing, JxlDecoderSetCoalescing), + ( + desired_intensity_target, + JxlDecoderSetDesiredIntensityTarget + ) + } + + Ok(Self { + dec, + basic_info: None, + jpeg_buffer: Vec::new(), + config, + state: State::Continue, + }) + } + + fn step(&mut self, status: d::JxlDecoderStatus) -> Result { + use jpegxl_sys::decode::JxlDecoderStatus as s; + + match status { + s::Success => panic!("Unexpected success status"), + s::Error => Err(DecodeError::GenericError), + s::BasicInfo => self.get_basic_info(), + s::ColorEncoding => self.get_color_profile(), + s::PreviewImage => self.get_preview_image(), + s::Frame => self.get_frame(), + s::JPEGReconstruction => { + let Some(size) = self.config.jpeg_reconstruction else { + return Err(DecodeError::InternalError( + "Subscribe to JPEG reconstruction event but without a config!", + )); + }; + + self.jpeg_buffer.resize(size, 0); + + check_dec_status(unsafe { + d::JxlDecoderSetJPEGBuffer( + self.dec.ptr, + self.jpeg_buffer.as_mut_ptr(), + self.jpeg_buffer.len(), + ) + })?; + + Ok(State::Continue) + } + s::JPEGNeedMoreOutput => { + let remaining = unsafe { d::JxlDecoderReleaseJPEGBuffer(self.dec.ptr) }; + + self.jpeg_buffer + .resize(self.jpeg_buffer.len() + remaining, 0); + + check_dec_status(unsafe { + d::JxlDecoderSetJPEGBuffer( + self.dec.ptr, + self.jpeg_buffer.as_mut_ptr(), + self.jpeg_buffer.len(), + ) + })?; + + Ok(State::Continue) + } + _ => unimplemented!(), + } + } + + fn get_basic_info(&mut self) -> Result { + let mut info = MaybeUninit::uninit(); + check_dec_status(unsafe { d::JxlDecoderGetBasicInfo(self.dec.ptr, info.as_mut_ptr()) })?; + + if let Some(pr) = self.dec.parallel_runner { + pr.callback_basic_info(unsafe { &*info.as_ptr() }); + } + + unsafe { + self.basic_info = Some(Arc::new(info.assume_init())); + Ok(State::BasicInfo( + self.basic_info.as_ref().unwrap_unchecked().clone(), + )) + } + } + + fn get_color_profile(&mut self) -> Result { + let Some(config) = self.config.color_profile else { + return Err(DecodeError::InternalError( + "Subscribe to color encoding event but without a color profile config!", + )); + }; + + if config.icc_profile { + let mut icc_size = 0; + let mut icc_profile = Vec::new(); + + check_dec_status(unsafe { + d::JxlDecoderGetICCProfileSize(self.dec.ptr, config.target, &mut icc_size) + })?; + icc_profile.resize(icc_size, 0); + + check_dec_status(unsafe { + d::JxlDecoderGetColorAsICCProfile( + self.dec.ptr, + config.target, + icc_profile.as_mut_ptr(), + icc_size, + ) + })?; + + Ok(State::IccProfile(icc_profile)) + } else { + let mut color_encoding = MaybeUninit::uninit(); + + check_dec_status(unsafe { + d::JxlDecoderGetColorAsEncodedProfile( + self.dec.ptr, + config.target, + color_encoding.as_mut_ptr(), + ) + })?; + Ok(State::ColorProfile(Box::new(unsafe { + color_encoding.assume_init() + }))) + } + } + + fn get_preview_image(&mut self) -> Result { + let Some(pixel_format) = self.config.preview else { + return Err(DecodeError::InternalError( + "Subscribe to preview image event but without a pixel format!", + )); + }; + + let mut size = 0; + + check_dec_status(unsafe { + d::JxlDecoderPreviewOutBufferSize(self.dec.ptr, &pixel_format, &mut size) + })?; + + let mut buffer = vec![0; size]; + check_dec_status(unsafe { + d::JxlDecoderSetPreviewOutBuffer( + self.dec.ptr, + &pixel_format, + buffer.as_mut_ptr().cast(), + buffer.len(), + ) + })?; + + Ok(State::PreviewImage(Pixels::new(buffer, &pixel_format))) + } + + fn get_frame(&mut self) -> Result { + let mut header = MaybeUninit::uninit(); + check_dec_status(unsafe { + d::JxlDecoderGetFrameHeader(self.dec.ptr, header.as_mut_ptr()) + })?; + let header = unsafe { header.assume_init() }; + + let mut buffer = vec![0; header.name_length as usize + 1]; + check_dec_status(unsafe { + d::JxlDecoderGetFrameName(self.dec.ptr, buffer.as_mut_ptr().cast(), buffer.len()) + })?; + let name = CString::from_vec_with_nul(buffer) + .map_err(|_| DecodeError::InternalError("Invalid frame name"))?; + + Ok(State::Frame) + } +} + +impl<'dec, 'pr, 'mm> Iterator for Session<'dec, 'pr, 'mm> { + type Item = Result; + + fn next(&mut self) -> Option { + use jpegxl_sys::decode::{JxlDecoderProcessInput, JxlDecoderStatus as s}; + + let status = unsafe { JxlDecoderProcessInput(self.dec.ptr) }; + + match status { + s::Success => None, + status => Some(self.step(status)), + } + } +} + +impl Drop for Session<'_, '_, '_> { + fn drop(&mut self) { + unsafe { jpegxl_sys::decode::JxlDecoderReset(self.dec.ptr) } + } +} + +#[cfg(test)] +mod tests { + use testresult::TestResult; + + use crate::decoder_builder; + + use super::*; + + #[test] + fn test_session() -> TestResult { + let mut decoder = decoder_builder().build()?; + let session = Session::new(&mut decoder, [Event::BasicInfo])?; + drop(session); + + Ok(()) + } +} diff --git a/jpegxl-src/CHANGELOG.md b/jpegxl-src/CHANGELOG.md index ebf22d6..de7a069 100644 --- a/jpegxl-src/CHANGELOG.md +++ b/jpegxl-src/CHANGELOG.md @@ -1,11 +1,11 @@ -# Changelog - -## [Unreleased] - -## [0.11.1](https://github.com/inflation/jpegxl-rs/compare/jpegxl-src-v0.10.5...jpegxl-src-v0.11.1) - 2024-09-27 - -### 🐛 Bug Fixes - -- Fix that published crate doesn't contain source code - -## 0.11.0 - *YANKED* +# Changelog + +## [Unreleased] + +## [0.11.1](https://github.com/inflation/jpegxl-rs/compare/jpegxl-src-v0.10.5...jpegxl-src-v0.11.1) - 2024-09-27 + +### 🐛 Bug Fixes + +- Fix that published crate doesn't contain source code + +## 0.11.0 - *YANKED* diff --git a/jpegxl-src/Cargo.toml b/jpegxl-src/Cargo.toml index 1bd53ad..9edd3b9 100644 --- a/jpegxl-src/Cargo.toml +++ b/jpegxl-src/Cargo.toml @@ -1,47 +1,47 @@ -[package] -authors = ["Inflation "] -description = "Source of libjxl and logic to build it." -edition = "2021" -license = "BSD-3-Clause" -name = "jpegxl-src" -readme = "README.md" -repository = "https://github.com/inflation/jpegxl-rs" -version = "0.11.1" -rust-version.workspace = true -exclude = [ - "libjxl/third_party/libpng", - "libjxl/third_party/sjpeg", - "libjxl/third_party/lcms", - "libjxl/third_party/googletest", - "libjxl/third_party/brotli/tests", - "libjxl/third_party/brotli/java", - "libjxl/third_party/brotli/csharp", - "libjxl/third_party/brotli/research", - "libjxl/third_party/brotli/js", - "libjxl/third_party/libjpeg-turbo", - "libjxl/third_party/highway/g3doc", - "libjxl/third_party/skcms/profiles", - "libjxl/third_party/zlib/contrib", - "libjxl/testdata", - "libjxl/examples", - "libjxl/experimental", - "libjxl/docker", - "libjxl/doc", - "libjxl/.github", - "libjxl/debian", - "libjxl/plugins", -] - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } - -[lints.clippy] -pedantic = "warn" - -[dependencies] -cmake = "0.1.51" - -[features] -threads = [] +[package] +authors = ["Inflation "] +description = "Source of libjxl and logic to build it." +edition = "2021" +license = "BSD-3-Clause" +name = "jpegxl-src" +readme = "README.md" +repository = "https://github.com/inflation/jpegxl-rs" +version = "0.11.1" +rust-version.workspace = true +exclude = [ + "libjxl/third_party/libpng", + "libjxl/third_party/sjpeg", + "libjxl/third_party/lcms", + "libjxl/third_party/googletest", + "libjxl/third_party/brotli/tests", + "libjxl/third_party/brotli/java", + "libjxl/third_party/brotli/csharp", + "libjxl/third_party/brotli/research", + "libjxl/third_party/brotli/js", + "libjxl/third_party/libjpeg-turbo", + "libjxl/third_party/highway/g3doc", + "libjxl/third_party/skcms/profiles", + "libjxl/third_party/zlib/contrib", + "libjxl/testdata", + "libjxl/examples", + "libjxl/experimental", + "libjxl/docker", + "libjxl/doc", + "libjxl/.github", + "libjxl/debian", + "libjxl/plugins", +] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } + +[lints.clippy] +pedantic = "warn" + +[dependencies] +cmake = "0.1.51" + +[features] +threads = [] diff --git a/jpegxl-sys/CHANGELOG.md b/jpegxl-sys/CHANGELOG.md index b025123..fbf24e8 100644 --- a/jpegxl-sys/CHANGELOG.md +++ b/jpegxl-sys/CHANGELOG.md @@ -1,43 +1,43 @@ -# Changelog - -## [Unreleased] - -## [0.11.1+libjxl-0.11.0](https://github.com/inflation/jpegxl-rs/compare/jpegxl-sys-v0.11.0+libjxl-0.11.0...jpegxl-sys-v0.11.1+libjxl-0.11.0) - 2024-10-01 - -### 🐛 Bug Fixes - -- Fix doc gen - -### 📚 Documentation - -- Remove docsrs-specific reference to deleted "threads" feature - -## [0.11.0+libjxl-0.11.0](https://github.com/inflation/jpegxl-rs/compare/jpegxl-sys-v0.10.4+libjxl-0.10.3...jpegxl-sys-v0.11.0+libjxl-0.11.0) - 2024-09-27 - -### ⛰️ Features - -- Add gain map utility functions - -### 🐛 Bug Fixes - -- Change ffi function types to use `c-unwind` ABI - -### 🚜 Refactor - -- Move `libjxl` functions into modules -- Remove threads feature and update dependencies. - -### 📚 Documentation - -- Convert `libjxl` doc to rustdoc format with help from @copilot -- Update how docs are generated ([#73](https://github.com/inflation/jpegxl-rs/pull/73)) - -### 📦 Dependencies - -- Bump pkg-config from 0.3.30 to 0.3.31 -- Bump pretty_assertions from 1.4.0 to 1.4.1 -- Bump image from 0.25.1 to 0.25.2 - -### ⚙️ Miscellaneous Tasks - -- Update release configuration for `jpegxl-rs` and `jpegxl-sys` packages +# Changelog + +## [Unreleased] + +## [0.11.1+libjxl-0.11.0](https://github.com/inflation/jpegxl-rs/compare/jpegxl-sys-v0.11.0+libjxl-0.11.0...jpegxl-sys-v0.11.1+libjxl-0.11.0) - 2024-10-01 + +### 🐛 Bug Fixes + +- Fix doc gen + +### 📚 Documentation + +- Remove docsrs-specific reference to deleted "threads" feature + +## [0.11.0+libjxl-0.11.0](https://github.com/inflation/jpegxl-rs/compare/jpegxl-sys-v0.10.4+libjxl-0.10.3...jpegxl-sys-v0.11.0+libjxl-0.11.0) - 2024-09-27 + +### ⛰️ Features + +- Add gain map utility functions + +### 🐛 Bug Fixes + +- Change ffi function types to use `c-unwind` ABI + +### 🚜 Refactor + +- Move `libjxl` functions into modules +- Remove threads feature and update dependencies. + +### 📚 Documentation + +- Convert `libjxl` doc to rustdoc format with help from @copilot +- Update how docs are generated ([#73](https://github.com/inflation/jpegxl-rs/pull/73)) + +### 📦 Dependencies + +- Bump pkg-config from 0.3.30 to 0.3.31 +- Bump pretty_assertions from 1.4.0 to 1.4.1 +- Bump image from 0.25.1 to 0.25.2 + +### ⚙️ Miscellaneous Tasks + +- Update release configuration for `jpegxl-rs` and `jpegxl-sys` packages diff --git a/jpegxl-sys/Cargo.toml b/jpegxl-sys/Cargo.toml index cb8ee24..546e5fc 100644 --- a/jpegxl-sys/Cargo.toml +++ b/jpegxl-sys/Cargo.toml @@ -1,45 +1,45 @@ -[package] -authors = ["Inflation "] -categories = ["external-ffi-bindings", "encoding", "multimedia::images"] -description = "Rust wrapper for JPEG XL reference implementation" -edition = "2021" -keywords = ["jpeg-xl", "jxl"] -license = "GPL-3.0-or-later" -links = "jxl" -name = "jpegxl-sys" -readme = "README.md" -repository = "https://github.com/inflation/jpegxl-rs" -version = "0.11.1+libjxl-0.11.0" -rust-version.workspace = true - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } - -[lints.clippy] -pedantic = "warn" -module_name_repetitions = "allow" - -[lints.rustdoc] -broken_intra_doc_links = "deny" - -[package.metadata.docs.rs] -features = ["docs"] - -[build-dependencies] -pkg-config = "0.3.31" - -[build-dependencies.jpegxl-src] -version = "0.11.1" -path = "../jpegxl-src" -optional = true - -[dev-dependencies] -image = { version = "0.25.2", default-features = false, features = ["png"] } -pretty_assertions = "1.4.1" - -[features] -default = [] -vendored = ["jpegxl-src"] -docs = [] +[package] +authors = ["Inflation "] +categories = ["external-ffi-bindings", "encoding", "multimedia::images"] +description = "Rust wrapper for JPEG XL reference implementation" +edition = "2021" +keywords = ["jpeg-xl", "jxl"] +license = "GPL-3.0-or-later" +links = "jxl" +name = "jpegxl-sys" +readme = "README.md" +repository = "https://github.com/inflation/jpegxl-rs" +version = "0.11.1+libjxl-0.11.0" +rust-version.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } + +[lints.clippy] +pedantic = "warn" +module_name_repetitions = "allow" + +[lints.rustdoc] +broken_intra_doc_links = "deny" + +[package.metadata.docs.rs] +features = ["docs"] + +[build-dependencies] +pkg-config = "0.3.31" + +[build-dependencies.jpegxl-src] +version = "0.11.1" +path = "../jpegxl-src" +optional = true + +[dev-dependencies] +image = { version = "0.25.2", default-features = false, features = ["png"] } +pretty_assertions = "1.4.1" + +[features] +default = [] +vendored = ["jpegxl-src"] +docs = []