fix flush of left-over bits
we were not adjusting for pixel size, thanks MathemanFlo see https://github.com/libvips/libvips/pull/1672#issuecomment-644807739
This commit is contained in:
parent
1f8d007d19
commit
b2feb4805f
@ -1310,8 +1310,14 @@ eightbit2nbit( Wtiff *wtiff, VipsPel *q, VipsPel *p, int n )
|
|||||||
|
|
||||||
/* Any left-over bits? Need to be left-aligned.
|
/* Any left-over bits? Need to be left-aligned.
|
||||||
*/
|
*/
|
||||||
if( (x & pixel_mask) != 0 )
|
if( (x & pixel_mask) != 0 ) {
|
||||||
*q++ = (bits ^ mask) << (8 - (x & pixel_mask));
|
/* The number of bits we've collected in bits and must
|
||||||
|
* left-align and flush.
|
||||||
|
*/
|
||||||
|
int collected_bits = (x & pixel_mask) << (wtiff->bitdepth - 1);
|
||||||
|
|
||||||
|
*q++ = (bits ^ mask) << (8 - collected_bits);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Swap the sense of the first channel, if necessary.
|
/* Swap the sense of the first channel, if necessary.
|
||||||
|
Loading…
Reference in New Issue
Block a user