#pragma version(1)
#pragma rs java_package_name(com.example.android.rs.hellocompute)
float gFactor;// 0.0f: color, 1.0f: mono
float3 m0 = {0.3588f, 0.7044f, 0.1368f};
float3 m1 = {0.2990f, 0.5870f, 0.1140f};
float3 m2 = {0.2392f, 0.4696f, 0.0912f};
void root(const uchar4 *v_in, uchar4 *v_out) {
float4 f4 = rsUnpackColor8888(*v_in);
float3 out;
out.r = dot(f4.rgb, m0);
out.g = dot(f4.rgb, m1);
out.b = dot(f4.rgb, m2);
if(out.r > 1.f)
out.r = 1.f;
if(out.g > 1.f)
out.g = 1.f;
if(out.b > 1.f)
out.b = 1.f;
float3 res = f4.rgb + (out - f4.rgb)*gFactor;
*v_out = rsPackColorTo8888(res);
}
No comments:
Post a Comment