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;
270 bytestream_put_be16(&q, page_id);
278 for (region_id = 0; region_id < h->
num_rects; region_id++) {
281 bytestream_put_be16(&q, h->
rects[region_id]->
x);
282 bytestream_put_be16(&q, h->
rects[region_id]->
y);
285 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
288 for (clut_id = 0; clut_id < h->
num_rects; clut_id++) {
309 bytestream_put_be16(&q, page_id);
313 *q++ = (0 << 4) | 0xf;
317 *q++ = (1 << (7 - bpp_index)) | (0xf << 1) | 1;
321 a = (x >> 24) & 0xff;
322 r = (x >> 16) & 0xff;
333 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
337 for (region_id = 0; region_id < h->
num_rects; region_id++) {
353 bytestream_put_be16(&q, page_id);
358 bytestream_put_be16(&q, h->
rects[region_id]->
w);
359 bytestream_put_be16(&q, h->
rects[region_id]->
h);
360 *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
365 bytestream_put_be16(&q, region_id);
366 *q++ = (0 << 6) | (0 << 4);
371 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
376 for (object_id = 0; object_id < h->
num_rects; object_id++) {
378 const uint8_t *bitmap,
int linesize,
398 bytestream_put_be16(&q, page_id);
402 bytestream_put_be16(&q, object_id);
407 uint8_t *ptop_field_len, *pbottom_field_len, *top_ptr, *bottom_ptr;
411 pbottom_field_len = q;
420 h->
rects[object_id]->
h >> 1);
422 bytestream_put_be16(&ptop_field_len, bottom_ptr - top_ptr);
423 bytestream_put_be16(&pbottom_field_len, q - bottom_ptr);
426 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
434 bytestream_put_be16(&q, page_id);
438 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
447 unsigned char *buf,
int buf_size,