olikraus / u8glib

Arduino Monochrom Graphics Library for LCDs and OLEDs
https://github.com/olikraus/u8glib/wiki
Other
1.24k stars 313 forks source link

RLE Compression , repeat number #524

Closed IronMan-Nam closed 1 year ago

IronMan-Nam commented 1 year ago

First, I am very grateful you have created a great library to ease the development of our projects. after learning and experimenting. I saw one thing that I think we should change it. In the source file bdf_rle.c function bg_prepare_01_rle(bg_t *bg, unsigned a, unsigned b). I change the comparison operand from >= in the two while loops to >. That reduces one repetition if the length of bit 0 or bit 1 is within the specified number of bits. Example in case: bg->rle_bits_per_0= 3, bg->rle_bits_per_1 = 4, a = 7, b = 4 The number of compressions is 1 time instead of 2 times before the improvement.