1 .function orc_splat_u32
7 .function orc_memcpy_u32
13 .function orc_blend_u8
32 .function orc_blend_argb
44 .const 4 a_alpha 0x000000ff
51 x4 mullw a_wide, a_wide, alpha
52 x4 shruw a_wide, a_wide, 8
56 x4 subw s_wide, s_wide, d_wide
57 x4 mullw s_wide, s_wide, a_wide
58 x4 div255w s_wide, s_wide
59 x4 addw d_wide, d_wide, s_wide
64 .function orc_blend_bgra
77 .const 4 a_alpha 0xff000000
85 x4 mullw a_wide, a_wide, alpha
86 x4 shruw a_wide, a_wide, 8
90 x4 subw s_wide, s_wide, d_wide
91 x4 mullw s_wide, s_wide, a_wide
92 x4 div255w s_wide, s_wide
93 x4 addw d_wide, d_wide, s_wide
99 .function orc_overlay_argb
113 .const 4 xfs 0xffffffff
114 .const 4 a_alpha 0x000000ff
115 .const 4 a_alpha_inv 0xffffff00
117 # calc source alpha as alpha_s = alpha_s * alpha / 256
122 x4 convubw alpha_s, a
123 x4 mullw alpha_s, alpha_s, alpha
124 x4 shruw alpha_s, alpha_s, 8
126 x4 mullw s_wide, s_wide, alpha_s
128 # calc destination alpha as alpha_d = (255-alpha_s) * alpha_d / 255
130 x4 convubw alpha_s_inv, a
131 x4 subw alpha_s_inv, alpha_s_inv, alpha_s
136 x4 convubw alpha_d, a
137 x4 mullw alpha_d, alpha_d, alpha_s_inv
138 x4 div255w alpha_d, alpha_d
140 x4 mullw d_wide, d_wide, alpha_d
142 # calc final pixel as pix_d = pix_s*alpha_s + pix_d*alpha_d*(255-alpha_s)/255
143 x4 addw d_wide, d_wide, s_wide
145 # calc the final destination alpha_d = alpha_s + alpha_d * (255-alpha_s)/255
146 x4 addw alpha_d, alpha_d, alpha_s
148 # now normalize the pix_d by the final alpha to make it associative
149 x4 divluw, d_wide, d_wide, alpha_d
151 # pack the new alpha into the correct spot
153 andl t, t, a_alpha_inv
159 .function orc_overlay_bgra
174 .const 4 xfs 0xffffffff
175 .const 4 a_alpha 0xff000000
176 .const 4 a_alpha_inv 0x00ffffff
178 # calc source alpha as alpha_s = alpha_s * alpha / 256
184 x4 convubw alpha_s, a
185 x4 mullw alpha_s, alpha_s, alpha
186 x4 shruw alpha_s, alpha_s, 8
188 x4 mullw s_wide, s_wide, alpha_s
190 # calc destination alpha as alpha_d = (255-alpha_s) * alpha_d / 255
192 x4 convubw alpha_s_inv, a
193 x4 subw alpha_s_inv, alpha_s_inv, alpha_s
199 x4 convubw alpha_d, a
200 x4 mullw alpha_d, alpha_d, alpha_s_inv
201 x4 div255w alpha_d, alpha_d
203 x4 mullw d_wide, d_wide, alpha_d
205 # calc final pixel as pix_d = pix_s*alpha_s + pix_d*alpha_d*(255-alpha_s)/255
206 x4 addw d_wide, d_wide, s_wide
208 # calc the final destination alpha_d = alpha_s + alpha_d * (255-alpha_s)/255
209 x4 addw alpha_d, alpha_d, alpha_s
211 # now normalize the pix_d by the final alpha to make it associative
212 x4 divluw, d_wide, d_wide, alpha_d
214 # pack the new alpha into the correct spot
216 andl t, t, a_alpha_inv