diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-05-06 04:53:56 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-05-06 04:53:56 +0000 |
commit | eef7945a970e4da69b95c638a44a8ee1a9205430 (patch) | |
tree | ec015938370aaa6e84d3652f914c1766a963582d /apps/plugins | |
parent | f779160de53686e45f57fad882a6d8f8db6360fd (diff) | |
download | rockbox-eef7945a970e4da69b95c638a44a8ee1a9205430.tar.gz rockbox-eef7945a970e4da69b95c638a44a8ee1a9205430.zip |
Move YUV->RGB in JPEG load from before scaler to after scaler. Required change to struct custom_format, so sorted the plugin API as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20856 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/jpeg/yuv2rgb.c | 7 | ||||
-rw-r--r-- | apps/plugins/pictureflow.c | 30 |
2 files changed, 30 insertions, 7 deletions
diff --git a/apps/plugins/jpeg/yuv2rgb.c b/apps/plugins/jpeg/yuv2rgb.c index c2464924fe..ed88d5416a 100644 --- a/apps/plugins/jpeg/yuv2rgb.c +++ b/apps/plugins/jpeg/yuv2rgb.c | |||
@@ -48,13 +48,6 @@ | |||
48 | #define COMPONENT_SHIFT 15 | 48 | #define COMPONENT_SHIFT 15 |
49 | #define MATRIX_SHIFT 7 | 49 | #define MATRIX_SHIFT 7 |
50 | 50 | ||
51 | static inline int clamp_component(int x) | ||
52 | { | ||
53 | if ((unsigned)x > YUV_WHITE) | ||
54 | x = x < 0 ? 0 : YUV_WHITE; | ||
55 | return x; | ||
56 | } | ||
57 | |||
58 | static inline int clamp_component_bits(int x, int bits) | 51 | static inline int clamp_component_bits(int x, int bits) |
59 | { | 52 | { |
60 | if ((unsigned)x > (1u << bits) - 1) | 53 | if ((unsigned)x > (1u << bits) - 1) |
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index b78b953f13..7261d7a402 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c | |||
@@ -634,13 +634,43 @@ static void output_row_transposed(uint32_t row, void * row_in, | |||
634 | #endif | 634 | #endif |
635 | } | 635 | } |
636 | 636 | ||
637 | #ifdef HAVE_LCD_COLOR | ||
638 | static void output_row_transposed_fromyuv(uint32_t row, void * row_in, | ||
639 | struct scaler_context *ctx) | ||
640 | { | ||
641 | pix_t *dest = (pix_t*)ctx->bm->data + row; | ||
642 | pix_t *end = dest + ctx->bm->height * ctx->bm->width; | ||
643 | struct uint32_rgb *qp = (struct uint32_rgb*)row_in; | ||
644 | for (; dest < end; dest += ctx->bm->height) | ||
645 | { | ||
646 | unsigned r, g, b, y, u, v; | ||
647 | y = SC_MUL(qp->b + ctx->round, ctx->divisor); | ||
648 | u = SC_MUL(qp->g + ctx->round, ctx->divisor); | ||
649 | v = SC_MUL(qp->r + ctx->round, ctx->divisor); | ||
650 | qp++; | ||
651 | yuv_to_rgb(y, u, v, &r, &g, &b); | ||
652 | r = (31 * r + (r >> 3) + 127) >> 8; | ||
653 | g = (63 * g + (g >> 2) + 127) >> 8; | ||
654 | b = (31 * b + (b >> 3) + 127) >> 8; | ||
655 | *dest = LCD_RGBPACK_LCD(r, g, b); | ||
656 | } | ||
657 | } | ||
658 | #endif | ||
659 | |||
637 | static unsigned int get_size(struct bitmap *bm) | 660 | static unsigned int get_size(struct bitmap *bm) |
638 | { | 661 | { |
639 | return bm->width * bm->height * sizeof(pix_t); | 662 | return bm->width * bm->height * sizeof(pix_t); |
640 | } | 663 | } |
641 | 664 | ||
642 | const struct custom_format format_transposed = { | 665 | const struct custom_format format_transposed = { |
666 | #ifdef HAVE_LCD_COLOR | ||
667 | .output_row = { | ||
668 | output_row_transposed, | ||
669 | output_row_transposed_fromyuv | ||
670 | }, | ||
671 | #else | ||
643 | .output_row = output_row_transposed, | 672 | .output_row = output_row_transposed, |
673 | #endif | ||
644 | .get_size = get_size | 674 | .get_size = get_size |
645 | }; | 675 | }; |
646 | 676 | ||