summaryrefslogtreecommitdiff
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
parentf779160de53686e45f57fad882a6d8f8db6360fd (diff)
downloadrockbox-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
-rw-r--r--apps/plugin.c30
-rw-r--r--apps/plugin.h45
-rw-r--r--apps/plugins/jpeg/yuv2rgb.c7
-rw-r--r--apps/plugins/pictureflow.c30
-rw-r--r--apps/recorder/bmp.c2
-rw-r--r--apps/recorder/jpeg_common.h51
-rw-r--r--apps/recorder/jpeg_load.c32
-rw-r--r--apps/recorder/resize.c47
-rw-r--r--apps/recorder/resize.h11
9 files changed, 174 insertions, 81 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 2d996a404e..f079e849bd 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -135,11 +135,18 @@ static const struct plugin_api rockbox_api = {
135 lcd_blit_mono, 135 lcd_blit_mono,
136 lcd_blit_grey_phase, 136 lcd_blit_grey_phase,
137#endif /* LCD_DEPTH */ 137#endif /* LCD_DEPTH */
138#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
139 lcd_blit_pal256,
140 lcd_pal256_update_pal,
141#endif
138 lcd_puts_style, 142 lcd_puts_style,
139 lcd_puts_scroll_style, 143 lcd_puts_scroll_style,
140#ifdef HAVE_LCD_INVERT 144#ifdef HAVE_LCD_INVERT
141 lcd_set_invert_display, 145 lcd_set_invert_display,
142#endif /* HAVE_LCD_INVERT */ 146#endif /* HAVE_LCD_INVERT */
147#if defined(HAVE_LCD_MODES)
148 lcd_set_mode,
149#endif
143#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 150#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
144 lcd_activation_set_hook, 151 lcd_activation_set_hook,
145 &button_queue, 152 &button_queue,
@@ -571,6 +578,11 @@ static const struct plugin_api rockbox_api = {
571#endif 578#endif
572#ifdef HAVE_LCD_BITMAP 579#ifdef HAVE_LCD_BITMAP
573 read_bmp_file, 580 read_bmp_file,
581 read_bmp_fd,
582#ifdef HAVE_JPEG
583 read_jpeg_file,
584 read_jpeg_fd,
585#endif
574 screen_dump_set_hook, 586 screen_dump_set_hook,
575#endif 587#endif
576 show_logo, 588 show_logo,
@@ -632,24 +644,6 @@ static const struct plugin_api rockbox_api = {
632 appsversion, 644 appsversion,
633 /* new stuff at the end, sort into place next time 645 /* new stuff at the end, sort into place next time
634 the API gets incompatible */ 646 the API gets incompatible */
635
636#if defined(HAVE_LCD_MODES)
637 lcd_set_mode,
638#endif
639
640#if defined(HAVE_LCD_MODES)
641#if HAVE_LCD_MODES & LCD_MODE_PAL256
642 lcd_blit_pal256,
643 lcd_pal256_update_pal,
644#endif
645#endif
646#ifdef HAVE_LCD_BITMAP
647#ifdef HAVE_JPEG
648 read_jpeg_file,
649 read_jpeg_fd,
650#endif
651 read_bmp_fd,
652#endif
653}; 647};
654 648
655int plugin_load(const char* plugin, const void* parameter) 649int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 72d71b6e93..d017d6394d 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -129,12 +129,12 @@ void* plugin_get_buffer(size_t *buffer_size);
129#define PLUGIN_MAGIC 0x526F634B /* RocK */ 129#define PLUGIN_MAGIC 0x526F634B /* RocK */
130 130
131/* increase this every time the api struct changes */ 131/* increase this every time the api struct changes */
132#define PLUGIN_API_VERSION 149 132#define PLUGIN_API_VERSION 150
133 133
134/* update this to latest version if a change to the api struct breaks 134/* update this to latest version if a change to the api struct breaks
135 backwards compatibility (and please take the opportunity to sort in any 135 backwards compatibility (and please take the opportunity to sort in any
136 new function which are "waiting" at the end of the function table) */ 136 new function which are "waiting" at the end of the function table) */
137#define PLUGIN_MIN_API_VERSION 147 137#define PLUGIN_MIN_API_VERSION 150
138 138
139/* plugin return codes */ 139/* plugin return codes */
140enum plugin_status { 140enum plugin_status {
@@ -220,12 +220,20 @@ struct plugin_api {
220 int bx, int by, int bwidth, int bheight, 220 int bx, int by, int bwidth, int bheight,
221 int stride); 221 int stride);
222#endif /* LCD_DEPTH */ 222#endif /* LCD_DEPTH */
223#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
224 void (*lcd_blit_pal256)(unsigned char *src, int src_x, int src_y, int x, int y,
225 int width, int height);
226 void (*lcd_pal256_update_pal)(fb_data *palette);
227#endif
223 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); 228 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
224 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string, 229 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
225 int style); 230 int style);
226#ifdef HAVE_LCD_INVERT 231#ifdef HAVE_LCD_INVERT
227 void (*lcd_set_invert_display)(bool yesno); 232 void (*lcd_set_invert_display)(bool yesno);
228#endif /* HAVE_LCD_INVERT */ 233#endif /* HAVE_LCD_INVERT */
234#if defined(HAVE_LCD_MODES)
235 void (*lcd_set_mode)(int mode);
236#endif
229 237
230#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 238#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
231 void (*lcd_activation_set_hook)(void (*enable_hook)(void)); 239 void (*lcd_activation_set_hook)(void (*enable_hook)(void));
@@ -723,6 +731,14 @@ struct plugin_api {
723#ifdef HAVE_LCD_BITMAP 731#ifdef HAVE_LCD_BITMAP
724 int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize, 732 int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize,
725 int format, const struct custom_format *cformat); 733 int format, const struct custom_format *cformat);
734 int (*read_bmp_fd)(int fd, struct bitmap *bm, int maxsize,
735 int format, const struct custom_format *cformat);
736#ifdef HAVE_JPEG
737 int (*read_jpeg_file)(const char* filename, struct bitmap *bm, int maxsize,
738 int format, const struct custom_format *cformat);
739 int (*read_jpeg_fd)(int fd, struct bitmap *bm, int maxsize,
740 int format, const struct custom_format *cformat);
741#endif
726 void (*screen_dump_set_hook)(void (*hook)(int fh)); 742 void (*screen_dump_set_hook)(void (*hook)(int fh));
727#endif 743#endif
728 int (*show_logo)(void); 744 int (*show_logo)(void);
@@ -788,32 +804,9 @@ struct plugin_api {
788 void (*semaphore_release)(struct semaphore *s); 804 void (*semaphore_release)(struct semaphore *s);
789#endif 805#endif
790 806
791 const char *appsversion; 807 const char *appsversion;
792 /* new stuff at the end, sort into place next time 808 /* new stuff at the end, sort into place next time
793 the API gets incompatible */ 809 the API gets incompatible */
794
795#if defined(HAVE_LCD_MODES)
796 void (*lcd_set_mode)(int mode);
797#endif
798
799#if defined(HAVE_LCD_MODES)
800#if HAVE_LCD_MODES & LCD_MODE_PAL256
801 void (*lcd_blit_pal256)(unsigned char *src, int src_x, int src_y, int x, int y,
802 int width, int height);
803 void (*lcd_pal256_update_pal)(fb_data *palette);
804#endif
805#endif
806
807#ifdef HAVE_LCD_BITMAP
808#ifdef HAVE_JPEG
809 int (*read_jpeg_file)(const char* filename, struct bitmap *bm, int maxsize,
810 int format, const struct custom_format *cformat);
811 int (*read_jpeg_fd)(int fd, struct bitmap *bm, int maxsize,
812 int format, const struct custom_format *cformat);
813#endif
814 int (*read_bmp_fd)(int fd, struct bitmap *bm, int maxsize,
815 int format, const struct custom_format *cformat);
816#endif
817}; 810};
818 811
819/* plugin header */ 812/* plugin header */
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
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index 403c34d951..f1fc1f83b4 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -603,7 +603,7 @@ int read_bmp_fd(int fd,
603 { 603 {
604 if (resize_on_load(bm, dither, &src_dim, &rset, 604 if (resize_on_load(bm, dither, &src_dim, &rset,
605 bitmap + totalsize, maxsize - totalsize, 605 bitmap + totalsize, maxsize - totalsize,
606 cformat, store_part_bmp, &ba)) 606 cformat, IF_PIX_FMT(0,) store_part_bmp, &ba))
607 return totalsize; 607 return totalsize;
608 else 608 else
609 return 0; 609 return 0;
diff --git a/apps/recorder/jpeg_common.h b/apps/recorder/jpeg_common.h
index 44bf81e435..061cfc8e64 100644
--- a/apps/recorder/jpeg_common.h
+++ b/apps/recorder/jpeg_common.h
@@ -28,6 +28,8 @@
28#ifndef _JPEG_COMMON_H 28#ifndef _JPEG_COMMON_H
29#define _JPEG_COMMON_H 29#define _JPEG_COMMON_H
30 30
31#include "bmp.h"
32
31#define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */ 33#define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */
32#define JPEG_READ_BUF_SIZE 16 34#define JPEG_READ_BUF_SIZE 16
33struct derived_tbl 35struct derived_tbl
@@ -51,6 +53,55 @@ struct derived_tbl
51 53
52#define QUANT_TABLE_LENGTH 64 54#define QUANT_TABLE_LENGTH 64
53 55
56/*
57 * Conversion of full 0-255 range YCrCb to RGB:
58 * |R| |1.000000 -0.000001 1.402000| |Y'|
59 * |G| = |1.000000 -0.334136 -0.714136| |Pb|
60 * |B| |1.000000 1.772000 0.000000| |Pr|
61 * Scaled (yields s15-bit output):
62 * |R| |128 0 179| |Y |
63 * |G| = |128 -43 -91| |Cb - 128|
64 * |B| |128 227 0| |Cr - 128|
65 */
66#define YFAC 128
67#define RVFAC 179
68#define GUFAC (-43)
69#define GVFAC (-91)
70#define BUFAC 227
71#define COMPONENT_SHIFT 15
72
73struct uint8_yuv {
74 uint8_t y;
75 uint8_t u;
76 uint8_t v;
77};
78
79union uint8_rgbyuv {
80 struct uint8_yuv yuv;
81 struct uint8_rgb rgb;
82};
83
84static inline int clamp_component(int x)
85{
86 if ((unsigned)x > 255)
87 x = x < 0 ? 0 : 255;
88 return x;
89}
90#include <debug.h>
91static inline void yuv_to_rgb(int y, int u, int v, unsigned *r, unsigned *g, unsigned *b)
92{
93 int rv, guv, bu;
94 y = y * YFAC + (YFAC >> 1);
95 u = u - 128;
96 v = v - 128;
97 rv = RVFAC * v;
98 guv = GUFAC * u + GVFAC * v;
99 bu = BUFAC * u;
100 *r = clamp_component((y + rv) / YFAC);
101 *g = clamp_component((y + guv) / YFAC);
102 *b = clamp_component((y + bu) / YFAC);
103}
104
54/* for type of Huffman table */ 105/* for type of Huffman table */
55#define DC_LEN 28 106#define DC_LEN 28
56#define AC_LEN 178 107#define AC_LEN 178
diff --git a/apps/recorder/jpeg_load.c b/apps/recorder/jpeg_load.c
index 8b2c3f2fef..14aa024fcf 100644
--- a/apps/recorder/jpeg_load.c
+++ b/apps/recorder/jpeg_load.c
@@ -153,13 +153,6 @@ INLINE unsigned range_limit(int value)
153#endif 153#endif
154} 154}
155 155
156static inline int clamp_component(int x)
157{
158 if ((unsigned)x > 255)
159 x = x < 0 ? 0 : 255;
160 return x;
161}
162
163/* IDCT implementation */ 156/* IDCT implementation */
164 157
165 158
@@ -1810,27 +1803,8 @@ static struct img_part *store_row_jpeg(void *jpeg_args)
1810 unsigned int xp; 1803 unsigned int xp;
1811 int yp; 1804 int yp;
1812 unsigned char *row = out; 1805 unsigned char *row = out;
1813 if (p_jpeg->blocks > 1) { 1806 if (p_jpeg->blocks == 1)
1814 for (yp = 0; yp < height; yp++, row += b_width) 1807 {
1815 {
1816 unsigned char *px = row;
1817 for (xp = 0; xp < 1U << p_jpeg->h_scale[1];
1818 xp++, px += JPEG_PIX_SZ)
1819 {
1820 int y, u, v, rv, guv, bu;
1821 y = px[0] * YFAC + (YFAC >> 1);
1822 u = px[1] - 128;
1823 v = px[2] - 128;
1824 rv = RVFAC * v;
1825 guv = GUFAC * u + GVFAC * v;
1826 bu = BUFAC * u;
1827 struct uint8_rgb *rgb = (struct uint8_rgb *)px;
1828 rgb->red = clamp_component((y + rv) / YFAC);
1829 rgb->green = clamp_component((y + guv) / YFAC);
1830 rgb->blue = clamp_component((y + bu) / YFAC);
1831 }
1832 }
1833 } else {
1834 for (yp = 0; yp < height; yp++, row += b_width) 1808 for (yp = 0; yp < height; yp++, row += b_width)
1835 { 1809 {
1836 unsigned char *px = row; 1810 unsigned char *px = row;
@@ -2003,7 +1977,7 @@ int read_jpeg_fd(int fd,
2003 rset.rowstop = bm->height; 1977 rset.rowstop = bm->height;
2004 rset.rowstep = 1; 1978 rset.rowstep = 1;
2005 if (resize_on_load(bm, dither, &src_dim, &rset, buf_start, maxsize, cformat, 1979 if (resize_on_load(bm, dither, &src_dim, &rset, buf_start, maxsize, cformat,
2006 store_row_jpeg, p_jpeg)) 1980 IF_PIX_FMT(p_jpeg->blocks == 1 ? 0 : 1,) store_row_jpeg, p_jpeg))
2007 return bm_size; 1981 return bm_size;
2008 else 1982 else
2009 return 0; 1983 return 0;
diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c
index 7000c448e6..1852519958 100644
--- a/apps/recorder/resize.c
+++ b/apps/recorder/resize.c
@@ -59,6 +59,7 @@
59#undef DEBUGF 59#undef DEBUGF
60#define DEBUGF(...) 60#define DEBUGF(...)
61#endif 61#endif
62#include <jpeg_load.h>
62 63
63#if CONFIG_CPU == SH7034 64#if CONFIG_CPU == SH7034
64/* 16*16->32 bit multiplication is a single instrcution on the SH1 */ 65/* 16*16->32 bit multiplication is a single instrcution on the SH1 */
@@ -516,6 +517,35 @@ static inline bool scale_v_linear(struct rowset *rset,
516} 517}
517#endif /* HAVE_UPSCALER */ 518#endif /* HAVE_UPSCALER */
518 519
520#if defined(HAVE_LCD_COLOR) && (defined(HAVE_JPEG) || defined(PLUGIN))
521void output_row_native_fromyuv(uint32_t row, void * row_in,
522 struct scaler_context *ctx)
523{
524 int col;
525 int fb_width = BM_WIDTH(ctx->bm->width,FORMAT_NATIVE,0);
526 uint8_t dy = DITHERY(row);
527 struct uint32_rgb *qp = (struct uint32_rgb *)row_in;
528 SDEBUGF("output_row: y: %lu in: %p\n",row, row_in);
529 fb_data *dest = (fb_data *)ctx->bm->data + fb_width * row;
530 int delta = 127;
531 unsigned r, g, b, y, u, v;
532
533 for (col = 0; col < ctx->bm->width; col++) {
534 if (ctx->dither)
535 delta = DITHERXDY(col,dy);
536 y = SC_MUL(qp->b + ctx->round, ctx->divisor);
537 u = SC_MUL(qp->g + ctx->round, ctx->divisor);
538 v = SC_MUL(qp->r + ctx->round, ctx->divisor);
539 qp++;
540 yuv_to_rgb(y, u, v, &r, &g, &b);
541 r = (31 * r + (r >> 3) + delta) >> 8;
542 g = (63 * g + (g >> 2) + delta) >> 8;
543 b = (31 * b + (b >> 3) + delta) >> 8;
544 *dest++ = LCD_RGBPACK_LCD(r, g, b);
545 }
546}
547#endif
548
519#if !defined(PLUGIN) || LCD_DEPTH > 1 549#if !defined(PLUGIN) || LCD_DEPTH > 1
520void output_row_native(uint32_t row, void * row_in, 550void output_row_native(uint32_t row, void * row_in,
521 struct scaler_context *ctx) 551 struct scaler_context *ctx)
@@ -614,7 +644,14 @@ unsigned int get_size_native(struct bitmap *bm)
614} 644}
615 645
616const struct custom_format format_native = { 646const struct custom_format format_native = {
647#if defined(HAVE_LCD_COLOR) && (defined(HAVE_JPEG) || defined(PLUGIN))
648 .output_row = {
649 output_row_native,
650 output_row_native_fromyuv
651 },
652#else
617 .output_row = output_row_native, 653 .output_row = output_row_native,
654#endif
618 .get_size = get_size_native 655 .get_size = get_size_native
619}; 656};
620#endif 657#endif
@@ -622,6 +659,7 @@ const struct custom_format format_native = {
622int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, 659int resize_on_load(struct bitmap *bm, bool dither, struct dim *src,
623 struct rowset *rset, unsigned char *buf, unsigned int len, 660 struct rowset *rset, unsigned char *buf, unsigned int len,
624 const struct custom_format *format, 661 const struct custom_format *format,
662 IF_PIX_FMT(int format_index,)
625 struct img_part* (*store_part)(void *args), 663 struct img_part* (*store_part)(void *args),
626 void *args) 664 void *args)
627{ 665{
@@ -683,10 +721,19 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src,
683 ctx.src = src; 721 ctx.src = src;
684 ctx.dither = dither; 722 ctx.dither = dither;
685#if !defined(PLUGIN) 723#if !defined(PLUGIN)
724#if defined(HAVE_LCD_COLOR) && defined(HAVE_JPEG)
725 ctx.output_row = format_index ? output_row_native_fromyuv
726 : output_row_native;
727#else
686 ctx.output_row = output_row_native; 728 ctx.output_row = output_row_native;
729#endif
687 if (format) 730 if (format)
688#endif 731#endif
732#if defined(HAVE_LCD_COLOR) && (defined(HAVE_JPEG) || defined(PLUGIN))
733 ctx.output_row = format->output_row[format_index];
734#else
689 ctx.output_row = format->output_row; 735 ctx.output_row = format->output_row;
736#endif
690#ifdef HAVE_UPSCALER 737#ifdef HAVE_UPSCALER
691 if (sw > dw) 738 if (sw > dw)
692 { 739 {
diff --git a/apps/recorder/resize.h b/apps/recorder/resize.h
index de9e8a9ab0..f7cda15254 100644
--- a/apps/recorder/resize.h
+++ b/apps/recorder/resize.h
@@ -143,8 +143,18 @@ struct scaler_context {
143 bool (*h_scaler)(void*,struct scaler_context*, bool); 143 bool (*h_scaler)(void*,struct scaler_context*, bool);
144}; 144};
145 145
146#if defined(HAVE_LCD_COLOR) && (defined(HAVE_JPEG) || defined(PLUGIN))
147#define IF_PIX_FMT(...) __VA_ARGS__
148#else
149#define IF_PIX_FMT(...)
150#endif
151
146struct custom_format { 152struct custom_format {
153#if defined(HAVE_LCD_COLOR)
154 void (*output_row[2])(uint32_t,void*,struct scaler_context*);
155#else
147 void (*output_row)(uint32_t,void*,struct scaler_context*); 156 void (*output_row)(uint32_t,void*,struct scaler_context*);
157#endif
148 unsigned int (*get_size)(struct bitmap *bm); 158 unsigned int (*get_size)(struct bitmap *bm);
149}; 159};
150 160
@@ -161,6 +171,7 @@ int resize_on_load(struct bitmap *bm, bool dither,
161 struct dim *src, struct rowset *tmp_row, 171 struct dim *src, struct rowset *tmp_row,
162 unsigned char *buf, unsigned int len, 172 unsigned char *buf, unsigned int len,
163 const struct custom_format *cformat, 173 const struct custom_format *cformat,
174 IF_PIX_FMT(int format_index,)
164 struct img_part* (*store_part)(void *args), 175 struct img_part* (*store_part)(void *args),
165 void *args); 176 void *args);
166 177