70 return ((src_sz >> 1) * 3 + (src_sz & 1));
102 for (i = 1; i < src_sz; i++) {
103 if (prev_b != src[i] || cnt == 255) {
106 if (nbytes >= dst_sz)
108 dst[nbytes++] = prev_b;
112 if (nbytes >= dst_sz - 2)
114 dst[nbytes++] = prev_b;
115 dst[nbytes++] = prev_b;
116 dst[nbytes++] = (
unsigned char) cnt;
125 if (nbytes >= dst_sz)
127 dst[nbytes++] = prev_b;
130 if (nbytes >= dst_sz - 2)
132 dst[nbytes++] = prev_b;
133 dst[nbytes++] = prev_b;
134 dst[nbytes++] = (
unsigned char) cnt;
144 int i, j, nbytes, cnt;
145 unsigned char prev_b;
167 if (nbytes + cnt > dst_sz)
169 for (j = 0; j < cnt; j++) {
170 dst[nbytes++] = prev_b;
178 if (prev_b != src[i]) {
179 if (nbytes + cnt > dst_sz)
181 dst[nbytes++] = prev_b;
189 if (nbytes >= dst_sz)
192 dst[nbytes++] = prev_b;
int G_rle_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
int G_rle_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
int G_rle_compress_bound(int src_sz)