[gegl] exposure: remove gamma property
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] exposure: remove gamma property
- Date: Sun, 26 Feb 2017 16:05:17 +0000 (UTC)
commit 6740fc4d7b1985223cff82b24448b7a05ef9ded7
Author: Øyvind Kolås <pippin gimp org>
Date: Sun Feb 26 16:49:15 2017 +0100
exposure: remove gamma property
GEGL has a separate gamma operation - which can be used for pre or post
processing independently instead of a hard-coded post processing step.
operations/common/exposure.c | 45 +++++++++++-----------------------------
tests/simple/test-serialize.c | 2 +-
2 files changed, 14 insertions(+), 33 deletions(-)
---
diff --git a/operations/common/exposure.c b/operations/common/exposure.c
index 47f439a..1fc712a 100644
--- a/operations/common/exposure.c
+++ b/operations/common/exposure.c
@@ -31,10 +31,6 @@ property_double (exposure, _("Exposure"), 0.0)
description (_("Relative brightness change in stops"))
ui_range (-10.0, 10.0)
-property_double (gamma, _("Gamma adjustment"), 1.0)
- value_range (0.01, 10)
- ui_range (0.01, 3.0)
-
#else
#define GEGL_OP_POINT_FILTER
@@ -74,7 +70,6 @@ process (GeglOperation *op,
gfloat exposure_negated = (gfloat) -o->exposure;
gfloat gain;
gfloat white;
- gfloat gamma = 1.0 / o->gamma;
glong i;
@@ -85,28 +80,16 @@ process (GeglOperation *op,
diff = MAX (white - black_level, 0.01);
gain = 1.0f / diff;
- if (gamma == 1.0)
- for (i=0; i<n_pixels; i++)
- {
- out_pixel[0] = (in_pixel[0] - black_level) * gain;
- out_pixel[1] = (in_pixel[1] - black_level) * gain;
- out_pixel[2] = (in_pixel[2] - black_level) * gain;
- out_pixel[3] = in_pixel[3];
-
- out_pixel += 4;
- in_pixel += 4;
- }
- else
- for (i=0; i<n_pixels; i++)
- {
- out_pixel[0] = powf ((in_pixel[0] - black_level) * gain, gamma);
- out_pixel[1] = powf ((in_pixel[1] - black_level) * gain, gamma);
- out_pixel[2] = powf ((in_pixel[2] - black_level) * gain, gamma);
- out_pixel[3] = in_pixel[3];
-
- out_pixel += 4;
- in_pixel += 4;
- }
+ for (i=0; i<n_pixels; i++)
+ {
+ out_pixel[0] = (in_pixel[0] - black_level) * gain;
+ out_pixel[1] = (in_pixel[1] - black_level) * gain;
+ out_pixel[2] = (in_pixel[2] - black_level) * gain;
+ out_pixel[3] = in_pixel[3];
+
+ out_pixel += 4;
+ in_pixel += 4;
+ }
return TRUE;
}
@@ -117,13 +100,12 @@ static const char* kernel_source =
"__kernel void kernel_exposure(__global const float4 *in, \n"
" __global float4 *out, \n"
" float black_level, \n"
-" float gain, \n"
-" float gamma) \n"
+" float gain) \n"
"{ \n"
" int gid = get_global_id(0); \n"
" float4 in_v = in[gid]; \n"
" float4 out_v; \n"
-" out_v.xyz = pow(((in_v.xyz - black_level) * gain), 1.0/gamma); \n"
+" out_v.xyz = ((in_v.xyz - black_level) * gain) \n"
" out_v.w = in_v.w; \n"
" out[gid] = out_v; \n"
"} \n";
@@ -150,7 +132,6 @@ cl_process (GeglOperation *op,
gfloat exposure_negated = (gfloat) -o->exposure;
gfloat gain;
gfloat white;
- gfloat gamma = 1.0 / o->gamma;
cl_int cl_err = 0;
@@ -169,7 +150,6 @@ cl_process (GeglOperation *op,
cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 1, sizeof(cl_mem), (void*)&out_tex);
cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 2, sizeof(cl_float), (void*)&black_level);
cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 3, sizeof(cl_float), (void*)&gain);
- cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 4, sizeof(cl_float), (void*)&gamma);
if (cl_err != CL_SUCCESS) return cl_err;
cl_err = gegl_clEnqueueNDRangeKernel(gegl_cl_get_command_queue (),
@@ -201,6 +181,7 @@ gegl_op_class_init (GeglOpClass *klass)
"title", _("Exposure"),
"categories", "color",
"description", _("Changes Exposure of an image, allows stepping HDR and photographs up/down in stops. "),
+ "op-version", "1:0",
NULL);
}
diff --git a/tests/simple/test-serialize.c b/tests/simple/test-serialize.c
index 20cf50d..ed8eba5 100644
--- a/tests/simple/test-serialize.c
+++ b/tests/simple/test-serialize.c
@@ -73,7 +73,7 @@ TestCase tests[] = {
{"exposure foo=2",
"gegl:exposure",
- "gegl:exposure has no foo property, properties: 'black-level', 'exposure', 'gamma', "},
+ "gegl:exposure has no foo property, properties: 'black-level', 'exposure', "},
{"over aux=[text string='foo bar']",
"svg:src-over aux=[ gegl:text string='foo bar' width=33 height=7 ]",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]