From: Mikhail Gusarov <dottedmag@dottedmag.net>

Subject: [E-devel] [evas] Add RGBA -> grayscale 64 entries palette conversion

This is needed for E-Ink devices outta there. Names of new files,
configure.ac variables and macros are awful, suggestions are welcome.



SVN revision: 41825
This commit is contained in:
Mikhail Gusarov 2009-08-17 01:41:07 +00:00 committed by Carsten Haitzler
parent 90f801d31c
commit 226e4e5e16
5 changed files with 66 additions and 0 deletions

View File

@ -1072,6 +1072,27 @@ EVAS_CONVERT_ROT(32, RGB, 270)
## Convert to 32bpp RGB with rotation of 90
EVAS_CONVERT_ROT(32, RGB, 90)
#######################################
## Convert to 8bpp grayscale, 64-palette
conv_8_grayscale_64="yes"
AC_MSG_CHECKING(whether to build 8bpp grayscale 64-palette converter code)
AC_ARG_ENABLE(convert-8-grayscale-64,
AC_HELP_STRING([--disable-convert-8-grayscale-64], [disable 8bpp grayscale 64-palette converter code]),
[
if test "$enableval" = "xyes"; then
AC_DEFINE(BUILD_CONVERT_8_GRAYSCALE_64, 1, [8bpp Grayscale 64-palette Converter Support])
conv_8_grayscale_64="yes"
else
conv_8_grayscale_64="no"
fi
], [
if test "x$conv_8_grayscale_64" = "xyes"; then
AC_DEFINE(BUILD_CONVERT_8_GRAYSCALE_64, 1, [32bpp Grayscale 64-palette Converter Support])
fi
]
)
AC_MSG_RESULT($conv_8_grayscale_64)
## valgrind
want_valgrind="no"
have_valgrind="no"
@ -1286,6 +1307,7 @@ echo " 8bpp RGB 222............: $conv_8_rgb_222"
echo " 8bpp RGB 221............: $conv_8_rgb_221"
echo " 8bpp RGB 121............: $conv_8_rgb_121"
echo " 8bpp RGB 111............: $conv_8_rgb_111"
echo " 8bpp Grayscale 64-pal...: $conv_8_grayscale_64"
# FIXME: add grayscale and B&W support
echo " 16bpp RGB 565...........: $conv_16_rgb_565"
echo " 16bpp BGR 565...........: $conv_16_bgr_565"

View File

@ -35,6 +35,7 @@ evas_convert_rgb_16.c \
evas_convert_rgb_24.c \
evas_convert_rgb_32.c \
evas_convert_rgb_8.c \
evas_convert_grypal_6.c \
evas_convert_yuv.c \
evas_cpu.c \
evas_draw_main.c \
@ -78,6 +79,7 @@ evas_convert_colorspace.h \
evas_convert_gry_1.h \
evas_convert_gry_4.h \
evas_convert_gry_8.h \
evas_convert_grypal_6.h \
evas_convert_main.h \
evas_convert_rgb_16.h \
evas_convert_rgb_24.h \

View File

@ -0,0 +1,27 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "evas_common.h"
#include "evas_convert_grypal_6.h"
#ifdef BUILD_CONVERT_8_GRAYSCALE_64
void evas_common_convert_rgba_to_8bpp_pal_gray64 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
{
DATA32 *src_ptr;
DATA8 *dst_ptr;
int x, y;
DATA8 Y;
dst_ptr = dst;
CONVERT_LOOP_START_ROT_0();
/* RGB -> YUV conversion */
Y = ((R_VAL(src_ptr) * 76) +
(G_VAL(src_ptr) * 151) +
(B_VAL(src_ptr) * 29)) >> 10;
*dst_ptr = pal[Y];
CONVERT_LOOP_END_ROT_0();
}
#endif

View File

@ -0,0 +1,10 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifndef _EVAS_CONVERT_GRY_4_H
#define _EVAS_CONVERT_GRY_4_H
void evas_common_convert_rgba_to_8bpp_pal_gray64 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal);
#endif /* _EVAS_CONVERT_GRY_4_H */

View File

@ -7,6 +7,7 @@
#include "evas_convert_rgb_16.h"
#include "evas_convert_rgb_24.h"
#include "evas_convert_rgb_32.h"
#include "evas_convert_grypal_6.h"
#include "evas_convert_yuv.h"
#ifdef USE_DITHER_44
@ -192,6 +193,10 @@ evas_common_convert_func_get(DATA8 *dest, int w, int h, int depth, DATA32 rmask,
#ifdef BUILD_CONVERT_8_RGB_111
if (pal_mode == PAL_MODE_RGB111)
return evas_common_convert_rgba_to_8bpp_rgb_111_dith;
#endif
#ifdef BUILD_CONVERT_8_GRAYSCALE_64
if (pal_mode == PAL_MODE_GRAY64)
return evas_common_convert_rgba_to_8bpp_pal_gray64;
#endif
}
if (depth == 1)