30 #define PUTBITS2(val)\
32 bitbuf |= (val) << bitcnt;\
42 const uint8_t *bitmap,
int linesize,
52 for(y = 0; y < h; y++) {
61 while (x1 < w && bitmap[x1] == color)
64 if (color == 0 && len == 2) {
68 }
else if (len >= 3 && len <= 10) {
74 }
else if (len >= 12 && len <= 27) {
82 }
else if (len >= 29) {
117 #define PUTBITS4(val)\
119 bitbuf |= (val) << bitcnt;\
130 const uint8_t *bitmap,
int linesize,
140 for(y = 0; y < h; y++) {
148 color = bitmap[x1++];
149 while (x1 < w && bitmap[x1] == color)
152 if (color == 0 && len == 2) {
155 }
else if (color == 0 && (len >= 3 && len <= 9)) {
158 }
else if (len >= 4 && len <= 7) {
162 }
else if (len >= 9 && len <= 24) {
167 }
else if (len >= 25) {
200 uint8_t *q, *pseg_len;
201 int page_id, region_id, clut_id, object_id, i, bpp_index, page_state;
217 bytestream_put_be16(&q, page_id);
228 for (region_id = 0; region_id < h->
num_rects; region_id++) {
231 bytestream_put_be16(&q, h->
rects[region_id]->
x);
232 bytestream_put_be16(&q, h->
rects[region_id]->
y);
235 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
238 for (clut_id = 0; clut_id < h->
num_rects; clut_id++) {
254 bytestream_put_be16(&q, page_id);
258 *q++ = (0 << 4) | 0xf;
262 *q++ = (1 << (7 - bpp_index)) | (0xf << 1) | 1;
266 a = (x >> 24) & 0xff;
267 r = (x >> 16) & 0xff;
278 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
282 for (region_id = 0; region_id < h->
num_rects; region_id++) {
298 bytestream_put_be16(&q, page_id);
303 bytestream_put_be16(&q, h->
rects[region_id]->
w);
304 bytestream_put_be16(&q, h->
rects[region_id]->
h);
305 *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
311 bytestream_put_be16(&q, region_id);
312 *q++ = (0 << 6) | (0 << 4);
318 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
323 for (object_id = 0; object_id < h->
num_rects; object_id++) {
338 bytestream_put_be16(&q, page_id);
342 bytestream_put_be16(&q, object_id);
347 uint8_t *ptop_field_len, *pbottom_field_len, *top_ptr, *bottom_ptr;
348 void (*dvb_encode_rle)(uint8_t **pq,
349 const uint8_t *bitmap,
int linesize,
353 pbottom_field_len = q;
367 h->
rects[object_id]->
h >> 1);
369 bytestream_put_be16(&ptop_field_len, bottom_ptr - top_ptr);
370 bytestream_put_be16(&pbottom_field_len, q - bottom_ptr);
373 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
381 bytestream_put_be16(&q, page_id);
385 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
395 unsigned char *buf,
int buf_size,
void *
data)