Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor out lossless JPEG code so that it can eventually be used independently #127

Merged
merged 15 commits into from
Dec 9, 2024
40 changes: 20 additions & 20 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lepton_jpeg"
version = "0.4.0"
version = "0.4.1"
edition = "2021"
authors = ["Kristof Roomp <[email protected]>"]

Expand Down
2 changes: 1 addition & 1 deletion package/Lepton.Jpeg.Rust.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Lepton.Jpeg.Rust</id>
<version>0.4.0</version>
<version>0.4.1</version>
<title>Lepton JPEG Compression Rust version binaries and libraries</title>
<authors>kristofr</authors>
<owners>kristofr</owners>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/structs/bit_writer.rs → src/jpeg/bit_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ impl BitWriter {
#[cfg(test)]
use std::io::Cursor;

#[cfg(test)]
use super::bit_reader::BitReader;
use crate::helpers::has_ff;
#[cfg(test)]
use crate::helpers::u32_bit_length;
#[cfg(test)]
use crate::structs::bit_reader::BitReader;

// write a test pattern with an escape and see if it matches
#[test]
Expand Down
14 changes: 2 additions & 12 deletions src/structs/block_based_image.rs → src/jpeg/block_based_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use log::info;
use wide::{i16x8, CmpEq};

use crate::consts::ZIGZAG_TO_TRANSPOSED;
use crate::structs::block_context::BlockContext;
use crate::structs::jpeg_header::JPegHeader;

use super::jpeg_header::JPegHeader;

/// holds the 8x8 blocks for a given component. Since we do multithreaded encoding,
/// the image may only hold a subset of the components (specified by dpos_offset),
Expand Down Expand Up @@ -110,16 +110,6 @@ impl BlockBasedImage {
);
}

// blocks above the first line are never dereferenced
pub fn off_y(&self, y: u32) -> BlockContext {
return BlockContext::new(
self.block_width * y,
if y > 0 { self.block_width * (y - 1) } else { 0 },
if (y & 1) != 0 { self.block_width } else { 0 },
if (y & 1) != 0 { 0 } else { self.block_width },
);
}

pub fn get_block_width(&self) -> u32 {
self.block_width
}
Expand Down
File renamed without changes.
Loading