Skip to content
Open
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
21 changes: 11 additions & 10 deletions .github/workflows/no_std.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ jobs:
# Target below does not have a standard library
- run: rustup target add x86_64-unknown-uefi
# Below targets run in no-std environments
- run: cargo build -p zune-core --target x86_64-unknown-uefi --no-default-features
- run: cargo build -p zune-inflate --target x86_64-unknown-uefi --no-default-features
- run: cargo build -p zune-jpeg --target x86_64-unknown-uefi --no-default-features
- run: cargo build -p zune-png --target x86_64-unknown-uefi --no-default-features
- run: cargo build -p zune-ppm --target x86_64-unknown-uefi --no-default-features
- run: cargo build -p zune-qoi --target x86_64-unknown-uefi --no-default-features
- run: cargo build -p zune-farbfeld --target x86_64-unknown-uefi --no-default-features
- run: cargo build -p zune-psd --target x86_64-unknown-uefi --no-default-features
- run: cargo build -p zune-bmp --target x86_64-unknown-uefi --no-default-features

- run: cargo build -p zune-core --target x86_64-unknown-uefi --no-default-features --features log,serde
- run: cargo build -p zune-inflate --target x86_64-unknown-uefi --no-default-features --features zlib,gzip
- run: cargo build -p zune-jpeg --target x86_64-unknown-uefi --no-default-features --features log
- run: cargo build -p zune-png --target x86_64-unknown-uefi --no-default-features --features log
- run: cargo build -p zune-ppm --target x86_64-unknown-uefi --no-default-features --features log
- run: cargo build -p zune-qoi --target x86_64-unknown-uefi --no-default-features --features log
- run: cargo build -p zune-farbfeld --target x86_64-unknown-uefi --no-default-features --features log
- run: cargo build -p zune-psd --target x86_64-unknown-uefi --no-default-features --features log
- run: cargo build -p zune-bmp --target x86_64-unknown-uefi --no-default-features --features log,rgb_inverse
- run: cargo build -p zune-gif --target x86_64-unknown-uefi --no-default-features --features log
- run: cargo build -p zune-jpegxl --target x86_64-unknown-uefi --no-default-features --features log


3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
**/.DS_Store
**/.DS_Store
Cargo.lock
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0 OR Zlib"
repository = "https://github.com/etemesi254/zune-image.git"
rust-version = "1.81.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[workspace]
Expand Down
1 change: 1 addition & 0 deletions benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "zune-benches"
version = "0.1.0"
edition = "2021"
rust-version = "1.81.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
1 change: 1 addition & 0 deletions crates/zune-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "zune-bin"
version = "0.5.0-rc0"
edition = "2021"
repository = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-bin"
rust-version = "1.81.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
6 changes: 4 additions & 2 deletions crates/zune-bmp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ keywords = ["bmp", "bmp-decoder", "decoder"]
categories = ["multimedia::images"]
exclude = ["fuzz/*"]
description = "A fast BMP decoder"

rust-version = "1.81.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
log = ["zune-core/log"]
std = ["zune-core/std"]
rgb_inverse = []

[dependencies]
zune-core = { version = "0.5.0-rc1", path = "../zune-core" }
log = "0.4.21"

[dev-dependencies]
zune-core = { version = "0.5.0-rc1", path = "../zune-core", features = ["std"] }
1 change: 1 addition & 0 deletions crates/zune-bmp/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
rust-version = "1.81.0"

[package.metadata]
cargo-fuzz = true
Expand Down
6 changes: 1 addition & 5 deletions crates/zune-bmp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@
//! use zune_bmp::BmpDecoder;
//! // read from a file
//! let source = BufReader::new(File::open("./image.bmp").unwrap());
//! // only run when std is enabled, otherwise zune_core doesn't implement the ZByteReader trait
//! // on File since it doesn't exist in `no_std` land
//! #[cfg(feature = "std")]
//! let decoder = BmpDecoder::new(source);
//!
//! ```
Expand All @@ -71,9 +68,8 @@
//! benchmark just in case you think it's slowing you down in any way.
//!
#![no_std]
#![macro_use]
extern crate alloc;

extern crate alloc;
extern crate core;

pub use zune_core;
Expand Down
1 change: 1 addition & 0 deletions crates/zune-capi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "zune-capi"
version = "0.5.0"
edition = "2021"
repository = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-capi"
rust-version = "1.81.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
3 changes: 2 additions & 1 deletion crates/zune-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repository = "https://github.com/etemesi254/zune-image"
keywords = ["image"]
categories = ["multimedia::images", "multimedia::encoding"]
license = "MIT OR Apache-2.0 OR Zlib"
rust-version = "1.81.0"

[features]
# When present, we can use std facilities to detect
Expand All @@ -19,4 +20,4 @@ std = []

[dependencies]
log = { version = "0.4.17", optional = true }
serde = { version = "1.0.52", optional = true }
serde = { version = "1.0.52", optional = true, default-features = false }
2 changes: 1 addition & 1 deletion crates/zune-core/src/bytestream/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,6 @@ where
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
use std::io::ErrorKind;
self.read_bytes(buf)
.map_err(|e| std::io::Error::new(ErrorKind::Other, format!("{:?}", e)))
.map_err(|e| std::io::Error::new(ErrorKind::Other, alloc::format!("{:?}", e)))
}
}
1 change: 1 addition & 0 deletions crates/zune-core/src/bytestream/reader/std_readers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![cfg(feature = "std")]

use alloc::vec::Vec;
use std::io;
use std::io::SeekFrom;

Expand Down
7 changes: 5 additions & 2 deletions crates/zune-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@
//!
//!
//!
#![cfg_attr(not(feature = "std"), no_std)]
#![macro_use]
#![no_std]

extern crate alloc;
extern crate core;

#[cfg(feature = "std")]
extern crate std;

#[cfg(not(feature = "log"))]
pub mod log;

Expand Down
10 changes: 5 additions & 5 deletions crates/zune-core/src/options/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ impl DecoderOptions {
// where we can do runtime check if feature is present
#[cfg(feature = "std")]
{
if is_x86_feature_detected!("sse2") {
if std::is_x86_feature_detected!("sse2") {
return true;
}
}
Expand Down Expand Up @@ -483,7 +483,7 @@ impl DecoderOptions {
// where we can do runtime check if feature is present
#[cfg(feature = "std")]
{
if is_x86_feature_detected!("sse3") {
if std::is_x86_feature_detected!("sse3") {
return true;
}
}
Expand Down Expand Up @@ -515,7 +515,7 @@ impl DecoderOptions {
// where we can do runtime check if feature is present
#[cfg(feature = "std")]
{
if is_x86_feature_detected!("sse4.1") {
if std::is_x86_feature_detected!("sse4.1") {
return true;
}
}
Expand Down Expand Up @@ -547,7 +547,7 @@ impl DecoderOptions {
// where we can do runtime check if feature is present
#[cfg(feature = "std")]
{
if is_x86_feature_detected!("avx") {
if std::is_x86_feature_detected!("avx") {
return true;
}
}
Expand Down Expand Up @@ -579,7 +579,7 @@ impl DecoderOptions {
// where we can do runtime check if feature is present
#[cfg(feature = "std")]
{
if is_x86_feature_detected!("avx2") {
if std::is_x86_feature_detected!("avx2") {
return true;
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/zune-farbfeld/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ homepage = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-farbfe
keywords = ["image"]
categories = ["multimedia::images", "multimedia::encoding"]
license = "MIT OR Apache-2.0 OR Zlib"
rust-version = "1.81.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
Expand Down
2 changes: 1 addition & 1 deletion crates/zune-farbfeld/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
//!
//!
#![no_std]
#![macro_use]

extern crate alloc;

pub use decoder::*;
Expand Down
1 change: 1 addition & 0 deletions crates/zune-gif/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "zune-gif"
version = "0.5.0-rc0"
edition = "2021"
repository = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-gif"
rust-version = "1.81.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 2 additions & 0 deletions crates/zune-gif/src/decoder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use alloc::vec::Vec;

use zune_core::bytestream::{ZByteReaderTrait, ZReader};
use zune_core::log::trace;
use zune_core::options::DecoderOptions;
Expand Down
4 changes: 2 additions & 2 deletions crates/zune-gif/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::fmt::Debug;
use std::fmt::Formatter;
use core::fmt::Formatter;

use zune_core::bytestream::ZByteIoError;

Expand All @@ -18,7 +18,7 @@ pub enum GifDecoderErrors {
TooSmallSize(usize, usize)
}
impl Debug for GifDecoderErrors {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
match self {
GifDecoderErrors::NotAGif => {
writeln!(f, "Not a gif, magic bytes didn't match")
Expand Down
6 changes: 6 additions & 0 deletions crates/zune-gif/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#![no_std]

#[macro_use]
extern crate alloc;
extern crate core;

mod decoder;
mod enums;
mod errors;
Expand Down
1 change: 1 addition & 0 deletions crates/zune-hdr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ homepage = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-hdr"
keywords = ["image"]
categories = ["multimedia::images", "multimedia::encoding", ]
license = "MIT OR Apache-2.0 OR Zlib"
rust-version = "1.81.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
Expand Down
1 change: 1 addition & 0 deletions crates/zune-hdr/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
rust-version = "1.81.0"

[package.metadata]
cargo-fuzz = true
Expand Down
1 change: 1 addition & 0 deletions crates/zune-image/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0 OR Zlib"
keywords = ["image", "decoder", "encoder", "image-processing"]
categories = ["multimedia::images"]
description = "An image library, contiaining necessary capabilities to decode, manipulate and encode images"
rust-version = "1.81.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
# Single based image decoders and encoders
Expand Down
2 changes: 1 addition & 1 deletion crates/zune-imageprocs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0 OR Zlib"
keywords = ["image", "image-processing"]
categories = ["multimedia::images"]
description = "Common image processing routines for zune-image"

rust-version = "1.81.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
5 changes: 2 additions & 3 deletions crates/zune-inflate/Cargo.toml
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes us lose runtime detection so may be slower see docs on https://docs.rs/simd-adler32/latest/simd_adler32/

Any reason why it was removed

Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ homepage = "https://github.com/etemesi254/zune-image/tree/main/zune-inflate"
keywords = ["compression", "inflate", "deflate"]
categories = ["compression"]
license = "MIT OR Apache-2.0 OR Zlib"
rust-version = "1.81.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
zlib = ["simd-adler32"]
gzip = []
std = ["simd-adler32/std"]


default = ["zlib", "gzip", "std"]
default = ["zlib", "gzip"]

[dependencies]
simd-adler32 = { version = "0.3.4", optional = true, default-features = false }
1 change: 1 addition & 0 deletions crates/zune-inflate/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
rust-version = "1.81.0"

[package.metadata]
cargo-fuzz = true
Expand Down
3 changes: 1 addition & 2 deletions crates/zune-inflate/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,4 @@ impl Display for InflateDecodeErrors {
}
}

#[cfg(feature = "std")]
impl std::error::Error for InflateDecodeErrors {}
impl core::error::Error for InflateDecodeErrors {}
3 changes: 2 additions & 1 deletion crates/zune-inflate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
//! [libdeflater]: https://github.com/adamkewley/libdeflater
//! [flate2-rs]: https://github.com/rust-lang/flate2-rs
//!
#![cfg_attr(not(feature = "std"), no_std)]
#![no_std]

extern crate alloc;

pub use crate::decoder::{DeflateDecoder, DeflateOptions};
Expand Down
4 changes: 2 additions & 2 deletions crates/zune-jpeg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ keywords = ["jpeg", "jpeg-decoder", "decoder"]
categories = ["multimedia::images"]
exclude = ["/benches/images/*", "/tests/*", "/.idea/*", "/.gradle/*", "/test-images/*", "fuzz/*"]
description = "A fast, correct and safe jpeg decoder"
rust-version = "1.81.0"

[lints.rust]
# Disable feature checker for fuzzing since it's used and cargo doesn't
Expand All @@ -20,9 +21,8 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
[features]
x86 = []
neon = []
std = ["zune-core/std"]
log = ["zune-core/log"]
default = ["x86", "neon", "std"]
default = ["x86", "neon"]


[dependencies]
Expand Down
1 change: 1 addition & 0 deletions crates/zune-jpeg/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
rust-version = "1.81.0"

[package.metadata]
cargo-fuzz = true
Expand Down
3 changes: 1 addition & 2 deletions crates/zune-jpeg/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ pub enum DecodeErrors {
IoErrors(ZByteIoError)
}

#[cfg(feature = "std")]
impl std::error::Error for DecodeErrors {}
impl core::error::Error for DecodeErrors {}

impl From<&'static str> for DecodeErrors {
fn from(data: &'static str) -> Self {
Expand Down
5 changes: 3 additions & 2 deletions crates/zune-jpeg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@
// no_std compatibility
#![deny(clippy::std_instead_of_alloc, clippy::alloc_instead_of_core)]
#![cfg_attr(not(any(feature = "x86", feature = "neon")), forbid(unsafe_code))]
#![cfg_attr(not(feature = "std"), no_std)]
#![macro_use]
#![no_std]

#[macro_use]
extern crate alloc;
extern crate core;

Expand Down
Loading