EVAS_CONVERT_ROT(32, RGB, 90)
#######################################
+## Convert to 8bpp grayscale with 256 value, no palette
+EVAS_CONVERT_COLOR(8, GRY, 1)
+## Convert to 8bpp grayscale with 16 value, no palette
+EVAS_CONVERT_COLOR(8, GRY, 16)
+
+#######################################
## Convert to 8bpp grayscale, 64-palette
conv_8_grayscale_64="yes"
AC_MSG_CHECKING(whether to build 8bpp grayscale 64-palette converter code)
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 (256)....: $conv_8_gry_1"
+echo " 8bpp Grayscale (16).....: $conv_8_gry_16"
echo " 8bpp Grayscale 64-pal...: $conv_8_grayscale_64"
# FIXME: add grayscale and B&W support
echo " 16bpp RGB 565...........: $conv_16_rgb_565"
#include "evas_common.h"
#include "evas_convert_gry_8.h"
+#ifdef USE_DITHER_44
+extern const DATA8 _evas_dither_44[4][4];
+#endif
+#ifdef USE_DITHER_128128
+extern const DATA8 _evas_dither_128128[128][128];
+#endif
+
#ifdef BUILD_CONVERT_8_GRY_1
-void evas_common_convert_rgba_to_8bpp_gry_256_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal){}
+void evas_common_convert_rgba_to_8bpp_gry_256_dith (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 r, g, b;
+ DATA32 gry8;
+
+ dst_ptr = (DATA8 *)dst;
+
+ CONVERT_LOOP_START_ROT_0();
+
+ r = (R_VAL(src_ptr));
+ g = (G_VAL(src_ptr));
+ b = (B_VAL(src_ptr));
+
+ // Y = 0.299 * R + 0.587 * G + 0.114 * B;
+ gry8 = ((r * 19595) + (g * 38469) + (b * 7471)) >> 16;
+
+ *dst_ptr = gry8;
+
+ CONVERT_LOOP_END_ROT_0();
+}
#endif
#ifdef BUILD_CONVERT_8_GRY_4
#endif
#ifdef BUILD_CONVERT_8_GRY_16
-void evas_common_convert_rgba_to_8bpp_gry_16_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal){}
+void evas_common_convert_rgba_to_8bpp_gry_16_dith (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 r, g, b;
+ DATA32 gry8;
+ DATA8 dith, dith2;
+
+ dst_ptr = (DATA8 *)dst;
+
+ CONVERT_LOOP_START_ROT_0();
+
+ dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
+
+ r = (R_VAL(src_ptr));
+ g = (G_VAL(src_ptr));
+ b = (B_VAL(src_ptr));
+
+ // Y = 0.299 * R + 0.587 * G + 0.114 * B;
+ gry8 = ((r * 19595) + (g * 38469) + (b * 7471)) >> 16;
+
+ if (((gry8 - gry8 * 255 / 4) >= dith) && (gry8 < 0x07)) gry8++;
+
+ *dst_ptr = gry8;
+
+ CONVERT_LOOP_END_ROT_0();
+}
#endif
#ifdef BUILD_CONVERT_8_GRY_64
#include "evas_convert_rgb_24.h"
#include "evas_convert_rgb_32.h"
#include "evas_convert_grypal_6.h"
+#include "evas_convert_gry_8.h"
#include "evas_convert_yuv.h"
const DATA8 _evas_dither_44[4][4] =
{
if (depth == 8)
{
+#ifdef BUILD_CONVERT_8_GRY_1
+ if (pal_mode == PAL_MODE_NONE)
+ return evas_common_convert_rgba_to_8bpp_gry_256_dith;
+#endif
+#ifdef BUILD_CONVERT_8_GRY_16
+ if (pal_mode == PAL_MODE_NONE)
+ return evas_common_convert_rgba_to_8bpp_gry_16_dith;
+#endif
#ifdef BUILD_CONVERT_8_RGB_332
if (pal_mode == PAL_MODE_RGB332)
return evas_common_convert_rgba_to_8bpp_rgb_332_dith;