Skip to content

Commit 53de4f6

Browse files
committed
No longer need to pass around is_jfif
1 parent e663b78 commit 53de4f6

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

src/decoder.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,6 @@ impl<R: Read> Decoder<R> {
685685
&frame.components,
686686
planes,
687687
frame.output_size,
688-
self.is_jfif,
689688
self.determine_color_transform(),
690689
)
691690
}
@@ -1294,7 +1293,6 @@ fn compute_image(
12941293
components: &[Component],
12951294
mut data: Vec<Vec<u8>>,
12961295
output_size: Dimensions,
1297-
is_jfif: bool,
12981296
color_transform: ColorTransform,
12991297
) -> Result<Vec<u8>> {
13001298
if data.is_empty() || data.iter().any(Vec::is_empty) {
@@ -1325,13 +1323,12 @@ fn compute_image(
13251323
decoded.resize(size, 0);
13261324
Ok(decoded)
13271325
} else {
1328-
compute_image_parallel(components, data, output_size, is_jfif, color_transform)
1326+
compute_image_parallel(components, data, output_size, color_transform)
13291327
}
13301328
}
13311329

13321330
pub(crate) fn choose_color_convert_func(
13331331
component_count: usize,
1334-
_is_jfif: bool,
13351332
color_transform: ColorTransform,
13361333
) -> Result<fn(&[Vec<u8>], &mut [u8])> {
13371334
match component_count {

src/worker/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,17 @@ pub fn compute_image_parallel(
9898
components: &[Component],
9999
data: Vec<Vec<u8>>,
100100
output_size: Dimensions,
101-
is_jfif: bool,
102101
color_transform: ColorTransform,
103102
) -> Result<Vec<u8>> {
104103
#[cfg(all(
105104
not(any(target_arch = "asmjs", target_arch = "wasm32")),
106105
feature = "rayon"
107106
))]
108-
return rayon::compute_image_parallel(components, data, output_size, is_jfif, color_transform);
107+
return rayon::compute_image_parallel(components, data, output_size, color_transform);
109108

110109
#[allow(unreachable_code)]
111110
{
112-
let color_convert_func =
113-
choose_color_convert_func(components.len(), is_jfif, color_transform)?;
111+
let color_convert_func = choose_color_convert_func(components.len(), color_transform)?;
114112
let upsampler = Upsampler::new(components, output_size.width, output_size.height)?;
115113
let line_size = output_size.width as usize * components.len();
116114
let mut image = vec![0u8; line_size * output_size.height as usize];

src/worker/rayon.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rayon::slice::ParallelSliceMut;
66
use crate::decoder::{choose_color_convert_func, ColorTransform};
77
use crate::error::Result;
88
use crate::idct::dequantize_and_idct_block;
9-
use crate::parser::{AdobeColorTransform, Component};
9+
use crate::parser::Component;
1010
use crate::upsampler::Upsampler;
1111
use crate::{decoder::MAX_COMPONENTS, parser::Dimensions};
1212

@@ -196,10 +196,9 @@ pub fn compute_image_parallel(
196196
components: &[Component],
197197
data: Vec<Vec<u8>>,
198198
output_size: Dimensions,
199-
is_jfif: bool,
200199
color_transform: ColorTransform,
201200
) -> Result<Vec<u8>> {
202-
let color_convert_func = choose_color_convert_func(components.len(), is_jfif, color_transform)?;
201+
let color_convert_func = choose_color_convert_func(components.len(), color_transform)?;
203202
let upsampler = Upsampler::new(components, output_size.width, output_size.height)?;
204203
let line_size = output_size.width as usize * components.len();
205204
let mut image = vec![0u8; line_size * output_size.height as usize];

0 commit comments

Comments
 (0)