commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
c1088c0aada52c67ec7acbf5ea5f95bfd5aadf2a | Philip Degarmo | 2022-01-04T00:49:30 | Bump puffin(0.12.1) and dependencies
Co-authored-by: At <atrisarkar91@gmail.com> | diff --git a/Cargo.toml b/Cargo.toml
index 3a0d8a0..2612c65 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,7 @@ categories = ["development-tools::profiling"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-puffin = { version = "0.10", optional ... | 2 | 4 | 4 |
0f08e545d330123187458e216423e9a487097a1e | Philip Degarmo | 2021-06-25T02:33:21 | Release 1.0.3
profiling@1.0.3
Generated by cargo-workspaces | diff --git a/Cargo.toml b/Cargo.toml
index 0cde516..cb298f8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ members = [
[package]
name = "profiling"
-version = "1.0.2"
+version = "1.0.3"
authors = ["Philip Degarmo <aclysma@gmail.com>"]
edition = "2018"
description = "This crate provides a very thin abst... | 2 | 3 | 3 |
e06adfe1779884b0db1135cdb6cb8bf891729504 | Philip Degarmo | 2021-06-22T15:26:42 | Update puffin-imgui to 0.8 to match puffin 0.5 (#25) | diff --git a/Cargo.toml b/Cargo.toml
index 205fedb..0cde516 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,7 +35,7 @@ bincode = "1.3.1"
lazy_static = "1"
imgui = "0.7"
imgui-winit-support = "0.7"
-puffin-imgui = "0.7"
+puffin-imgui = "0.8"
glam = "0.8.6"
log = "0.4" | 1 | 1 | 1 |
f2e9508b2c7c729456980bafc35563dba20e6d9c | Aron Granberg | 2021-06-22T05:20:18 | Update puffin to version 0.5 (#23) | diff --git a/Cargo.toml b/Cargo.toml
index 4fbff8f..205fedb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,7 @@ categories = ["development-tools::profiling"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-puffin = { version = "0.4", optional =... | 1 | 1 | 1 |
3b4382ba8d8813ce75e14b0cea22361d41f850b4 | Philip Degarmo | 2021-06-09T05:13:13 | Release 1.0.2
profiling@1.0.2
profiling-procmacros@1.0.2
Generated by cargo-workspaces | diff --git a/Cargo.toml b/Cargo.toml
index 1cd8e4a..4fbff8f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ members = [
[package]
name = "profiling"
-version = "1.0.1"
+version = "1.0.2"
authors = ["Philip Degarmo <aclysma@gmail.com>"]
edition = "2018"
description = "This crate provides a very thin abst... | 2 | 3 | 3 |
811fe4669030c9e623a4eed8f1aa222c151a9802 | Philip Degarmo | 2021-06-09T05:12:27 | Fix tracing backend failing to compile when tracing crate is not a dependency in the downstream crate (#22) | diff --git a/examples/puffin/renderer.rs b/examples/puffin/renderer.rs
index 19b21ed..adcd802 100644
--- a/examples/puffin/renderer.rs
+++ b/examples/puffin/renderer.rs
@@ -66,12 +66,12 @@ impl Renderer {
Self::upload_font_atlas(&resource_manager, &graphics_queue, font_atlas_texture)?;
Ok(Render... | 3 | 7 | 7 |
6ccc7efee6b79f24a071959fa2d8f9eb2e763895 | Philip Degarmo | 2021-04-29T15:09:28 | Release 1.0.1
profiling@1.0.1
profiling-procmacros@1.0.1
Generated by cargo-workspaces | diff --git a/Cargo.toml b/Cargo.toml
index 6cc6f60..1cd8e4a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ members = [
[package]
name = "profiling"
-version = "1.0.0"
+version = "1.0.1"
authors = ["Philip Degarmo <aclysma@gmail.com>"]
edition = "2018"
description = "This crate provides a very thin abst... | 2 | 3 | 3 |
0799bfbb2b21e5c73d88d1d42ef6eca687aabe8f | Philip Degarmo | 2021-03-17T04:57:58 | Release 0.1.10 | diff --git a/Cargo.toml b/Cargo.toml
index de6e154..ebf3397 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ members = [
[package]
name = "profiling"
-version = "0.1.9"
+version = "0.1.10"
authors = ["Philip Degarmo <aclysma@gmail.com>"]
edition = "2018"
description = "This crate provides a very thin abs... | 1 | 1 | 1 |
3e48887aa03135310a0d94c9319d7e08e3c733e5 | Connor Fitzgerald | 2021-03-16T16:44:03 | Fix unconditional import | diff --git a/src/lib.rs b/src/lib.rs
index bcb7d0b..150913f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -83,6 +83,7 @@ macro_rules! scope {
///
/// }
/// ```
+#[cfg(feature = "procmacros")]
pub use profiling_procmacros::function;
/// Registers a thread with the profiler API(s). This is usually setting a name for... | 1 | 1 | 0 |
f39c65385a24083147ae358d44864743aee6d9bd | Philip Degarmo | 2021-02-07T03:06:19 | Fix DPI scaling in demo | diff --git a/examples/puffin/puffin.rs b/examples/puffin/puffin.rs
index 093eba2..f2e7696 100644
--- a/examples/puffin/puffin.rs
+++ b/examples/puffin/puffin.rs
@@ -63,7 +63,7 @@ fn main() {
// Create a single window
let window = winit::window::WindowBuilder::new()
- .with_title("Skulpin")
+ .... | 2 | 16 | 16 |
f16eb6c4fd3346e977f38d8a712ff28f03297a65 | Philip Degarmo | 2021-02-07T02:19:41 | Fix build (upstream crate was yanked) | diff --git a/Cargo.toml b/Cargo.toml
index 326c338..8d5f6c8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,11 +30,11 @@ profiling-procmacros = { version = "0.1.3", path = "profiling-procmacros", optio
[dev-dependencies]
# Needed for the puffin example
rafx = { version = "0.0.7", features = ["rafx-vulkan", "framewor... | 1 | 2 | 2 |
15d41ac040708bb02e17dc8026ae4b3d12388186 | Philip Degarmo | 2021-01-27T05:17:15 | Release 0.1.8 | diff --git a/Cargo.toml b/Cargo.toml
index 0696d35..bfa88ad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ members = [
[package]
name = "profiling"
-version = "0.1.7"
+version = "0.1.8"
authors = ["Philip Degarmo <aclysma@gmail.com>"]
edition = "2018"
description = "This crate provides a very thin abst... | 1 | 1 | 1 |
4bdb34f1bcd26cdb977b062100ed402fa9a10431 | Philip Degarmo | 2021-01-27T05:04:18 | Update dependencies for examples | diff --git a/Cargo.toml b/Cargo.toml
index b4c0ddb..0696d35 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,13 +28,13 @@ superluminal-perf = { version = "0.1", optional = true }
profiling-procmacros = { version = "0.1.3", path = "profiling-procmacros", optional = true }
[dev-dependencies]
-skulpin = { version = "0.... | 1 | 3 | 3 |
33adaf781d22468be18408974d058e5138e47d08 | Philip Degarmo | 2020-12-24T16:30:09 | Compile fix for example broken by upstream change | diff --git a/Cargo.toml b/Cargo.toml
index d054256..e5fcea0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -34,7 +34,7 @@ puffin-imgui = "0.5"
log = "0.4"
env_logger = "0.6"
imgui = "0.6"
-imgui-winit-support = "0.6"
+imgui-winit-support = "=0.6.0"
tracing-tracy = { version = "0.4.0" }
tracing-subscriber = { versio... | 1 | 1 | 1 |
494d7b6f263ce02ece01cf623cf068d6f751307e | Philip Degarmo | 2020-12-12T16:24:49 | Add superluminal/tracy to the proc macro. Only run the tracing setup in the example if the tracing feature is enabled. | diff --git a/examples/simple.rs b/examples/simple.rs
index 8cb60af..c2cb5b9 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -1,9 +1,11 @@
#![allow(dead_code)]
#[cfg(not(any(
+ feature = "profile-with-optick",
feature = "profile-with-puffin",
+ feature = "profile-with-superluminal",
+ featu... | 2 | 17 | 6 |
542317fca4a65d168f3da49f4df11624f0f6c363 | Imbris | 2020-12-12T04:39:26 | Directly construct tracy spans for reduced overhead | diff --git a/Cargo.toml b/Cargo.toml
index 50e5c3d..fd39be6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -38,8 +38,8 @@ default = ["procmacros"]
profile-with-puffin = ["puffin"]
profile-with-optick = ["optick"]
profile-with-superluminal = ["superluminal-perf"]
+profile-with-tracy = ["tracy-client"]
profile-with-trac... | 2 | 15 | 5 |
aafd9a2676343fc195839fc973f10b473300ca61 | Philip Degarmo | 2020-11-28T05:38:15 | Use 0xFFFFFFFF for superluminal scope colors as this indicates "use default" | diff --git a/src/lib.rs b/src/lib.rs
index 386a58f..150ae21 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -130,6 +130,9 @@ macro_rules! finish_frame {
pub mod superluminal {
pub struct SuperluminalGuard;
+ // 0xFFFFFFFF means "use default color"
+ const DEFAULT_SUPERLUMINAL_COLOR: u32 = 0xFFFFFFFF;
+
i... | 1 | 4 | 1 |
f01b17d4f3de3d838ab215cfb08420140d8a83c5 | Philip Degarmo | 2020-11-26T08:35:23 | Clean up dependencies in profiling-procmacros | diff --git a/profiling-procmacros/Cargo.toml b/profiling-procmacros/Cargo.toml
index 3a0a179..3ff23cd 100644
--- a/profiling-procmacros/Cargo.toml
+++ b/profiling-procmacros/Cargo.toml
@@ -14,9 +14,8 @@ categories = ["development-tools::profiling"]
# See more keys and their definitions at https://doc.rust-lang.org/car... | 1 | 2 | 3 |
0039974a32466411423f1a28101fc6c878115dbd | Philip Degarmo | 2020-11-26T05:59:39 | Fix register_thread!() not using the provided names | diff --git a/src/lib.rs b/src/lib.rs
index 65c7442..5ee1e9d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,7 +6,7 @@
///
/// ```
/// profiling::scope!("outer");
-/// for _in 0..10 {
+/// for _ in 0..10 {
/// profiling::scope!("inner", format!("iteration {}").as_str());
/// }
/// ```
@@ -46,10 +46,10 @@ macro_... | 1 | 3 | 3 |
2e249112414803d536a0609f5cff5508290b0f03 | Philip Degarmo | 2020-11-26T03:28:50 | Make procmacros an optional import. Fix tracy scopes. Init tracy in the example. | diff --git a/profiling-procmacros/src/lib.rs b/profiling-procmacros/src/lib.rs
index c25f277..a81b9e4 100644
--- a/profiling-procmacros/src/lib.rs
+++ b/profiling-procmacros/src/lib.rs
@@ -21,7 +21,9 @@ pub fn function(
optick::event!();
#[cfg(feature = "profile-with-tracing")]
- ... | 4 | 65 | 26 |
c8d970c2cbfe4aa2401c9d24d751dd4f4466e3d5 | Philip Degarmo | 2020-11-26T02:19:31 | Rename profiling-derive to profiling-procmacros (the procmacros are attributes on functions, not derives :D) | diff --git a/Cargo.toml b/Cargo.toml
index 7502540..8fbac4e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[workspace]
members = [
"profiling",
- "profiling-derive"
+ "profiling-procmacros"
]
diff --git a/profiling-derive/Cargo.toml b/profiling-procmacros/Cargo.toml
similarity index 91%
rename f... | 5 | 4 | 4 |
2dcda08ad157db6529e78fa362f11f0339cedfb8 | Philip Degarmo | 2020-11-25T19:34:21 | Fix categories in cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index b676f12..c224afc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/aclysma/profiling"
homepage = "https://github.com/aclysma/profiling"
-keywords = ["performance"]
-categories = ["per... | 1 | 2 | 2 |
bfd92264c8f741d0bee9f090c38d842db6766243 | Ivan Smirnov | 2025-07-27T19:28:11 | clippy for fuzz | diff --git a/fuzz/fuzz_targets/decode.rs b/fuzz/fuzz_targets/decode.rs
index 62a1c3b..9dc1c0a 100644
--- a/fuzz/fuzz_targets/decode.rs
+++ b/fuzz/fuzz_targets/decode.rs
@@ -24,7 +24,7 @@ fuzz_target!(|input: (u16, u16, bool, &[u8])| {
channels,
0,
];
- vec.extend(&*data);
+ vec.extend(data)... | 1 | 1 | 1 |
287fd19224bc8e7163f54fdd9f6adaaa78905e17 | Ivan Smirnov | 2025-07-27T19:27:47 | fix fuzz build | diff --git a/fuzz/fuzz_targets/encode.rs b/fuzz/fuzz_targets/encode.rs
index aedb0c3..ef4113c 100644
--- a/fuzz/fuzz_targets/encode.rs
+++ b/fuzz/fuzz_targets/encode.rs
@@ -1,7 +1,7 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
-use qoi::{encode_size_limit, encode_to_vec};
+use qoi::{encode_max_len, encode_to_vec}... | 1 | 2 | 2 |
97cf574643abce80a585c2d8a8b661ce43cebf15 | Ivan Smirnov | 2025-07-27T19:27:15 | fix crate reference in cargo fuzz | diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml
index f9c04dc..b9dfd50 100644
--- a/fuzz/Cargo.toml
+++ b/fuzz/Cargo.toml
@@ -10,7 +10,7 @@ cargo-fuzz = true
[dependencies]
# internal
-qoi-fast = { path = ".." }
+qoi = { path = ".." }
# external
libfuzzer-sys = "0.4" | 1 | 1 | 1 |
983ad9af6b88bfc75db6d49881e4ce1af8767ac1 | Ivan Smirnov | 2025-07-27T19:06:00 | decode to leading bytes of the provided buffer | diff --git a/src/decode.rs b/src/decode.rs
index efcab63..b2e86a9 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -380,6 +380,8 @@ impl<R: Reader> Decoder<R> {
/// Decodes the image to a pre-allocated buffer and returns the number of bytes written.
///
/// The minimum size of the buffer can be found vi... | 1 | 7 | 1 |
fea289ff1585ac98ad056bfbfab9a5a51f5d2f23 | Ivan Smirnov | 2025-07-27T19:05:49 | add tests for decoding into buf larger than needed | diff --git a/tests/test_misc.rs b/tests/test_misc.rs
index 539374f..c08e0c0 100644
--- a/tests/test_misc.rs
+++ b/tests/test_misc.rs
@@ -52,6 +52,47 @@ fn test_start_with_qoi_op_run_and_use_index() -> Result<()> {
Ok(())
}
+#[cfg(feature = "std")]
+mod std_tests {
+ use qoi::{Channels, ColorSpace, Decoder, H... | 1 | 41 | 0 |
c262afafdf146a515ec4350460db249e52eda55b | Ivan Smirnov | 2025-07-27T17:22:58 | add --stream option to bench cli | diff --git a/bench/src/main.rs b/bench/src/main.rs
index 383863c..66e6b8f 100644
--- a/bench/src/main.rs
+++ b/bench/src/main.rs
@@ -1,11 +1,13 @@
use std::cmp::Ordering;
use std::fs::{self, File};
+use std::io::Cursor;
use std::path::{Path, PathBuf};
use std::time::{Duration, Instant};
use anyhow::{bail, ensure... | 1 | 54 | 28 |
14cc7e68005ae475a2d7f8241662d9cdd6b81627 | Ivan Smirnov | 2025-07-27T17:22:48 | make bench cli runnable again | diff --git a/bench/src/main.rs b/bench/src/main.rs
index e7dbeaa..383863c 100644
--- a/bench/src/main.rs
+++ b/bench/src/main.rs
@@ -405,7 +405,7 @@ struct Args {
#[structopt(short, long)]
average: bool,
/// Simple totals, no fancy tables.
- #[structopt(short, long)]
+ #[structopt(long)]
simpl... | 1 | 1 | 1 |
ca27e687ed1632fe3a919db628a7cf61c1c411bb | Ivan Smirnov | 2025-07-27T16:58:34 | add tests for stream mode (background bug) | diff --git a/tests/test_misc.rs b/tests/test_misc.rs
index 7511c38..539374f 100644
--- a/tests/test_misc.rs
+++ b/tests/test_misc.rs
@@ -1,5 +1,5 @@
use qoi::{
- consts::{QOI_OP_RGB, QOI_OP_RUN, QOI_OP_INDEX},
+ consts::{QOI_OP_INDEX, QOI_OP_RGB, QOI_OP_RUN},
decode_to_vec, Channels, ColorSpace, Header, Res... | 1 | 23 | 5 |
3a1ce9430196b55ed6b627294ed87a304dabe8c6 | Martin Jakobsson | 2025-07-27T16:47:14 | fix transparent background bug (#17)
* fix transparent background bug
* handle edge case before loop for slices | diff --git a/src/decode.rs b/src/decode.rs
index be97803..efcab63 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -35,6 +35,11 @@ where
let mut px = Pixel::<N>::new().with_a(0xff);
let mut px_rgba: Pixel<4>;
+ if matches!(data, [QOI_OP_RUN..=QOI_OP_RUN_END, ..]) {
+ px_rgba = px.as_rgba(0xff);
+... | 2 | 19 | 1 |
b03ef6273ad6beaef4be787c3cda3c72121141b6 | Ivan Smirnov | 2025-03-10T02:06:36 | don't need the package to be a workspace anymore | diff --git a/Cargo.toml b/Cargo.toml
index c63598d..8252569 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -33,9 +33,6 @@ reference = []
[dependencies]
bytemuck = "1.22"
-[workspace]
-members = ["libqoi", "bench"]
-
[dev-dependencies]
# external
anyhow = "1.0" | 1 | 0 | 3 |
bb875ec0d9867af7904ef4b73a9281affb232515 | Ivan Smirnov | 2025-03-10T01:37:58 | clean up manifest exclude section | diff --git a/Cargo.toml b/Cargo.toml
index 9aa7bc8..c63598d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,14 @@ homepage = "https://github.com/aldanor/qoi-rust"
documentation = "https://docs.rs/qoi"
categories = ["multimedia::images", "multimedia::encoding"]
keywords = ["qoi", "graphics", "image", "encoding"... | 1 | 8 | 1 |
f877d0399f545ddec67b7521c1c8d4ad3305b918 | Ivan Smirnov | 2025-03-10T01:21:43 | don't run test_gen tests on big-endian | diff --git a/tests/test_gen.rs b/tests/test_gen.rs
index 1f3fc9c..fd015c5 100644
--- a/tests/test_gen.rs
+++ b/tests/test_gen.rs
@@ -1,3 +1,5 @@
+#![cfg_attr(target_endian = "big", allow(unused_imports, dead_code))]
+
mod common;
use bytemuck::cast_slice;
@@ -269,6 +271,7 @@ fn check_roundtrip<E, D, VE, VD, EE, ED>... | 1 | 3 | 0 |
d0d626a0d17d48e7613190e498c48b99082dd1bc | Ivan Smirnov | 2025-03-09T23:31:52 | hash_index() fix for big-endian | diff --git a/src/pixel.rs b/src/pixel.rs
index 76f2a7b..fb87d5a 100644
--- a/src/pixel.rs
+++ b/src/pixel.rs
@@ -124,12 +124,12 @@ impl<const N: usize> Pixel<N> {
{
// credits for the initial idea: @zakarumych
let v = if N == 4 {
- u32::from_ne_bytes(cast(self.0))
+ u32::fro... | 1 | 3 | 3 |
e74f88fce9977b363930075cb44507d0d6900282 | Ivan Smirnov | 2025-03-09T23:31:41 | fix libqoi flag | diff --git a/libqoi/build.rs b/libqoi/build.rs
index f69cb6a..71ee19e 100644
--- a/libqoi/build.rs
+++ b/libqoi/build.rs
@@ -12,7 +12,7 @@ fn main() {
.include("../ext/qoi")
.define("QOI_NO_STDIO", None)
.define("QOI_IMPLEMENTATION", None)
- .flag("-Wno-unsequenced")
+ .flag_if_... | 1 | 1 | 1 |
28b73bbc0589a97f567ca0bce0aaf3d6ebd0ec26 | Ivan Smirnov | 2025-03-09T22:53:19 | make tests no-std-compatible | diff --git a/tests/test_ref.rs b/tests/test_ref.rs
index 59a7315..fbfaa56 100644
--- a/tests/test_ref.rs
+++ b/tests/test_ref.rs
@@ -1,11 +1,10 @@
use std::fs::{self, File};
use std::path::{Path, PathBuf};
-use anyhow::{bail, Result};
use cfg_if::cfg_if;
use walkdir::{DirEntry, WalkDir};
-use qoi::{decode_to_ve... | 1 | 12 | 13 |
c0ae879bf0ec4f3b9a342793554c027ca1071e1d | Ivan Smirnov | 2025-03-09T21:50:20 | add a big endian marker test for CI | diff --git a/tests/test_misc.rs b/tests/test_misc.rs
index 7314f32..0a93f61 100644
--- a/tests/test_misc.rs
+++ b/tests/test_misc.rs
@@ -21,3 +21,10 @@ fn test_start_with_qoi_op_run() -> Result<()> {
assert_eq!(decoded, vec![0, 0, 0, 255, 0, 0, 0, 255, 10, 20, 30, 255]);
Ok(())
}
+
+#[cfg(target_endian = "bi... | 1 | 7 | 0 |
e8664cab6d6c852ed10f671a5cd078d27865767b | Ivan Smirnov | 2025-03-09T21:55:47 | clippy fixes | diff --git a/src/decode.rs b/src/decode.rs
index 029c590..be97803 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -244,7 +244,7 @@ impl<'a> Bytes<'a> {
}
}
-impl<'a> Reader for Bytes<'a> {
+impl Reader for Bytes<'_> {
#[inline]
fn decode_header(&mut self) -> Result<Header> {
let header = He... | 3 | 10 | 4 |
f947d0afbd3ff5e0f7d538efa359f8a97545447a | Ivan Smirnov | 2025-03-09T21:03:30 | (auto rustfmt) | diff --git a/src/lib.rs b/src/lib.rs
index f77506b..3fb7a35 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -63,7 +63,7 @@
clippy::module_name_repetitions,
clippy::cargo_common_metadata,
clippy::doc_markdown,
- clippy::return_self_not_must_use,
+ clippy::return_self_not_must_use
)]
#![cfg_attr(not(an... | 1 | 1 | 1 |
ec432f0e006c0c1340e2c0194386cbcf93c70cd6 | Ivan Smirnov | 2025-03-09T21:01:41 | add a test for starting with QOI_OP_RUN | diff --git a/tests/test_misc.rs b/tests/test_misc.rs
index 720adf4..7314f32 100644
--- a/tests/test_misc.rs
+++ b/tests/test_misc.rs
@@ -1,6 +1,23 @@
+use qoi::{
+ consts::{QOI_OP_RGB, QOI_OP_RUN},
+ decode_to_vec, Channels, ColorSpace, Header, Result,
+};
+
#[test]
fn test_new_encoder() {
// this used to ... | 1 | 18 | 1 |
018d304cff078998af999a9821af59c393f577f3 | Ivan Smirnov | 2025-03-09T21:00:41 | make Header::{encode,decode} pub | diff --git a/src/header.rs b/src/header.rs
index ccdb1cc..c1c44b6 100644
--- a/src/header.rs
+++ b/src/header.rs
@@ -67,7 +67,7 @@ impl Header {
/// Serializes the header into a bytes array.
#[inline]
- pub(crate) fn encode(&self) -> [u8; QOI_HEADER_SIZE] {
+ pub fn encode(&self) -> [u8; QOI_HEADER_SI... | 1 | 2 | 2 |
e22ea039fc08665d39b1e269c98d8e35f1a28035 | Ivan Smirnov | 2025-03-09T20:30:09 | dependencies version bumps | diff --git a/Cargo.toml b/Cargo.toml
index bce14ed..a0f6495 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,7 @@ std = []
reference = []
[dependencies]
-bytemuck = "1.12"
+bytemuck = "1.22"
[workspace]
members = ["libqoi", "bench"]
@@ -32,11 +32,11 @@ members = ["libqoi", "bench"]
[dev-dependencies]
# e... | 1 | 2 | 2 |
ec7f6af4b8de7f7472ff9b96ec132204462aa08d | Ivan Smirnov | 2025-03-09T20:29:59 | cargo.toml cleanup | diff --git a/Cargo.toml b/Cargo.toml
index 6c09245..bce14ed 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,16 +11,17 @@ homepage = "https://github.com/aldanor/qoi-rust"
documentation = "https://docs.rs/qoi"
categories = ["multimedia::images", "multimedia::encoding"]
keywords = ["qoi", "graphics", "image", "encoding... | 1 | 11 | 8 |
a37184645d957a7479144b66ed698b131284815c | Ivan Smirnov | 2025-03-09T20:26:44 | bump rand/rand_distr in tests | diff --git a/Cargo.toml b/Cargo.toml
index a2f6155..6c09245 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -33,8 +33,9 @@ anyhow = "1.0"
png = "0.17"
walkdir = "2.3"
cfg-if = "1.0"
-rand = "0.8"
libqoi = { path = "libqoi"}
+rand = "0.9"
+rand_distr = "0.5"
[lib]
name = "qoi"
diff --git a/tests/test_gen.rs b/tests/... | 2 | 17 | 23 |
2921967c0a2f207b4d340d3fea759ec81d2ef985 | Ivan Smirnov | 2023-10-11T11:20:48 | Fix clippy errors | diff --git a/src/decode.rs b/src/decode.rs
index 019dac2..029c590 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -137,7 +137,7 @@ pub fn decode_header(data: impl AsRef<[u8]>) -> Result<Header> {
Header::decode(data)
}
-#[cfg(any(feature = "std"))]
+#[cfg(feature = "std")]
#[inline]
fn decode_impl_stream<R:... | 3 | 9 | 9 |
fe83d1b3eea80c83c0e4234b6a15ef237b8123ff | Ivan Smirnov | 2022-10-16T23:51:38 | Version bump to v0.4.1 | diff --git a/Cargo.toml b/Cargo.toml
index 4300672..8417cc7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "qoi"
-version = "0.4.0"
+version = "0.4.1"
description = "VERY fast encoder/decoder for QOI (Quite Okay Image) format"
authors = ["Ivan Smirnov <rust@ivan.smirnov.ie>"]
edition = "... | 1 | 1 | 1 |
e30c034738a2fb576d2a4370e305c1b1d0e21214 | Ivan Smirnov | 2022-10-16T23:42:28 | Bump bytemuck dependency | diff --git a/Cargo.toml b/Cargo.toml
index d1c8ec7..327a4d1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ std = [] # std mode (enabled by default) - provides access to `std::io`,
reference = [] # follows reference encoder implementation precisely, but may be slightly slower
[dependencies]
-byte... | 1 | 1 | 1 |
bd009489522c2982d981e917bd148332076d286a | Ivan Smirnov | 2022-10-16T23:34:11 | Various clippy fixes | diff --git a/src/decode.rs b/src/decode.rs
index ce105a5..019dac2 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -318,12 +318,13 @@ impl<R: Read> Decoder<R> {
/// Returns an immutable reference to the underlying reader.
#[inline]
- pub fn reader(&self) -> &R {
+ pub const fn reader(&self) -> &R {
... | 3 | 9 | 7 |
9fdca30f9e5946b4cf03712b3d9955a4098bd220 | Ivan Smirnov | 2022-10-16T23:31:27 | Make `Bytes` pub | diff --git a/src/decode.rs b/src/decode.rs
index b9fb6f2..ce105a5 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -230,7 +230,7 @@ pub trait Reader: Sized {
fn decode_image(&mut self, out: &mut [u8], channels: u8, src_channels: u8) -> Result<()>;
}
-struct Bytes<'a>(&'a [u8]);
+pub struct Bytes<'a>(&'a [u8]);... | 2 | 7 | 1 |
437d9b6280d204af828c453aa004d6aa86dfdc7c | Ivan Smirnov | 2022-01-06T00:39:35 | tests: make them 1.51-compatible, fix tiny gen bug | diff --git a/tests/test_gen.rs b/tests/test_gen.rs
index 8a91737..f25b082 100644
--- a/tests/test_gen.rs
+++ b/tests/test_gen.rs
@@ -5,7 +5,11 @@ use std::borrow::Cow;
use std::fmt::Debug;
use cfg_if::cfg_if;
-use rand::{rngs::StdRng, Rng, SeedableRng};
+use rand::{
+ distributions::{Distribution, Standard},
+ ... | 1 | 14 | 8 |
fa2a675ecb7b054ef21ecba19ef4b37d8e54b4eb | Ivan Smirnov | 2022-01-06T00:26:58 | Improve tests in the generated test suite | diff --git a/tests/test_gen.rs b/tests/test_gen.rs
index 713a650..8a91737 100644
--- a/tests/test_gen.rs
+++ b/tests/test_gen.rs
@@ -1,10 +1,18 @@
mod common;
+use bytemuck::cast_slice;
+use std::borrow::Cow;
+use std::fmt::Debug;
+
use cfg_if::cfg_if;
use rand::{rngs::StdRng, Rng, SeedableRng};
use libqoi::{qo... | 1 | 150 | 15 |
49b4b5b69c199430d9c2e375f11da89fc564ea70 | Ivan Smirnov | 2022-01-06T00:15:40 | Fix chunk tests to match encoder run logic fixes | diff --git a/tests/test_chunks.rs b/tests/test_chunks.rs
index 391ba53..a0680e1 100644
--- a/tests/test_chunks.rs
+++ b/tests/test_chunks.rs
@@ -42,20 +42,8 @@ fn test_encode_rgba() {
}
#[test]
-#[cfg(feature = "reference")]
-fn test_encode_run_start_len1_3ch_ref() {
- test_chunk([[0, 0, 0], [11, 22, 33]], [QOI_... | 1 | 22 | 32 |
7ac43c442cb5e77506273dc1d128ca61e69b0a18 | Ivan Smirnov | 2022-01-06T00:08:38 | qoi-bench: report MB/s, improve totals formatting | diff --git a/bench/src/main.rs b/bench/src/main.rs
index fb01a0f..1ef3a57 100644
--- a/bench/src/main.rs
+++ b/bench/src/main.rs
@@ -115,6 +115,10 @@ impl Image {
pub const fn n_pixels(&self) -> usize {
(self.width as usize) * (self.height as usize)
}
+
+ pub const fn n_bytes(&self) -> usize {
+ ... | 1 | 82 | 35 |
7cadd4c03e8ef5b667ac191b906c6b6a88bd7bb6 | Ivan Smirnov | 2022-01-05T23:50:21 | Encoder fix - always disallow first-run shortcut | diff --git a/src/encode.rs b/src/encode.rs
index 1d60bb8..0ed8476 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -25,10 +25,10 @@ where
let mut index = [Pixel::new(); 256];
let mut px_prev = Pixel::new().with_a(0xff);
- let mut hash_prev = Pixel::<N>::new().with_a(0xff).hash_index();
+ let mut hash... | 1 | 4 | 4 |
5a899bbf2532b0ab5f02a8a1f07c19c37a035248 | Ivan Smirnov | 2022-01-05T19:52:19 | Index bugfix: force decoder index to be 4-channel | diff --git a/src/decode.rs b/src/decode.rs
index 7d062b2..b9fb6f2 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -31,14 +31,16 @@ where
let data_len = data.len();
let mut data = data;
- let mut index = [Pixel::<N>::new(); 256];
+ let mut index = [Pixel::<4>::new(); 256];
let mut px = Pixel::<N... | 2 | 15 | 4 |
c2d23f8decef206e521f2b185bf2bf9af10e38f5 | Ivan Smirnov | 2022-01-05T14:17:42 | tests: add generated image tests | diff --git a/Cargo.toml b/Cargo.toml
index 578fab1..b7b9fd6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -33,6 +33,8 @@ anyhow = "1.0"
png = "0.17"
walkdir = "2.3"
cfg-if = "1.0"
+rand = "0.8"
+libqoi = { path = "libqoi"}
[lib]
name = "qoi_fast"
diff --git a/tests/test_gen.rs b/tests/test_gen.rs
new file mode 100... | 2 | 174 | 0 |
8c7b78a97f359501434ca6d5b5ef34df10bf5aea | Ivan Smirnov | 2022-01-05T14:17:10 | tests: move common stuff into a `common` mod | diff --git a/tests/common.rs b/tests/common.rs
new file mode 100644
index 0000000..cc1eff1
--- /dev/null
+++ b/tests/common.rs
@@ -0,0 +1,12 @@
+#[allow(unused)]
+pub fn hash<const N: usize>(px: [u8; N]) -> u8 {
+ let r = px[0];
+ let g = px[1];
+ let b = px[2];
+ let a = if N >= 4 { px[3] } else { 0xff };
... | 2 | 15 | 12 |
432f9d3af6acf068d2a10ba930cc54b627a30436 | Ivan Smirnov | 2022-01-05T14:16:41 | qoi-bench: minor formatting and cosmetic fixes | diff --git a/bench/src/main.rs b/bench/src/main.rs
index 2e257da..fb01a0f 100644
--- a/bench/src/main.rs
+++ b/bench/src/main.rs
@@ -149,7 +149,7 @@ impl Codec for CodecQoiC {
type Output = CVec<u8>;
fn name() -> &'static str {
- "qoi-c"
+ "qoi.h"
}
fn encode(img: &Image) -> Result... | 1 | 5 | 7 |
497d188f9aecf279ef568edda5438277299e30e5 | Ivan Smirnov | 2022-01-05T14:10:42 | qoi-bench: rework png decoding, convert grayscale | diff --git a/bench/Cargo.toml b/bench/Cargo.toml
index add470f..d5ae950 100644
--- a/bench/Cargo.toml
+++ b/bench/Cargo.toml
@@ -12,6 +12,7 @@ qoi-fast = { path = ".." }
# external
anyhow = "1.0"
libc = "0.2"
+bytemuck = "1.7"
png = "0.17"
structopt = "0.3"
walkdir = "2.3"
diff --git a/bench/src/main.rs b/bench/s... | 2 | 51 | 12 |
50d268cd1404174c3a05dc2a14e23ea78a0c6daa | Ivan Smirnov | 2022-01-04T23:28:39 | Add extensive tests for specific chunk types | diff --git a/tests/test_chunks.rs b/tests/test_chunks.rs
new file mode 100644
index 0000000..beeffe4
--- /dev/null
+++ b/tests/test_chunks.rs
@@ -0,0 +1,230 @@
+use bytemuck::{cast_slice, Pod};
+
+use qoi_fast::consts::{
+ QOI_HEADER_SIZE, QOI_OP_DIFF, QOI_OP_INDEX, QOI_OP_LUMA, QOI_OP_RGB, QOI_OP_RGBA, QOI_OP_RUN,
... | 1 | 230 | 0 |
d5cfc60013c69f2f50fcc91b41eaa227dec065c8 | Ivan Smirnov | 2022-01-04T13:53:28 | Fix an edge case bug with non-reference encoding | diff --git a/src/encode.rs b/src/encode.rs
index ec66b74..1d60bb8 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -15,7 +15,7 @@ use crate::types::{Channels, ColorSpace};
use crate::utils::GenericWriter;
use crate::utils::{unlikely, BytesMut, Writer};
-#[allow(clippy::cast_possible_truncation, unused_assignments)... | 1 | 4 | 2 |
72c9128c61036a5ebf3f00d972d852aca48c2c4e | Ivan Smirnov | 2022-01-04T00:13:53 | (Minor clippy fixes) | diff --git a/src/lib.rs b/src/lib.rs
index a218af3..2684163 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -53,7 +53,8 @@
clippy::missing_errors_doc,
clippy::must_use_candidate,
clippy::module_name_repetitions,
- clippy::cargo_common_metadata
+ clippy::cargo_common_metadata,
+ clippy::doc_markdown
... | 3 | 3 | 2 |
f3120d5df3650133cc66edba9c1bbf2f72738301 | Ivan Smirnov | 2022-01-03T23:57:42 | Tons of docstrings + some renames | diff --git a/Cargo.toml b/Cargo.toml
index eac840f..6a5ebe3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "qoi-fast"
version = "0.2.0"
-description = "VERY fast encoder/decoder for QOI (Quite Okay Image) format"
+description = "Fast encoder/decoder for QOI (Quite Okay Image) format"
auth... | 6 | 96 | 15 |
86d5462958737435d4115c687b78d7691f4a48f2 | Ivan Smirnov | 2022-01-03T22:59:58 | Update Header docstring | diff --git a/src/header.rs b/src/header.rs
index fa9f4f3..6295805 100644
--- a/src/header.rs
+++ b/src/header.rs
@@ -8,7 +8,7 @@ use crate::error::{Error, Result};
use crate::types::{Channels, ColorSpace};
use crate::utils::unlikely;
-/// QOI image header.
+/// Image header: dimensions, channels, color space.
///
... | 1 | 1 | 1 |
c062c6b79b0a6efecfc6d9b8669db6ae9cbbf1b4 | Ivan Smirnov | 2022-01-03T22:46:13 | Improve hashing algorithm slightly (see credits) | diff --git a/src/encode.rs b/src/encode.rs
index 604620e..1e80cc0 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -4,6 +4,8 @@ use core::convert::TryFrom;
#[cfg(feature = "std")]
use std::io::Write;
+use bytemuck::Pod;
+
use crate::consts::{QOI_HEADER_SIZE, QOI_OP_INDEX, QOI_OP_RUN, QOI_PADDING, QOI_PADDING_SIZE... | 2 | 16 | 6 |
52cc56381e67340c5c190f7cb87869ede79b22c7 | Ivan Smirnov | 2022-01-03T22:30:45 | Compute hash on 4-byte (extended) pixels always | diff --git a/src/decode.rs b/src/decode.rs
index 0049a18..0f4e660 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -76,7 +76,8 @@ where
}
}
- index[px.hash_index() as usize] = px;
+ let px_rgba = px.as_rgba(0xff);
+ index[px_rgba.hash_index() as usize] = px;
*px_ou... | 2 | 4 | 3 |
88a020b8510d5962c48bd3c8fac6438453a0d19b | Ivan Smirnov | 2022-01-03T21:25:05 | Merge StreamDecoder into Decoder | diff --git a/src/decode.rs b/src/decode.rs
index f0721bf..0049a18 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -125,68 +125,6 @@ pub fn decode_header(data: impl AsRef<[u8]>) -> Result<Header> {
Header::decode(data)
}
-#[derive(Clone)]
-pub struct Decoder<'a> {
- data: &'a [u8],
- header: Header,
- ... | 2 | 87 | 86 |
5371c75a59295519612dceb1f749240df89185ae | Ivan Smirnov | 2022-01-03T21:24:11 | (Rearrange code in utils mod a bit) | diff --git a/src/utils.rs b/src/utils.rs
index 858486a..76ed92a 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -30,33 +30,32 @@ pub trait Writer: Sized {
fn capacity(&self) -> usize;
}
-#[cfg(feature = "std")]
-pub struct GenericWriter<W> {
- writer: W,
- n_written: usize,
-}
-
-#[cfg(feature = "std")]
-... | 1 | 43 | 43 |
b0dca7ba025635b51331cae8edb56b42bd2df07d | Ivan Smirnov | 2022-01-03T19:10:03 | Add docstrings for Error variants | diff --git a/src/error.rs b/src/error.rs
index 50649b0..6fe6e33 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -6,31 +6,24 @@ use crate::consts::QOI_MAGIC;
/// Errors that can occur during encoding or decoding.
#[derive(Debug)]
pub enum Error {
- InvalidMagic {
- magic: u32,
- },
- InvalidChannels {... | 1 | 15 | 22 |
cb10dd3629757b1ae547853fa06be9ae58f6bb9f | Ivan Smirnov | 2022-01-03T18:12:06 | Error types cleanup + clippy fixes | diff --git a/src/decode.rs b/src/decode.rs
index ee8bfb0..862e068 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -73,7 +73,7 @@ where
_ => {
cold();
if unlikely(data.len() < QOI_PADDING_SIZE) {
- return Err(Error::UnexpectedBufferEnd); // TODO: remove... | 5 | 26 | 39 |
718e09e30398189f37159e2d38e59f2186c11b09 | Ivan Smirnov | 2022-01-03T17:44:05 | Minor tweaks to Pixel::read() | diff --git a/src/pixel.rs b/src/pixel.rs
index f0b52ba..90674e4 100644
--- a/src/pixel.rs
+++ b/src/pixel.rs
@@ -14,10 +14,14 @@ impl<const N: usize> Pixel<N> {
#[inline]
pub fn read(&mut self, s: &[u8]) {
- let mut i = 0;
- while i < N {
- self.0[i] = s[i];
- i += 1;
+ ... | 1 | 8 | 4 |
4633be5c5256b58c4a136593c288870bbd3b801e | Ivan Smirnov | 2022-01-03T17:43:55 | Add docstrings for Channels / ColorSpace | diff --git a/src/types.rs b/src/types.rs
index 659f5f9..81229d4 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -17,14 +17,17 @@ pub enum ColorSpace {
}
impl ColorSpace {
+ /// Returns true if the color space is sRGB with linear alpha.
pub const fn is_srgb(self) -> bool {
matches!(self, Self::Srgb)... | 1 | 7 | 0 |
f9f5acb73ae2624a23de2cdefef0ae8b894d366b | Ivan Smirnov | 2022-01-03T15:31:06 | Slight improvement to BytesMut | diff --git a/src/utils.rs b/src/utils.rs
index d7b6f9e..858486a 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -90,15 +90,18 @@ impl<'a> BytesMut<'a> {
*first = v;
Self(tail)
} else {
- cold();
- panic!();
+ unreachable!()
}
}
#[i... | 1 | 8 | 5 |
4f0bce5fca2eb654fedbe31d064ac53db2a6bd97 | Ivan Smirnov | 2022-01-03T14:43:28 | qoi-bench: only abort on r/t fail if it's qoi-fast | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index 277079a..9c0c60c 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -250,12 +250,12 @@ impl ImageBench {
let encoded = encoded?;
let (decoded, t_decode) = timeit(|| C::decode(&encoded, img));
let decoded = decoded... | 1 | 6 | 6 |
a9b369e5856a8c0f8b251cced713beb2e0bb6481 | Ivan Smirnov | 2022-01-03T14:14:30 | In tests, always check for encoded length match | diff --git a/tests/test_ref.rs b/tests/test_ref.rs
index 1fd301e..ee54e34 100644
--- a/tests/test_ref.rs
+++ b/tests/test_ref.rs
@@ -98,6 +98,7 @@ fn test_reference_images() -> Result<()> {
println!("{} {} {} {}", png_name, img.width, img.height, img.channels);
let encoded = qoi_encode_to_vec(&img.dat... | 1 | 1 | 0 |
5952a88e8c1752a08384d55612e0524d1a059b92 | Ivan Smirnov | 2022-01-03T14:14:13 | Minor fixups to Pixel struct | diff --git a/src/pixel.rs b/src/pixel.rs
index 0f8fe7b..f0b52ba 100644
--- a/src/pixel.rs
+++ b/src/pixel.rs
@@ -2,9 +2,9 @@ use crate::consts::{QOI_OP_DIFF, QOI_OP_LUMA, QOI_OP_RGB, QOI_OP_RGBA};
use crate::error::Result;
use crate::utils::Writer;
-#[derive(Copy, Clone, PartialEq, Eq)]
+#[derive(Copy, Clone, Parti... | 1 | 2 | 2 |
5469530c64edecabe7e71c659071ce4975dd460d | Ivan Smirnov | 2022-01-03T14:14:01 | Initial attempt at no_std | diff --git a/Cargo.toml b/Cargo.toml
index c0f61ba..2500e2c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,9 @@ exclude = [
]
[features]
-default = []
+default = ["std"]
+alloc = [] # provides access to `Vec` without enabling `std` mode
+std = [] # std mode (enabled by default) - provides access ... | 8 | 83 | 27 |
e39bec8725e9e31819e2473296dceac0939917d8 | Ivan Smirnov | 2022-01-03T14:11:39 | Bug-fix with non-reference encoding | diff --git a/src/encode.rs b/src/encode.rs
index d28c6d9..bd08c77 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -35,7 +35,7 @@ where
if run != 0 {
#[cfg(not(feature = "reference"))]
{
- buf = buf.write_one(if run == 1 {
+ buf = buf... | 1 | 1 | 1 |
f3947a2a01c06fb041cf96ff0940242b76f9952b | Ivan Smirnov | 2021-12-30T10:22:36 | qoi-bench: fail immediately if roundtrip fails | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index fedd22f..277079a 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -250,7 +250,12 @@ impl ImageBench {
let encoded = encoded?;
let (decoded, t_decode) = timeit(|| C::decode(&encoded, img));
let decoded = decoded?... | 1 | 6 | 1 |
c59f6ac686c0564fba02203539e46e4d18e2bc90 | Ivan Smirnov | 2022-01-03T12:56:17 | Update the tests (with reference feature on/off) | diff --git a/Cargo.toml b/Cargo.toml
index 99630b0..c0f61ba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,6 +29,7 @@ members = ["qoi-bench"]
anyhow = "1.0"
png = "0.17"
walkdir = "2.3"
+cfg-if = "1.0"
[lib]
name = "qoi_fast"
diff --git a/tests/test_ref.rs b/tests/test_ref.rs
index e35eb28..1fd301e 100644
--- a... | 2 | 11 | 3 |
465a5b86a16b0fc5d06a40475159ff1f53eaa4ab | Ivan Smirnov | 2022-01-03T12:56:03 | Encode runs of 1 as index (+ "reference" feature) | diff --git a/Cargo.toml b/Cargo.toml
index 4f2fc67..99630b0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,6 +15,10 @@ exclude = [
"assets/*",
]
+[features]
+default = []
+reference = [] # follows reference encoder implementation precisely, but may be slightly slower
+
[dependencies]
bytemuck = "1.7"
diff... | 2 | 21 | 5 |
ab92cf64b6f86a61b1b166ab1b57ad769dab1ece | Ivan Smirnov | 2022-01-03T12:54:41 | Disable doctests for the main crate | diff --git a/Cargo.toml b/Cargo.toml
index 1d329a2..4f2fc67 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,6 +29,7 @@ walkdir = "2.3"
[lib]
name = "qoi_fast"
path = "src/lib.rs"
+doctest = false
[profile.test]
opt-level = 3 | 1 | 1 | 0 |
7b0044a824a73f63461b0812b6fa29264319dc72 | Ivan Smirnov | 2022-01-03T12:18:50 | qoi-bench: only report totals if more than one png | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index 9462463..fedd22f 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -381,7 +381,9 @@ fn bench_suite(files: &[PathBuf], seconds: f64, use_median: bool) -> Result<()>
}
}
}
- totals.report(use_median);
+ if to... | 1 | 3 | 1 |
feaac2824437e4e6db03ded151b3381cc4485740 | Ivan Smirnov | 2022-01-03T12:13:04 | Run tests in opt-level=3 mode | diff --git a/Cargo.toml b/Cargo.toml
index 51261ea..1d329a2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,3 +29,6 @@ walkdir = "2.3"
[lib]
name = "qoi_fast"
path = "src/lib.rs"
+
+[profile.test]
+opt-level = 3 | 1 | 3 | 0 |
5036518108c04a9c4a731898a2841f7080c9f081 | Ivan Smirnov | 2022-01-03T11:41:53 | Change crate edition to "2018" | diff --git a/Cargo.toml b/Cargo.toml
index 30e5802..f03e434 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ name = "qoi-fast"
version = "0.2.0"
description = "VERY fast encoder/decoder for QOI (Quite Okay Image) format"
authors = ["Ivan Smirnov <rust@ivan.smirnov.ie>"]
-edition = "2021"
+edition = "2018"
r... | 3 | 3 | 2 |
45bed0445d146fe83465e4d0085ac32d7301fd91 | Ivan Smirnov | 2022-01-03T11:30:37 | Fix a few clippy warnings | diff --git a/src/decode.rs b/src/decode.rs
index 8a53f4e..962cd8b 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -81,7 +81,7 @@ where
if unlikely(data.len() < QOI_PADDING_SIZE) {
return Err(Error::UnexpectedBufferEnd);
- } else if unlikely(&data[..QOI_PADDING_SIZE] != &QOI_PADDING) {
+ } else i... | 2 | 2 | 1 |
c52ff2bb9b745d11c55a29da2c47416d48af41db | Ivan Smirnov | 2022-01-03T11:19:11 | Clean up header struct/mod, add docstrings | diff --git a/src/header.rs b/src/header.rs
index c3d1c2a..2214e6a 100644
--- a/src/header.rs
+++ b/src/header.rs
@@ -8,11 +8,21 @@ use crate::error::{Error, Result};
use crate::types::{Channels, ColorSpace};
use crate::utils::unlikely;
-#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+/// QOI image header.
+///
+/// #... | 1 | 21 | 6 |
e3184aed0173d4f8eb7be3d0d3d29a9d2c45cd68 | Ivan Smirnov | 2022-01-03T10:41:54 | Derive PartialOrd/Ord for Channels and ColorSpace | diff --git a/src/types.rs b/src/types.rs
index 65a5cd1..48419d1 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -7,7 +7,7 @@ use crate::utils::unlikely;
///
/// Note: the color space is purely informative. Although it is saved to the
/// file header, it does not affect encoding/decoding in any way.
-#[derive(Copy, C... | 1 | 2 | 2 |
fb8a43fd13e4a9bed6a0a08d1e534e4497a57698 | Ivan Smirnov | 2022-01-03T10:04:22 | Fix potential decoder panic when checking padding | diff --git a/src/decode.rs b/src/decode.rs
index 59ca777..8a53f4e 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1,7 +1,7 @@
use std::io::Read;
// TODO: can be removed once https://github.com/rust-lang/rust/issues/74985 is stable
-use bytemuck::{cast_slice, cast_slice_mut, Pod};
+use bytemuck::{cast_slice_mut, ... | 1 | 2 | 2 |
e6e156f974f5eb59ddf3a085e908ea9c18651535 | Ivan Smirnov | 2022-01-03T09:02:27 | Update fuzz targets | diff --git a/fuzz/fuzz_targets/qoi_decode.rs b/fuzz/fuzz_targets/qoi_decode.rs
index f01845f..f14517b 100644
--- a/fuzz/fuzz_targets/qoi_decode.rs
+++ b/fuzz/fuzz_targets/qoi_decode.rs
@@ -3,7 +3,7 @@ use libfuzzer_sys::fuzz_target;
fuzz_target!(|input: (u16, u16, bool, &[u8])| {
let (w, h, is_4, data) = input;... | 2 | 15 | 18 |
4e43c8ba01e12c0b038e21df27b28f30d5c88d83 | Ivan Smirnov | 2022-01-03T09:00:18 | Add ColorSpace::as_u8() | diff --git a/src/types.rs b/src/types.rs
index b5c271c..65a5cd1 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -24,6 +24,10 @@ impl ColorSpace {
pub const fn is_linear(self) -> bool {
matches!(self, Self::Linear)
}
+
+ pub const fn as_u8(self) -> u8 {
+ self as u8
+ }
}
impl Default... | 1 | 4 | 0 |
71e787f648db817613e725fb94a8f98f6f876c5d | Ivan Smirnov | 2022-01-02T22:15:57 | Update Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index ad1624d..30e5802 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "qoi-fast"
-version = "0.0.1"
-description = "Fast encoder/decoder for QOI (Quite Okay Image) format"
+version = "0.2.0"
+description = "VERY fast encoder/decoder for QOI (Quite Okay I... | 1 | 2 | 2 |
ae6d410374d13db0c0fd3e2ba29f669830e146df | Ivan Smirnov | 2022-01-02T22:11:01 | Implement efficient encoding to generic streams | diff --git a/src/encode.rs b/src/encode.rs
index 12d3300..5b7bbf3 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -1,17 +1,18 @@
+use std::io::Write;
+
use crate::consts::{QOI_HEADER_SIZE, QOI_OP_INDEX, QOI_OP_RUN, QOI_PADDING, QOI_PADDING_SIZE};
use crate::error::{Error, Result};
use crate::header::Header;
use c... | 3 | 67 | 29 |
9d036bc64eb02ed2741218076280e2c11c3d6807 | Ivan Smirnov | 2022-01-02T21:47:23 | Update tests and benches to the new encoder API | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index 57c0f7a..9462463 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -123,7 +123,7 @@ impl Codec for CodecQoiFast {
}
fn encode(img: &Image) -> Result<Vec<u8>> {
- Ok(qoi_fast::qoi_encode_to_vec(&img.data, img.width, img.h... | 2 | 2 | 2 |
b461af81accd4f72cfa87774e2b1fbdd8c106ba1 | Ivan Smirnov | 2022-01-02T21:47:13 | Introduce Channels and finish encoder refactor | diff --git a/src/decode.rs b/src/decode.rs
index 197f2ec..59ca777 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -10,6 +10,7 @@ use crate::consts::{
use crate::error::{Error, Result};
use crate::header::Header;
use crate::pixel::{Pixel, SupportedChannels};
+use crate::types::Channels;
use crate::utils::{cold, un... | 6 | 205 | 102 |
0b76352b22f4dcb112e06cd3b3cc3969407b92e2 | Ivan Smirnov | 2022-01-02T20:30:28 | Use u32::{from_be_bytes,to_be_bytes} builtins | diff --git a/src/consts.rs b/src/consts.rs
index b143f90..2281c24 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -12,7 +12,6 @@ pub const QOI_HEADER_SIZE: usize = 14;
pub const QOI_PADDING: [u8; 8] = [0, 0, 0, 0, 0, 0, 0, 0x01]; // 7 zeros and one 0x01 marker
pub const QOI_PADDING_SIZE: usize = 8;
-pub const QOI... | 2 | 10 | 24 |
d763e1d62c651a0b4e3f695eb22eb00adae1feab | Ivan Smirnov | 2022-01-02T19:54:56 | Remove magic field from Header | diff --git a/src/encode.rs b/src/encode.rs
index 548dd61..f0d4e80 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -33,7 +33,7 @@ where
let out_size = out.len();
let mut buf = BytesMut::new(out);
- let header = Header { width, height, channels: N as u8, colorspace, ..Header::default() };
+ let header... | 2 | 5 | 12 |
9289fdd59bc304e5b19570a0ea6d229695345589 | Ivan Smirnov | 2022-01-02T17:16:05 | Encoding - start the big refactor | diff --git a/src/encode.rs b/src/encode.rs
index 3fe44d4..548dd61 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -2,46 +2,12 @@ use std::convert::TryInto;
use crate::colorspace::ColorSpace;
use crate::consts::{
- QOI_HEADER_SIZE, QOI_OP_DIFF, QOI_OP_INDEX, QOI_OP_LUMA, QOI_OP_RGB, QOI_OP_RGBA, QOI_OP_RUN,
- ... | 3 | 94 | 94 |
268953033bcfca7237bab9c43273f32a9698ee6a | Ivan Smirnov | 2022-01-02T16:14:12 | Decoder - cleanup, move some logic back into Pixel | diff --git a/src/decode.rs b/src/decode.rs
index 4d86a5b..197f2ec 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -17,37 +17,6 @@ const QOI_OP_RUN_END: u8 = QOI_OP_RUN | 0x3d; // <- note, 0x3d (not 0x3f)
const QOI_OP_DIFF_END: u8 = QOI_OP_DIFF | 0x3f;
const QOI_OP_LUMA_END: u8 = QOI_OP_LUMA | 0x3f;
-#[inline(alwa... | 2 | 61 | 75 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.