From 53ecac38a9e9938897cf70fb9cfbb187bc833202 Mon Sep 17 00:00:00 2001 From: Ivan Smirnov Date: Thu, 6 Jan 2022 03:59:32 +0300 Subject: [PATCH] Rename qoi-fast -> qoi (qoi-rust) + update repo --- Cargo.toml | 14 +++++++------- README.md | 12 ++++++------ bench/Cargo.toml | 2 +- bench/src/main.rs | 14 +++++++------- fuzz/fuzz_targets/decode.rs | 2 +- fuzz/fuzz_targets/encode.rs | 2 +- src/lib.rs | 4 ++-- tests/test_chunks.rs | 4 ++-- tests/test_gen.rs | 14 +++++++------- tests/test_ref.rs | 2 +- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b7b9fd6..d1c8ec7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "qoi-fast" -version = "0.2.0" -description = "Fast encoder/decoder for QOI (Quite Okay Image) format" +name = "qoi" +version = "0.4.0" +description = "VERY fast encoder/decoder for QOI (Quite Okay Image) format" authors = ["Ivan Smirnov "] edition = "2018" readme = "README.md" license = "MIT/Apache-2.0" -repository = "https://github.com/aldanor/qoi-fast" -homepage = "https://github.com/aldanor/qoi-fast" -documentation = "https://docs.rs/qoi-fast" +repository = "https://github.com/aldanor/qoi-rust" +homepage = "https://github.com/aldanor/qoi-rust" +documentation = "https://docs.rs/qoi" categories = ["multimedia::images", "multimedia::encoding"] keywords = ["qoi", "graphics", "image", "encoding"] exclude = [ @@ -37,7 +37,7 @@ rand = "0.8" libqoi = { path = "libqoi"} [lib] -name = "qoi_fast" +name = "qoi" path = "src/lib.rs" doctest = false diff --git a/README.md b/README.md index f3f6a0d..a7de677 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# [qoi-fast](https://crates.io/crates/qoi-fast) +# [qoi](https://crates.io/crates/qoi) -[![Build](https://github.com/aldanor/qoi-fast/workflows/CI/badge.svg)](https://github.com/aldanor/qoi-fast/actions?query=branch%3Amaster) -[![Latest Version](https://img.shields.io/crates/v/qoi-fast.svg)](https://crates.io/crates/qoi-fast) -[![Documentation](https://img.shields.io/docsrs/qoi-fast)](https://docs.rs/qoi-fast) +[![Build](https://github.com/aldanor/qoi-rust/workflows/CI/badge.svg)](https://github.com/aldanor/qoi-rust/actions?query=branch%3Amaster) +[![Latest Version](https://img.shields.io/crates/v/qoi.svg)](https://crates.io/crates/qoi) +[![Documentation](https://img.shields.io/docsrs/qoi)](https://docs.rs/qoi) [![Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance) @@ -19,7 +19,7 @@ Fast encoder/decoder for [QOI image format](https://qoiformat.org/), implemented ### Examples ```rust -use qoi_fast::{encode_to_vec, decode_to_vec}; +use qoi::{encode_to_vec, decode_to_vec}; let encoded = encode_to_vec(&pixels, width, height)?; let (header, decoded) = decode_to_vec(&encoded)?; @@ -34,7 +34,7 @@ assert_eq!(decoded, pixels); ``` decode:Mp/s encode:Mp/s decode:MB/s encode:MB/s qoi.h 282.9 225.3 978.3 778.9 -qoi-fast 427.4 290.0 1477.7 1002.9 +qoi-rust 427.4 290.0 1477.7 1002.9 ``` - Reference C implementation: diff --git a/bench/Cargo.toml b/bench/Cargo.toml index d7973af..d1a04d6 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -9,7 +9,7 @@ publish = false [dependencies] # internal libqoi = { path = "../libqoi" } -qoi-fast = { path = ".." } +qoi = { path = ".." } # external anyhow = "1.0" bytemuck = "1.7" diff --git a/bench/src/main.rs b/bench/src/main.rs index 1ef3a57..e7dbeaa 100644 --- a/bench/src/main.rs +++ b/bench/src/main.rs @@ -129,21 +129,21 @@ trait Codec { fn decode(data: &[u8], img: &Image) -> Result; } -struct CodecQoiFast; +struct CodecQoiRust; -impl Codec for CodecQoiFast { +impl Codec for CodecQoiRust { type Output = Vec; fn name() -> &'static str { - "qoi-fast" + "qoi-rust" } fn encode(img: &Image) -> Result> { - Ok(qoi_fast::encode_to_vec(&img.data, img.width, img.height)?) + Ok(qoi::encode_to_vec(&img.data, img.width, img.height)?) } fn decode(data: &[u8], _img: &Image) -> Result> { - Ok(qoi_fast::decode_to_vec(data)?.1) + Ok(qoi::decode_to_vec(data)?.1) } } @@ -215,7 +215,7 @@ impl ImageBench { let (decoded, t_decode) = timeit(|| C::decode(encoded.as_ref(), img)); let decoded = decoded?; let roundtrip = decoded.as_ref() == img.data.as_slice(); - if C::name() == "qoi-fast" { + if C::name() == "qoi-rust" { assert!(roundtrip, "{}: decoded data doesn't roundtrip", C::name()); } else { ensure!(roundtrip, "{}: decoded data doesn't roundtrip", C::name()); @@ -374,7 +374,7 @@ fn bench_png(filename: &Path, seconds: f64, use_median: bool) -> Result(&img, seconds)?; - bench.run::(&img, seconds)?; + bench.run::(&img, seconds)?; bench.report(use_median); Ok(bench) } diff --git a/fuzz/fuzz_targets/decode.rs b/fuzz/fuzz_targets/decode.rs index 9ecb174..62a1c3b 100644 --- a/fuzz/fuzz_targets/decode.rs +++ b/fuzz/fuzz_targets/decode.rs @@ -1,7 +1,7 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use qoi_fast::{decode_header, decode_to_vec, Channels, ColorSpace, Header}; +use qoi::{decode_header, decode_to_vec, Channels, ColorSpace, Header}; fuzz_target!(|input: (u16, u16, bool, &[u8])| { let (w, h, is_4, data) = input; diff --git a/fuzz/fuzz_targets/encode.rs b/fuzz/fuzz_targets/encode.rs index 33f2315..aedb0c3 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_fast::{encode_size_limit, encode_to_vec}; +use qoi::{encode_size_limit, encode_to_vec}; fuzz_target!(|input: (bool, u8, &[u8])| { let (is_4, w_frac, data) = input; diff --git a/src/lib.rs b/src/lib.rs index f0945cf..9ef6637 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,7 @@ //! ### Examples //! //! ```rust -//! use qoi_fast::{encode_to_vec, decode_to_vec}; +//! use qoi::{encode_to_vec, decode_to_vec}; //! //! let encoded = encode_to_vec(&pixels, width, height)?; //! let (header, decoded) = decode_to_vec(&encoded)?; @@ -25,7 +25,7 @@ //! ``` //! decode:Mp/s encode:Mp/s decode:MB/s encode:MB/s //! qoi.h 282.9 225.3 978.3 778.9 -//! qoi-fast 427.4 290.0 1477.7 1002.9 +//! qoi-rust 427.4 290.0 1477.7 1002.9 //! ``` //! //! - Reference C implementation: diff --git a/tests/test_chunks.rs b/tests/test_chunks.rs index a0680e1..d465140 100644 --- a/tests/test_chunks.rs +++ b/tests/test_chunks.rs @@ -2,11 +2,11 @@ mod common; use bytemuck::{cast_slice, Pod}; -use qoi_fast::consts::{ +use qoi::consts::{ QOI_HEADER_SIZE, QOI_OP_DIFF, QOI_OP_INDEX, QOI_OP_LUMA, QOI_OP_RGB, QOI_OP_RGBA, QOI_OP_RUN, QOI_PADDING_SIZE, }; -use qoi_fast::{decode_to_vec, encode_to_vec}; +use qoi::{decode_to_vec, encode_to_vec}; use self::common::hash; diff --git a/tests/test_gen.rs b/tests/test_gen.rs index f25b082..08767d4 100644 --- a/tests/test_gen.rs +++ b/tests/test_gen.rs @@ -12,11 +12,11 @@ use rand::{ }; use libqoi::{qoi_decode, qoi_encode}; -use qoi_fast::consts::{ +use qoi::consts::{ QOI_HEADER_SIZE, QOI_MASK_2, QOI_OP_DIFF, QOI_OP_INDEX, QOI_OP_LUMA, QOI_OP_RGB, QOI_OP_RGBA, QOI_OP_RUN, QOI_PADDING_SIZE, }; -use qoi_fast::{decode_header, decode_to_vec, encode_to_vec}; +use qoi::{decode_header, decode_to_vec, encode_to_vec}; use self::common::hash; @@ -291,9 +291,9 @@ fn test_generated() { let encode_c = |data: &[u8], size| qoi_encode(data, size, 1, channels as _); let decode_c = |data: &[u8]| qoi_decode(data, channels as _).map(|r| r.1); - check_roundtrip("qoi-fast -> qoi-fast", &img, channels as _, encode, decode); - check_roundtrip("qoi-fast -> qoi.h", &img, channels as _, encode, decode_c); - check_roundtrip("qoi.h -> qoi-fast", &img, channels as _, encode_c, decode); + check_roundtrip("qoi-rust -> qoi-rust", &img, channels as _, encode, decode); + check_roundtrip("qoi-rust -> qoi.h", &img, channels as _, encode, decode_c); + check_roundtrip("qoi.h -> qoi-rust", &img, channels as _, encode_c, decode); let size = (img.len() / channels) as u32; let encoded = encode(&img, size).unwrap(); @@ -301,10 +301,10 @@ fn test_generated() { cfg_if! { if #[cfg(feature = "reference")] { let eq = encoded.as_slice() == encoded_c.as_ref(); - assert!(eq, "qoi-fast [reference mode] doesn't match qoi.h"); + assert!(eq, "qoi-rust [reference mode] doesn't match qoi.h"); } else { let eq = encoded.len() == encoded_c.len(); - assert!(eq, "qoi-fast [non-reference mode] length doesn't match qoi.h"); + assert!(eq, "qoi-rust [non-reference mode] length doesn't match qoi.h"); } } diff --git a/tests/test_ref.rs b/tests/test_ref.rs index 29edbb6..59a7315 100644 --- a/tests/test_ref.rs +++ b/tests/test_ref.rs @@ -5,7 +5,7 @@ use anyhow::{bail, Result}; use cfg_if::cfg_if; use walkdir::{DirEntry, WalkDir}; -use qoi_fast::{decode_to_vec, encode_to_vec}; +use qoi::{decode_to_vec, encode_to_vec}; fn find_qoi_png_pairs(root: impl AsRef) -> Vec<(PathBuf, PathBuf)> { let root = root.as_ref();