summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/jpeg/yuv2rgb.c7
-rw-r--r--apps/plugins/pictureflow.c30
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
51static 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
58static inline int clamp_component_bits(int x, int bits) 51static 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
638static 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
637static unsigned int get_size(struct bitmap *bm) 660static 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
642const struct custom_format format_transposed = { 665const 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