summaryrefslogtreecommitdiff
path: root/apps/plugins/pictureflow.c
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-05-06 04:53:56 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-05-06 04:53:56 +0000
commiteef7945a970e4da69b95c638a44a8ee1a9205430 (patch)
treeec015938370aaa6e84d3652f914c1766a963582d /apps/plugins/pictureflow.c
parentf779160de53686e45f57fad882a6d8f8db6360fd (diff)
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/pictureflow.c')
-rw-r--r--apps/plugins/pictureflow.c30
1 files changed, 30 insertions, 0 deletions
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,
#endif
}
+#ifdef HAVE_LCD_COLOR
+static void output_row_transposed_fromyuv(uint32_t row, void * row_in,
+ struct scaler_context *ctx)
+{
+ pix_t *dest = (pix_t*)ctx->bm->data + row;
+ pix_t *end = dest + ctx->bm->height * ctx->bm->width;
+ struct uint32_rgb *qp = (struct uint32_rgb*)row_in;
+ for (; dest < end; dest += ctx->bm->height)
+ {
+ unsigned r, g, b, y, u, v;
+ y = SC_MUL(qp->b + ctx->round, ctx->divisor);
+ u = SC_MUL(qp->g + ctx->round, ctx->divisor);
+ v = SC_MUL(qp->r + ctx->round, ctx->divisor);
+ qp++;
+ yuv_to_rgb(y, u, v, &r, &g, &b);
+ r = (31 * r + (r >> 3) + 127) >> 8;
+ g = (63 * g + (g >> 2) + 127) >> 8;
+ b = (31 * b + (b >> 3) + 127) >> 8;
+ *dest = LCD_RGBPACK_LCD(r, g, b);
+ }
+}
+#endif
+
static unsigned int get_size(struct bitmap *bm)
{
return bm->width * bm->height * sizeof(pix_t);
}
const struct custom_format format_transposed = {
+#ifdef HAVE_LCD_COLOR
+ .output_row = {
+ output_row_transposed,
+ output_row_transposed_fromyuv
+ },
+#else
.output_row = output_row_transposed,
+#endif
.get_size = get_size
};