diff options
Diffstat (limited to 'apps/plugins/pictureflow/pictureflow.c')
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index c67825453b..2bf8c20802 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c | |||
@@ -228,7 +228,7 @@ typedef fb_data pix_t; | |||
228 | #define ERROR_BUFFER_FULL -2 | 228 | #define ERROR_BUFFER_FULL -2 |
229 | 229 | ||
230 | /* current version for cover cache */ | 230 | /* current version for cover cache */ |
231 | #define CACHE_VERSION 2 | 231 | #define CACHE_VERSION 3 |
232 | #define CONFIG_VERSION 1 | 232 | #define CONFIG_VERSION 1 |
233 | #define CONFIG_FILE "pictureflow.cfg" | 233 | #define CONFIG_FILE "pictureflow.cfg" |
234 | 234 | ||
@@ -603,6 +603,18 @@ static inline uint32_t div255(uint32_t val) | |||
603 | } | 603 | } |
604 | 604 | ||
605 | #define SCALE_VAL(val,out) div255((val) * (out) + 127) | 605 | #define SCALE_VAL(val,out) div255((val) * (out) + 127) |
606 | #define SCALE_VAL32(val, out) \ | ||
607 | ({ \ | ||
608 | uint32_t val__ = (val) * (out); \ | ||
609 | val__ = ((((val__ >> 8) + val__) >> 8) + val__ + 128) >> 8; \ | ||
610 | val__; \ | ||
611 | }) | ||
612 | #define SCALE_VAL8(val, out) \ | ||
613 | ({ \ | ||
614 | unsigned val__ = (val) * (out); \ | ||
615 | val__ = ((val__ >> 8) + val__ + 128) >> 8; \ | ||
616 | val__; \ | ||
617 | }) | ||
606 | 618 | ||
607 | static void output_row_8_transposed(uint32_t row, void * row_in, | 619 | static void output_row_8_transposed(uint32_t row, void * row_in, |
608 | struct scaler_context *ctx) | 620 | struct scaler_context *ctx) |
@@ -618,9 +630,9 @@ static void output_row_8_transposed(uint32_t row, void * row_in, | |||
618 | unsigned r, g, b; | 630 | unsigned r, g, b; |
619 | for (; dest < end; dest += ctx->bm->height) | 631 | for (; dest < end; dest += ctx->bm->height) |
620 | { | 632 | { |
621 | r = qp->red; | 633 | r = SCALE_VAL8(qp->red, 31); |
622 | g = qp->green; | 634 | g = SCALE_VAL8(qp->green, 63); |
623 | b = (qp++)->blue; | 635 | b = SCALE_VAL8((qp++)->blue, 31); |
624 | *dest = LCD_RGBPACK_LCD(r,g,b); | 636 | *dest = LCD_RGBPACK_LCD(r,g,b); |
625 | } | 637 | } |
626 | #endif | 638 | #endif |
@@ -637,10 +649,10 @@ static void output_row_32_transposed(uint32_t row, void * row_in, | |||
637 | *dest = SC_MUL((*qp++) + ctx->round, ctx->divisor); | 649 | *dest = SC_MUL((*qp++) + ctx->round, ctx->divisor); |
638 | #else | 650 | #else |
639 | struct uint32_rgb *qp = (struct uint32_rgb*)row_in; | 651 | struct uint32_rgb *qp = (struct uint32_rgb*)row_in; |
640 | uint32_t rb_mul = SCALE_VAL(ctx->divisor, 31), | 652 | uint32_t rb_mul = SCALE_VAL32(ctx->divisor, 31), |
641 | rb_rnd = SCALE_VAL(ctx->round, 31), | 653 | rb_rnd = SCALE_VAL32(ctx->round, 31), |
642 | g_mul = SCALE_VAL(ctx->divisor, 63), | 654 | g_mul = SCALE_VAL32(ctx->divisor, 63), |
643 | g_rnd = SCALE_VAL(ctx->round, 63); | 655 | g_rnd = SCALE_VAL32(ctx->round, 63); |
644 | int r, g, b; | 656 | int r, g, b; |
645 | for (; dest < end; dest += ctx->bm->height) | 657 | for (; dest < end; dest += ctx->bm->height) |
646 | { | 658 | { |