Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ part was built.
Lumen's own float-free code in a dependency-free `lumen-image` crate, with the supported and
refused features of each format stated. The crate is built by #195 to #199.
(flyingrobots/lumen#184.)
- **`lumen-image`, baseline JPEG** (work in progress): a dependency-free, float-free workspace
crate inside the deterministic core, with a baseline JPEG decoder to RGB8 under the identity
`lumen-jpeg-decode/1`. (flyingrobots/lumen#197.)
- **ADR 0011** records that arithmetic for analytic shapes, point lights and the thin lens is
versioned Bunny contracts, and that Lumen owns the scene model. (flyingrobots/lumen#183.)
- **Dependencies**: Bunny's `bunny-num`, `bunny-linalg`, `bunny-geom`, `bunny-query`,
Expand Down
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["crates/lumen", "xtask", "xtask/clippy-fixture"]
members = ["crates/lumen", "crates/lumen-image", "xtask", "xtask/clippy-fixture"]
resolver = "2"

[workspace.package]
Expand All @@ -22,6 +22,8 @@ bunny-linalg = { git = "https://github.com/flyingrobots/bunny", rev = "2cd551e24
bunny-num = { git = "https://github.com/flyingrobots/bunny", rev = "2cd551e248d55407a8f27e84dcb26d1b1d8768bd" }
bunny-optics = { git = "https://github.com/flyingrobots/bunny", rev = "2cd551e248d55407a8f27e84dcb26d1b1d8768bd" }
bunny-query = { git = "https://github.com/flyingrobots/bunny", rev = "2cd551e248d55407a8f27e84dcb26d1b1d8768bd" }
# Lumen's own image decoders (docs/adr/0012-image-decoding.md): a member with no dependency.
lumen-image = { path = "crates/lumen-image" }

[workspace.lints.rust]
unsafe_code = "forbid"
Expand Down
18 changes: 18 additions & 0 deletions crates/lumen-image/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "lumen-image"
description = "Lumen's image decoders: dependency-free, float-free and deterministic (ADR 0012)."
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true
keywords = ["jpeg", "decoder", "deterministic"]
categories = ["multimedia::images"]
publish = false

# No dependency, not even Bunny's, and no dev-dependency (docs/adr/0012-image-decoding.md).
[dependencies]

[lints]
workspace = true
5 changes: 5 additions & 0 deletions crates/lumen-image/src/jpeg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! A baseline JPEG decoder (work in progress, flyingrobots/lumen#197).

/// The identity of the decoding rules: the integer inverse DCT, the chroma upsampling rule and
/// the integer colour conversion. Changing any of them makes a new identity.
pub const JPEG_DECODE_ID: &str = "lumen-jpeg-decode/1";
16 changes: 16 additions & 0 deletions crates/lumen-image/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! Lumen's image decoders: bytes of an image file in, pixels out, by stated integer rules.
//!
//! The crate has no dependency and no floating point, and it is part of Lumen's deterministic
//! core (docs/adr/0012-image-decoding.md, docs/adr/0006-nondeterminism-gate.md): the same file
//! decodes to the same bytes on every platform and in every build profile. Every decoder
//! follows the same rules: a typed error that names the refused feature or the byte offset,
//! every limit taken from the caller and checked before a large allocation, and no panic and
//! no read past the input on any bytes.
//!
//! - [`jpeg`]: baseline JPEG to RGB8, under the identity [`jpeg::JPEG_DECODE_ID`].

// No float in the crate: `clippy.toml` bans the float types; this catches arithmetic on a float
// whose type is only inferred (docs/adr/0006-nondeterminism-gate.md).
#![deny(clippy::float_arithmetic)]

pub mod jpeg;
1 change: 1 addition & 0 deletions crates/lumen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ bunny-linalg.workspace = true
bunny-num.workspace = true
bunny-optics.workspace = true
bunny-query.workspace = true
lumen-image.workspace = true

[lints]
workspace = true
Loading