Mercurial > hg > dmlib
comparison tools/lib64gfx.c @ 1833:19d4f76e003d
Improve RLE compression by checking for "first byte" condition in the compressor.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 22 Jun 2018 16:35:08 +0300 |
parents | ce1a734b016f |
children | 88cef7758303 |
comparison
equal
deleted
inserted
replaced
1832:843d3a593f05 | 1833:19d4f76e003d |
---|---|
664 | 664 |
665 while (dmGrowBufGetU8(&src, &data)) | 665 while (dmGrowBufGetU8(&src, &data)) |
666 { | 666 { |
667 // If new data byte is different, or we exceed the rleMaxCount | 667 // If new data byte is different, or we exceed the rleMaxCount |
668 // for the active runs mode(s) .. then encode the run. | 668 // for the active runs mode(s) .. then encode the run. |
669 if (data != prev || | 669 if ((data != prev && prev != -1) || |
670 ((cfg->flags & DM_RLE_WORD_RUNS) && count >= cfg->rleMaxCountW) || | 670 ((cfg->flags & DM_RLE_WORD_RUNS) && count >= cfg->rleMaxCountW) || |
671 (((cfg->flags & DM_RLE_RUNS_MASK) == DM_RLE_BYTE_RUNS) && count >= cfg->rleMaxCountB)) | 671 (((cfg->flags & DM_RLE_RUNS_MASK) == DM_RLE_BYTE_RUNS) && count >= cfg->rleMaxCountB)) |
672 { | 672 { |
673 if ((res = dmEncodeGenericRLESequence(dst, prev, count, cfg)) != DMERR_OK) | 673 if ((res = dmEncodeGenericRLESequence(dst, prev, count, cfg)) != DMERR_OK) |
674 goto err; | 674 goto err; |