Update of /cvsroot/ufraw/ufraw
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv25999
Modified Files:
dcraw_api.cc dcraw_api.h dcraw_indi.c ufraw_conf.c
ufraw_preview.c ufraw_settings.cc ufraw_ufraw.c
Log Message:
Remove annoying messages for unsupported camera-wb.
Remove redundant messages of ChannelMultipliers: value too small.
Do not show "Camera WB" combo option for cameras that don't support it.
Show a warning icon instead.
Index: dcraw_indi.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw_indi.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- dcraw_indi.c 23 Jan 2010 05:00:58 -0000 1.80
+++ dcraw_indi.c 23 Feb 2010 19:36:43 -0000 1.81
@@ -210,33 +210,26 @@
#endif
}
-void CLASS scale_colors_INDI(ushort (*image)[4], int maximum, const int black,
- const int use_auto_wb, const int use_camera_wb, const float cam_mul[4],
- const unsigned iheight, const unsigned iwidth, const int colors,
+void CLASS scale_colors_INDI(int maximum, const int black,
+ const int use_camera_wb, const float cam_mul[4], const int colors,
float pre_mul[4], const unsigned filters, /*const*/ ushort white[8][8],
- const int shrink, const char *ifname_display, void *dcraw)
+ const char *ifname_display, void *dcraw)
{
- unsigned /*bottom, right, size,*/ row, col, /*ur, uc, i,*/ x, y, c, sum[8];
+ unsigned /*bottom, right, size,*/ row, col, /*ur, uc, i, x, y,*/ c, sum[8];
int val, dark, sat;
- double dsum[8], dmin, dmax;
+ double /*dsum[8],*/ dmin, dmax;
float scale_mul[4]/*, fr, fc*/;
#if 0
ushort *img=0, *pix;
if (user_mul[0])
memcpy (pre_mul, user_mul, sizeof pre_mul);
-#endif
if (use_auto_wb || (use_camera_wb && cam_mul[0] == -1)) {
memset (dsum, 0, sizeof dsum);
-#if 0
bottom = MIN (greybox[1]+greybox[3], height);
right = MIN (greybox[0]+greybox[2], width);
for (row=greybox[1]; row < bottom; row += 8)
for (col=greybox[0]; col < right; col += 8) {
-#else
- for (row=0; row < iheight-7; row += 8)
- for (col=0; col < iwidth-7; col += 8) {
-#endif
memset (sum, 0, sizeof sum);
for (y=row; y < row+8 /*&& y < bottom*/; y++)
for (x=col; x < col+8 /*&& x < right*/; x++)
@@ -257,6 +250,7 @@
}
FORC4 if (dsum[c]) pre_mul[c] = dsum[c+4] / dsum[c];
}
+#endif
if (use_camera_wb && cam_mul[0] != -1) {
memset (sum, 0, sizeof sum);
for (row=0; row < 8; row++)
@@ -274,6 +268,9 @@
else
dcraw_message (dcraw, DCRAW_NO_CAMERA_WB,
_("%s: Cannot use camera white balance.\n"), ifname_display);
+ } else {
+ dcraw_message (dcraw, DCRAW_NO_CAMERA_WB,
+ _("%s: Cannot use camera white balance.\n"), ifname_display);
}
if (pre_mul[3] == 0) pre_mul[3] = colors < 4 ? pre_mul[1] : 1;
dark = black;
Index: ufraw_settings.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_settings.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ufraw_settings.cc 22 Feb 2010 23:27:20 -0000 1.6
+++ ufraw_settings.cc 23 Feb 2010 19:36:43 -0000 1.7
@@ -15,6 +15,7 @@
#endif
#include "ufraw.h"
+#include "dcraw_api.h"
#include <glib/gi18n.h>
#include <string.h>
#include <assert.h>
@@ -250,7 +251,7 @@
if (uf == NULL)
return;
if (uf->rgbMax == 0) { // Raw file was not loaded yet.
- if (!wb.IsEqual(uf_manual_wb) && !wb.IsEqual(uf_manual_wb))
+ if (!wb.IsEqual(uf_manual_wb))
uf->WBDirty = true; // ChannelMultipliers should be calculated later
return;
}
@@ -266,6 +267,13 @@
if (uf == NULL)
return;
+ dcraw_data *raw = static_cast<dcraw_data *>(uf->raw);
+ if (strcmp(uf->conf->make, raw->make) != 0 ||
+ strcmp(uf->conf->model, raw->model) != 0)
+ uf->WBDirty = TRUE; // Re-calculate channel multipliers.
+ g_strlcpy(uf->conf->make, raw->make, max_name);
+ g_strlcpy(uf->conf->model, raw->model, max_name);
+
const wb_data *lastPreset = NULL;
uf->wb_presets_make_model_match = FALSE;
char model[max_name];
@@ -282,6 +290,20 @@
for (int i = 0; i<wb_preset_count; i++) {
if (strcmp(wb_preset[i].make, "") == 0) {
/* Common presets */
+ if (strcmp(wb_preset[i].name, uf_camera_wb) == 0) {
+ // Get the camera's presets.
+ int status=dcraw_set_color_scale(raw, TRUE);
+ // Failure means that dcraw does not support this model.
+ if (status != DCRAW_SUCCESS) {
+ if (wb.IsEqual(uf_camera_wb)) {
+ ufraw_message(UFRAW_SET_LOG,
+ _("Cannot use camera white balance, "
+ "reverting to auto white balance.\n"));
+ wb.Set(uf_auto_wb);
+ }
+ continue;
+ }
+ }
wb << new UFString(ufPreset, wb_preset[i].name);
} else if (strcmp(wb_preset[i].make, uf->conf->make) == 0 &&
strcmp(wb_preset[i].model, model) == 0) {
Index: ufraw_preview.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_preview.c,v
retrieving revision 1.341
retrieving revision 1.342
diff -u -d -r1.341 -r1.342
--- ufraw_preview.c 23 Feb 2010 06:20:50 -0000 1.341
+++ ufraw_preview.c 23 Feb 2010 19:36:43 -0000 1.342
@@ -2302,7 +2302,7 @@
double dy, dx = sqrt(aspect * (CFG->CropX2 - CFG->CropX1) *
(CFG->CropY2 - CFG->CropY1));
int i;
- for (i=0;i<10;i++) {
+ for (i=0;i<20;i++) {
if (cursor == top_left_cursor ||
cursor == bottom_left_cursor) {
if (CFG->CropX2 < dx)
@@ -4280,26 +4280,31 @@
/* Start of White Balance setting page */
table = GTK_TABLE(table_with_frame(page, NULL, TRUE));
- subTable = GTK_TABLE(gtk_table_new(10, 1, FALSE));
- gtk_table_attach(table, GTK_WIDGET(subTable), 0, 1, 0, 1,
- GTK_EXPAND|GTK_FILL, 0, 0, 0);
- combo = GTK_COMBO_BOX(ufarray_combo_box_new(ufgroup_element(image, ufWB)));
- gboolean make_model_match = uf->wb_presets_make_model_match;
- gtk_table_attach(subTable, GTK_WIDGET(combo), 0, 5+make_model_match, 0, 1,
- GTK_FILL, 0, 0, 0);
+ box = GTK_BOX(gtk_hbox_new(FALSE, 0));
+ gtk_table_attach(table, GTK_WIDGET(box), 0, 8, 0, 1,
+ GTK_EXPAND|GTK_FILL, 0, 0, 0);
+ UFObject *wb = ufgroup_element(image, ufWB);
+ combo = GTK_COMBO_BOX(ufarray_combo_box_new(wb));
+ gtk_box_pack_start(box, GTK_WIDGET(combo), TRUE, TRUE, 0);
uf_widget_set_tooltip(GTK_WIDGET(combo), _("White Balance"));
button = ufnumber_spin_button_new(
ufgroup_element(image, ufWBFineTuning));
- gtk_table_attach(subTable, button, 5+make_model_match, 6+make_model_match,
- 0, 1, GTK_SHRINK, 0, 0, 0);
- if (!make_model_match) {
+ gtk_box_pack_start(box, button, FALSE, FALSE, 0);
+ if (!ufgroup_has(wb, uf_camera_wb)) {
event_box = gtk_event_box_new();
label = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_BUTTON);
gtk_container_add(GTK_CONTAINER(event_box), label);
- gtk_table_attach(subTable, event_box, 6, 7, 0, 1, GTK_FILL, 0, 0, 0);
+ gtk_box_pack_start(box, event_box, FALSE, FALSE, 0);
+ uf_widget_set_tooltip(event_box, _("Cannot use camera white balance."));
+ } else if (!uf->wb_presets_make_model_match) {
+ event_box = gtk_event_box_new();
+ label = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_container_add(GTK_CONTAINER(event_box), label);
+ gtk_box_pack_start(box, event_box, FALSE, FALSE, 0);
uf_widget_set_tooltip(event_box,
_("There are no white balance presets for your camera model.\n"
"Check UFRaw's webpage for information on how to get your\n"
@@ -4309,31 +4314,36 @@
_("Reset white balance to initial value"));
ufobject_reset_button_add(resetWB, ufgroup_element(image, ufWB));
ufobject_reset_button_add(resetWB, ufgroup_element(image, ufWBFineTuning));
- gtk_table_attach(subTable, resetWB, 7, 8, 0, 1, 0, 0, 0, 0);
+ gtk_box_pack_start(box, resetWB, FALSE, FALSE, 0);
ufobject_set_user_data(image, data);
ufobject_set_changed_event_handle(image, ufraw_image_changed);
+
+ subTable = GTK_TABLE(gtk_table_new(10, 1, FALSE));
+ gtk_table_attach(table, GTK_WIDGET(subTable), 0, 1, 1, 2,
+ GTK_EXPAND|GTK_FILL, 0, 0, 0);
ufnumber_adjustment_scale(ufgroup_element(image, ufTemperature), subTable,
- 0, 1, _("Temperature"), _("White balance color temperature (K)"));
+ 0, 0, _("Temperature"), _("White balance color temperature (K)"));
ufnumber_adjustment_scale(ufgroup_element(image, ufGreen), subTable,
- 0, 2, _("Green"), _("Green component"));
+ 0, 1, _("Green"), _("Green component"));
// Spot WB button:
button = stock_icon_button(GTK_STOCK_COLOR_PICKER,
_("Select a spot on the preview image to apply spot white balance"),
G_CALLBACK(spot_wb_event), NULL);
- gtk_table_attach(subTable, button, 7, 8, 1, 3, 0, 0, 0, 0);
+ gtk_table_attach(subTable, button, 7, 8, 0, 2, 0, 0, 0, 0);
- GtkBox *subbox = GTK_BOX(gtk_hbox_new(0, 0));
- gtk_table_attach(table, GTK_WIDGET(subbox), 0, 1, 1, 2, 0, 0, 0, 0);
+ box = GTK_BOX(gtk_hbox_new(0, 0));
+ gtk_table_attach(table, GTK_WIDGET(box), 0, 1, 2, 3, 0, 0, 0, 0);
label = gtk_label_new(_("Chan. multipliers:"));
- gtk_box_pack_start(subbox, label, 0, 0, 0);
+ gtk_box_pack_start(box, label, FALSE, FALSE, 0);
for (i=0; i<data->UF->colors; i++) {
button = ufnumber_array_spin_button_new(
ufgroup_element(image, ufChannelMultipliers), i);
- gtk_box_pack_start(subbox, button, 0, 0, 0);
+ gtk_box_pack_start(box, button, FALSE, FALSE, 0);
}
ufobject_reset_button_add(resetWB,
ufgroup_element(image, ufChannelMultipliers));
+
/* Interpolation is temporarily in the WB page */
table = GTK_TABLE(table_with_frame(page, NULL, TRUE));
// box = GTK_BOX(gtk_hbox_new(FALSE, 6));
Index: ufraw_conf.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_conf.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- ufraw_conf.c 21 Feb 2010 10:03:55 -0000 1.160
+++ ufraw_conf.c 23 Feb 2010 19:36:43 -0000 1.161
@@ -865,13 +865,13 @@
ufraw_message(UFRAW_REPORT, NULL);
conf->version = 0;
}
- }
#ifdef HAVE_LENSFUN
- if (conf->ufobject != NULL) {
- UFObject *lensfun = ufgroup_drop(conf->ufobject, ufLensfun);
- ufobject_delete(lensfun);
- }
+ if (conf->ufobject != NULL) {
+ UFObject *lensfun = ufgroup_drop(conf->ufobject, ufLensfun);
+ ufobject_delete(lensfun);
+ }
#endif
+ }
}
int conf_save(conf_data *c, char *IDFilename, char **confBuffer)
Index: ufraw_ufraw.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v
retrieving revision 1.243
retrieving revision 1.244
diff -u -d -r1.243 -r1.244
--- ufraw_ufraw.c 23 Feb 2010 01:29:59 -0000 1.243
+++ ufraw_ufraw.c 23 Feb 2010 19:36:43 -0000 1.244
@@ -418,13 +418,6 @@
}
if (ufobject_name(uf->conf->ufobject) != ufRawImage)
g_warning("uf->conf->ufobject is not a ufRawImage");
- dcraw_data *raw = uf->raw;
- if (strcmp(uf->conf->make, raw->make) != 0 ||
- strcmp(uf->conf->model, raw->model) != 0)
- uf->WBDirty =TRUE; // Re-calculate channel multipliers.
- // make, model are used in ufraw_image_set_data()
- g_strlcpy(uf->conf->make, raw->make, max_name);
- g_strlcpy(uf->conf->model, raw->model, max_name);
/*Reset EXIF data text fields to avoid spill over between images.*/
strcpy(uf->conf->isoText, "");
strcpy(uf->conf->shutterText, "");
@@ -445,6 +438,7 @@
ufraw_lensfun_init(uf);
#endif
+ dcraw_data *raw = uf->raw;
char *absname = uf_file_set_absolute(uf->filename);
g_strlcpy(uf->conf->inputFilename, absname, max_path);
g_free(absname);
@@ -677,7 +671,7 @@
/* Here ufobject's automation goes against us. A change in
* ChannelMultipliers might change ufWB to uf_manual_wb.
* So we need to change it back. */
- if (!ufarray_is_equal(wb, uf_auto_wb))
+ if (ufarray_is_equal(wb, uf_manual_wb))
ufobject_set_string(wb, oldWB);
ufnumber_set(wbTuning, oldTuning);
g_free(oldWB);
@@ -1923,7 +1917,7 @@
{
dcraw_data *raw = uf->raw;
double rgbWB[3];
- int status, c, cc, i;
+ int c, cc, i;
UFObject *temperature = ufgroup_element(uf->conf->ufobject, ufTemperature);
UFObject *green = ufgroup_element(uf->conf->ufobject, ufGreen);
UFObject *chanMul = ufgroup_element(uf->conf->ufobject,
@@ -2008,24 +2002,8 @@
ufnumber_array_set(chanMul, chanMulArray);
ufnumber_set(wbTuning, 0);
} else if (ufarray_is_equal(wb, uf_camera_wb)) {
- if ( (status=dcraw_set_color_scale(raw,
- ufarray_is_equal(wb, uf_auto_wb),
- ufarray_is_equal(wb, uf_camera_wb)))!=DCRAW_SUCCESS ) {
- if (status==DCRAW_NO_CAMERA_WB) {
- ufraw_message(UFRAW_BATCH_MESSAGE,
- _("Cannot use camera white balance, "
- "reverting to auto white balance."));
- ufraw_message(UFRAW_INTERACTIVE_MESSAGE,
- _("Cannot use camera white balance, "
- "reverting to auto white balance."));
- ufobject_set_string(wb, uf_auto_wb);
- return UFRAW_SUCCESS;
- }
- if (status!=DCRAW_SUCCESS)
- return status;
- }
- double chanMulArray[4];
- for (c=0; c < 4; c++)
+ double chanMulArray[4] = { 1.0, 1.0, 1.0, 1.0 };
+ for (c=0; c < uf->colors; c++)
chanMulArray[c] = raw->post_mul[c];
ufnumber_array_set(chanMul, chanMulArray);
ufnumber_set(wbTuning, 0);
Index: dcraw_api.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw_api.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- dcraw_api.h 23 Jan 2010 05:00:58 -0000 1.40
+++ dcraw_api.h 23 Feb 2010 19:36:43 -0000 1.41
@@ -62,7 +62,7 @@
int dcraw_image_resize(dcraw_image_data *image, int size);
int dcraw_image_stretch(dcraw_image_data *image, double pixel_aspect);
int dcraw_flip_image(dcraw_image_data *image, int flip);
-int dcraw_set_color_scale(dcraw_data *h, int useAutoWB, int useCameraWB);
+int dcraw_set_color_scale(dcraw_data *h, int useCameraWB);
void dcraw_wavelet_denoise(dcraw_data *h, float threshold);
void dcraw_wavelet_denoise_shrinked(dcraw_image_data *f, float threshold);
void dcraw_finalize_raw(dcraw_data *h, dcraw_data *dark, int rgbWB[4]);
Index: dcraw_api.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw_api.cc,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- dcraw_api.cc 23 Jan 2010 05:00:58 -0000 1.66
+++ dcraw_api.cc 23 Feb 2010 19:36:43 -0000 1.67
@@ -39,11 +39,10 @@
const int iheight, const int iwidth, const int height, const int width,
const int colors, const int shrink, const float pre_mul[4],
const float threshold, const unsigned filters);
-void scale_colors_INDI(gushort (*image)[4], const int maximum, const int black,
- const int use_auto_wb, const int use_camera_wb, const float cam_mul[4],
- const unsigned iheight, const unsigned iwidth, const int colors,
+void scale_colors_INDI(const int maximum, const int black,
+ const int use_camera_wb, const float cam_mul[4], const int colors,
float pre_mul[4], const unsigned filters, /*const*/ gushort white[8][8],
- const int shrink, const char *ifname_display, void *dcraw);
+ const char *ifname_display, void *dcraw);
void lin_interpolate_INDI(gushort (*image)[4], const unsigned filters,
const int width, const int height, const int colors, void *dcraw);
void vng_interpolate_INDI(gushort (*image)[4], const unsigned filters,
@@ -127,6 +126,11 @@
h->colors = d->colors;
h->filters = d->filters;
h->raw_color = d->raw_color;
+ memcpy(h->cam_mul, d->cam_mul, sizeof d->cam_mul);
+ // maximun and black might change during load_raw. We need them for the
+ // camera-wb. If they'll change we will recalculate the camera-wb.
+ h->rgbMax = d->maximum;
+ h->black = d->black;
h->shrink = d->shrink = (h->filters!=0);
h->pixel_aspect = d->pixel_aspect;
/* copied from dcraw's main() */
@@ -225,6 +229,8 @@
}
fclose(d->ifp);
h->ifp = NULL;
+ // TODO: Go over the following settings to see if they change during
+ // load_raw. If they change, document where. If not, move to dcraw_open().
h->rgbMax = d->maximum;
h->black = d->black;
d->dcraw_message(DCRAW_VERBOSE,_("Black: %d, Maximum: %d\n"),
@@ -233,13 +239,7 @@
for (i=0; i<h->colors; i++) if (dmin > d->pre_mul[i]) dmin = d->pre_mul[i];
for (i=0; i<h->colors; i++) h->pre_mul[i] = d->pre_mul[i]/dmin;
if (h->colors==3) h->pre_mul[3] = 0;
- memcpy(h->cam_mul, d->cam_mul, sizeof d->cam_mul);
memcpy(h->rgb_cam, d->rgb_cam, sizeof d->rgb_cam);
- // set post_mul in case wavelet_denoise() is called and scale_colors()
- // was never called.
- memcpy(h->post_mul, h->pre_mul, sizeof h->post_mul);
- if (h->post_mul[3] == 0)
- h->post_mul[3] = h->colors < 4 ? h->post_mul[1] : 1;
double rgb_cam_transpose[4][3];
for (i=0; i<4; i++) for (j=0; j<3; j++)
@@ -567,20 +567,22 @@
return DCRAW_SUCCESS;
}
-int dcraw_set_color_scale(dcraw_data *h, int useAutoWB, int useCameraWB)
+int dcraw_set_color_scale(dcraw_data *h, int useCameraWB)
{
DCRaw *d = (DCRaw *)h->dcraw;
g_free(d->messageBuffer);
d->messageBuffer = NULL;
d->lastStatus = DCRAW_SUCCESS;
memcpy(h->post_mul, h->pre_mul, sizeof h->post_mul);
- if (!d->is_foveon) /* foveon_interpolate() do this. */
- /* BUG white should not be global */
- scale_colors_INDI(h->raw.image,
- h->rgbMax-h->black, h->black, useAutoWB, useCameraWB,
- h->cam_mul, h->raw.height, h->raw.width, h->raw.colors,
- h->post_mul, h->filters, d->white, h->shrink,
+ if (d->is_foveon) {
+ // foveon_interpolate() applies the camera-wb already.
+ for (int c=0; c<4; c++)
+ h->post_mul[c] = 1.0;
+ } else {
+ scale_colors_INDI(h->rgbMax-h->black, h->black, useCameraWB,
+ h->cam_mul, h->raw.colors, h->post_mul, h->filters, d->white,
d->ifname_display, d);
+ }
h->message = d->messageBuffer;
return d->lastStatus;
}
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs