Skip to content

Commit

Permalink
move lepton_header into its own module
Browse files Browse the repository at this point in the history
  • Loading branch information
mcroomp committed Jul 25, 2024
1 parent 85dd62e commit 25b85ea
Show file tree
Hide file tree
Showing 8 changed files with 781 additions and 764 deletions.
21 changes: 10 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use lepton_error::{ExitCode, LeptonError};
use lepton_jpeg::metrics::CpuTimeMeasure;
use log::info;
use simple_logger::SimpleLogger;
use structs::lepton_format::read_jpeg;
use structs::lepton_format::{decode_as_single_image, read_jpeg};
#[cfg(all(target_os = "windows", feature = "use_rayon"))]
use thread_priority::{set_current_thread_priority, ThreadPriority, WinAPIThreadPriority};

Expand All @@ -32,9 +32,8 @@ use std::{

use crate::enabled_features::EnabledFeatures;
use crate::helpers::here;
use crate::structs::lepton_format::{
decode_lepton_wrapper, encode_lepton_wrapper_verify, LeptonHeader,
};
use crate::structs::lepton_format::{decode_lepton_wrapper, encode_lepton_wrapper_verify};
use crate::structs::lepton_header::LeptonHeader;

fn parse_numeric_parameter(arg: &str, name: &str) -> Option<i32> {
if arg.starts_with(name) {
Expand Down Expand Up @@ -160,13 +159,13 @@ fn main_with_result() -> anyhow::Result<()> {

let _metrics;

(block_image, _metrics) = lh
.decode_as_single_image(
&mut reader.take(filelen - 4), // last 4 bytes are the length of the file
num_threads as usize,
&enabled_features,
)
.context(here!())?;
(block_image, _metrics) = decode_as_single_image(
&mut lh,
&mut reader.take(filelen - 4), // last 4 bytes are the length of the file
num_threads as usize,
&enabled_features,
)
.context(here!())?;

loop {
println!("parsed header:");
Expand Down
2 changes: 1 addition & 1 deletion src/structs/jpeg_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use crate::helpers::here;
use super::bit_reader::BitReader;
use super::block_based_image::{AlignedBlock, BlockBasedImage};
use super::jpeg_position_state::JpegPositionState;
use super::lepton_format::LeptonHeader;
use super::lepton_header::LeptonHeader;
use super::thread_handoff::ThreadHandoff;
use crate::lepton_error::ExitCode;

Expand Down
2 changes: 1 addition & 1 deletion src/structs/jpeg_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use std::io::Write;

use super::{
bit_writer::BitWriter, block_based_image::BlockBasedImage, jpeg_header::HuffCodes,
jpeg_position_state::JpegPositionState, lepton_format::LeptonHeader, row_spec::RowSpec,
jpeg_position_state::JpegPositionState, lepton_header::LeptonHeader, row_spec::RowSpec,
thread_handoff::ThreadHandoff,
};

Expand Down
Loading

0 comments on commit 25b85ea

Please sign in to comment.