1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#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 __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
{
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
void evas_common_convert_rgba_to_8bpp_gry_64_dith (DATA32 *src __UNUSED__, DATA8 *dst __UNUSED__, int src_jump __UNUSED__, int dst_jump __UNUSED__, int w __UNUSED__, int h __UNUSED__, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__){}
#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 __UNUSED__)
{
DATA32 *src_ptr;
DATA8 *dst_ptr;
int x, y;
DATA8 r, g, b;
DATA32 gry8;
DATA8 dith;
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
void evas_common_convert_rgba_to_8bpp_gry_4_dith (DATA32 *src __UNUSED__, DATA8 *dst __UNUSED__, int src_jump __UNUSED__, int dst_jump __UNUSED__, int w __UNUSED__, int h __UNUSED__, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__){}
#endif
#ifdef BUILD_CONVERT_8_GRY_256
void evas_common_convert_rgba_to_8bpp_gry_1_dith (DATA32 *src __UNUSED__, DATA8 *dst __UNUSED__, int src_jump __UNUSED__, int dst_jump __UNUSED__, int w __UNUSED__, int h __UNUSED__, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__){}
#endif
|