summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorphintuka <phintuka>2011-01-21 14:43:17 +0000
committerphintuka <phintuka>2011-01-21 14:43:17 +0000
commitb20599cb1602fdd10d769f8d047e70469ec14293 (patch)
tree011bbc404d3a017225c7a6cb3d14b68b71b38f9c /tools
parentafda0d4e8f830ec110c68dc9ee58341b82352af3 (diff)
downloadxineliboutput-b20599cb1602fdd10d769f8d047e70469ec14293.tar.gz
xineliboutput-b20599cb1602fdd10d769f8d047e70469ec14293.tar.bz2
Moved frontend_svr.c:osd_recompress_net() --> rle.c:rle_recompress_net()
Diffstat (limited to 'tools')
-rw-r--r--tools/rle.c33
-rw-r--r--tools/rle.h4
2 files changed, 35 insertions, 2 deletions
diff --git a/tools/rle.c b/tools/rle.c
index 51a4bc2b..71013f55 100644
--- a/tools/rle.c
+++ b/tools/rle.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: rle.c,v 1.6 2011-01-21 14:38:55 phintuka Exp $
+ * $Id: rle.c,v 1.7 2011-01-21 14:43:17 phintuka Exp $
*
*/
@@ -64,6 +64,37 @@ uint rle_compress(xine_rle_elem_t **rle_data, const uint8_t *data, uint w, uint
return num_rle;
}
+uint rle_compress_net(uint8_t **rle_data, uint *elems, const uint8_t *data, uint w, uint h)
+{
+ *elems = rle_compress((xine_rle_elem_t**)rle_data, data, w, h);
+ return rle_recompress_net(*rle_data, *(xine_rle_elem_t **)rle_data, *elems);
+}
+
+/*
+ * rle_recompress_net()
+ *
+ * recompress RLE-compressed OSD using variable sized RLE codewords
+*/
+uint rle_recompress_net(uint8_t *raw, xine_rle_elem_t *data, uint elems)
+{
+ uint8_t *raw0 = raw;
+ uint i;
+
+ for (i = 0; i < elems; i++) {
+ uint16_t len = data[i].len;
+ uint16_t color = data[i].color;
+ if (len >= 0x80) {
+ *(raw++) = (len>>8) | 0x80;
+ *(raw++) = (len & 0xff);
+ } else {
+ *(raw++) = (len & 0x7f);
+ }
+ *(raw++) = color;
+ }
+
+ return (raw - raw0);
+}
+
/*
* rle_scale_nearest()
*
diff --git a/tools/rle.h b/tools/rle.h
index 41a579d2..8ad82ad3 100644
--- a/tools/rle.h
+++ b/tools/rle.h
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: rle.h,v 1.4 2011-01-21 14:38:55 phintuka Exp $
+ * $Id: rle.h,v 1.5 2011-01-21 14:43:17 phintuka Exp $
*
*/
@@ -26,6 +26,8 @@ struct xine_clut_s;
uint rle_compress(struct xine_rle_elem_s **rle_data, const uint8_t *data, uint w, uint h);
+uint rle_compress_net(uint8_t **rle_data, uint *elems, const uint8_t *data, uint w, uint h);
+uint rle_recompress_net(uint8_t *raw, xine_rle_elem_t *data, uint elems);
void rle_uncompress_lut8(const struct xine_rle_elem_s *rle_data,
uint8_t *data, uint w, uint h);