diff options
Diffstat (limited to 'tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh')
-rw-r--r-- | tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh index a1e4ae5..04ca1f1 100644 --- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh +++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh @@ -31,29 +31,29 @@ void init_vignette(uint32_t dim_x, uint32_t dim_y, float center_x, float center_ else axis_scale.x = (float)dim_x / (float)dim_y; - const float max_dist = 0.5 * length(axis_scale); + const float max_dist = 0.5f * length(axis_scale); sloped_inv_max_dist = desired_slope * 1.f/max_dist; // Range needs to be between 1.3 to 0.6. When scale is zero then range is // 1.3 which means no vignette at all because the luminousity difference is // less than 1/256. Expect input scale to be between 0.0 and 1.0. - const float neg_range = 0.7*sqrt(desired_scale) - 1.3; + const float neg_range = 0.7f*sqrt(desired_scale) - 1.3f; sloped_neg_range = exp(neg_range * desired_slope); shade = desired_shade; opp_shade = 1.f - desired_shade; } -void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) { +uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) { // Convert x and y to floating point coordinates with center as origin - const float4 fin = convert_float4(*in); + const float4 fin = convert_float4(in); const float2 inCoord = {(float)x, (float)y}; const float2 coord = mad(inCoord, inv_dimensions, neg_center); const float sloped_dist_ratio = length(axis_scale * coord) * sloped_inv_max_dist; - const float lumen = opp_shade + shade / ( 1.0 + sloped_neg_range * exp(sloped_dist_ratio) ); + const float lumen = opp_shade + shade / ( 1.0f + sloped_neg_range * exp(sloped_dist_ratio) ); float4 fout; fout.rgb = fin.rgb * lumen; fout.w = fin.w; - *out = convert_uchar4(fout); + return convert_uchar4(fout); } |