1a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray/*
2a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray * Copyright (C) 2013 The Android Open Source Project
3a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray *
4a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray * Licensed under the Apache License, Version 2.0 (the "License");
5a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray * you may not use this file except in compliance with the License.
6a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray * You may obtain a copy of the License at
7a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray *
8a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray *      http://www.apache.org/licenses/LICENSE-2.0
9a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray *
10a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray * Unless required by applicable law or agreed to in writing, software
11a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray * distributed under the License is distributed on an "AS IS" BASIS,
12a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray * See the License for the specific language governing permissions and
14a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray * limitations under the License.
15a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray */
16a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray
17a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray#pragma version(1)
18a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray#pragma rs java_package_name(com.example.android.rs.hellocomputendk)
19a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray
20a89eef413da39b013f2e931c9f207ef2587eef01Tim Murrayconst static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
21a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray
22a89eef413da39b013f2e931c9f207ef2587eef01Tim Murrayvoid root(const uchar4 *v_in, uchar4 *v_out) {
23a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray    float4 f4 = rsUnpackColor8888(*v_in);
24a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray
25a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray    float3 mono = dot(f4.rgb, gMonoMult);
26a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray    *v_out = rsPackColorTo8888(mono);
27a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray}
28a89eef413da39b013f2e931c9f207ef2587eef01Tim Murray
29