Skip to content

Commit

Permalink
Roll our own matrix code & separate math into new crate (#27)
Browse files Browse the repository at this point in the history
* Implement matrix subset locally

* Use multiply_add in matrix math

* Update MSRV lockfile

* Refactor xy_to_xyz a bit

* Create yuvxyb-math crate

* ci: Run clippy on subcrate

* Update MSRV lockfile
  • Loading branch information
FreezyLemon authored Nov 21, 2024
1 parent 9f07a7c commit d7c338f
Show file tree
Hide file tree
Showing 15 changed files with 460 additions and 285 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/crate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ jobs:
run: cargo build
- name: Run tests
run: cargo test

lint-math:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Lint
run: cargo clippy --manifest-path yuvxyb-math/Cargo.toml
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/target
/Cargo.lock
yuvxyb-dump

# subcrate-specific
yuvxyb-math/target
yuvxyb-math/Cargo.lock
93 changes: 5 additions & 88 deletions Cargo.lock.MSRV

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

11 changes: 3 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,22 @@ homepage = "https://github.com/rust-av/yuvxyb"
repository = "https://github.com/rust-av/yuvxyb"
exclude = ["test_data", "yuvxyb-dump"]

# When changing MSRV: Also update README and .github/workflows/crate.yml
# When changing MSRV: Also update README, yuvxyb-matrix and .github/workflows/crate.yml
rust-version = "1.64.0"

[features]
default = ["fastmath"]
fastmath = []
fastmath = ["yuvxyb-math/fastmath"]

[dependencies]
yuvxyb-math = { version = "0.1.0", path = "yuvxyb-math" }
av-data = "0.4.2"
log = "0.4.17"
num-traits = "0.2.15"
paste = "1.0.9"
thiserror = "1.0.40"
v_frame = "0.3.8"

[dependencies.nalgebra]
version = "0.32.2"
# The default features include macros that we don't need
default-features = false
features = ["std"]

[dev-dependencies]
criterion = { version = "0.5", default-features = false }
image = { version = "0.25", default-features = false, features = ["png"] }
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#![warn(clippy::use_debug)]
#![warn(clippy::verbose_file_reads)]

mod math;
mod rgb_xyb;
mod yuv_rgb;

Expand Down
2 changes: 1 addition & 1 deletion src/rgb_xyb.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(clippy::many_single_char_names)]

use crate::math::cbrtf;
use yuvxyb_math::cbrtf;

const K_M02: f32 = 0.078f32;
const K_M00: f32 = 0.30f32;
Expand Down
Loading

0 comments on commit d7c338f

Please sign in to comment.