# HG changeset patch # User michael # Date 1230299289 0 # Node ID 75328d3e788e7e012de9e14900170e48be8fbddc # Parent 3700af1c1f4f09f83afc4a77314429f060caed0b Factorize mode switching in put_line(). diff -r 3700af1c1f4f -r 75328d3e788e faxcompr.c --- a/faxcompr.c Fri Dec 26 13:46:11 2008 +0000 +++ b/faxcompr.c Fri Dec 26 13:48:09 2008 +0000 @@ -232,20 +232,19 @@ static void put_line(uint8_t *dst, int size, int width, const int *runs) { PutBitContext pb; - int run, mode = 0, pix_left = width, run_idx = 0; + int run, mode = 1, pix_left = width, run_idx = 0; init_put_bits(&pb, dst, size*8); while(pix_left > 0){ run = runs[run_idx++]; + mode = !mode; if(!run){ - mode = !mode; continue; } pix_left -= run; for(; run > 16; run -= 16) put_sbits(&pb, 16, -mode); put_sbits(&pb, run, -mode); - mode = !mode; } }