- fix tiled image reading
Fuzz / Fuzz (decode_comprehensive) (push) Failing after 37s
Fuzz / Fuzz (decode_image) (push) Failing after 35s
Fuzz / Fuzz regression (push) Successful in 28s
Rust CI / build (1.88.0) (push) Successful in 46s
Rust CI / build (beta) (push) Successful in 38s
Rust CI / build (nightly) (push) Successful in 36s
Rust CI / build (stable) (push) Successful in 39s
Rust CI / test-platforms (ubuntu-latest) (push) Successful in 33s
Rust CI / features () (push) Successful in 29s
Rust CI / features (default) (push) Successful in 37s
Rust CI / features (default,zstd) (push) Successful in 36s
Rust CI / features (deflate) (push) Successful in 35s
Rust CI / features (jpeg) (push) Successful in 36s
Rust CI / features (lzw) (push) Successful in 35s
Rust CI / features (zstd) (push) Successful in 35s
Rust CI / other_archs (i686-unknown-linux-gnu) (push) Failing after 19s
Rust CI / other_archs (powerpc-unknown-linux-gnu) (push) Failing after 18s
Rust CI / rustfmt (push) Successful in 25s
Rust CI / msrv (push) Successful in 57s
Rust CI / clippy (push) Successful in 33s
Rust CI / test-platforms (macos-26-intel) (push) Canceled after 0s
Rust CI / test-platforms (macos-latest) (push) Canceled after 0s
Rust CI / test-platforms (ubuntu-24.04-arm) (push) Canceled after 0s
Rust CI / test-platforms (windows-11-arm) (push) Canceled after 0s
Rust CI / test-platforms (windows-latest) (push) Canceled after 0s
Fuzz / Fuzz (decode_comprehensive) (push) Failing after 37s
Fuzz / Fuzz (decode_image) (push) Failing after 35s
Fuzz / Fuzz regression (push) Successful in 28s
Rust CI / build (1.88.0) (push) Successful in 46s
Rust CI / build (beta) (push) Successful in 38s
Rust CI / build (nightly) (push) Successful in 36s
Rust CI / build (stable) (push) Successful in 39s
Rust CI / test-platforms (ubuntu-latest) (push) Successful in 33s
Rust CI / features () (push) Successful in 29s
Rust CI / features (default) (push) Successful in 37s
Rust CI / features (default,zstd) (push) Successful in 36s
Rust CI / features (deflate) (push) Successful in 35s
Rust CI / features (jpeg) (push) Successful in 36s
Rust CI / features (lzw) (push) Successful in 35s
Rust CI / features (zstd) (push) Successful in 35s
Rust CI / other_archs (i686-unknown-linux-gnu) (push) Failing after 19s
Rust CI / other_archs (powerpc-unknown-linux-gnu) (push) Failing after 18s
Rust CI / rustfmt (push) Successful in 25s
Rust CI / msrv (push) Successful in 57s
Rust CI / clippy (push) Successful in 33s
Rust CI / test-platforms (macos-26-intel) (push) Canceled after 0s
Rust CI / test-platforms (macos-latest) (push) Canceled after 0s
Rust CI / test-platforms (ubuntu-24.04-arm) (push) Canceled after 0s
Rust CI / test-platforms (windows-11-arm) (push) Canceled after 0s
Rust CI / test-platforms (windows-latest) (push) Canceled after 0s
This commit is contained in:
1 parent
96d37bb087
commit
9b452e93b7
3 files changed
+53
-1
No files matched your search
@@ -506,6 +506,47 @@ fn test_tiled_extra_samples_border_u8() {
|
||||
assert_eq!(data, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tiled_planar_border_u16() {
|
||||
// A planar (separate) tiled image whose dimensions are not multiples of the tile size.
|
||||
// The tile grid repeats for every plane, but the chunk (tile) index counts all planes, so
|
||||
// the border padding of the second plane used to be looked up with the wrong tile index.
|
||||
// The bottom-right tile of plane 1 then claimed a full tile height, and the decoder ran
|
||||
// past the end of the output buffer.
|
||||
//
|
||||
// Note that `read_image` only decodes the first plane, so this has to go through
|
||||
// `read_image_to_buffer` to reach the tiles that were mis-sized.
|
||||
let path = PathBuf::from(TEST_IMAGE_DIR).join("tiled-planar-2c-16b.tif");
|
||||
let img_file = File::open(path).expect("Cannot find test image!");
|
||||
let mut decoder = Decoder::open(img_file).expect("Cannot create decoder");
|
||||
decoder.next_image().expect("Cannot read image IFD");
|
||||
assert_eq!(decoder.dimensions().unwrap(), (30, 20));
|
||||
assert_eq!(
|
||||
decoder.colortype().unwrap(),
|
||||
ColorType::Multiband {
|
||||
bit_depth: 16,
|
||||
num_samples: 2
|
||||
}
|
||||
);
|
||||
|
||||
let mut buffer = DecodingSampleBuffer::U16(Vec::new());
|
||||
decoder.read_image_to_buffer(&mut buffer).unwrap();
|
||||
let DecodingSampleBuffer::U16(data) = buffer else {
|
||||
panic!("Wrong bit depth")
|
||||
};
|
||||
assert_eq!(data.len(), 2 * 20 * 30);
|
||||
|
||||
let mut expected = Vec::with_capacity(2 * 20 * 30);
|
||||
for plane in 0..2u16 {
|
||||
for y in 0..20u16 {
|
||||
for x in 0..30u16 {
|
||||
expected.push(1000 * plane + 10 * y + x);
|
||||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(data, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_inner_access() {
|
||||
let path = PathBuf::from(TEST_IMAGE_DIR).join("tiled-rect-rgb-u8.tif");
|
||||
|
||||
Reference in new issue
Block a user