summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/rle.c30
-rw-r--r--tools/rle.h23
2 files changed, 28 insertions, 25 deletions
diff --git a/tools/rle.c b/tools/rle.c
index 0cee6603..2425630b 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.2 2009-02-16 16:11:51 phintuka Exp $
+ * $Id: rle.c,v 1.3 2009-02-16 16:14:58 phintuka Exp $
*
*/
@@ -23,7 +23,7 @@
* rle_compress()
*
*/
-int rle_compress(xine_rle_elem_t **rle_data, const uint8_t *data, int w, int h)
+int rle_compress(xine_rle_elem_t **rle_data, const uint8_t *data, uint w, uint h)
{
xine_rle_elem_t rle, *rle_p = 0, *rle_base;
int x, y, num_rle = 0, rle_size = 8128;
@@ -68,29 +68,29 @@ int rle_compress(xine_rle_elem_t **rle_data, const uint8_t *data, int w, int h)
* - fast scaling in compressed form without decompression
*/
xine_rle_elem_t *rle_scale_nearest(const xine_rle_elem_t *old_rle, int *rle_elems,
- int w, int h, int new_w, int new_h)
+ uint w, uint h, uint new_w, uint new_h)
{
#define FACTORBASE 0x100
#define FACTOR2PIXEL(f) ((f)>>8)
#define SCALEX(x) FACTOR2PIXEL(factor_x*(x))
#define SCALEY(y) FACTOR2PIXEL(factor_y*(y))
- int old_w = w, old_h = h;
- int old_y = 0, new_y = 0;
- int factor_x = FACTORBASE*new_w/old_w;
- int factor_y = FACTORBASE*new_h/old_h;
- int rle_size = MAX(8128, *rle_elems * new_h/h ); /* guess ... */
- int num_rle = 0;
+ uint old_w = w, old_h = h;
+ uint old_y = 0, new_y = 0;
+ uint factor_x = FACTORBASE*new_w/old_w;
+ uint factor_y = FACTORBASE*new_h/old_h;
+ uint rle_size = MAX(8128, *rle_elems * new_h/h ); /* guess ... */
+ uint num_rle = 0;
xine_rle_elem_t *new_rle = (xine_rle_elem_t*)malloc(sizeof(xine_rle_elem_t)*rle_size);
xine_rle_elem_t *new_rle_start = new_rle;
/* we assume rle elements are breaked at end of line */
while (old_y < old_h) {
- int elems_current_line = 0;
- int old_x = 0, new_x = 0;
+ uint elems_current_line = 0;
+ uint old_x = 0, new_x = 0;
while (old_x < old_w) {
- int new_x_end = SCALEX(old_x + old_rle->len);
+ uint new_x_end = SCALEX(old_x + old_rle->len);
if (new_x_end > new_w) {
new_x_end = new_w;
@@ -109,7 +109,7 @@ xine_rle_elem_t *rle_scale_nearest(const xine_rle_elem_t *old_rle, int *rle_elem
num_rle++;
elems_current_line++;
- if( (num_rle + 1) >= rle_size ) {
+ if ( (num_rle + 1) >= rle_size ) {
rle_size *= 2;
new_rle_start = (xine_rle_elem_t*)realloc( new_rle_start, 4*rle_size);
new_rle = new_rle_start + num_rle;
@@ -131,7 +131,7 @@ xine_rle_elem_t *rle_scale_nearest(const xine_rle_elem_t *old_rle, int *rle_elem
while (dup-- && (new_y+1<new_h)) {
xine_rle_elem_t *prevline;
- int n;
+ uint n;
if ( (num_rle + elems_current_line + 1) >= rle_size ) {
rle_size *= 2;
new_rle_start = (xine_rle_elem_t*)realloc( new_rle_start, 4*rle_size);
@@ -149,7 +149,7 @@ xine_rle_elem_t *rle_scale_nearest(const xine_rle_elem_t *old_rle, int *rle_elem
} else if (factor_y < FACTORBASE) {
/* scale down -- drop next line ? */
- int skip = new_y - SCALEY(old_y);
+ uint skip = new_y - SCALEY(old_y);
if (old_y == old_h-1) {
/* one (old) line left ; don't skip it if new rle is not complete */
if (new_y < new_h)
diff --git a/tools/rle.h b/tools/rle.h
index 09405bbc..d6900e8f 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.1 2008-12-05 16:34:21 phintuka Exp $
+ * $Id: rle.h,v 1.2 2009-02-16 16:14:58 phintuka Exp $
*
*/
@@ -20,16 +20,19 @@ typedef enum {
scale_good_BW = 1, /* linear interpolation, palette re-generation */
} scale_mode_t;
+
struct xine_rle_elem_s;
struct xine_clut_s;
-int rle_compress(struct xine_rle_elem_s **rle_data, const uint8_t *data, int w, int h);
-void rle_uncompress_lut8(const struct xine_rle_elem_s *rle_data,
- uint8_t *data, int w, int h);
-void rle_uncompress_argb(const struct xine_rle_elem_s *rle_data,
- uint8_t *data, int w, int h,
- struct xine_clut_s *palette);
+int rle_compress(struct xine_rle_elem_s **rle_data, const uint8_t *data, uint w, uint h);
+
+void rle_uncompress_lut8(const struct xine_rle_elem_s *rle_data,
+ uint8_t *data, uint w, uint h);
+void rle_uncompress_argb(uint32_t *dst,
+ const struct xine_rle_elem_s *rle_data, uint num_rle,
+ uint w, uint h, uint stride,
+ struct xine_clut_s *palette);
/*
* rle_scale_nearest()
@@ -37,9 +40,9 @@ void rle_uncompress_argb(const struct xine_rle_elem_s *rle_data,
* - Simple nearest-neighbour scaling for RLE-compressed image
* - fast scaling in compressed form without decompression
*/
-struct xine_rle_elem_s *rle_scale_nearest(const struct xine_rle_elem_s *old_rle,
- int *rle_elems,
- int w, int h, int new_w, int new_h);
+struct xine_rle_elem_s *rle_scale_nearest(const struct xine_rle_elem_s *old_rle,
+ int *rle_elems,
+ uint w, uint h, uint new_w, uint new_h);
#if defined __cplusplus