We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 93baf7d commit d11922eCopy full SHA for d11922e
src/lossless_transform.rs
@@ -387,11 +387,12 @@ pub(crate) fn apply_color_indexing_transform(
387
table_data: &[u8],
388
) {
389
if table_size > 16 {
390
- let mut table = table_data.chunks_exact(4).collect::<Vec<_>>();
391
- table.resize(256, &[0; 4]);
+ let mut table: Vec<[u8; 4]> = table_data.chunks_exact(4).map(|c| TryInto::<[u8; 4]>::try_into(c).unwrap()).collect();
+ table.resize(256, [0; 4]);
392
+ let table: &[[u8; 4]; 256] = table.as_slice().try_into().unwrap();
393
394
for pixel in image_data.chunks_exact_mut(4) {
- pixel.copy_from_slice(table[pixel[1] as usize]);
395
+ pixel.copy_from_slice(&table[pixel[1] as usize]);
396
}
397
} else {
398
let width_bits: u8 = if table_size <= 2 {
0 commit comments