No examples for this method.
Frequently called with: [Clear]
-1
00001 /* 00002 * Copyright (C) 2011 The Android Open Source Project 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00023 #ifndef __RS_CL_RSH__ 00024 #define __RS_CL_RSH__ 00025 00026 // Conversions 00027 #define CVT_FUNC_2(typeout, typein) \ 00028 _RS_RUNTIME typeout##2 __attribute__((overloadable)) \ 00029 convert_##typeout##2(typein##2 v); \ 00030 _RS_RUNTIME typeout##3 __attribute__((overloadable)) \ 00031 convert_##typeout##3(typein##3 v); \ 00032 _RS_RUNTIME typeout##4 __attribute__((overloadable)) \ 00033 convert_##typeout##4(typein##4 v); 00034 00035 00036 #define CVT_FUNC(type) CVT_FUNC_2(type, uchar) \ 00037 CVT_FUNC_2(type, char) \ 00038 CVT_FUNC_2(type, ushort) \ 00039 CVT_FUNC_2(type, short) \ 00040 CVT_FUNC_2(type, uint) \ 00041 CVT_FUNC_2(type, int) \ 00042 CVT_FUNC_2(type, float) 00043 00044 CVT_FUNC(char) 00045 CVT_FUNC(uchar) 00046 CVT_FUNC(short) 00047 CVT_FUNC(ushort) 00048 CVT_FUNC(int) 00049 CVT_FUNC(uint) 00050 CVT_FUNC(float) 00051 00052 // Float ops, 6.11.2 00053 00054 #define FN_FUNC_FN(fnc) \ 00055 _RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v); \ 00056 _RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v); \ 00057 _RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v); 00058 00059 #define IN_FUNC_FN(fnc) \ 00060 _RS_RUNTIME int2 __attribute__((overloadable)) fnc(float2 v); \ 00061 _RS_RUNTIME int3 __attribute__((overloadable)) fnc(float3 v); \ 00062 _RS_RUNTIME int4 __attribute__((overloadable)) fnc(float4 v); 00063 00064 #define FN_FUNC_FN_FN(fnc) \ 00065 _RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, float2 v2); \ 00066 _RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, float3 v2); \ 00067 _RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, float4 v2); 00068 00069 #define FN_FUNC_FN_F(fnc) \ 00070 _RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, float v2); \ 00071 _RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, float v2); \ 00072 _RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, float v2); 00073 00074 #define FN_FUNC_FN_IN(fnc) \ 00075 _RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, int2 v2); \ 00076 _RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, int3 v2); \ 00077 _RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, int4 v2); \ 00078 00079 #define FN_FUNC_FN_I(fnc) \ 00080 _RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, int v2); \ 00081 _RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, int v2); \ 00082 _RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, int v2); 00083 00084 #define FN_FUNC_FN_PFN(fnc) \ 00085 _RS_RUNTIME float2 __attribute__((overloadable)) \ 00086 fnc(float2 v1, float2 *v2); \ 00087 _RS_RUNTIME float3 __attribute__((overloadable)) \ 00088 fnc(float3 v1, float3 *v2); \ 00089 _RS_RUNTIME float4 __attribute__((overloadable)) \ 00090 fnc(float4 v1, float4 *v2); 00091 00092 #define FN_FUNC_FN_PIN(fnc) \ 00093 _RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, int2 *v2); \ 00094 _RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, int3 *v2); \ 00095 _RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, int4 *v2); 00096 00097 #define FN_FUNC_FN_FN_FN(fnc) \ 00098 _RS_RUNTIME float2 __attribute__((overloadable)) \ 00099 fnc(float2 v1, float2 v2, float2 v3); \ 00100 _RS_RUNTIME float3 __attribute__((overloadable)) \ 00101 fnc(float3 v1, float3 v2, float3 v3); \ 00102 _RS_RUNTIME float4 __attribute__((overloadable)) \ 00103 fnc(float4 v1, float4 v2, float4 v3); 00104 00105 #define FN_FUNC_FN_FN_PIN(fnc) \ 00106 _RS_RUNTIME float2 __attribute__((overloadable)) \ 00107 fnc(float2 v1, float2 v2, int2 *v3); \ 00108 _RS_RUNTIME float3 __attribute__((overloadable)) \ 00109 fnc(float3 v1, float3 v2, int3 *v3); \ 00110 _RS_RUNTIME float4 __attribute__((overloadable)) \ 00111 fnc(float4 v1, float4 v2, int4 *v3); 00112 00113 00119 extern float __attribute__((overloadable)) acos(float); 00120 FN_FUNC_FN(acos) 00121 00127 extern float __attribute__((overloadable)) acosh(float); 00128 FN_FUNC_FN(acosh) 00129 00135 _RS_RUNTIME float __attribute__((overloadable)) acospi(float v); 00136 FN_FUNC_FN(acospi) 00137 00143 extern float __attribute__((overloadable)) asin(float); 00144 FN_FUNC_FN(asin) 00145 00151 extern float __attribute__((overloadable)) asinh(float); 00152 FN_FUNC_FN(asinh) 00153 00154 00160 _RS_RUNTIME float __attribute__((overloadable)) asinpi(float v); 00161 FN_FUNC_FN(asinpi) 00162 00168 extern float __attribute__((overloadable)) atan(float); 00169 FN_FUNC_FN(atan) 00170 00180 extern float __attribute__((overloadable)) atan2(float y, float x); 00181 FN_FUNC_FN_FN(atan2) 00182 00188 extern float __attribute__((overloadable)) atanh(float); 00189 FN_FUNC_FN(atanh) 00190 00196 _RS_RUNTIME float __attribute__((overloadable)) atanpi(float v); 00197 FN_FUNC_FN(atanpi) 00198 00208 _RS_RUNTIME float __attribute__((overloadable)) atan2pi(float y, float x); 00209 FN_FUNC_FN_FN(atan2pi) 00210 00211 00217 extern float __attribute__((overloadable)) cbrt(float); 00218 FN_FUNC_FN(cbrt) 00219 00225 extern float __attribute__((overloadable)) ceil(float); 00226 FN_FUNC_FN(ceil) 00227 00237 extern float __attribute__((overloadable)) copysign(float x, float y); 00238 FN_FUNC_FN_FN(copysign) 00239 00245 extern float __attribute__((overloadable)) cos(float); 00246 FN_FUNC_FN(cos) 00247 00253 extern float __attribute__((overloadable)) cosh(float); 00254 FN_FUNC_FN(cosh) 00255 00261 _RS_RUNTIME float __attribute__((overloadable)) cospi(float v); 00262 FN_FUNC_FN(cospi) 00263 00269 extern float __attribute__((overloadable)) erfc(float); 00270 FN_FUNC_FN(erfc) 00271 00277 extern float __attribute__((overloadable)) erf(float); 00278 FN_FUNC_FN(erf) 00279 00285 extern float __attribute__((overloadable)) exp(float); 00286 FN_FUNC_FN(exp) 00287 00293 extern float __attribute__((overloadable)) exp2(float); 00294 FN_FUNC_FN(exp2) 00295 00302 extern float __attribute__((overloadable)) pow(float x, float y); 00303 FN_FUNC_FN_FN(pow) 00304 00310 _RS_RUNTIME float __attribute__((overloadable)) exp10(float v); 00311 FN_FUNC_FN(exp10) 00312 00318 extern float __attribute__((overloadable)) expm1(float); 00319 FN_FUNC_FN(expm1) 00320 00326 extern float __attribute__((overloadable)) fabs(float); 00327 FN_FUNC_FN(fabs) 00328 00335 extern float __attribute__((overloadable)) fdim(float, float); 00336 FN_FUNC_FN_FN(fdim) 00337 00343 extern float __attribute__((overloadable)) floor(float); 00344 FN_FUNC_FN(floor) 00345 00351 extern float __attribute__((overloadable)) fma(float a, float b, float c); 00352 FN_FUNC_FN_FN_FN(fma) 00353 00361 extern float __attribute__((overloadable)) fmax(float x, float y); 00362 FN_FUNC_FN_FN(fmax); 00363 FN_FUNC_FN_F(fmax); 00364 00371 extern float __attribute__((overloadable)) fmin(float x, float y); 00372 FN_FUNC_FN_FN(fmin); 00373 FN_FUNC_FN_F(fmin); 00374 00380 extern float __attribute__((overloadable)) fmod(float x, float y); 00381 FN_FUNC_FN_FN(fmod) 00382 00383 00390 _RS_RUNTIME float __attribute__((overloadable)) fract(float v, float *iptr); 00391 FN_FUNC_FN_PFN(fract) 00392 00399 extern float __attribute__((overloadable)) frexp(float v, int *iptr); 00400 FN_FUNC_FN_PIN(frexp) 00401 00407 extern float __attribute__((overloadable)) hypot(float x, float y); 00408 FN_FUNC_FN_FN(hypot) 00409 00415 extern int __attribute__((overloadable)) ilogb(float); 00416 IN_FUNC_FN(ilogb) 00417 00424 extern float __attribute__((overloadable)) ldexp(float x, int y); 00425 FN_FUNC_FN_IN(ldexp) 00426 FN_FUNC_FN_I(ldexp) 00427 00433 extern float __attribute__((overloadable)) lgamma(float); 00434 FN_FUNC_FN(lgamma) 00435 00442 extern float __attribute__((overloadable)) lgamma(float x, int* y); 00443 FN_FUNC_FN_PIN(lgamma) 00444 00450 extern float __attribute__((overloadable)) log(float); 00451 FN_FUNC_FN(log) 00452 00458 extern float __attribute__((overloadable)) log10(float); 00459 FN_FUNC_FN(log10) 00460 00466 _RS_RUNTIME float __attribute__((overloadable)) log2(float v); 00467 FN_FUNC_FN(log2) 00468 00474 extern float __attribute__((overloadable)) log1p(float v); 00475 FN_FUNC_FN(log1p) 00476 00482 extern float __attribute__((overloadable)) logb(float); 00483 FN_FUNC_FN(logb) 00484 00490 extern float __attribute__((overloadable)) mad(float a, float b, float c); 00491 FN_FUNC_FN_FN_FN(mad) 00492 00501 extern float __attribute__((overloadable)) modf(float x, float *iret); 00502 FN_FUNC_FN_PFN(modf); 00503 00504 extern float __attribute__((overloadable)) nan(uint); 00505 00511 extern float __attribute__((overloadable)) nextafter(float x, float y); 00512 FN_FUNC_FN_FN(nextafter) 00513 00519 _RS_RUNTIME float __attribute__((overloadable)) pown(float v, int p); 00520 FN_FUNC_FN_IN(pown) 00521 00528 _RS_RUNTIME float __attribute__((overloadable)) powr(float v, float p); 00529 FN_FUNC_FN_FN(powr) 00530 00536 extern float __attribute__((overloadable)) remainder(float x, float y); 00537 FN_FUNC_FN_FN(remainder) 00538 00539 // document once we know the precision of bionic 00540 extern float __attribute__((overloadable)) remquo(float, float, int *); 00541 FN_FUNC_FN_FN_PIN(remquo) 00542 00548 extern float __attribute__((overloadable)) rint(float); 00549 FN_FUNC_FN(rint) 00550 00556 _RS_RUNTIME float __attribute__((overloadable)) rootn(float v, int n); 00557 FN_FUNC_FN_IN(rootn) 00558 00564 extern float __attribute__((overloadable)) round(float); 00565 FN_FUNC_FN(round) 00566 00572 extern float __attribute__((overloadable)) sqrt(float); 00573 FN_FUNC_FN(sqrt) 00574 00581 _RS_RUNTIME float __attribute__((overloadable)) rsqrt(float v); 00582 FN_FUNC_FN(rsqrt) 00583 00590 extern float __attribute__((overloadable)) sin(float v); 00591 FN_FUNC_FN(sin) 00592 00602 _RS_RUNTIME float __attribute__((overloadable)) sincos(float v, float *cosptr); 00603 FN_FUNC_FN_PFN(sincos); 00604 00610 extern float __attribute__((overloadable)) sinh(float); 00611 FN_FUNC_FN(sinh) 00612 00618 _RS_RUNTIME float __attribute__((overloadable)) sinpi(float v); 00619 FN_FUNC_FN(sinpi) 00620 00627 extern float __attribute__((overloadable)) tan(float v); 00628 FN_FUNC_FN(tan) 00629 00636 extern float __attribute__((overloadable)) tanh(float); 00637 FN_FUNC_FN(tanh) 00638 00644 _RS_RUNTIME float __attribute__((overloadable)) tanpi(float v); 00645 FN_FUNC_FN(tanpi) 00646 00652 extern float __attribute__((overloadable)) tgamma(float); 00653 FN_FUNC_FN(tgamma) 00654 00660 extern float __attribute__((overloadable)) trunc(float); 00661 FN_FUNC_FN(trunc) 00662 00663 00664 #define XN_FUNC_YN(typeout, fnc, typein) \ 00665 extern typeout __attribute__((overloadable)) fnc(typein); \ 00666 _RS_RUNTIME typeout##2 __attribute__((overloadable)) fnc(typein##2 v); \ 00667 _RS_RUNTIME typeout##3 __attribute__((overloadable)) fnc(typein##3 v); \ 00668 _RS_RUNTIME typeout##4 __attribute__((overloadable)) fnc(typein##4 v); 00669 00670 #define UIN_FUNC_IN(fnc) \ 00671 XN_FUNC_YN(uchar, fnc, char) \ 00672 XN_FUNC_YN(ushort, fnc, short) \ 00673 XN_FUNC_YN(uint, fnc, int) 00674 00675 #define IN_FUNC_IN(fnc) \ 00676 XN_FUNC_YN(uchar, fnc, uchar) \ 00677 XN_FUNC_YN(char, fnc, char) \ 00678 XN_FUNC_YN(ushort, fnc, ushort) \ 00679 XN_FUNC_YN(short, fnc, short) \ 00680 XN_FUNC_YN(uint, fnc, uint) \ 00681 XN_FUNC_YN(int, fnc, int) 00682 00683 00684 #define XN_FUNC_XN_XN_BODY(type, fnc, body) \ 00685 _RS_RUNTIME type __attribute__((overloadable)) \ 00686 fnc(type v1, type v2); \ 00687 _RS_RUNTIME type##2 __attribute__((overloadable)) \ 00688 fnc(type##2 v1, type##2 v2); \ 00689 _RS_RUNTIME type##3 __attribute__((overloadable)) \ 00690 fnc(type##3 v1, type##3 v2); \ 00691 _RS_RUNTIME type##4 __attribute__((overloadable)) \ 00692 fnc(type##4 v1, type##4 v2); 00693 00694 #define IN_FUNC_IN_IN_BODY(fnc, body) \ 00695 XN_FUNC_XN_XN_BODY(uchar, fnc, body) \ 00696 XN_FUNC_XN_XN_BODY(char, fnc, body) \ 00697 XN_FUNC_XN_XN_BODY(ushort, fnc, body) \ 00698 XN_FUNC_XN_XN_BODY(short, fnc, body) \ 00699 XN_FUNC_XN_XN_BODY(uint, fnc, body) \ 00700 XN_FUNC_XN_XN_BODY(int, fnc, body) \ 00701 XN_FUNC_XN_XN_BODY(float, fnc, body) 00702 00703 UIN_FUNC_IN(abs) 00704 IN_FUNC_IN(clz) 00705 00711 IN_FUNC_IN_IN_BODY(min, (v1 < v2 ? v1 : v2)) 00712 FN_FUNC_FN_F(min) 00713 00719 IN_FUNC_IN_IN_BODY(max, (v1 > v2 ? v1 : v2)) 00720 FN_FUNC_FN_F(max) 00721 00729 _RS_RUNTIME float __attribute__((overloadable)) clamp(float amount, float low, float high); 00730 _RS_RUNTIME float2 __attribute__((overloadable)) clamp(float2 amount, float2 low, float2 high); 00731 _RS_RUNTIME float3 __attribute__((overloadable)) clamp(float3 amount, float3 low, float3 high); 00732 _RS_RUNTIME float4 __attribute__((overloadable)) clamp(float4 amount, float4 low, float4 high); 00733 _RS_RUNTIME float2 __attribute__((overloadable)) clamp(float2 amount, float low, float high); 00734 _RS_RUNTIME float3 __attribute__((overloadable)) clamp(float3 amount, float low, float high); 00735 _RS_RUNTIME float4 __attribute__((overloadable)) clamp(float4 amount, float low, float high); 00736 00742 _RS_RUNTIME float __attribute__((overloadable)) degrees(float radians); 00743 FN_FUNC_FN(degrees) 00744 00750 _RS_RUNTIME float __attribute__((overloadable)) mix(float start, float stop, float amount); 00751 _RS_RUNTIME float2 __attribute__((overloadable)) mix(float2 start, float2 stop, float2 amount); 00752 _RS_RUNTIME float3 __attribute__((overloadable)) mix(float3 start, float3 stop, float3 amount); 00753 _RS_RUNTIME float4 __attribute__((overloadable)) mix(float4 start, float4 stop, float4 amount); 00754 _RS_RUNTIME float2 __attribute__((overloadable)) mix(float2 start, float2 stop, float amount); 00755 _RS_RUNTIME float3 __attribute__((overloadable)) mix(float3 start, float3 stop, float amount); 00756 _RS_RUNTIME float4 __attribute__((overloadable)) mix(float4 start, float4 stop, float amount); 00757 00763 _RS_RUNTIME float __attribute__((overloadable)) radians(float degrees); 00764 FN_FUNC_FN(radians) 00765 00774 _RS_RUNTIME float __attribute__((overloadable)) step(float edge, float v); 00775 _RS_RUNTIME float2 __attribute__((overloadable)) step(float2 edge, float2 v); 00776 _RS_RUNTIME float3 __attribute__((overloadable)) step(float3 edge, float3 v); 00777 _RS_RUNTIME float4 __attribute__((overloadable)) step(float4 edge, float4 v); 00778 _RS_RUNTIME float2 __attribute__((overloadable)) step(float2 edge, float v); 00779 _RS_RUNTIME float3 __attribute__((overloadable)) step(float3 edge, float v); 00780 _RS_RUNTIME float4 __attribute__((overloadable)) step(float4 edge, float v); 00781 00782 // not implemented 00783 extern float __attribute__((overloadable)) smoothstep(float, float, float); 00784 extern float2 __attribute__((overloadable)) smoothstep(float2, float2, float2); 00785 extern float3 __attribute__((overloadable)) smoothstep(float3, float3, float3); 00786 extern float4 __attribute__((overloadable)) smoothstep(float4, float4, float4); 00787 extern float2 __attribute__((overloadable)) smoothstep(float, float, float2); 00788 extern float3 __attribute__((overloadable)) smoothstep(float, float, float3); 00789 extern float4 __attribute__((overloadable)) smoothstep(float, float, float4); 00790 00798 _RS_RUNTIME float __attribute__((overloadable)) sign(float v); 00799 FN_FUNC_FN(sign) 00800 00806 _RS_RUNTIME float3 __attribute__((overloadable)) cross(float3 lhs, float3 rhs); 00807 _RS_RUNTIME float4 __attribute__((overloadable)) cross(float4 lhs, float4 rhs); 00808 00814 _RS_RUNTIME float __attribute__((overloadable)) dot(float lhs, float rhs); 00815 _RS_RUNTIME float __attribute__((overloadable)) dot(float2 lhs, float2 rhs); 00816 _RS_RUNTIME float __attribute__((overloadable)) dot(float3 lhs, float3 rhs); 00817 _RS_RUNTIME float __attribute__((overloadable)) dot(float4 lhs, float4 rhs); 00818 00824 _RS_RUNTIME float __attribute__((overloadable)) length(float v); 00825 _RS_RUNTIME float __attribute__((overloadable)) length(float2 v); 00826 _RS_RUNTIME float __attribute__((overloadable)) length(float3 v); 00827 _RS_RUNTIME float __attribute__((overloadable)) length(float4 v); 00828 00834 _RS_RUNTIME float __attribute__((overloadable)) distance(float lhs, float rhs); 00835 _RS_RUNTIME float __attribute__((overloadable)) distance(float2 lhs, float2 rhs); 00836 _RS_RUNTIME float __attribute__((overloadable)) distance(float3 lhs, float3 rhs); 00837 _RS_RUNTIME float __attribute__((overloadable)) distance(float4 lhs, float4 rhs); 00838 00844 _RS_RUNTIME float __attribute__((overloadable)) normalize(float v); 00845 _RS_RUNTIME float2 __attribute__((overloadable)) normalize(float2 v); 00846 _RS_RUNTIME float3 __attribute__((overloadable)) normalize(float3 v); 00847 _RS_RUNTIME float4 __attribute__((overloadable)) normalize(float4 v); 00848 00849 #undef CVT_FUNC 00850 #undef CVT_FUNC_2 00851 #undef FN_FUNC_FN 00852 #undef IN_FUNC_FN 00853 #undef FN_FUNC_FN_FN 00854 #undef FN_FUNC_FN_F 00855 #undef FN_FUNC_FN_IN 00856 #undef FN_FUNC_FN_I 00857 #undef FN_FUNC_FN_PFN 00858 #undef FN_FUNC_FN_PIN 00859 #undef FN_FUNC_FN_FN_FN 00860 #undef FN_FUNC_FN_FN_PIN 00861 #undef XN_FUNC_YN 00862 #undef UIN_FUNC_IN 00863 #undef IN_FUNC_IN 00864 #undef XN_FUNC_XN_XN_BODY 00865 #undef IN_FUNC_IN_IN_BODY 00866 00867 #endif