The code for packing packbits is pointing at a literal ( non-repeating block ) and tries to avoid that 2 consecutive bytes in the mid of a series of unique characters interrupt the literal block since it would increase the length with one.
If it is followed by another replication block, it or happens at the end, it can become a replication block of 2 bytes without overhead.
The code for packing packbits is pointing at a literal ( non-repeating block ) and tries to avoid that 2 consecutive bytes in the mid of a series of unique characters interrupt the literal block since it would increase the length with one.
If it is followed by another replication block, it or happens at the end, it can become a replication block of 2 bytes without overhead.
But line https://github.com/cgohlke/imagecodecs/blob/c85049eaca98a28963b3a447a284a74680c794ce/imagecodecs/imcd.c#L759 calculates the position after the replicate block by adding the length to srcptr instead of dupptr.
Or am I missing something here ?
Regards, Dirk