Author: abrander
Date: 2009-12-28 01:42:19 +0100 (Mon, 28 Dec 2009)
New Revision: 2866

Modified:
   branches/rawstudio-ng-color/plugins/dcp/dcp.c
   branches/rawstudio-ng-color/plugins/dcp/dcp.h
Log:
Added use-profile property to RSDcp.

Modified: branches/rawstudio-ng-color/plugins/dcp/dcp.c
===================================================================
--- branches/rawstudio-ng-color/plugins/dcp/dcp.c       2009-12-28 00:33:32 UTC 
(rev 2865)
+++ branches/rawstudio-ng-color/plugins/dcp/dcp.c       2009-12-28 00:42:19 UTC 
(rev 2866)
@@ -29,7 +29,8 @@
 enum {
        PROP_0,
        PROP_SETTINGS,
-       PROP_PROFILE
+       PROP_PROFILE,
+       PROP_USE_PROFILE
 };
 
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
@@ -86,6 +87,12 @@
                        RS_TYPE_DCP_FILE, G_PARAM_READWRITE)
        );
 
+       g_object_class_install_property(object_class,
+               PROP_USE_PROFILE, g_param_spec_boolean(
+                       "use-profile", "use-profile", "Use DCP profile",
+                       FALSE, G_PARAM_READWRITE)
+       );
+
        filter_class->name = "Adobe DNG camera profile filter";
        filter_class->get_image = get_image;
        filter_class->get_icc_profile = get_icc_profile;
@@ -261,6 +268,9 @@
                        read_profile(dcp, g_value_get_object(value));
                        rs_filter_changed(filter, RS_FILTER_CHANGED_PIXELDATA);
                        break;
+               case PROP_USE_PROFILE:
+                       dcp->use_profile = g_value_get_boolean(value);
+                       break;
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, 
pspec);
        }
@@ -751,23 +761,26 @@
                        g = _F(pixel[G]);
                        b = _F(pixel[B]);
 
-                       r = MIN(dcp->camera_white.x, r);
-                       g = MIN(dcp->camera_white.y, g);
-                       b = MIN(dcp->camera_white.z, b);
+                       if (dcp->use_profile)
+                       {
+                               r = MIN(dcp->camera_white.x, r);
+                               g = MIN(dcp->camera_white.y, g);
+                               b = MIN(dcp->camera_white.z, b);
 
-                       pix.R = r;
-                       pix.G = g;
-                       pix.B = b;
-                       pix = vector3_multiply_matrix(&pix, 
&dcp->camera_to_prophoto);
+                               pix.R = r;
+                               pix.G = g;
+                               pix.B = b;
+                               pix = vector3_multiply_matrix(&pix, 
&dcp->camera_to_prophoto);
 
-                       r = CLAMP(pix.R, 0.0, 1.0);
-                       g = CLAMP(pix.G, 0.0, 1.0);
-                       b = CLAMP(pix.B, 0.0, 1.0);
+                               r = CLAMP(pix.R, 0.0, 1.0);
+                               g = CLAMP(pix.G, 0.0, 1.0);
+                               b = CLAMP(pix.B, 0.0, 1.0);
+                       }
 
                        /* To HSV */
                        RGBtoHSV(r, g, b, &h, &s, &v);
 
-                       if (dcp->huesatmap)
+                       if (dcp->use_profile && dcp->huesatmap)
                                huesat_map(dcp->huesatmap, &h, &s, &v);
 
                        /* Saturation */
@@ -799,14 +812,14 @@
                        /* Curve */
                        v = dcp->curve_samples[_S(v)];
 
-                       if (dcp->looktable)
+                       if (dcp->use_profile && dcp->looktable)
                                huesat_map(dcp->looktable, &h, &s, &v);
 
                        /* Back to RGB */
                        HSVtoRGB(h, s, v, &r, &g, &b);
 
                        /* Apply tone curve */
-                       if (dcp->tone_curve_lut) 
+                       if (dcp->use_profile && dcp->tone_curve_lut) 
                                rgb_tone(&r, &g, &b, dcp->tone_curve_lut);
 
                        /* Save as gushort */

Modified: branches/rawstudio-ng-color/plugins/dcp/dcp.h
===================================================================
--- branches/rawstudio-ng-color/plugins/dcp/dcp.h       2009-12-28 00:33:32 UTC 
(rev 2865)
+++ branches/rawstudio-ng-color/plugins/dcp/dcp.h       2009-12-28 00:42:19 UTC 
(rev 2866)
@@ -60,6 +60,8 @@
        gfloat temp1;
        gfloat temp2;
 
+       gboolean use_profile;
+
        RSSpline *tone_curve;
        gfloat *tone_curve_lut;
 


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to