Compute hash on 4-byte (extended) pixels always

This commit is contained in:
Ivan Smirnov 2022-01-04 01:30:45 +03:00
parent 88a020b851
commit 52cc56381e
2 changed files with 4 additions and 3 deletions

View file

@ -76,7 +76,8 @@ where
}
}
index[px.hash_index() as usize] = px;
let px_rgba = px.as_rgba(0xff);
index[px_rgba.hash_index() as usize] = px;
*px_out = px.into();
}

View file

@ -52,9 +52,9 @@ where
}
run = 0;
}
hash_prev = px.hash_index();
let index_px = &mut index[hash_prev as usize];
let px_rgba = px.as_rgba(0xff);
hash_prev = px_rgba.hash_index();
let index_px = &mut index[hash_prev as usize];
if *index_px == px_rgba {
buf = buf.write_one(QOI_OP_INDEX | hash_prev)?;
} else {