summaryrefslogtreecommitdiffstats
path: root/apps/recorder
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-06-18 07:15:00 +0200
committerThomas Martitz <kugel@rockbox.org>2014-06-21 00:15:53 +0200
commita1842c04f9cb73210d4cacde61a9e4b115050765 (patch)
treea37af61ef9285b763a42cd33797e2f3d634fbf9f /apps/recorder
parent0250be1d6799db7b5ddc99cb33f31bf9cff01ed2 (diff)
downloadrockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.tar.gz
rockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.tar.bz2
rockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.zip
lcd-24bit: Introduce a 24-bit mid-level LCD driver
With LCD driver all calculation will be performed on RGB888 and the hardware/OS can display from our 24bit framebuffer. It is not yet as performance optimized as the existing drivers but should be good enough.The vast number of small changes is due to the fact that fb_data can be a struct type now, while most of the code expected a scalar type. lcd-as-memframe ASM code does not work with 24bit currently so the with 24bit it enforces the generic C code. All plugins are ported over. Except for rockpaint. It uses so much memory that it wouldnt fit into the 512k plugin buffer anymore (patches welcome). Change-Id: Ibb1964545028ce0d8ff9833ccc3ab66be3ee0754
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/bmp.c17
-rw-r--r--apps/recorder/resize.c12
2 files changed, 21 insertions, 8 deletions
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index a6d6dd71b1..a9cc34b2c6 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -455,7 +455,7 @@ void output_row_8_native(uint32_t row, void * row_in,
*dest++ |= vi_pattern[bright] << shift;
}
#endif /* LCD_PIXELFORMAT */
-#elif LCD_DEPTH == 16
+#elif LCD_DEPTH >= 16
/* iriver h300, colour iPods, X5 */
(void)fb_width;
fb_data *dest = STRIDE_MAIN((fb_data *)ctx->bm->data + fb_width * row,
@@ -470,15 +470,18 @@ void output_row_8_native(uint32_t row, void * row_in,
bm_alpha += ALIGN_UP(ctx->bm->width, 2) * row/2;
for (col = 0; col < ctx->bm->width; col++) {
+ (void) delta;
if (ctx->dither)
delta = DITHERXDY(col,dy);
r = qp->red;
g = qp->green;
b = qp->blue;
+#if LCD_DEPTH < 24
r = (31 * r + (r >> 3) + delta) >> 8;
g = (63 * g + (g >> 2) + delta) >> 8;
b = (31 * b + (b >> 3) + delta) >> 8;
- *dest = LCD_RGBPACK_LCD(r, g, b);
+#endif
+ *dest = FB_RGBPACK_LCD(r, g, b);
dest += STRIDE_MAIN(1, ctx->bm->height);
if (bm_alpha) {
/* pack alpha channel for 2 pixels into 1 byte and negate
@@ -526,8 +529,8 @@ int read_bmp_fd(int fd,
bool dither = false;
#endif
-#ifdef HAVE_REMOTE_LCD
bool remote = false;
+#ifdef HAVE_REMOTE_LCD
if (format & FORMAT_REMOTE) {
remote = true;
#if LCD_REMOTE_DEPTH == 1
@@ -710,9 +713,7 @@ int read_bmp_fd(int fd,
case 16:
#if LCD_DEPTH >= 16
/* don't dither 16 bit BMP to LCD with same or larger depth */
-#ifdef HAVE_REMOTE_LCD
if (!remote)
-#endif
dither = false;
#endif
if (compression == 0) { /* BI_RGB, i.e. 15 bit */
@@ -755,6 +756,12 @@ int read_bmp_fd(int fd,
break;
}
+#if LCD_DEPTH >= 24
+ /* Never dither 24/32 bit BMP to 24 bit LCDs */
+ if (depth >= 24 && !remote)
+ dither = false;
+#endif
+
/* Search to the beginning of the image data */
lseek(fd, (off_t)letoh32(bmph.off_bits), SEEK_SET);
diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c
index 32384537d4..ac6b7a3120 100644
--- a/apps/recorder/resize.c
+++ b/apps/recorder/resize.c
@@ -680,6 +680,7 @@ static void output_row_32_native_fromyuv(uint32_t row, void * row_in,
unsigned r, g, b, y, u, v;
for (col = 0; col < ctx->bm->width; col++) {
+ (void) delta;
if (ctx->dither)
delta = DITHERXDY(col,dy);
y = SC_OUT(qp->b, ctx);
@@ -687,10 +688,12 @@ static void output_row_32_native_fromyuv(uint32_t row, void * row_in,
v = SC_OUT(qp->r, ctx);
qp++;
yuv_to_rgb(y, u, v, &r, &g, &b);
+#if LCD_DEPTH < 24
r = (31 * r + (r >> 3) + delta) >> 8;
g = (63 * g + (g >> 2) + delta) >> 8;
b = (31 * b + (b >> 3) + delta) >> 8;
- *dest = LCD_RGBPACK_LCD(r, g, b);
+#endif
+ *dest = FB_RGBPACK_LCD(r, g, b);
dest += DEST_STEP;
}
}
@@ -764,7 +767,7 @@ static void output_row_32_native(uint32_t row, void * row_in,
*dest++ |= vi_pattern[bright] << shift;
}
#endif /* LCD_PIXELFORMAT */
-#elif LCD_DEPTH == 16
+#elif LCD_DEPTH >= 16
/* iriver h300, colour iPods, X5 */
(void)fb_width;
fb_data *dest = STRIDE_MAIN((fb_data *)ctx->bm->data + fb_width * row,
@@ -780,16 +783,19 @@ static void output_row_32_native(uint32_t row, void * row_in,
bm_alpha += ALIGN_UP(ctx->bm->width, 2)*row/2;
for (col = 0; col < ctx->bm->width; col++) {
+ (void) delta;
if (ctx->dither)
delta = DITHERXDY(col,dy);
q0 = *qp++;
r = SC_OUT(q0.r, ctx);
g = SC_OUT(q0.g, ctx);
b = SC_OUT(q0.b, ctx);
+#if LCD_DEPTH < 24
r = (31 * r + (r >> 3) + delta) >> 8;
g = (63 * g + (g >> 2) + delta) >> 8;
b = (31 * b + (b >> 3) + delta) >> 8;
- *dest = LCD_RGBPACK_LCD(r, g, b);
+#endif
+ *dest = FB_RGBPACK_LCD(r, g, b);
dest += STRIDE_MAIN(1, ctx->bm->height);
if (bm_alpha) {
/* pack alpha channel for 2 pixels into 1 byte */