Skip to content

Commit 092879c

Browse files
committed
More precise bit depth expanding
1 parent 7f78d82 commit 092879c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/codecs/avif/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ impl<R: Read> AvifDecoder<R> {
545545
// Expand current bit depth to target 16
546546
let target_expand_bits = 16u32 - self.picture.bit_depth() as u32;
547547
for item in target.iter_mut() {
548-
*item <<= target_expand_bits;
548+
*item = (*item << target_expand_bits) | (*item >> (16 - target_expand_bits));
549549
}
550550

551551
Ok(())

0 commit comments

Comments
 (0)