summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_op_mask/op_mask_pixel_color_.c
blob: aa726b41a744ded6f3f05ba0f09e3d87c16c1761 (plain) (blame)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* mask pixel x color --> dst */

static void
_op_mask_p_c_dp(DATA32 *s, DATA8 *m EINA_UNUSED, DATA32 c, DATA32 *d, int l) {
   DATA32 *e = d + l;
   l = 1 + (c >> 24);
   while (d < e) {
	c = 1 + ((l * (*s >> 24)) >> 8);
	*d = MUL_256(c, *d);
	s++;  d++;
     }
}

#define _op_mask_pas_c_dp _op_mask_p_c_dp
#define _op_mask_pan_c_dp _op_mask_p_c_dp
#define _op_mask_p_can_dp _op_mask_p_c_dp
#define _op_mask_pas_can_dp _op_mask_p_c_dp
#define _op_mask_p_caa_dp _op_mask_p_c_dp
#define _op_mask_pas_caa_dp _op_mask_p_c_dp
#define _op_mask_pan_caa_dp _op_mask_p_c_dp

#define _op_mask_p_c_dpan _op_mask_p_c_dp
#define _op_mask_pas_c_dpan _op_mask_p_c_dp
#define _op_mask_pan_c_dpan _op_mask_p_c_dp
#define _op_mask_p_can_dpan _op_mask_p_c_dp
#define _op_mask_pas_can_dpan _op_mask_p_c_dp
#define _op_mask_p_caa_dpan _op_mask_p_c_dp
#define _op_mask_pas_caa_dpan _op_mask_p_c_dp
#define _op_mask_pan_caa_dpan _op_mask_p_c_dp

static void
init_mask_pixel_color_span_funcs_c(void)
{
   op_mask_span_funcs[SP][SM_N][SC][DP][CPU_C] = _op_mask_p_c_dp;
   op_mask_span_funcs[SP_AS][SM_N][SC][DP][CPU_C] = _op_mask_pas_c_dp;
   op_mask_span_funcs[SP_AN][SM_N][SC][DP][CPU_C] = _op_mask_pan_c_dp;
   op_mask_span_funcs[SP][SM_N][SC_AN][DP][CPU_C] = _op_mask_p_can_dp;
   op_mask_span_funcs[SP_AS][SM_N][SC_AN][DP][CPU_C] = _op_mask_pas_can_dp;
   op_mask_span_funcs[SP][SM_N][SC_AA][DP][CPU_C] = _op_mask_p_caa_dp;
   op_mask_span_funcs[SP_AS][SM_N][SC_AA][DP][CPU_C] = _op_mask_pas_caa_dp;
   op_mask_span_funcs[SP_AN][SM_N][SC_AA][DP][CPU_C] = _op_mask_pan_caa_dp;

   op_mask_span_funcs[SP][SM_N][SC][DP_AN][CPU_C] = _op_mask_p_c_dpan;
   op_mask_span_funcs[SP_AS][SM_N][SC][DP_AN][CPU_C] = _op_mask_pas_c_dpan;
   op_mask_span_funcs[SP_AN][SM_N][SC][DP_AN][CPU_C] = _op_mask_pan_c_dpan;
   op_mask_span_funcs[SP][SM_N][SC_AN][DP_AN][CPU_C] = _op_mask_p_can_dpan;
   op_mask_span_funcs[SP_AS][SM_N][SC_AN][DP_AN][CPU_C] = _op_mask_pas_can_dpan;
   op_mask_span_funcs[SP][SM_N][SC_AA][DP_AN][CPU_C] = _op_mask_p_caa_dpan;
   op_mask_span_funcs[SP_AS][SM_N][SC_AA][DP_AN][CPU_C] = _op_mask_pas_caa_dpan;
   op_mask_span_funcs[SP_AN][SM_N][SC_AA][DP_AN][CPU_C] = _op_mask_pan_caa_dpan;
}

static void
_op_mask_pt_p_c_dp(DATA32 s, DATA8 m EINA_UNUSED, DATA32 c, DATA32 *d) {
	c = 1 + ((((c >> 24) * (s >> 24)) + 255) >> 8);
	*d = MUL_256(c, *d);
}

#define _op_mask_pt_pas_c_dp _op_mask_pt_p_c_dp
#define _op_mask_pt_pan_c_dp _op_mask_pt_p_c_dp
#define _op_mask_pt_p_can_dp _op_mask_pt_p_c_dp
#define _op_mask_pt_pas_can_dp _op_mask_pt_p_c_dp
#define _op_mask_pt_p_caa_dp _op_mask_pt_p_c_dp
#define _op_mask_pt_pas_caa_dp _op_mask_pt_p_c_dp
#define _op_mask_pt_pan_caa_dp _op_mask_pt_p_c_dp

#define _op_mask_pt_p_c_dpan _op_mask_pt_p_c_dp
#define _op_mask_pt_pas_c_dpan _op_mask_pt_p_c_dp
#define _op_mask_pt_pan_c_dpan _op_mask_pt_p_c_dp
#define _op_mask_pt_p_can_dpan _op_mask_pt_p_c_dp
#define _op_mask_pt_pas_can_dpan _op_mask_pt_p_c_dp
#define _op_mask_pt_p_caa_dpan _op_mask_pt_p_c_dp
#define _op_mask_pt_pas_caa_dpan _op_mask_pt_p_c_dp
#define _op_mask_pt_pan_caa_dpan _op_mask_pt_p_c_dp

static void
init_mask_pixel_color_pt_funcs_c(void)
{
   op_mask_pt_funcs[SP][SM_N][SC][DP][CPU_C] = _op_mask_pt_p_c_dp;
   op_mask_pt_funcs[SP_AS][SM_N][SC][DP][CPU_C] = _op_mask_pt_pas_c_dp;
   op_mask_pt_funcs[SP_AN][SM_N][SC][DP][CPU_C] = _op_mask_pt_pan_c_dp;
   op_mask_pt_funcs[SP][SM_N][SC_AN][DP][CPU_C] = _op_mask_pt_p_can_dp;
   op_mask_pt_funcs[SP_AS][SM_N][SC_AN][DP][CPU_C] = _op_mask_pt_pas_can_dp;
   op_mask_pt_funcs[SP][SM_N][SC_AA][DP][CPU_C] = _op_mask_pt_p_caa_dp;
   op_mask_pt_funcs[SP_AS][SM_N][SC_AA][DP][CPU_C] = _op_mask_pt_pas_caa_dp;
   op_mask_pt_funcs[SP_AN][SM_N][SC_AA][DP][CPU_C] = _op_mask_pt_pan_caa_dp;

   op_mask_pt_funcs[SP][SM_N][SC][DP_AN][CPU_C] = _op_mask_pt_p_c_dpan;
   op_mask_pt_funcs[SP_AS][SM_N][SC][DP_AN][CPU_C] = _op_mask_pt_pas_c_dpan;
   op_mask_pt_funcs[SP_AN][SM_N][SC][DP_AN][CPU_C] = _op_mask_pt_pan_c_dpan;
   op_mask_pt_funcs[SP][SM_N][SC_AN][DP_AN][CPU_C] = _op_mask_pt_p_can_dpan;
   op_mask_pt_funcs[SP_AS][SM_N][SC_AN][DP_AN][CPU_C] = _op_mask_pt_pas_can_dpan;
   op_mask_pt_funcs[SP][SM_N][SC_AA][DP_AN][CPU_C] = _op_mask_pt_p_caa_dpan;
   op_mask_pt_funcs[SP_AS][SM_N][SC_AA][DP_AN][CPU_C] = _op_mask_pt_pas_caa_dpan;
   op_mask_pt_funcs[SP_AN][SM_N][SC_AA][DP_AN][CPU_C] = _op_mask_pt_pan_caa_dpan;
}