Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jxl/src/frame/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ impl Frame {
}
}
for i in 3..num_channels {
pipeline =
pipeline.add_inout_stage(ConvertModularToF32Stage::new(i, metadata.bit_depth))?;
let ec_bit_depth = metadata.extra_channel_info[i - 3].bit_depth();
pipeline = pipeline.add_inout_stage(ConvertModularToF32Stage::new(i, ec_bit_depth))?;
}

for c in 0..3 {
Expand Down
3 changes: 3 additions & 0 deletions jxl/src/headers/extra_channels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ impl ExtraChannelInfo {
pub fn alpha_associated(&self) -> bool {
self.alpha_associated
}
pub fn bit_depth(&self) -> BitDepth {
self.bit_depth
}
fn check(&self, _: &Empty) -> Result<(), Error> {
if self.dim_shift > 3 {
Err(Error::DimShiftTooLarge(self.dim_shift))
Expand Down
19 changes: 19 additions & 0 deletions jxl/src/render/stages/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,4 +448,23 @@ mod test {
fn f32_to_f16_consistency() -> Result<()> {
crate::render::test::test_stage_consistency(|| ConvertF32ToF16Stage::new(0), (500, 500), 1)
}

/// Test ConvertModularToF32Stage consistency with different bit depths.
#[test]
fn modular_to_f32_8bit_consistency() -> Result<()> {
crate::render::test::test_stage_consistency(
|| ConvertModularToF32Stage::new(0, BitDepth::integer_samples(8)),
(500, 500),
1,
)
}

#[test]
fn modular_to_f32_16bit_consistency() -> Result<()> {
crate::render::test::test_stage_consistency(
|| ConvertModularToF32Stage::new(0, BitDepth::integer_samples(16)),
(500, 500),
1,
)
}
}
Loading