add PNG support
Subsystems (4)
v3 cover add PNG support
Hi,
v3:
- fix comment
- add introduce image helper
while use the image renderer for multiple image support I found tis was missing
This even simplify png implemtation by not duplication the rendering
v2:
fix comment
fix missing select
drop logo (will be send in a seprated pull)
please pull
The following changes since commit 298d15571da8d1cb71e7fd87cc53cad3b2bf1d12:
i.MX51: unbreak FEC iomux (2012-09-07 10:28:17 +0200)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git tags/png
for you to fetch changes up to 832e83c040dfa41b64ba5307d8f31218ff600934:
png: add picoPNG lib support (2012-09-09 01:56:27 +0800)
----------------------------------------------------------------
Introduce PNG support
This will allow to reduce the binary size and support transparent image png + png8 is 50% less than lzo + bmp (same image)
- rename bmp to splash
- add background support (usefull for transparent image)
- add LodePNG and PicoPNG
PicoPNG only support PNG8 RGBA where LodePNG support most of the PNG (PNG24 & PNG8). PicoPNG is ~5KiB smaller than LodePNG.
Attention the coding style on both PicoPNG and LodePNG are untouched for maintainance purpose.
Use LodePNG version 20120729 from http://lodev.org/lodepng/
Use from http://forge.voodooprojects.org/
which is base on picoPNG C++ wrote by Lode Vandevenne. The same author as LodePNG.
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (11):
bmp: rename it to splash
bmp: split bmp rending in lib/bmp.c introduce image_renderer framework
filetype: add BMP support
splash/bmp: switch to image_renderer
splash: add support to set a background color Introduce graphic utils
graphic_utils: add rgba support
filetype: add PNG support
add PNG support
png: add picoPNG lib support
Documentation/commands.dox | 2 +-
arch/arm/boards/eukrea_cpuimx25/env/bin/init_board | 4 +-
arch/arm/boards/eukrea_cpuimx27/env/bin/init | 4 +-
arch/arm/boards/eukrea_cpuimx35/env/bin/init_board | 4 +-
arch/arm/boards/eukrea_cpuimx51/env/bin/init_board | 4 +-
arch/arm/boards/karo-tx25/env/bin/init_board | 2 +-
arch/arm/boards/mioa701/env/bin/init | 2 +-
arch/arm/configs/chumbyone_defconfig | 2 +-
arch/arm/configs/cupid_defconfig | 2 +-
arch/arm/configs/eukrea_cpuimx25_defconfig | 2 +-
arch/arm/configs/eukrea_cpuimx27_defconfig | 2 +-
arch/arm/configs/eukrea_cpuimx35_defconfig | 2 +-
arch/arm/configs/freescale_mx35_3stack_defconfig | 2 +-
arch/arm/configs/imx28evk_defconfig | 2 +-
arch/arm/configs/mioa701_defconfig | 2 +-
arch/arm/configs/neso_defconfig | 2 +-
arch/arm/configs/pcm027_defconfig | 2 +-
arch/arm/configs/pcm038_defconfig | 2 +-
arch/arm/configs/tx25stk5_defconfig | 2 +-
arch/arm/configs/tx28stk5_defconfig | 2 +-
commands/Kconfig | 5 +-
commands/Makefile | 2 +-
commands/bmp.c | 221 ---
commands/splash.c | 133 ++
common/filetype.c | 5 +
include/filetype.h | 2 +
include/graphic_utils.h | 17 +
include/image_renderer.h | 85 +
lib/Kconfig | 35 +
lib/Makefile | 6 +
lib/bmp.c | 134 ++
{include => lib}/bmp_layout.h | 11 +
lib/graphic_utils.c | 191 +++
lib/image_renderer.c | 96 ++
lib/lodepng.c | 5928 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
lib/lodepng.h | 1640 +++++++++++++++++++
lib/picopng.c | 810 ++++++++++
lib/picopng.h | 34 +
lib/png.c | 89 ++
lib/png.h | 21 +
lib/png_lode.c | 90 ++
lib/png_pico.c | 85 +
42 files changed, 9440 insertions(+), 248 deletions(-)
delete mode 100644 commands/bmp.c
create mode 100644 commands/splash.c
create mode 100644 include/graphic_utils.h
create mode 100644 include/image_renderer.h
create mode 100644 lib/bmp.c
rename {include => lib}/bmp_layout.h (85%)
create mode 100644 lib/graphic_utils.c
create mode 100644 lib/image_renderer.c
create mode 100644 lib/lodepng.c
create mode 100644 lib/lodepng.h
create mode 100644 lib/picopng.c
create mode 100644 lib/picopng.h
create mode 100644 lib/png.c
create mode 100644 lib/png.h
create mode 100644 lib/png_lode.c
create mode 100644 lib/png_pico.cBest Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 2/11 bmp: split bmp rending in lib/bmp.c
In reply to Jean-Christophe PLAGNIOL-VILLARDSo we can add other format support
--- commands/Kconfig | 1 + commands/splash.c | 124 +++++------------------------------------------ include/bmp_layout.h | 11 +++++ lib/Kconfig | 3 ++ lib/Makefile | 1 + lib/bmp.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 159 insertions(+), 113 deletions(-) create mode 100644 lib/bmp.c
commands/Kconfig +1 -0
@@ -538,6 +538,7 @@ config CMD_LSMOD config CMD_SPLASH bool depends on VIDEO + select BMP prompt "splash" help show bmp files on framebuffer devices
commands/splash.c +11 -113
159 lines not on this page · raw message
include/bmp_layout.h +11 -0
@@ -74,4 +74,15 @@ struct bmp_image {#define BMP_BI_RLE8 1#define BMP_BI_RLE4 2 +#ifdef CONFIG_BMP +int bmp_render_file (struct fb_info *info,const char * bmpfile,void * fb, +int startx,int starty,int xres,int yres,void * offscreenbuf); +#else +static inline int bmp_render_file (struct fb_info *info,const char * bmpfile,void * fb, +int startx,int starty,int xres,int yres,void * offscreenbuf) +{ +return -ENOSYS ; +} +#endif +#endif /* _BMP_H_ */
lib/Kconfig +3 -0
@@ -38,4 +38,7 @@ config BITREV config QSORT bool +config BMP + bool + endmenu
lib/Makefile +1 -0
@@ -34,3 +34,4 @@ obj-$(CONFIG_UNCOMPRESS) += uncompress.o obj-$(CONFIG_BCH) += bch.o obj-$(CONFIG_BITREV) += bitrev.o obj-$(CONFIG_QSORT) += qsort.o +obj-$(CONFIG_BMP) += bmp.o
lib/bmp.c new file +132 -0
132 lines not on this page · raw message
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 4/11 filetype: add BMP support
In reply to Jean-Christophe PLAGNIOL-VILLARD--- common/filetype.c | 2 ++ include/filetype.h | 1 + 2 files changed, 3 insertions(+)
common/filetype.c +2 -0
@@ -101,6 +101,8 @@ enum filetype file_detect_type(void *_buf)return filetype_mips_barebox;if (is_fat (buf8))return filetype_fat; +if (strncmp (buf8,"BM" ,2 ) ==0 ) +return filetype_bmp;return filetype_unknown; }
include/filetype.h +1 -0
@@ -19,6 +19,7 @@ enum filetype { filetype_sh, filetype_mips_barebox, filetype_fat, + filetype_bmp, };const char *file_type_to_string (enum filetype f);
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 5/11 splash/bmp: switch to image_renderer
In reply to Jean-Christophe PLAGNIOL-VILLARD---
commands/Kconfig | 1 +
commands/splash.c | 10 ++--
lib/Kconfig | 1 +
lib/bmp.c | 103 +++++++++++++++++++++--------------------
{include => lib}/bmp_layout.h | 0
5 files changed, 59 insertions(+), 56 deletions(-)
rename {include => lib}/bmp_layout.h (100%)commands/Kconfig +1 -0
@@ -538,6 +538,7 @@ config CMD_LSMOD config CMD_SPLASH bool depends on VIDEO + select IMAGE_RENDERER select BMP prompt "splash" help
commands/splash.c +5 -5
@@ -7,7 +7,7 @@#include <getopt.h> #include <fcntl.h> #include <fb.h> -#include <bmp_layout.h> +#include <image_renderer.h> static int do_splash (int argc,char *argv[]) {
@@ -15,7 +15,7 @@ static int do_splash(int argc, char *argv[])char *fbdev ="/dev/fb0" ;void *fb;struct fb_info info; -char *bmpfile; +char *image_file;int startx =-1 , starty =-1 ;int xres, yres;int offscreen =0 ;
@@ -40,7 +40,7 @@ static int do_splash(int argc, char *argv[])printf ("no filename given\n" );return 1 ; } - bmpfile = argv[optind]; + image_file = argv[optind]; fd =open (fbdev,O_RDWR );if (fd <0 ) {
@@ -75,8 +75,8 @@ static int do_splash(int argc, char *argv[])memcpy (offscreenbuf, fb, fbsize); } -if (bmp_render_file (&info, bmpfile, fb, startx, starty, xres, yres, - offscreenbuf) <0 ) +if (image_renderer_file (&info, image_file, fb, startx, starty, + offscreenbuf) <0 ) ret =1 ;if (offscreenbuf)
lib/Kconfig +1 -0
@@ -45,5 +45,6 @@ config IMAGE_RENDERER config BMP bool + depends on IMAGE_RENDERER endmenu
lib/bmp.c +52 -51
150 lines not on this page · raw message
lib/bmp_layout.h renamed from include/bmp_layout.h +0 -0
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 3/11 introduce image_renderer framework
In reply to Jean-Christophe PLAGNIOL-VILLARDThis will allow to support bmp and png
--- include/image_renderer.h | 105 ++++++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig | 5 +++ lib/Makefile | 1 + lib/image_renderer.c | 96 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 207 insertions(+) create mode 100644 include/image_renderer.h create mode 100644 lib/image_renderer.c
include/image_renderer.h new file +105 -0
@@ -0,0 +1,105 @@ +/* +* Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <[email protected]> +* +* GPL v2 +*/ + +#ifndef __IMAGE_RENDER_H__ +#define __IMAGE_RENDER_H__ + +#include <filetype.h> +#include <linux/list.h> +#include <errno.h> +#include <linux/err.h> +#include <fb.h> + +struct image { +void *data; +struct image_renderer *ir; +int height; +int width; +int bits_per_pixel; +}; + +struct image_renderer { +enum filetype type; +struct image *(*open)(char *data,int size); +void (*close)(struct image *img); +int (*renderer)(struct fb_info *info,struct image *img,void * fb, +int startx,int starty,void * offscreenbuf); + +/* +* do not free the data read from the file +* needed by bmp support +*/ +int keep_file_data; + +struct list_head list; +}; + +static inline void set_pixel (struct fb_info *info,void *adr,int r,int g,int b) +{ +u32 px; + + px = (r >> (8 - info->red.length)) << info->red.offset | + (g >> (8 - info->green.length)) << info->green.offset | + (b >> (8 - info->blue.length)) << info->blue.offset; + +switch (info->bits_per_pixel) { +case 8 : +break ; +case 16 : + *(u16 *)adr = px; +break ; +case 32 : + *(u32 *)adr = px; +break ; + } +} + +#ifdef CONFIG_IMAGE_RENDERER +int image_renderer_register (struct image_renderer *ir); +void image_render_unregister (struct image_renderer *ir); + +int image_renderer_image (struct fb_info *info,struct image *img,void * fb, +int startx,int starty,void * offscreenbuf); + +struct image *image_renderer_open (const char * file); +void image_renderer_close (struct image *img); + +#else +static inline int image_renderer_register (struct image_renderer *ir) +{ +return -EINVAL ; +} +static inline void image_renderer_unregister (struct image_renderer *ir) {} + +static inline struct image *image_renderer_open (const char * file) +{ +return ERR_PTR (-EINVAL ); +} + +static inline void image_renderer_close (struct image *img) {} + +int image_renderer_image (struct fb_info *info,struct image *img,void * fb, +int startx,int starty,void * offscreenbuf); +#endif + +static inline int image_renderer_file (struct fb_info *info,const char * file,void * fb, +int startx,int starty,void * offscreenbuf) +{ +struct image * img =image_renderer_open (file); +int ret; + +if (IS_ERR (img)) +return PTR_ERR (img); + + ret =image_renderer_image (info, img, fb, startx, starty, + offscreenbuf); + +image_renderer_close (img); + +return ret; +} + +#endif /* __IMAGE_RENDERER_H__ */
lib/Kconfig +5 -0
@@ -38,6 +38,11 @@ config BITREV config QSORT bool +config IMAGE_RENDERER + bool + depends on VIDEO + select FILETYPE + config BMP bool
lib/Makefile +1 -0
@@ -35,3 +35,4 @@ obj-$(CONFIG_BCH) += bch.o obj-$(CONFIG_BITREV) += bitrev.o obj-$(CONFIG_QSORT) += qsort.o obj-$(CONFIG_BMP) += bmp.o +obj-$(CONFIG_IMAGE_RENDERER) += image_renderer.o
lib/image_renderer.c new file +96 -0
96 lines not on this page · raw message
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 9/11 filetype: add PNG support
In reply to Jean-Christophe PLAGNIOL-VILLARD--- common/filetype.c | 3 +++ include/filetype.h | 1 + 2 files changed, 4 insertions(+)
common/filetype.c +3 -0
@@ -71,6 +71,7 @@ static int is_fat(u8 *buf)enum filetype file_detect_type (void *_buf) {u32 *buf = _buf; +u64 *buf64 = _buf;u8 *buf8 = _buf;if (strncmp (buf8,"#!/bin/sh" ,9 ) ==0 )
@@ -103,6 +104,8 @@ enum filetype file_detect_type(void *_buf)return filetype_fat;if (strncmp (buf8,"BM" ,2 ) ==0 )return filetype_bmp; +if (buf64[0 ] ==le64_to_cpu (0x0a1a0a0d474e5089ull )) +return filetype_png;return filetype_unknown; }
include/filetype.h +1 -0
@@ -20,6 +20,7 @@ enum filetype { filetype_mips_barebox, filetype_fat, filetype_bmp, + filetype_png, };const char *file_type_to_string (enum filetype f);
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 6/11 splash: add support to set a background color
In reply to Jean-Christophe PLAGNIOL-VILLARDThis will allow to reset the screen to a default color when using transparent PNG.
--- commands/splash.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 3 deletions(-)
commands/splash.c +76 -3
@@ -9,6 +9,66 @@#include <fb.h> #include <image_renderer.h> +static u32 get_pixel (struct fb_info *info,u32 color) +{ +u32 px; +u8 t = (color >>24 ) &0xff ; +u8 r = (color >>16 ) &0xff ; +u8 g = (color >>8 ) &0xff ; +u8 b = (color >>0 ) &0xff ; + +if (info->grayscale) { + px = (r | g | b) ?0xffffffff :0x0 ; +return px; + } + + px = (t >> (8 - info->transp.length)) << info->transp.offset | + (r >> (8 - info->red.length)) << info->red.offset | + (g >> (8 - info->green.length)) << info->green.offset | + (b >> (8 - info->blue.length)) << info->blue.offset; + +return px; +} + +static void memsetw (void *s,u16 c,size_t n) +{ +size_t i; +u16 * tmp = s; + +for (i =0 ; i < n; i++) + *tmp++ = c; +} + +static void memsetl (void *s,u32 c,size_t n) +{ +size_t i; +u32 * tmp = s; + +for (i =0 ; i < n; i++) + *tmp++ = c; +} + +static void memset_pixel (struct fb_info *info,void * buf,u32 color,size_t size) +{ +u32 px; +u8 *screen = buf; + + px =get_pixel (info, color); + +switch (info->bits_per_pixel) { +case 8 : +memset (screen, (uint8_t )px, size); +break ; +case 16 : +memsetw (screen, (uint16_t )px, size); +break ; +case 32 : +case 24 : +memsetl (screen, px, size); +break ; + } +} +static int do_splash (int argc,char *argv[]) {int ret, opt, fd;
@@ -19,13 +79,19 @@ static int do_splash(int argc, char *argv[])int startx =-1 , starty =-1 ;int xres, yres;int offscreen =0 ; +u32 bg_color =0x00000000 ; +bool do_bg = false;void *offscreenbuf =NULL ; -while ((opt =getopt (argc, argv,"f:x:y:o" )) >0 ) { +while ((opt =getopt (argc, argv,"f:x:y:ob:" )) >0 ) {switch (opt) {case 'f' : fbdev = optarg;break ; +case 'b' : + bg_color =simple_strtoul (optarg,NULL ,0 ); + do_bg = true; +break ;case 'x' : startx =simple_strtoul (optarg,NULL ,0 );break ;
@@ -71,8 +137,14 @@ static int do_splash(int argc, char *argv[]) fbsize = xres * yres * (info.bits_per_pixel >>3 ); offscreenbuf =malloc (fbsize); -if (offscreenbuf) -memcpy (offscreenbuf, fb, fbsize); +if (offscreenbuf) { +if (do_bg) +memset_pixel (&info, offscreenbuf, bg_color, xres * yres); +else +memcpy (offscreenbuf, fb, fbsize); + } + }else if (do_bg) { +memset_pixel (&info, fb, bg_color, xres * yres); } if (image_renderer_file(&info, image_file, fb, startx, starty,
@@ -98,6 +170,7 @@ BAREBOX_CMD_HELP_SHORT("Show the bitmap FILE on the framebuffer.\n") BAREBOX_CMD_HELP_OPT ("-f <fb>", "framebuffer device (/dev/fb0)\n") BAREBOX_CMD_HELP_OPT ("-x <xofs>", "x offset (default center)\n") BAREBOX_CMD_HELP_OPT ("-y <yofs>", "y offset (default center)\n") +BAREBOX_CMD_HELP_OPT ("-b <backgroung>", "backgroung color\n") BAREBOX_CMD_HELP_OPT ("-o", "render offscreen\n")BAREBOX_CMD_HELP_END
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 8/11 graphic_utils: add rgba support
In reply to Jean-Christophe PLAGNIOL-VILLARDthis will allow to render rgba image with or without hw support
--- include/graphic_utils.h | 4 ++ lib/graphic_utils.c | 116 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 116 insertions(+), 4 deletions(-)
include/graphic_utils.h +4 -0
@@ -7,7 +7,11 @@#ifndef __GRAPHIC_UTILS_H__#define __GRAPHIC_UTILS_H__ +void rgba_blend (struct fb_info *info,void *image,void * dest,int height, +int width,int startx,int starty,bool is_rgba); +void set_pixel (struct fb_info *info,void *adr,u32 px);void set_rgb_pixel (struct fb_info *info,void *adr,int r,int g,int b); +void set_rgba_pixel (struct fb_info *info,void *adr,int r,int g,int b,int a);void memset_pixel (struct fb_info *info,void * buf,u32 color,size_t size);#endif /* __GRAPHIC_UTILS_H__ */
lib/graphic_utils.c +112 -4
129 lines not on this page · raw message
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 1/11 bmp: rename it to splash
In reply to Jean-Christophe PLAGNIOL-VILLARDso be can add more format support
---
Documentation/commands.dox | 2 +-
arch/arm/boards/eukrea_cpuimx25/env/bin/init_board | 4 ++--
arch/arm/boards/eukrea_cpuimx27/env/bin/init | 4 ++--
arch/arm/boards/eukrea_cpuimx35/env/bin/init_board | 4 ++--
arch/arm/boards/eukrea_cpuimx51/env/bin/init_board | 4 ++--
arch/arm/boards/karo-tx25/env/bin/init_board | 2 +-
arch/arm/boards/mioa701/env/bin/init | 2 +-
arch/arm/configs/chumbyone_defconfig | 2 +-
arch/arm/configs/cupid_defconfig | 2 +-
arch/arm/configs/eukrea_cpuimx25_defconfig | 2 +-
arch/arm/configs/eukrea_cpuimx27_defconfig | 2 +-
arch/arm/configs/eukrea_cpuimx35_defconfig | 2 +-
arch/arm/configs/freescale_mx35_3stack_defconfig | 2 +-
arch/arm/configs/imx28evk_defconfig | 2 +-
arch/arm/configs/mioa701_defconfig | 2 +-
arch/arm/configs/neso_defconfig | 2 +-
arch/arm/configs/pcm027_defconfig | 2 +-
arch/arm/configs/pcm038_defconfig | 2 +-
arch/arm/configs/tx25stk5_defconfig | 2 +-
arch/arm/configs/tx28stk5_defconfig | 2 +-
commands/Kconfig | 4 ++--
commands/Makefile | 2 +-
commands/{bmp.c => splash.c} | 12 ++++++------
23 files changed, 33 insertions(+), 33 deletions(-)
rename commands/{bmp.c => splash.c} (95%)Documentation/commands.dox +1 -1
@@ -18,7 +18,6 @@ available in @a Barebox: @li @subpage _name @li @subpage addpart_command @li @subpage alternate -@li @subpage bmp_command @li @subpage bootm_command @li @subpage bootu @li @subpage bootz
@@ -95,6 +94,7 @@ available in @a Barebox: @li @subpage sh @li @subpage sleep @li @subpage source +@li @subpage splash_command @li @subpage test @li @subpage timeout @li @subpage true
arch/arm/boards/eukrea_cpuimx25/env/bin/init_board +2 -2
@@ -1,11 +1,11 @@ #!/bin/sh if [ -f /env/logo.bmp ]; then - bmp /env/logo.bmp + splash /env/logo.bmp fb0.enable=1 elif [ -f /env/logo.bmp.lzo ]; then uncompress /env/logo.bmp.lzo /logo.bmp - bmp /logo.bmp + splash /logo.bmp fb0.enable=1 fi
arch/arm/boards/eukrea_cpuimx27/env/bin/init +2 -2
@@ -17,11 +17,11 @@ if [ -e /dev/nand0 ]; then fi if [ -f /env/logo.bmp ]; then - bmp /env/logo.bmp + splash /env/logo.bmp fb0.enable=1 elif [ -f /env/logo.bmp.lzo ]; then uncompress /env/logo.bmp.lzo /logo.bmp - bmp /logo.bmp + splash /logo.bmp fb0.enable=1 fi
arch/arm/boards/eukrea_cpuimx35/env/bin/init_board +2 -2
@@ -1,12 +1,12 @@ #!/bin/sh if [ -f /env/logo.bmp ]; then - bmp /env/logo.bmp + splash /env/logo.bmp fb0.enable=1 gpio_set_value 1 1 elif [ -f /env/logo.bmp.lzo ]; then uncompress /env/logo.bmp.lzo /logo.bmp - bmp /logo.bmp + splash /logo.bmp fb0.enable=1 gpio_set_value 1 1 fi
arch/arm/boards/eukrea_cpuimx51/env/bin/init_board +2 -2
@@ -1,12 +1,12 @@ #!/bin/sh if [ -f /env/logo.bmp ]; then - bmp /env/logo.bmp + splash /env/logo.bmp fb0.enable=1 gpio_set_value 1 1 elif [ -f /env/logo.bmp.lzo ]; then uncompress /env/logo.bmp.lzo /logo.bmp - bmp /logo.bmp + splash /logo.bmp fb0.enable=1 gpio_set_value 1 1 fi
arch/arm/boards/karo-tx25/env/bin/init_board +1 -1
@@ -1,6 +1,6 @@ if [ -e /dev/fb0 -a -e /env/splash.bmp ]; then - bmp /env/splash.bmp + splash /env/splash.bmp fb0.enable=1 fi
arch/arm/boards/mioa701/env/bin/init +1 -1
@@ -12,7 +12,7 @@ led keyboard 0 sdcard_override fb0.enable=1 -bmp /dev/mtd0.barebox-logo +splash /dev/mtd0.barebox-logo mtd_env_override if [ $? = 0 ]; then
arch/arm/configs/chumbyone_defconfig +1 -1
@@ -30,7 +30,7 @@ CONFIG_CMD_RESET=y CONFIG_CMD_GO=y CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_NET=y CONFIG_NET_DHCP=y
arch/arm/configs/cupid_defconfig +1 -1
@@ -45,7 +45,7 @@ CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_NET=y
arch/arm/configs/eukrea_cpuimx25_defconfig +1 -1
@@ -43,7 +43,7 @@ CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_CMD_I2C=y
arch/arm/configs/eukrea_cpuimx27_defconfig +1 -1
@@ -31,7 +31,7 @@ CONFIG_CMD_RESET=y CONFIG_CMD_GO=y CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_CMD_I2C=y
arch/arm/configs/eukrea_cpuimx35_defconfig +1 -1
@@ -44,7 +44,7 @@ CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_CMD_I2C=y
arch/arm/configs/freescale_mx35_3stack_defconfig +1 -1
@@ -42,7 +42,7 @@ CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_CMD_I2C=y
arch/arm/configs/imx28evk_defconfig +1 -1
@@ -33,7 +33,7 @@ CONFIG_CMD_RESET=y CONFIG_CMD_GO=y CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_NET=y CONFIG_NET_DHCP=y
arch/arm/configs/mioa701_defconfig +1 -1
@@ -38,7 +38,7 @@ CONFIG_CMD_BOOTM_INITRD=y CONFIG_CMD_RESET=y CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_CMD_LED=y
arch/arm/configs/neso_defconfig +1 -1
@@ -45,7 +45,7 @@ CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_NET=y
arch/arm/configs/pcm027_defconfig +1 -1
@@ -43,7 +43,7 @@ CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_NET=y
arch/arm/configs/pcm038_defconfig +1 -1
@@ -49,7 +49,7 @@ CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_NET=y
arch/arm/configs/tx25stk5_defconfig +1 -1
@@ -45,7 +45,7 @@ CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_NET=y
arch/arm/configs/tx28stk5_defconfig +1 -1
@@ -41,7 +41,7 @@ CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y -CONFIG_CMD_BMP=y +CONFIG_CMD_SPLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_UNCOMPRESS=y CONFIG_NET=y
commands/Kconfig +2 -2
@@ -535,10 +535,10 @@ config CMD_LSMOD depends on MODULES prompt "lsmod" -config CMD_BMP +config CMD_SPLASH bool depends on VIDEO - prompt "bmp" + prompt "splash" help show bmp files on framebuffer devices
commands/Makefile +1 -1
@@ -49,7 +49,7 @@ obj-$(CONFIG_CMD_VERSION) += version.o obj-$(CONFIG_CMD_HELP) += help.o obj-$(CONFIG_CMD_LSMOD) += lsmod.o obj-$(CONFIG_CMD_INSMOD) += insmod.o -obj-$(CONFIG_CMD_BMP) += bmp.o +obj-$(CONFIG_CMD_SPLASH) += splash.o obj-$(CONFIG_USB_GADGET_DFU) += dfu.o obj-$(CONFIG_USB_GADGET_SERIAL) += usbserial.o obj-$(CONFIG_CMD_GPIO) += gpio.o
commands/splash.c renamed from commands/bmp.c +6 -6
@@ -30,7 +30,7 @@ static inline void set_pixel(struct fb_info *info, void *adr, int r, int g, int } } -static int do_bmp (int argc,char *argv[]) +static int do_splash (int argc,char *argv[]) {int ret, opt, fd;char *fbdev ="/dev/fb0" ;
@@ -194,8 +194,8 @@ failed_memmap:return 1 ; } -BAREBOX_CMD_HELP_START(bmp) -BAREBOX_CMD_HELP_USAGE("bmp [OPTIONS] FILE\n") +BAREBOX_CMD_HELP_START(splash) +BAREBOX_CMD_HELP_USAGE("splash [OPTIONS] FILE\n") BAREBOX_CMD_HELP_SHORT("Show the bitmap FILE on the framebuffer.\n") BAREBOX_CMD_HELP_OPT ("-f <fb>", "framebuffer device (/dev/fb0)\n")BAREBOX_CMD_HELP_OPT ("-x <xofs>" ,"x offset (default center)\n" )
@@ -214,8 +214,8 @@ color depth.*/ -BAREBOX_CMD_START (bmp) - .cmd = do_bmp, +BAREBOX_CMD_START (splash) + .cmd = do_splash, .usage = "show a bmp image", - BAREBOX_CMD_HELP(cmd_bmp_help) + BAREBOX_CMD_HELP(cmd_splash_help)BAREBOX_CMD_END
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 7/11 Introduce graphic utils
to Factorise pixel rendering
--- commands/splash.c | 61 +--------------------------------- include/graphic_utils.h | 13 ++++++++ include/image_renderer.h | 20 ----------- lib/Makefile | 1 + lib/bmp.c | 5 +-- lib/graphic_utils.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 101 insertions(+), 82 deletions(-) create mode 100644 include/graphic_utils.h create mode 100644 lib/graphic_utils.c
commands/splash.c +1 -60
@@ -8,66 +8,7 @@#include <fcntl.h> #include <fb.h> #include <image_renderer.h> - -static u32 get_pixel (struct fb_info *info,u32 color) -{ -u32 px; -u8 t = (color >>24 ) &0xff ; -u8 r = (color >>16 ) &0xff ; -u8 g = (color >>8 ) &0xff ; -u8 b = (color >>0 ) &0xff ; - -if (info->grayscale) { - px = (r | g | b) ?0xffffffff :0x0 ; -return px; - } - - px = (t >> (8 - info->transp.length)) << info->transp.offset | - (r >> (8 - info->red.length)) << info->red.offset | - (g >> (8 - info->green.length)) << info->green.offset | - (b >> (8 - info->blue.length)) << info->blue.offset; - -return px; -} - -static void memsetw (void *s,u16 c,size_t n) -{ -size_t i; -u16 * tmp = s; - -for (i =0 ; i < n; i++) - *tmp++ = c; -} - -static void memsetl (void *s,u32 c,size_t n) -{ -size_t i; -u32 * tmp = s; - -for (i =0 ; i < n; i++) - *tmp++ = c; -} - -static void memset_pixel (struct fb_info *info,void * buf,u32 color,size_t size) -{ -u32 px; -u8 *screen = buf; - - px =get_pixel (info, color); - -switch (info->bits_per_pixel) { -case 8 : -memset (screen, (uint8_t )px, size); -break ; -case 16 : -memsetw (screen, (uint16_t )px, size); -break ; -case 32 : -case 24 : -memsetl (screen, px, size); -break ; - } -} +#include <graphic_utils.h> static int do_splash (int argc,char *argv[]) {
include/graphic_utils.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <[email protected]> +* +* GPL v2 +*/ + +#ifndef __GRAPHIC_UTILS_H__ +#define __GRAPHIC_UTILS_H__ + +void set_rgb_pixel (struct fb_info *info,void *adr,int r,int g,int b); +void memset_pixel (struct fb_info *info,void * buf,u32 color,size_t size); + +#endif /* __GRAPHIC_UTILS_H__ */
include/image_renderer.h +0 -20
@@ -37,26 +37,6 @@ struct image_renderer {struct list_head list; }; -static inline void set_pixel (struct fb_info *info,void *adr,int r,int g,int b) -{ -u32 px; - - px = (r >> (8 - info->red.length)) << info->red.offset | - (g >> (8 - info->green.length)) << info->green.offset | - (b >> (8 - info->blue.length)) << info->blue.offset; - -switch (info->bits_per_pixel) { -case 8 : -break ; -case 16 : - *(u16 *)adr = px; -break ; -case 32 : - *(u32 *)adr = px; -break ; - } -} -#ifdef CONFIG_IMAGE_RENDERER int image_renderer_register (struct image_renderer *ir);void image_render_unregister (struct image_renderer *ir);
lib/Makefile +1 -0
@@ -35,4 +35,5 @@ obj-$(CONFIG_BCH) += bch.o obj-$(CONFIG_BITREV) += bitrev.o obj-$(CONFIG_QSORT) += qsort.o obj-$(CONFIG_BMP) += bmp.o +obj-$(CONFIG_IMAGE_RENDERER) += image_renderer.o graphic_utils.o obj-$(CONFIG_IMAGE_RENDERER) += image_renderer.o
lib/bmp.c +3 -2
@@ -6,6 +6,7 @@#include <asm/byteorder.h> #include <init.h> #include <image_renderer.h> +#include <graphic_utils.h> struct image *bmp_open (char *inbuf,int insize) {
@@ -81,7 +82,7 @@ static int bmp_renderer(struct fb_info *info, struct image *img, void* fb, pixel = *image; -set_pixel (info, adr, color_table[pixel].red, +set_rgb_pixel (info, adr, color_table[pixel].red, color_table[pixel].green, color_table[pixel].blue); adr += info->bits_per_pixel >>3 ;
@@ -103,7 +104,7 @@ static int bmp_renderer(struct fb_info *info, struct image *img, void* fb, pixel = image; -set_pixel (info, adr, pixel[2 ], pixel[1 ], +set_rgb_pixel (info, adr, pixel[2 ], pixel[1 ], pixel[0 ]); adr += info->bits_per_pixel >>3 ;
lib/graphic_utils.c new file +83 -0
83 lines not on this page · raw message
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 11/11 png: add picoPNG lib support
In reply to Jean-Christophe PLAGNIOL-VILLARDThis is an alternative to LodePNG take from http://forge.voodooprojects.org/
which is base on picoPNG C++ wrote by Lode Vandevenne. The same author as LodePNG.
PicoPNG only support RGBA PNG8
The source code of picopng.c was just adapted to be compliant with C89 and drop the internal ZLIB support. Coding style untouched.
--- lib/Kconfig | 5 + lib/Makefile | 1 + lib/picopng.c | 810 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/picopng.h | 34 +++ lib/png_pico.c | 85 ++++++ 5 files changed, 935 insertions(+) create mode 100644 lib/picopng.c create mode 100644 lib/picopng.h create mode 100644 lib/png_pico.c
lib/Kconfig +5 -0
@@ -62,6 +62,11 @@ config LODEPNG help Mostly PNG support +config PICOPNG + bool "picoPNG" + help + Support only RGBA PNG8 + endchoice endif
lib/Makefile +1 -0
@@ -39,3 +39,4 @@ obj-$(CONFIG_IMAGE_RENDERER) += image_renderer.o graphic_utils.o obj-$(CONFIG_IMAGE_RENDERER) += image_renderer.o obj-$(CONFIG_PNG) += png.o obj-$(CONFIG_LODEPNG) += png_lode.o lodepng.o +obj-$(CONFIG_PICOPNG) += png_pico.o picopng.o
lib/picopng.c new file +810 -0
810 lines not on this page · raw message
lib/picopng.h new file +34 -0
@@ -0,0 +1,34 @@ +#ifndef _PICOPNG_H +#define _PICOPNG_H + +typedef struct { +uint32_t *data; +size_t size; +size_t allocsize; +}vector32_t ; + +typedef struct { +uint8_t *data; +size_t size; +size_t allocsize; +}vector8_t ; + +typedef struct { +uint32_t width, height; +uint32_t colorType, bitDepth; +uint32_t compressionMethod, filterMethod, interlaceMethod; +uint32_t key_r, key_g, key_b; +bool key_defined;// is a transparent color key given? +vector8_t *palette; +vector8_t *image; +}PNG_info_t ; + +PNG_info_t *PNG_decode (const uint8_t *in,uint32_t size); +void png_alloc_free_all (void ); + +unsigned picopng_zlib_decompress (unsigned char * out,size_t outsize, +const unsigned char * in,size_t insize); + +extern int PNG_error; + +#endif
lib/png_pico.c new file +85 -0
85 lines not on this page · raw message
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 10/11 add PNG support
In reply to Jean-Christophe PLAGNIOL-VILLARDuse LodePNG version 20120729 from http://lodev.org/lodepng/
The original coding style is keeped to simplify update.
--- commands/Kconfig | 1 - lib/Kconfig | 25 +- lib/Makefile | 2 + lib/lodepng.c | 5928 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/lodepng.h | 1640 +++++++++++++++ lib/png.c | 89 + lib/png.h | 21 + lib/png_lode.c | 90 + 8 files changed, 7793 insertions(+), 3 deletions(-) create mode 100644 lib/lodepng.c create mode 100644 lib/lodepng.h create mode 100644 lib/png.c create mode 100644 lib/png.h create mode 100644 lib/png_lode.c
commands/Kconfig +0 -1
@@ -539,7 +539,6 @@ config CMD_SPLASH bool depends on VIDEO select IMAGE_RENDERER - select BMP prompt "splash" help show bmp files on framebuffer devices
lib/Kconfig +23 -2
@@ -43,8 +43,29 @@ config IMAGE_RENDERER depends on VIDEO select FILETYPE +if IMAGE_RENDERER + config BMP - bool - depends on IMAGE_RENDERER + bool "bmp" + +config PNG + bool "png" + select ZLIB + +if PNG + +choice + prompt "PNG Lib" + +config LODEPNG + bool "lodePNG" + help + Mostly PNG support + +endchoice + +endif + +endif endmenu
lib/Makefile +2 -0
@@ -37,3 +37,5 @@ obj-$(CONFIG_QSORT) += qsort.o obj-$(CONFIG_BMP) += bmp.o obj-$(CONFIG_IMAGE_RENDERER) += image_renderer.o graphic_utils.o obj-$(CONFIG_IMAGE_RENDERER) += image_renderer.o +obj-$(CONFIG_PNG) += png.o +obj-$(CONFIG_LODEPNG) += png_lode.o lodepng.o
lib/lodepng.c new file +5928 -0
2,957 lines not on this page · raw message
lib/lodepng.h new file +1640 -0
1,640 lines not on this page · raw message
lib/png.c new file +89 -0
89 lines not on this page · raw message
lib/png_lode.c new file +90 -0
90 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Part of the diff is not shown here. View the raw message.
Sascha Hauer
maintainerRe: [PATCH 06/11] splash: add support to set a background color
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 118 lines · Jean-Christophe PLAGNIOL-VILLARD
This will allow to reset the screen to a default color when using transparent PNG.
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- commands/splash.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 3 deletions(-)commands/splash.c +75
-3@@ -9,6 +9,66 @@#include <fb.h> #include <image_renderer.h> +static u32 get_pixel (struct fb_info *info,u32 color) +{ +u32 px; +u8 t = (color >>24 ) &0xff ; +u8 r = (color >>16 ) &0xff ; +u8 g = (color >>8 ) &0xff ; +u8 b = (color >>0 ) &0xff ; + +if (info->grayscale) { + px = (r | g | b) ?0xffffffff :0x0 ; +return px; + } + + px = (t >> (8 - info->transp.length)) << info->transp.offset | + (r >> (8 - info->red.length)) << info->red.offset | + (g >> (8 - info->green.length)) << info->green.offset | + (b >> (8 - info->blue.length)) << info->blue.offset; + +return px; +} + +static void memsetw (void *s,u16 c,size_t n) +{ +size_t i; +u16 * tmp = s; + +for (i =0 ; i < n; i++) + *tmp++ = c; +} + +static void memsetl (void *s,u32 c,size_t n) +{ +size_t i; +u32 * tmp = s; + +for (i =0 ; i < n; i++) + *tmp++ = c; +} + +static void memset_pixel (struct fb_info *info,void * buf,u32 color,size_t size) +{ +u32 px; +u8 *screen = buf; + + px =get_pixel (info, color); + +switch (info->bits_per_pixel) { +case 8 : +memset (screen, (uint8_t )px, size); +break ; +case 16 : +memsetw (screen, (uint16_t )px, size); +break ; +case 32 : +case 24 : +memsetl (screen, px, size); +break ; + } +} +static int do_splash (int argc,char *argv[]) {int ret, opt, fd;@@ -19,13 +79,19 @@ static int do_splash(int argc, char *argv[])int startx =-1 , starty =-1 ;int xres, yres;int offscreen =0 ; +u32 bg_color =0x00000000 ; +bool do_bg = false;void *offscreenbuf =NULL ; -while ((opt =getopt (argc, argv,"f:x:y:o" )) >0 ) { +while ((opt =getopt (argc, argv,"f:x:y:ob:" )) >0 ) {switch (opt) {case 'f' : fbdev = optarg;break ; +case 'b' : + bg_color =simple_strtoul (optarg,NULL ,0 ); + do_bg = true; +break ;case 'x' : startx =simple_strtoul (optarg,NULL ,0 );break ;@@ -71,8 +137,14 @@ static int do_splash(int argc, char *argv[]) fbsize = xres * yres * (info.bits_per_pixel >>3 ); offscreenbuf =malloc (fbsize); -if (offscreenbuf) -memcpy (offscreenbuf, fb, fbsize); +if (offscreenbuf) { +if (do_bg) +memset_pixel (&info, offscreenbuf, bg_color, xres * yres); +else +memcpy (offscreenbuf, fb, fbsize); + } + }else if (do_bg) { +memset_pixel (&info, fb, bg_color, xres * yres); } if (image_renderer_file(&info, image_file, fb, startx, starty,
commands/splash.c BAREBOX_CMD_HELP_SHORT("Show the bitmap FILE on the framebuffer.\n") · line 173
Quoted 4 lines
commands/splash.c +1
-0@@ -98,6 +170,7 @@ BAREBOX_CMD_HELP_SHORT("Show the bitmap FILE on the framebuffer.\n") BAREBOX_CMD_HELP_OPT ("-f <fb>", "framebuffer device (/dev/fb0)\n") BAREBOX_CMD_HELP_OPT ("-x <xofs>", "x offset (default center)\n") BAREBOX_CMD_HELP_OPT ("-y <yofs>", "y offset (default center)\n") +BAREBOX_CMD_HELP_OPT ("-b <backgroung>" ,"backgroung color\n" )
s/backgroung/background/
Maybe better:
"-b <color>", "background color in 0xttrrggbb\n"
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 07/11] Introduce graphic utils
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 72 lines · Jean-Christophe PLAGNIOL-VILLARD
to Factorise pixel rendering
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- commands/splash.c | 61 +--------------------------------- include/graphic_utils.h | 13 ++++++++ include/image_renderer.h | 20 ----------- lib/Makefile | 1 + lib/bmp.c | 5 +-- lib/graphic_utils.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 101 insertions(+), 82 deletions(-) create mode 100644 include/graphic_utils.h create mode 100644 lib/graphic_utils.ccommands/splash.c +0
-50@@ -8,66 +8,7 @@#include <fcntl.h> #include <fb.h> #include <image_renderer.h> - -static u32 get_pixel (struct fb_info *info,u32 color) -{ -u32 px; -u8 t = (color >>24 ) &0xff ; -u8 r = (color >>16 ) &0xff ; -u8 g = (color >>8 ) &0xff ; -u8 b = (color >>0 ) &0xff ; - -if (info->grayscale) { - px = (r | g | b) ?0xffffffff :0x0 ; -return px; - } - - px = (t >> (8 - info->transp.length)) << info->transp.offset | - (r >> (8 - info->red.length)) << info->red.offset | - (g >> (8 - info->green.length)) << info->green.offset | - (b >> (8 - info->blue.length)) << info->blue.offset; - -return px; -} - -static void memsetw (void *s,u16 c,size_t n) -{ -size_t i; -u16 * tmp = s; - -for (i =0 ; i < n; i++) - *tmp++ = c; -} - -static void memsetl (void *s,u32 c,size_t n) -{ -size_t i; -u32 * tmp = s; - -for (i =0 ; i < n; i++) - *tmp++ = c; -} - -static void memset_pixel (struct fb_info *info,void * buf,u32 color,size_t size) -{ -u32 px; -u8 *screen = buf; - - px =get_pixel (info, color); - -switch (info->bits_per_pixel) { -case 8 : -memset (screen, (uint8_t )px, size);
commands/splash.c line 70
Quoted 10 lines
commands/splash.c +0
-10-break ; -case 16 : -memsetw (screen, (uint16_t )px, size); -break ; -case 32 : -case 24 : -memsetl (screen, px, size); -break ; - } -}
These were introduced with the last patch. The order should be reversed.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerlib/Kconfig config IMAGE_RENDERER · line 63
Quoted 12 lines · Jean-Christophe PLAGNIOL-VILLARD
use LodePNG version 20120729 from http://lodev.org/lodepng/
The original coding style is keeped to simplify update.
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>---
lib/Kconfig +6
-0+ prompt "PNG Lib" + +config LODEPNG + bool "lodePNG" + help + Mostly PNG support
This PNG library supports most PNG formats.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 11/11] png: add picoPNG lib support
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 26 lines · Jean-Christophe PLAGNIOL-VILLARD
This is an alternative to LodePNG take from http://forge.voodooprojects.org/
which is base on picoPNG C++ wrote by Lode Vandevenne. The same author as LodePNG.PicoPNG only support RGBA PNG8
The source code of
picopng.cwas just adapted to be compliant with C89 and drop the internal ZLIB support. Coding style untouched.Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- lib/Kconfig | 5 + lib/Makefile | 1 + lib/picopng.c | 810 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/picopng.h | 34 +++ lib/png_pico.c | 85 ++++++ 5 files changed, 935 insertions(+) create mode 100644 lib/picopng.c create mode 100644 lib/picopng.h create mode 100644 lib/png_pico.clib/Kconfig +0
-0
lib/Kconfig config LODEPNG · line 68
Quoted 7 lines
lib/Kconfig +4
-0@@ -62,6 +62,11 @@ config LODEPNG help Mostly PNG support +config PICOPNG + bool "picoPNG" + help + Support only RGBA PNG8
This PNG libraray only supports RGBA PNG8 but is much smaller in binary size then lodepng.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 11/11] png: add picoPNG lib support
Quoted 6 lines
lib/Kconfig config LODEPNG · line 68
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Sascha" == Sascha Hauer <[email protected]> writes:
lib/Kconfig +4
-0+config PICOPNG + bool "picoPNG" + help + Support only RGBA PNG8
Sascha> This PNG libraray only supports RGBA PNG8 but is much smaller
Sascha> in binary size then lodepng.
s/libraray/library/
s/then/than/
Signature · 6 lines
Bye, Peter Korsgaard _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 02/11] bmp: split bmp rending in lib/bmp.c
In reply to Jean-Christophe PLAGNIOL-VILLARDIn Subject: s/rending/rendering/
Or better: Move bmp rendering to lib/bmp.c
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
lib/Makefile +1
-0@@ -34,3 +34,4 @@ obj-$(CONFIG_UNCOMPRESS) += uncompress.o obj-$(CONFIG_BCH) += bch.o obj-$(CONFIG_BITREV) += bitrev.o obj-$(CONFIG_QSORT) += qsort.o +obj-$(CONFIG_BMP) += bmp.olib/bmp.c new file +0
-0
lib/bmp.c line 9
Quoted 9 lines
lib/bmp.c new file +9
-0@@ -0,0 +1,132 @@ +#include <common.h> +#include <fs.h> +#include <errno.h> +#include <malloc.h> +#include <fb.h> +#include <bmp_layout.h> +#include <asm/byteorder.h> + +static inline void set_pixel (struct fb_info *info,void *adr,int r,int g,int b)
This function is first moved from commands/bmp.c to lib/bmp.c, then added as a static inline to include/image_renderer.h, then removed again from lib/bmp.c, then removed from include/image_renderer.h, then reintroduced as a different function in include/graphic_utils.h.
Can you please reorder your patch series to make it readable so that we can see what actually happens?
Thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 11/11] png: add picoPNG lib support
In reply to Peter KorsgaardQuoted 10 lines · Peter Korsgaard
Quoted 6 lines
lib/Kconfig config LODEPNG · line 68
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Sascha" == Sascha Hauer <[email protected]> writes:
lib/Kconfig +4
-0+config PICOPNG + bool "picoPNG" + help + Support only RGBA PNG8Sascha> This PNG libraray only supports RGBA PNG8 but is much smaller
Sascha> in binary size then lodepng.
Quoted 3 lines
s/libraray/library/
s/then/than/
even better ;)
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox