29 #define PUTBITS2(val)\
31 bitbuf |= (val) << bitcnt;\
41 const uint8_t *bitmap,
int linesize,
51 for(y = 0; y < h; y++) {
60 while (x1 < w && bitmap[x1] == color)
63 if (color == 0 && len == 2) {
67 }
else if (len >= 3 && len <= 10) {
73 }
else if (len >= 12 && len <= 27) {
81 }
else if (len >= 29) {
116 #define PUTBITS4(val)\
118 bitbuf |= (val) << bitcnt;\
129 const uint8_t *bitmap,
int linesize,
139 for(y = 0; y < h; y++) {
147 color = bitmap[x1++];
148 while (x1 < w && bitmap[x1] == color)
151 if (color == 0 && len == 2) {
154 }
else if (color == 0 && (len >= 3 && len <= 9)) {
157 }
else if (len >= 4 && len <= 7) {
161 }
else if (len >= 9 && len <= 24) {
166 }
else if (len >= 25) {
197 const uint8_t *bitmap,
int linesize,
205 for (y = 0; y < h; y++) {
211 color = bitmap[x1++];
212 while (x1 < w && bitmap[x1] == color)
215 if (len == 1 && color) {
221 len =
FFMIN(len, 127);
224 }
else if (len > 2) {
226 len =
FFMIN(len, 127);
254 int page_id, region_id, clut_id, object_id, i, bpp_index, page_state;
268 bytestream_put_be16(&q, page_id);
276 for (region_id = 0; region_id < h->
num_rects; region_id++) {
279 bytestream_put_be16(&q, h->
rects[region_id]->
x);
280 bytestream_put_be16(&q, h->
rects[region_id]->
y);
283 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
286 for (clut_id = 0; clut_id < h->
num_rects; clut_id++) {
307 bytestream_put_be16(&q, page_id);
311 *q++ = (0 << 4) | 0xf;
315 *q++ = (1 << (7 - bpp_index)) | (0xf << 1) | 1;
319 a = (x >> 24) & 0xff;
320 r = (x >> 16) & 0xff;
331 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
335 for (region_id = 0; region_id < h->
num_rects; region_id++) {
351 bytestream_put_be16(&q, page_id);
356 bytestream_put_be16(&q, h->
rects[region_id]->
w);
357 bytestream_put_be16(&q, h->
rects[region_id]->
h);
358 *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
363 bytestream_put_be16(&q, region_id);
364 *q++ = (0 << 6) | (0 << 4);
369 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
374 for (object_id = 0; object_id < h->
num_rects; object_id++) {
376 const uint8_t *bitmap,
int linesize,
396 bytestream_put_be16(&q, page_id);
400 bytestream_put_be16(&q, object_id);
405 uint8_t *ptop_field_len, *pbottom_field_len, *top_ptr, *bottom_ptr;
409 pbottom_field_len = q;
418 h->
rects[object_id]->
h >> 1);
420 bytestream_put_be16(&ptop_field_len, bottom_ptr - top_ptr);
421 bytestream_put_be16(&pbottom_field_len, q - bottom_ptr);
424 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
432 bytestream_put_be16(&q, page_id);
436 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
443 unsigned char *
buf,
int buf_size,