blob: 797bff01ca7b3696d7b74814b43c2a4b83697fca [file] [log] [blame]
Jason Samscf9ea9f2012-09-23 17:00:54 -07001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
Jason Sams709a0972012-11-15 18:18:04 -080018#include "rsCpuIntrinsic.h"
19#include "rsCpuIntrinsicInlines.h"
Jason Samscf9ea9f2012-09-23 17:00:54 -070020
Jason Sams709a0972012-11-15 18:18:04 -080021namespace android {
22namespace renderscript {
23
24
25class RsdCpuScriptIntrinsicBlend : public RsdCpuScriptIntrinsic {
26public:
Stephen Hinesc060f142015-05-13 19:26:09 -070027 void populateScript(Script *) override;
Jason Sams709a0972012-11-15 18:18:04 -080028
Stephen Hinesc060f142015-05-13 19:26:09 -070029 ~RsdCpuScriptIntrinsicBlend() override;
Jason Samsc905efd2012-11-26 15:20:18 -080030 RsdCpuScriptIntrinsicBlend(RsdCpuReferenceImpl *ctx, const Script *s, const Element *e);
Jason Sams709a0972012-11-15 18:18:04 -080031
32protected:
David Grossb0abb142015-03-12 15:23:03 -070033 static void kernel(const RsExpandKernelDriverInfo *info, uint32_t xstart,
Chris Wailes9ed79102014-07-25 15:53:28 -070034 uint32_t xend, uint32_t outstep);
Jason Samscf9ea9f2012-09-23 17:00:54 -070035};
36
Jason Sams709a0972012-11-15 18:18:04 -080037}
38}
39
Jason Samscf9ea9f2012-09-23 17:00:54 -070040
Jason Samscf9ea9f2012-09-23 17:00:54 -070041enum {
42 BLEND_CLEAR = 0,
43 BLEND_SRC = 1,
44 BLEND_DST = 2,
45 BLEND_SRC_OVER = 3,
46 BLEND_DST_OVER = 4,
47 BLEND_SRC_IN = 5,
48 BLEND_DST_IN = 6,
49 BLEND_SRC_OUT = 7,
50 BLEND_DST_OUT = 8,
51 BLEND_SRC_ATOP = 9,
52 BLEND_DST_ATOP = 10,
53 BLEND_XOR = 11,
54
55 BLEND_NORMAL = 12,
56 BLEND_AVERAGE = 13,
57 BLEND_MULTIPLY = 14,
58 BLEND_SCREEN = 15,
59 BLEND_DARKEN = 16,
60 BLEND_LIGHTEN = 17,
61 BLEND_OVERLAY = 18,
62 BLEND_HARDLIGHT = 19,
63 BLEND_SOFTLIGHT = 20,
64 BLEND_DIFFERENCE = 21,
65 BLEND_NEGATION = 22,
66 BLEND_EXCLUSION = 23,
67 BLEND_COLOR_DODGE = 24,
68 BLEND_INVERSE_COLOR_DODGE = 25,
69 BLEND_SOFT_DODGE = 26,
70 BLEND_COLOR_BURN = 27,
71 BLEND_INVERSE_COLOR_BURN = 28,
72 BLEND_SOFT_BURN = 29,
73 BLEND_REFLECT = 30,
74 BLEND_GLOW = 31,
75 BLEND_FREEZE = 32,
76 BLEND_HEAT = 33,
77 BLEND_ADD = 34,
78 BLEND_SUBTRACT = 35,
79 BLEND_STAMP = 36,
80 BLEND_RED = 37,
81 BLEND_GREEN = 38,
82 BLEND_BLUE = 39,
83 BLEND_HUE = 40,
84 BLEND_SATURATION = 41,
85 BLEND_COLOR = 42,
86 BLEND_LUMINOSITY = 43
87};
88
Jason Sams074424a2014-05-22 13:30:03 -070089#if defined(ARCH_ARM_USE_INTRINSICS)
Simon Hosie5d069192014-02-19 16:33:45 -080090extern "C" int rsdIntrinsicBlend_K(uchar4 *out, uchar4 const *in, int slot,
91 uint32_t xstart, uint32_t xend);
Rose, James7b7060c2014-04-22 12:08:06 +080092#endif
93
94#if defined(ARCH_X86_HAVE_SSSE3)
Dan Albertebf0eb92014-08-22 13:19:24 -070095extern void rsdIntrinsicBlendSrcOver_K(void *dst, const void *src, uint32_t count8);
96extern void rsdIntrinsicBlendDstOver_K(void *dst, const void *src, uint32_t count8);
97extern void rsdIntrinsicBlendSrcIn_K(void *dst, const void *src, uint32_t count8);
98extern void rsdIntrinsicBlendDstIn_K(void *dst, const void *src, uint32_t count8);
99extern void rsdIntrinsicBlendSrcOut_K(void *dst, const void *src, uint32_t count8);
100extern void rsdIntrinsicBlendDstOut_K(void *dst, const void *src, uint32_t count8);
101extern void rsdIntrinsicBlendSrcAtop_K(void *dst, const void *src, uint32_t count8);
102extern void rsdIntrinsicBlendDstAtop_K(void *dst, const void *src, uint32_t count8);
103extern void rsdIntrinsicBlendXor_K(void *dst, const void *src, uint32_t count8);
104extern void rsdIntrinsicBlendMultiply_K(void *dst, const void *src, uint32_t count8);
105extern void rsdIntrinsicBlendAdd_K(void *dst, const void *src, uint32_t count8);
106extern void rsdIntrinsicBlendSub_K(void *dst, const void *src, uint32_t count8);
Rose, James7b7060c2014-04-22 12:08:06 +0800107#endif
Jason Samsfa17cda2012-09-26 18:33:58 -0700108
Chih-Hung Hsieh462de212016-11-16 11:33:57 -0800109namespace android {
110namespace renderscript {
111
David Grossb0abb142015-03-12 15:23:03 -0700112void RsdCpuScriptIntrinsicBlend::kernel(const RsExpandKernelDriverInfo *info,
Jason Sams709a0972012-11-15 18:18:04 -0800113 uint32_t xstart, uint32_t xend,
Chris Wailes9ed79102014-07-25 15:53:28 -0700114 uint32_t outstep) {
Tim Murray36889a02012-09-24 14:52:48 -0700115 // instep/outstep can be ignored--sizeof(uchar4) known at compile time
David Grossb0abb142015-03-12 15:23:03 -0700116 uchar4 *out = (uchar4 *)info->outPtr[0];
117 uchar4 *in = (uchar4 *)info->inPtr[0];
Jason Samscf9ea9f2012-09-23 17:00:54 -0700118 uint32_t x1 = xstart;
119 uint32_t x2 = xend;
120
Miao Wanga615daa2016-03-31 14:40:08 -0700121#if defined(ARCH_ARM_USE_INTRINSICS)
Stephen Hines820e22b2015-06-29 14:34:11 -0700122 // Bug: 22047392 - Skip optimized version for BLEND_DST_ATOP until this
123 // been fixed.
124 if (gArchUseSIMD && info->slot != BLEND_DST_ATOP) {
David Grossb0abb142015-03-12 15:23:03 -0700125 if (rsdIntrinsicBlend_K(out, in, info->slot, x1, x2) >= 0)
Simon Hosie5d069192014-02-19 16:33:45 -0800126 return;
127 }
128#endif
David Grossb0abb142015-03-12 15:23:03 -0700129 switch (info->slot) {
Jason Samscf9ea9f2012-09-23 17:00:54 -0700130 case BLEND_CLEAR:
131 for (;x1 < x2; x1++, out++) {
132 *out = 0;
133 }
134 break;
135 case BLEND_SRC:
136 for (;x1 < x2; x1++, out++, in++) {
Tim Murray36889a02012-09-24 14:52:48 -0700137 *out = *in;
Jason Samscf9ea9f2012-09-23 17:00:54 -0700138 }
139 break;
Tim Murray36889a02012-09-24 14:52:48 -0700140 //BLEND_DST is a NOP
Jason Samscf9ea9f2012-09-23 17:00:54 -0700141 case BLEND_DST:
Tim Murray36889a02012-09-24 14:52:48 -0700142 break;
143 case BLEND_SRC_OVER:
Rose, James7b7060c2014-04-22 12:08:06 +0800144 #if defined(ARCH_X86_HAVE_SSSE3)
145 if (gArchUseSIMD) {
146 if ((x1 + 8) < x2) {
147 uint32_t len = (x2 - x1) >> 3;
148 rsdIntrinsicBlendSrcOver_K(out, in, len);
149 x1 += len << 3;
150 out += len << 3;
151 in += len << 3;
152 }
153 }
154 #endif
Jason Samscf9ea9f2012-09-23 17:00:54 -0700155 for (;x1 < x2; x1++, out++, in++) {
Tim Murray36889a02012-09-24 14:52:48 -0700156 short4 in_s = convert_short4(*in);
157 short4 out_s = convert_short4(*out);
Tim Murray0b575de2013-03-15 15:56:43 -0700158 in_s = in_s + ((out_s * (short4)(255 - in_s.w)) >> (short4)8);
Tim Murray36889a02012-09-24 14:52:48 -0700159 *out = convert_uchar4(in_s);
Jason Samscf9ea9f2012-09-23 17:00:54 -0700160 }
161 break;
Tim Murray36889a02012-09-24 14:52:48 -0700162 case BLEND_DST_OVER:
Rose, James7b7060c2014-04-22 12:08:06 +0800163 #if defined(ARCH_X86_HAVE_SSSE3)
164 if (gArchUseSIMD) {
165 if ((x1 + 8) < x2) {
166 uint32_t len = (x2 - x1) >> 3;
167 rsdIntrinsicBlendDstOver_K(out, in, len);
168 x1 += len << 3;
169 out += len << 3;
170 in += len << 3;
171 }
172 }
173 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700174 for (;x1 < x2; x1++, out++, in++) {
175 short4 in_s = convert_short4(*in);
176 short4 out_s = convert_short4(*out);
Tim Murray0b575de2013-03-15 15:56:43 -0700177 in_s = out_s + ((in_s * (short4)(255 - out_s.w)) >> (short4)8);
Tim Murray36889a02012-09-24 14:52:48 -0700178 *out = convert_uchar4(in_s);
179 }
180 break;
181 case BLEND_SRC_IN:
Rose, James7b7060c2014-04-22 12:08:06 +0800182 #if defined(ARCH_X86_HAVE_SSSE3)
183 if (gArchUseSIMD) {
184 if ((x1 + 8) < x2) {
185 uint32_t len = (x2 - x1) >> 3;
186 rsdIntrinsicBlendSrcIn_K(out, in, len);
187 x1 += len << 3;
188 out += len << 3;
189 in += len << 3;
190 }
191 }
192 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700193 for (;x1 < x2; x1++, out++, in++) {
194 short4 in_s = convert_short4(*in);
Tim Murray0b575de2013-03-15 15:56:43 -0700195 in_s = (in_s * out->w) >> (short4)8;
Tim Murray36889a02012-09-24 14:52:48 -0700196 *out = convert_uchar4(in_s);
197 }
198 break;
199 case BLEND_DST_IN:
Rose, James7b7060c2014-04-22 12:08:06 +0800200 #if defined(ARCH_X86_HAVE_SSSE3)
201 if (gArchUseSIMD) {
202 if ((x1 + 8) < x2) {
203 uint32_t len = (x2 - x1) >> 3;
204 rsdIntrinsicBlendDstIn_K(out, in, len);
205 x1 += len << 3;
206 out += len << 3;
207 in += len << 3;
208 }
209 }
210 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700211 for (;x1 < x2; x1++, out++, in++) {
212 short4 out_s = convert_short4(*out);
Tim Murray0b575de2013-03-15 15:56:43 -0700213 out_s = (out_s * in->w) >> (short4)8;
Tim Murray36889a02012-09-24 14:52:48 -0700214 *out = convert_uchar4(out_s);
215 }
216 break;
217 case BLEND_SRC_OUT:
Rose, James7b7060c2014-04-22 12:08:06 +0800218 #if defined(ARCH_X86_HAVE_SSSE3)
219 if (gArchUseSIMD) {
220 if ((x1 + 8) < x2) {
221 uint32_t len = (x2 - x1) >> 3;
222 rsdIntrinsicBlendSrcOut_K(out, in, len);
223 x1 += len << 3;
224 out += len << 3;
225 in += len << 3;
226 }
227 }
228 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700229 for (;x1 < x2; x1++, out++, in++) {
230 short4 in_s = convert_short4(*in);
Tim Murray0b575de2013-03-15 15:56:43 -0700231 in_s = (in_s * (short4)(255 - out->w)) >> (short4)8;
Tim Murray36889a02012-09-24 14:52:48 -0700232 *out = convert_uchar4(in_s);
233 }
234 break;
235 case BLEND_DST_OUT:
Rose, James7b7060c2014-04-22 12:08:06 +0800236 #if defined(ARCH_X86_HAVE_SSSE3)
237 if (gArchUseSIMD) {
238 if ((x1 + 8) < x2) {
239 uint32_t len = (x2 - x1) >> 3;
240 rsdIntrinsicBlendDstOut_K(out, in, len);
241 x1 += len << 3;
242 out += len << 3;
243 in += len << 3;
244 }
245 }
246 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700247 for (;x1 < x2; x1++, out++, in++) {
248 short4 out_s = convert_short4(*out);
Tim Murray0b575de2013-03-15 15:56:43 -0700249 out_s = (out_s * (short4)(255 - in->w)) >> (short4)8;
Tim Murray36889a02012-09-24 14:52:48 -0700250 *out = convert_uchar4(out_s);
251 }
252 break;
253 case BLEND_SRC_ATOP:
Rose, James7b7060c2014-04-22 12:08:06 +0800254 #if defined(ARCH_X86_HAVE_SSSE3)
255 if (gArchUseSIMD) {
256 if ((x1 + 8) < x2) {
257 uint32_t len = (x2 - x1) >> 3;
258 rsdIntrinsicBlendSrcAtop_K(out, in, len);
259 x1 += len << 3;
260 out += len << 3;
261 in += len << 3;
262 }
263 }
264 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700265 for (;x1 < x2; x1++, out++, in++) {
266 short4 in_s = convert_short4(*in);
267 short4 out_s = convert_short4(*out);
Tim Murray0b575de2013-03-15 15:56:43 -0700268 out_s.xyz = ((in_s.xyz * out_s.w) +
269 (out_s.xyz * ((short3)255 - (short3)in_s.w))) >> (short3)8;
Tim Murray36889a02012-09-24 14:52:48 -0700270 *out = convert_uchar4(out_s);
271 }
272 break;
273 case BLEND_DST_ATOP:
Rose, James7b7060c2014-04-22 12:08:06 +0800274 #if defined(ARCH_X86_HAVE_SSSE3)
275 if (gArchUseSIMD) {
276 if ((x1 + 8) < x2) {
277 uint32_t len = (x2 - x1) >> 3;
278 rsdIntrinsicBlendDstAtop_K(out, in, len);
279 x1 += len << 3;
280 out += len << 3;
281 in += len << 3;
282 }
283 }
284 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700285 for (;x1 < x2; x1++, out++, in++) {
286 short4 in_s = convert_short4(*in);
287 short4 out_s = convert_short4(*out);
Tim Murray0b575de2013-03-15 15:56:43 -0700288 out_s.xyz = ((out_s.xyz * in_s.w) +
289 (in_s.xyz * ((short3)255 - (short3)out_s.w))) >> (short3)8;
Stephen Hines820e22b2015-06-29 14:34:11 -0700290 out_s.w = in_s.w;
Tim Murray36889a02012-09-24 14:52:48 -0700291 *out = convert_uchar4(out_s);
292 }
293 break;
294 case BLEND_XOR:
Rose, James7b7060c2014-04-22 12:08:06 +0800295 #if defined(ARCH_X86_HAVE_SSSE3)
296 if (gArchUseSIMD) {
297 if ((x1 + 8) < x2) {
298 uint32_t len = (x2 - x1) >> 3;
299 rsdIntrinsicBlendXor_K(out, in, len);
300 x1 += len << 3;
301 out += len << 3;
302 in += len << 3;
303 }
304 }
305 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700306 for (;x1 < x2; x1++, out++, in++) {
307 *out = *in ^ *out;
308 }
309 break;
310 case BLEND_NORMAL:
311 ALOGE("Called unimplemented blend intrinsic BLEND_NORMAL");
312 rsAssert(false);
313 break;
314 case BLEND_AVERAGE:
315 ALOGE("Called unimplemented blend intrinsic BLEND_AVERAGE");
316 rsAssert(false);
317 break;
318 case BLEND_MULTIPLY:
Rose, James7b7060c2014-04-22 12:08:06 +0800319 #if defined(ARCH_X86_HAVE_SSSE3)
320 if (gArchUseSIMD) {
321 if ((x1 + 8) < x2) {
322 uint32_t len = (x2 - x1) >> 3;
323 rsdIntrinsicBlendMultiply_K(out, in, len);
324 x1 += len << 3;
325 out += len << 3;
326 in += len << 3;
327 }
328 }
329 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700330 for (;x1 < x2; x1++, out++, in++) {
331 *out = convert_uchar4((convert_short4(*in) * convert_short4(*out))
332 >> (short4)8);
333 }
334 break;
335 case BLEND_SCREEN:
336 ALOGE("Called unimplemented blend intrinsic BLEND_SCREEN");
337 rsAssert(false);
338 break;
339 case BLEND_DARKEN:
340 ALOGE("Called unimplemented blend intrinsic BLEND_DARKEN");
341 rsAssert(false);
342 break;
343 case BLEND_LIGHTEN:
344 ALOGE("Called unimplemented blend intrinsic BLEND_LIGHTEN");
345 rsAssert(false);
346 break;
347 case BLEND_OVERLAY:
348 ALOGE("Called unimplemented blend intrinsic BLEND_OVERLAY");
349 rsAssert(false);
350 break;
351 case BLEND_HARDLIGHT:
352 ALOGE("Called unimplemented blend intrinsic BLEND_HARDLIGHT");
353 rsAssert(false);
354 break;
355 case BLEND_SOFTLIGHT:
356 ALOGE("Called unimplemented blend intrinsic BLEND_SOFTLIGHT");
357 rsAssert(false);
358 break;
359 case BLEND_DIFFERENCE:
360 ALOGE("Called unimplemented blend intrinsic BLEND_DIFFERENCE");
361 rsAssert(false);
362 break;
363 case BLEND_NEGATION:
364 ALOGE("Called unimplemented blend intrinsic BLEND_NEGATION");
365 rsAssert(false);
366 break;
367 case BLEND_EXCLUSION:
368 ALOGE("Called unimplemented blend intrinsic BLEND_EXCLUSION");
369 rsAssert(false);
370 break;
371 case BLEND_COLOR_DODGE:
372 ALOGE("Called unimplemented blend intrinsic BLEND_COLOR_DODGE");
373 rsAssert(false);
374 break;
375 case BLEND_INVERSE_COLOR_DODGE:
376 ALOGE("Called unimplemented blend intrinsic BLEND_INVERSE_COLOR_DODGE");
377 rsAssert(false);
378 break;
379 case BLEND_SOFT_DODGE:
380 ALOGE("Called unimplemented blend intrinsic BLEND_SOFT_DODGE");
381 rsAssert(false);
382 break;
383 case BLEND_COLOR_BURN:
384 ALOGE("Called unimplemented blend intrinsic BLEND_COLOR_BURN");
385 rsAssert(false);
386 break;
387 case BLEND_INVERSE_COLOR_BURN:
388 ALOGE("Called unimplemented blend intrinsic BLEND_INVERSE_COLOR_BURN");
389 rsAssert(false);
390 break;
391 case BLEND_SOFT_BURN:
392 ALOGE("Called unimplemented blend intrinsic BLEND_SOFT_BURN");
393 rsAssert(false);
394 break;
395 case BLEND_REFLECT:
396 ALOGE("Called unimplemented blend intrinsic BLEND_REFLECT");
397 rsAssert(false);
398 break;
399 case BLEND_GLOW:
400 ALOGE("Called unimplemented blend intrinsic BLEND_GLOW");
401 rsAssert(false);
402 break;
403 case BLEND_FREEZE:
404 ALOGE("Called unimplemented blend intrinsic BLEND_FREEZE");
405 rsAssert(false);
406 break;
407 case BLEND_HEAT:
408 ALOGE("Called unimplemented blend intrinsic BLEND_HEAT");
409 rsAssert(false);
410 break;
411 case BLEND_ADD:
Rose, James7b7060c2014-04-22 12:08:06 +0800412 #if defined(ARCH_X86_HAVE_SSSE3)
413 if (gArchUseSIMD) {
414 if((x1 + 8) < x2) {
415 uint32_t len = (x2 - x1) >> 3;
416 rsdIntrinsicBlendAdd_K(out, in, len);
417 x1 += len << 3;
418 out += len << 3;
419 in += len << 3;
420 }
421 }
422 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700423 for (;x1 < x2; x1++, out++, in++) {
Tim Murray0b575de2013-03-15 15:56:43 -0700424 uint32_t iR = in->x, iG = in->y, iB = in->z, iA = in->w,
425 oR = out->x, oG = out->y, oB = out->z, oA = out->w;
426 out->x = (oR + iR) > 255 ? 255 : oR + iR;
427 out->y = (oG + iG) > 255 ? 255 : oG + iG;
428 out->z = (oB + iB) > 255 ? 255 : oB + iB;
429 out->w = (oA + iA) > 255 ? 255 : oA + iA;
Tim Murray36889a02012-09-24 14:52:48 -0700430 }
431 break;
432 case BLEND_SUBTRACT:
Rose, James7b7060c2014-04-22 12:08:06 +0800433 #if defined(ARCH_X86_HAVE_SSSE3)
434 if (gArchUseSIMD) {
435 if((x1 + 8) < x2) {
436 uint32_t len = (x2 - x1) >> 3;
437 rsdIntrinsicBlendSub_K(out, in, len);
438 x1 += len << 3;
439 out += len << 3;
440 in += len << 3;
441 }
442 }
443 #endif
Tim Murray36889a02012-09-24 14:52:48 -0700444 for (;x1 < x2; x1++, out++, in++) {
Tim Murray0b575de2013-03-15 15:56:43 -0700445 int32_t iR = in->x, iG = in->y, iB = in->z, iA = in->w,
446 oR = out->x, oG = out->y, oB = out->z, oA = out->w;
447 out->x = (oR - iR) < 0 ? 0 : oR - iR;
448 out->y = (oG - iG) < 0 ? 0 : oG - iG;
449 out->z = (oB - iB) < 0 ? 0 : oB - iB;
450 out->w = (oA - iA) < 0 ? 0 : oA - iA;
Tim Murray36889a02012-09-24 14:52:48 -0700451 }
452 break;
453 case BLEND_STAMP:
454 ALOGE("Called unimplemented blend intrinsic BLEND_STAMP");
455 rsAssert(false);
456 break;
457 case BLEND_RED:
458 ALOGE("Called unimplemented blend intrinsic BLEND_RED");
459 rsAssert(false);
460 break;
461 case BLEND_GREEN:
462 ALOGE("Called unimplemented blend intrinsic BLEND_GREEN");
463 rsAssert(false);
464 break;
465 case BLEND_BLUE:
466 ALOGE("Called unimplemented blend intrinsic BLEND_BLUE");
467 rsAssert(false);
468 break;
469 case BLEND_HUE:
470 ALOGE("Called unimplemented blend intrinsic BLEND_HUE");
471 rsAssert(false);
472 break;
473 case BLEND_SATURATION:
474 ALOGE("Called unimplemented blend intrinsic BLEND_SATURATION");
475 rsAssert(false);
476 break;
477 case BLEND_COLOR:
478 ALOGE("Called unimplemented blend intrinsic BLEND_COLOR");
479 rsAssert(false);
480 break;
481 case BLEND_LUMINOSITY:
482 ALOGE("Called unimplemented blend intrinsic BLEND_LUMINOSITY");
483 rsAssert(false);
484 break;
Jason Samscf9ea9f2012-09-23 17:00:54 -0700485
Tim Murray36889a02012-09-24 14:52:48 -0700486 default:
David Grossb0abb142015-03-12 15:23:03 -0700487 ALOGE("Called unimplemented value %d", info->slot);
Tim Murray36889a02012-09-24 14:52:48 -0700488 rsAssert(false);
Jason Samscf9ea9f2012-09-23 17:00:54 -0700489
490 }
Jason Samscf9ea9f2012-09-23 17:00:54 -0700491}
492
Jason Samscf9ea9f2012-09-23 17:00:54 -0700493
Jason Samsc905efd2012-11-26 15:20:18 -0800494RsdCpuScriptIntrinsicBlend::RsdCpuScriptIntrinsicBlend(RsdCpuReferenceImpl *ctx,
495 const Script *s, const Element *e)
496 : RsdCpuScriptIntrinsic(ctx, s, e, RS_SCRIPT_INTRINSIC_ID_BLEND) {
Jason Samscf9ea9f2012-09-23 17:00:54 -0700497
Jason Sams709a0972012-11-15 18:18:04 -0800498 mRootPtr = &kernel;
Jason Samscf9ea9f2012-09-23 17:00:54 -0700499}
500
Jason Sams709a0972012-11-15 18:18:04 -0800501RsdCpuScriptIntrinsicBlend::~RsdCpuScriptIntrinsicBlend() {
502}
503
504void RsdCpuScriptIntrinsicBlend::populateScript(Script *s) {
505 s->mHal.info.exportedVariableCount = 0;
506}
507
Jason Samsc905efd2012-11-26 15:20:18 -0800508RsdCpuScriptImpl * rsdIntrinsic_Blend(RsdCpuReferenceImpl *ctx,
509 const Script *s, const Element *e) {
510 return new RsdCpuScriptIntrinsicBlend(ctx, s, e);
Jason Sams709a0972012-11-15 18:18:04 -0800511}
Chih-Hung Hsieh462de212016-11-16 11:33:57 -0800512
513} // namespace renderscript
514} // namespace android