fix low-bitdepth spng save
There was a missing shift, thanks jeffska See https://github.com/libvips/libvips/issues/2985
This commit is contained in:
parent
29e80ca43f
commit
ca2796aa7f
@ -4,6 +4,7 @@
|
||||
- fix libpng fallback when spng is disabled in meson
|
||||
- add "unlimited" to jpegload
|
||||
- better 0 detection in unpremultiply
|
||||
- fix low bitdepth spng save [jeffska]
|
||||
|
||||
21/11/21 started 8.13
|
||||
- configure fails for requested but unmet dependencies [remicollet]
|
||||
|
@ -270,6 +270,7 @@ vips_foreign_save_spng_pack( VipsForeignSaveSpng *spng,
|
||||
VipsPel *q, VipsPel *p, size_t n )
|
||||
{
|
||||
int pixel_mask = 8 / spng->bitdepth - 1;
|
||||
int shift = 8 - spng->bitdepth;
|
||||
|
||||
VipsPel bits;
|
||||
size_t x;
|
||||
@ -277,7 +278,7 @@ vips_foreign_save_spng_pack( VipsForeignSaveSpng *spng,
|
||||
bits = 0;
|
||||
for( x = 0; x < n; x++ ) {
|
||||
bits <<= spng->bitdepth;
|
||||
bits |= p[x];
|
||||
bits |= p[x] >> shift;
|
||||
|
||||
if( (x & pixel_mask) == pixel_mask )
|
||||
*q++ = bits;
|
||||
|
Loading…
Reference in New Issue
Block a user