4#define G_254_SQUARE 64516
5#define G_254_TIMES_2 508
7#define G_RLE_OUTPUT_CODE(code) (*((unsigned char *)dst++) = (code))
8#define G_RLE_INPUT_CODE(codeP) (*(codeP) = *((unsigned char *)src++))
12static int G_rle_codeLength(
int length)
35static char *rle_length2code(
int length,
char *dst)
92static char *rle_code2length(
char *src,
int *length)
113 *length += 254 * code;
129 *length += 254 * code;
151 head = src + eltLength;
154 headStop = src + nofElts * eltLength;
160 if (*head != *tail) {
161 length += G_rle_codeLength(
nofEqual) + eltLength;
177 length += G_rle_codeLength(
nofEqual) + eltLength;
179 return length + G_rle_codeLength(-1);
193 head = src + eltLength;
196 headStop = src + nofElts * eltLength;
202 if (*head != *tail) {
203 dst = rle_length2code(
nofEqual, dst);
205 head = tail + eltLength;
225 dst = rle_length2code(
nofEqual, dst);
227 head = tail + eltLength;
230 dst = rle_length2code(-1, dst);
231 rle_code2length(dst - 2, &
nofEqual);
242 srcStop = src + nofElts * eltLength;
246 src = rle_code2length(src, &
nofEqual);
279 if (
scanf(
"%d", &length) != 1)
281 printf(
"length = %d\n", length);
282 printf(
"codeLength %d ", G_rle_codeLength(length));
283 (
void)rle_length2code(length, c);
285 (
void)rle_code2length(c, &length);
286 printf(
"output length %d\n\n", length);
void Rast3d_fatal_error(const char *,...) __attribute__((format(printf
void Rast3d_rle_decode(char *src, char *dst, int nofElts, int eltLength, int *lengthEncode, int *lengthDecode)
#define G_RLE_INPUT_CODE(codeP)
void Rast3d_rle_encode(char *src, char *dst, int nofElts, int eltLength)
int Rast3d_rle_count_only(char *src, int nofElts, int eltLength)
#define G_RLE_OUTPUT_CODE(code)