38 for(pos = start + bpp; count <
FFMIN(127, len); pos += bpp, count ++) {
39 if(same != !memcmp(pos-bpp, pos, bpp)) {
43 if(bpp == 1 && count + 1 <
FFMIN(127, len) && *pos != *(pos+1))
57 int ff_rle_encode(uint8_t *outbuf,
int out_size,
const uint8_t *ptr ,
int bpp,
int w,
58 int add_rep,
int xor_rep,
int add_raw,
int xor_raw)
61 uint8_t *out = outbuf;
63 for(x = 0; x < w; x += count) {
66 if(out + bpp + 1 > outbuf + out_size)
return -1;
67 *out++ = (count ^ xor_rep) + add_rep;
68 memcpy(out, ptr, bpp);
73 if(out + bpp*count >= outbuf + out_size)
return -1;
74 *out++ = (count ^ xor_raw) + add_raw;
76 memcpy(out, ptr, bpp * count);