Update of /cvsroot/ufraw/ufraw In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv12312
Modified Files: ufraw.h ufraw_conf.c ufraw_lens_ui.c ufraw_lensfun.cc ufraw_ufraw.c Log Message: Some refactoring of the lensfun code. Index: ufraw.h =================================================================== RCS file: /cvsroot/ufraw/ufraw/ufraw.h,v retrieving revision 1.153 retrieving revision 1.154 diff -u -d -r1.153 -r1.154 --- ufraw.h 27 Feb 2010 06:36:21 -0000 1.153 +++ ufraw.h 1 Mar 2010 23:34:20 -0000 1.154 @@ -21,10 +21,6 @@ #include "uf_glib.h" #include "ufobject.h" -#ifdef HAVE_LENSFUN -#include <lensfun.h> -#endif /* HAVE_LENSFUN */ - #include "nikon_curve.h" #include "uf_progress.h" @@ -86,6 +82,9 @@ UFObject *ufraw_image_new(); #ifdef HAVE_LENSFUN UFObject *ufraw_lensfun_new(); +struct lfDatabase *ufraw_lensfun_db(); /* mount/camera/lens database */ +struct lfLens *ufraw_lensfun_transformation_lens(UFObject *lensfun); +void ufraw_lensfun_interpolate(UFObject *lensfun, const struct lfLens *lens); #endif struct ufraw_struct *ufraw_image_get_data(UFObject *obj); void ufraw_image_set_data(UFObject *obj, struct ufraw_struct *uf); @@ -284,10 +283,7 @@ char real_make[max_name], real_model[max_name]; #ifdef HAVE_LENSFUN - lfDatabase *lensdb; /* mount/camera/lens database */ - lfCamera *camera; /* camera description */ - lfLens *lens; /* lens description */ - lfLensType cur_lens_type; + struct lfCamera *camera; /* camera description */ int lensfunMode; #endif /* HAVE_LENSFUN */ } conf_data; @@ -336,8 +332,8 @@ int RawCount; #ifdef HAVE_LENSFUN int modFlags; /* postprocessing operations (LF_MODIFY_XXX) */ - lfModifier *TCAmodifier; - lfModifier *modifier; + struct lfModifier *TCAmodifier; + struct lfModifier *modifier; #endif /* HAVE_LENSFUN */ int hotpixels; gboolean mark_hotpixels; Index: ufraw_lensfun.cc =================================================================== RCS file: /cvsroot/ufraw/ufraw/ufraw_lensfun.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ufraw_lensfun.cc 1 Mar 2010 21:42:30 -0000 1.6 +++ ufraw_lensfun.cc 1 Mar 2010 23:34:21 -0000 1.7 @@ -21,6 +21,7 @@ #include <math.h> #ifdef HAVE_LENSFUN +#include <lensfun.h> #define UF_LF_TRANSFORM ( \ LF_MODIFY_DISTORTION | LF_MODIFY_GEOMETRY | LF_MODIFY_SCALE) @@ -28,9 +29,8 @@ namespace UFRaw { class Lensfun : public UFGroup { -private: - static lfDatabase *LensDB; public: + static lfDatabase *LensDB; lfLens Transformation; lfLens Interpolation; double FocalLengthValue; @@ -482,12 +482,9 @@ LensDB->Load(); } ufraw_data *uf = ufraw_image_get_data(this); - uf->conf->lensdb = LensDB; - /* Create a default lens & camera */ - uf->conf->lens = &Transformation; + /* Create a default camera */ uf->conf->camera = lf_camera_new(); - uf->conf->cur_lens_type = LF_UNKNOWN; /* Set lens and camera from EXIF info, if possible */ if (uf->conf->real_make[0] || uf->conf->real_model[0]) { @@ -601,12 +598,20 @@ } } +UFObject *ufraw_lensfun_new() { + return new Lensfun(); } -} // namespace UFRaw +struct lfLens *ufraw_lensfun_transformation_lens(UFObject *lensfun) { + return &static_cast<UFRaw::Lensfun *>(lensfun)->Transformation; +} -extern "C" UFObject *ufraw_lensfun_new() { - return new UFRaw::Lensfun(); +lfDatabase *ufraw_lensfun_db() { + return Lensfun::LensDB; } +} // extern "C" + +} // namespace UFRaw + #endif // HAVE_LENSFUN Index: ufraw_conf.c =================================================================== RCS file: /cvsroot/ufraw/ufraw/ufraw_conf.c,v retrieving revision 1.164 retrieving revision 1.165 diff -u -d -r1.164 -r1.165 --- ufraw_conf.c 27 Feb 2010 10:50:23 -0000 1.164 +++ ufraw_conf.c 1 Mar 2010 23:34:20 -0000 1.165 @@ -11,6 +11,9 @@ */ #include "ufraw.h" +#ifdef HAVE_LENSFUN +#include <lensfun.h> +#endif #include <string.h> #include <errno.h> #include <math.h> @@ -130,10 +133,7 @@ "", "", /* real_make, real_model */ #ifdef HAVE_LENSFUN - NULL, /* mount/camera/lens database */ NULL, /* camera description */ - NULL, /* lens description */ - LF_UNKNOWN, /* lens type */ lensfun_default, /* lensfun starting mode */ #endif /* HAVE_LENSFUN */ }; @@ -1388,17 +1388,11 @@ #ifdef HAVE_LENSFUN dst->lensfunMode = src->lensfunMode; - dst->lensdb = src->lensdb; if (src->camera) { dst->camera = lf_camera_new (); lf_camera_copy (dst->camera, src->camera); } - if (src->lens) - { - dst->lens = lf_lens_new (); - lf_lens_copy (dst->lens, src->lens); - } #endif /* HAVE_LENSFUN */ } Index: ufraw_lens_ui.c =================================================================== RCS file: /cvsroot/ufraw/ufraw/ufraw_lens_ui.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- ufraw_lens_ui.c 27 Feb 2010 06:36:21 -0000 1.36 +++ ufraw_lens_ui.c 1 Mar 2010 23:34:20 -0000 1.37 @@ -18,6 +18,7 @@ #include <ctype.h> #ifdef HAVE_LENSFUN +#include <lensfun.h> static void delete_children(GtkWidget *widget, gpointer data) { @@ -146,8 +147,8 @@ const gchar *txt = gtk_entry_get_text(GTK_ENTRY(data->CameraModel)); parse_maker_model(txt, make, sizeof(make), model, sizeof(model)); - const lfCamera **camlist = - lf_db_find_cameras_ext(CFG->lensdb, make, model, 0); + lfDatabase *lensdb = ufraw_lensfun_db(); + const lfCamera **camlist = lf_db_find_cameras_ext(lensdb, make, model, 0); if (camlist == NULL) return; camera_menu_fill(data, camlist); @@ -160,7 +161,8 @@ static void camera_list_clicked(GtkWidget *button, preview_data *data) { (void)button; - const lfCamera *const *camlist = lf_db_get_cameras(CFG->lensdb); + lfDatabase *lensdb = ufraw_lensfun_db(); + const lfCamera *const *camlist = lf_db_get_cameras(lensdb); if (camlist == NULL) return; @@ -183,8 +185,9 @@ static void lens_set(preview_data *data) { + UFObject *lensfun = ufgroup_element(CFG->ufobject, ufLensfun); + lfLens *lens = ufraw_lensfun_transformation_lens(lensfun); gchar *fm; - lfLens *lens = CFG->lens; const char *maker = lf_mlstr_get(lens->Maker); const char *model = lf_mlstr_get(lens->Model); @@ -236,7 +239,6 @@ /* Create the focal/aperture/distance combo boxes */ gtk_container_foreach(GTK_CONTAINER(data->LensParamBox), delete_children, NULL); - UFObject *lensfun = ufgroup_element(CFG->ufobject, ufLensfun); UFObject *FocalLength = ufgroup_element(lensfun, ufFocalLength); combo_entry_new(FocalLength, data->LensParamBox, @@ -249,12 +251,8 @@ _("Distance"), _("Distance to subject in meters")); gtk_widget_show_all(data->LensParamBox); - - CFG->cur_lens_type = LF_UNKNOWN; } -void ufraw_lensfun_interpolate(UFObject *lensfun, const lfLens *lens); - static void lens_menu_select(GtkMenuItem *menuitem, preview_data *data) { lfLens *lens = (lfLens *)g_object_get_data(G_OBJECT(menuitem), "lfLens"); @@ -317,7 +315,8 @@ const gchar *txt = gtk_entry_get_text(GTK_ENTRY(data->LensModel)); parse_maker_model(txt, make, sizeof(make), model, sizeof(model)); - const lfLens **lenslist = lf_db_find_lenses_hd(CFG->lensdb, CFG->camera, + lfDatabase *lensdb = ufraw_lensfun_db(); + const lfLens **lenslist = lf_db_find_lenses_hd(lensdb, CFG->camera, make[0] ? make : NULL, model[0] ? model : NULL, 0); if (lenslist == NULL) return; @@ -332,15 +331,16 @@ { (void)button; + lfDatabase *lensdb = ufraw_lensfun_db(); if (CFG->camera != NULL) { - const lfLens **lenslist = lf_db_find_lenses_hd(CFG->lensdb, + const lfLens **lenslist = lf_db_find_lenses_hd(lensdb, CFG->camera, NULL, NULL, 0); if (lenslist == NULL) return; lens_menu_fill(data, lenslist); lf_free(lenslist); } else { - const lfLens *const *lenslist = lf_db_get_lenses(CFG->lensdb); + const lfLens *const *lenslist = lf_db_get_lenses(lensdb); if (lenslist == NULL) return; lens_menu_fill(data, lenslist); Index: ufraw_ufraw.c =================================================================== RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v retrieving revision 1.247 retrieving revision 1.248 diff -u -d -r1.247 -r1.248 --- ufraw_ufraw.c 27 Feb 2010 06:36:21 -0000 1.247 +++ ufraw_ufraw.c 1 Mar 2010 23:34:21 -0000 1.248 @@ -12,6 +12,9 @@ #include "ufraw.h" #include "dcraw_api.h" +#ifdef HAVE_LENSFUN +#include <lensfun.h> +#endif #include <glib/gi18n.h> #include <string.h> #include <sys/stat.h> /* for fstat() */ @@ -262,6 +265,8 @@ uf->TCAmodifier = NULL; uf->modifier = NULL; #endif + uf->inputExifBuf = NULL; + uf->outputExifBuf = NULL; ufraw_message(UFRAW_SET_LOG, "ufraw_open: w:%d h:%d curvesize:%d\n", raw->width, raw->height, raw->toneCurveSize); @@ -413,6 +418,7 @@ status = conf_set_cmd(uf->conf, cmd); if (status!=UFRAW_SUCCESS) return status; } + dcraw_data *raw = uf->raw; if (ufobject_name(uf->conf->ufobject) != ufRawImage) g_warning("uf->conf->ufobject is not a ufRawImage"); /*Reset EXIF data text fields to avoid spill over between images.*/ @@ -428,6 +434,24 @@ if ( ufraw_exif_read_input(uf)!=UFRAW_SUCCESS ) { ufraw_message(UFRAW_SET_LOG, "Error reading EXIF data from %s\n", uf->filename); + } else { + g_strlcpy(uf->conf->exifSource, "DCRaw", max_name); + uf->conf->iso_speed = raw->iso_speed; + g_snprintf(uf->conf->isoText, max_name, "%d", + (int)uf->conf->iso_speed); + uf->conf->shutter = raw->shutter; + if (uf->conf->shutter>0 && uf->conf->shutter<1) + g_snprintf(uf->conf->shutterText, max_name, "1/%0.1f s", + 1/uf->conf->shutter); + else + g_snprintf(uf->conf->shutterText, max_name, "%0.1f s", + uf->conf->shutter); + uf->conf->aperture = raw->aperture; + g_snprintf(uf->conf->apertureText, max_name, "F/%0.1f", + uf->conf->aperture); + uf->conf->focal_len = raw->focal_len; + g_snprintf(uf->conf->focalLenText, max_name, "%0.1f mm", + uf->conf->focal_len); } } ufraw_image_set_data(uf->conf->ufobject, uf); @@ -435,7 +459,6 @@ 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); @@ -492,26 +515,6 @@ // Normalise rotations to a flip, then rotation of 0 < a < 90 degrees. ufraw_normalize_rotation(uf); } - - if (uf->inputExifBuf==NULL) { - g_strlcpy(uf->conf->exifSource, "DCRaw", max_name); - uf->conf->iso_speed = raw->iso_speed; - g_snprintf(uf->conf->isoText, max_name, "%d", (int)uf->conf->iso_speed); - uf->conf->shutter = raw->shutter; - if (uf->conf->shutter>0 && uf->conf->shutter<1) - g_snprintf(uf->conf->shutterText, max_name, "1/%0.1f s", - 1/uf->conf->shutter); - else - g_snprintf(uf->conf->shutterText, max_name, "%0.1f s", - uf->conf->shutter); - uf->conf->aperture = raw->aperture; - g_snprintf(uf->conf->apertureText, max_name, "F/%0.1f", - uf->conf->aperture); - uf->conf->focal_len = raw->focal_len; - g_snprintf(uf->conf->focalLenText, max_name, "%0.1f mm", - uf->conf->focal_len); - } - /* If there is an embeded curve we "turn on" the custom/camera curve * mechanism */ if (raw->toneCurveSize!=0) { ------------------------------------------------------------------------------ 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 ufraw-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ufraw-cvs