Author: post
Date: 2009-11-22 17:43:32 +0100 (Sun, 22 Nov 2009)
New Revision: 2757
Modified:
trunk/plugins/dcp/dcp.c
Log:
DCP: Do exposure compensation in RGB mode.
Modified: trunk/plugins/dcp/dcp.c
===================================================================
--- trunk/plugins/dcp/dcp.c 2009-11-22 16:17:19 UTC (rev 2756)
+++ trunk/plugins/dcp/dcp.c 2009-11-22 16:43:32 UTC (rev 2757)
@@ -1314,12 +1314,8 @@
huesat_map_SSE2(dcp->huesatmap,
&dcp->huesatmap_precalc, &h, &s, &v);
}
- /* Exposure */
- v = _mm_min_ps(max_val, _mm_mul_ps(v, exp));
-
-
/* Saturation */
- s = _mm_min_ps(max_val, _mm_mul_ps(s, sat));
+ s = _mm_max_ps(min_val, _mm_min_ps(max_val,
_mm_mul_ps(s, sat)));
/* Hue */
__m128 six_ps = _mm_load_ps(_six_ps);
@@ -1334,6 +1330,18 @@
h = _mm_sub_ps(h, six_masked_gt);
h = _mm_add_ps(h, six_masked_lt);
+ HSVtoRGB_SSE(&h, &s, &v);
+ r = h; g = s; b = v;
+
+ /* Exposure */
+ r = _mm_min_ps(max_val, _mm_mul_ps(r, exp));
+ g = _mm_min_ps(max_val, _mm_mul_ps(g, exp));
+ b = _mm_min_ps(max_val, _mm_mul_ps(b, exp));
+
+ RGBtoHSV_SSE(&r, &g, &b);
+ h = r; s = g; v = b;
+
+
/* Convert v to lookup values */
/* TODO: Use 8 bit fraction as interpolation, for
interpolating
@@ -1451,8 +1459,6 @@
if (dcp->huesatmap)
huesat_map(dcp->huesatmap, &h, &s, &v);
- v = MIN(v * exposure_comp, 1.0);
-
/* Saturation */
s *= dcp->saturation;
s = MIN(s, 1.0);
@@ -1460,6 +1466,17 @@
/* Hue */
h += dcp->hue;
+ /* Back to RGB */
+ HSVtoRGB(h, s, v, &r, &g, &b);
+
+ /* Exposure Compensation */
+ r = MIN(r * exposure_comp, 1.0);
+ g = MIN(g * exposure_comp, 1.0);
+ b = MIN(b * exposure_comp, 1.0);
+
+ /* To HSV */
+ RGBtoHSV(r, g, b, &h, &s, &v);
+
/* Curve */
v = dcp->curve_samples[_S(v)];
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit