diff options
| author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-05-09 07:31:27 +0000 |
|---|---|---|
| committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-05-09 07:31:27 +0000 |
| commit | 91efc162564cd9c04677e2e38550cde21995b06e (patch) | |
| tree | c927cefc7f12a49396541dbac246dc76ca444c71 /apps/plugins | |
| parent | 67695617a13e9f37f17e3718b03046f6d748a9e1 (diff) | |
| download | rockbox-91efc162564cd9c04677e2e38550cde21995b06e.zip rockbox-91efc162564cd9c04677e2e38550cde21995b06e.tar.gz rockbox-91efc162564cd9c04677e2e38550cde21995b06e.tar.bz2 rockbox-91efc162564cd9c04677e2e38550cde21995b06e.tar.xz | |
Split 8-bit-to-native conversion in bmp.c into a function, add support for plugging unscaled output in BMP and JPEG loaders, use output_row_8_native in JPEG decoder when possible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20884 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/bench_mem_jpeg.c | 5 | ||||
| -rw-r--r-- | apps/plugins/lib/grey_draw.c | 13 | ||||
| -rw-r--r-- | apps/plugins/lib/pluginlib_bmp.c | 7 | ||||
| -rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 35 |
4 files changed, 43 insertions, 17 deletions
diff --git a/apps/plugins/bench_mem_jpeg.c b/apps/plugins/bench_mem_jpeg.c index 958e520..cd7dea3 100644 --- a/apps/plugins/bench_mem_jpeg.c +++ b/apps/plugins/bench_mem_jpeg.c @@ -42,13 +42,14 @@ static void output_row_null(uint32_t row, void * row_in, } const struct custom_format format_null = { + .output_row_8 = output_row_null, #ifdef HAVE_LCD_COLOR - .output_row = { + .output_row_32 = { output_row_null, output_row_null }, #else - .output_row = output_row_null, + .output_row_32 = output_row_null, #endif .get_size = get_size_null }; diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c index 65f2211..6315ad9 100644 --- a/apps/plugins/lib/grey_draw.c +++ b/apps/plugins/lib/grey_draw.c @@ -719,7 +719,15 @@ void grey_ub_gray_bitmap(const unsigned char *src, int x, int y, int width, grey_ub_gray_bitmap_part(src, 0, 0, width, x, y, width, height); } -static void output_row_grey(uint32_t row, void * row_in, struct scaler_context *ctx) +static void output_row_grey_8(uint32_t row, void * row_in, + struct scaler_context *ctx) +{ + uint8_t *dest = (uint8_t*)ctx->bm->data + ctx->bm->width * row; + rb->memcpy(dest, row_in, ctx->bm->width); +} + +static void output_row_grey_32(uint32_t row, void * row_in, + struct scaler_context *ctx) { int col; uint32_t *qp = (uint32_t*)row_in; @@ -734,6 +742,7 @@ static unsigned int get_size_grey(struct bitmap *bm) } const struct custom_format format_grey = { - .output_row = output_row_grey, + .output_row_8 = output_row_grey_8, + .output_row_32 = output_row_grey_32, .get_size = get_size_grey }; diff --git a/apps/plugins/lib/pluginlib_bmp.c b/apps/plugins/lib/pluginlib_bmp.c index 110e534..6b1a542 100644 --- a/apps/plugins/lib/pluginlib_bmp.c +++ b/apps/plugins/lib/pluginlib_bmp.c @@ -124,14 +124,7 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst) #endif /* LCD_DEPTH > 1 */ -#ifndef HAVE_BMP_SCALING #include "wrappers.h" /* import the core bmp loader */ #include "recorder/bmp.c" -#else -/* the full 16x16 Bayer dither matrix may be calculated quickly with this table -*/ -const unsigned char dither_table[16] = - { 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 }; -#endif diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 82dc974..6dd034c 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -607,7 +607,29 @@ static inline uint32_t div255(uint32_t val) #define SCALE_VAL(val,out) div255((val) * (out) + 127) -static void output_row_transposed(uint32_t row, void * row_in, +static void output_row_8_transposed(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; +#ifdef USEGSLIB + uint8_t *qp = (uint8_t*)row_in; + for (; dest < end; dest += ctx->bm->height) + *dest = *qp++; +#else + struct uint8_rgb *qp = (struct uint8_rgb*)row_in; + unsigned r, g, b; + for (; dest < end; dest += ctx->bm->height) + { + r = qp->red; + g = qp->green; + b = (qp++)->blue; + *dest = LCD_RGBPACK_LCD(r,g,b); + } +#endif +} + +static void output_row_32_transposed(uint32_t row, void * row_in, struct scaler_context *ctx) { pix_t *dest = (pix_t*)ctx->bm->data + row; @@ -635,7 +657,7 @@ static void output_row_transposed(uint32_t row, void * row_in, } #ifdef HAVE_LCD_COLOR -static void output_row_transposed_fromyuv(uint32_t row, void * row_in, +static void output_row_32_transposed_fromyuv(uint32_t row, void * row_in, struct scaler_context *ctx) { pix_t *dest = (pix_t*)ctx->bm->data + row; @@ -663,13 +685,14 @@ static unsigned int get_size(struct bitmap *bm) } const struct custom_format format_transposed = { + .output_row_8 = output_row_8_transposed, #ifdef HAVE_LCD_COLOR - .output_row = { - output_row_transposed, - output_row_transposed_fromyuv + .output_row_32 = { + output_row_32_transposed, + output_row_32_transposed_fromyuv }, #else - .output_row = output_row_transposed, + .output_row_32 = output_row_32_transposed, #endif .get_size = get_size }; |