Hi,
Thanks for the answer.

Le Wed, 03 Dec 2008 06:23:05 +0100,
Anders Brander <[EMAIL PROTECTED]> a écrit :

> Hi,
> 
> On Mon, 2008-12-01 at 10:41 +0100, Ille wrote:
> > I'm still trying to improve the foveon/x3f support in rawstudio.
> > I can now reload the x3f, giving the user the ability to
> > change on the fly the in-camera white balance set when shooting
> > (Sunlight, Shade, Overcast, Incandescent, Fluorescent, Flash, Auto
> > or Custom). But as stated, it needs a full reload of the file, so I
> > can't have different camera WB settings for each snapshot.
> > 
> > I would like to access the rs->toolbox widget from within
> > x3f-meta.c to be able to add a notebook page when loading a x3f
> > file. Is there a way to do it using photo->parent, which is a
> > GObject?
> 
> All functions in meta-loaders must be self-contained, or at least not
> require anything from the GUI.

OK, but then maybe I can add a popup window?
> 
> As of now there really isn't any easy way to do what you're proposing
> in Rawstudio - I have an idea thou:
> 
> Abstract the white balance somewhat away from RSMetadata, and let the
> metaloaders export a list of possible white balances the
> toolbox/toolchain can select from at a later stage.
> 
> Maybe it can even be simpler, add a simple struct:
>  
> typedef struct _RSWhiteBalance {
>   const gchar *title; /* FIXME: Should this be translated? */
>   gfloat *multipliers[4]; /* Multipliers for R, G, B and G2 */
>   gfloat temperature; /* Unused by now, prepare for the future */
> } RSWhiteBalance;
> 
> In RSMetadata, the following fields could replace cam_mul:
>   GSList wb; /* A list of white balances to choose from */
>   gint current_wb; /* An index to use with g_slist_nth_data() */
> 
> It's a somewhat big change thou...

Well, x3f files store all in-camera White Balance settings as 3x3
matrix. But the white balance correction is applied by dcraw at the
very first beginning of foveon_interpolate. My purpose was to override
the white balance setting which was set when shooting. For this I
modified dcraw_api.cc
I didn't want to make so big changes to rawstudio, because foveon based
camera are quiet rare compared to other brands.
Maybe it could be possible to add a page in the notebook which already
contains the toolbox, batchbox and dir_selector, and keep this page for
meta-loaders usage? Or add a #define X3F_SPECIFIC so that users can
choose at compile-time if they want some extra features for X3F?

By the way, I think there is a bug when opening x3f files which do NOT
need demosaic. Those are actually opened at double size, causing the
preview to be a little bit blurry... I join a patch to correct this
behaviour. The patch also take care of the auto-rotation of the x3f
thumbnail and image.

Regards
Ille

> 
> /abrander
> 
> 
> 
> _______________________________________________
> Rawstudio-dev mailing list
> [email protected]
> http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-dev
diff -ur rawstudio-svn2079.orig/src/dcraw_api.cc rawstudio-x3f/src/dcraw_api.cc
--- rawstudio-svn2079.orig/src/dcraw_api.cc	2008-10-28 04:15:03.000000000 +0100
+++ rawstudio-x3f/src/dcraw_api.cc	2008-12-04 01:32:27.000000000 +0100
@@ -123,6 +123,7 @@
     h->raw.image = NULL;
     h->thumbType = unknown_thumb_type;
     h->message = d->messageBuffer;
+    h->is_foveon = d->is_foveon;
     return d->lastStatus;
 }
 
diff -ur rawstudio-svn2079.orig/src/dcraw_api.h rawstudio-x3f/src/dcraw_api.h
--- rawstudio-svn2079.orig/src/dcraw_api.h	2008-10-28 04:15:03.000000000 +0100
+++ rawstudio-x3f/src/dcraw_api.h	2008-12-04 01:42:40.000000000 +0100
@@ -49,6 +49,7 @@
     float iso_speed, shutter, aperture, focal_len;
     time_t timestamp;
     char make[80], model[80];
+    int is_foveon;
     int thumbType, thumbOffset, thumbBufferLength;
 } dcraw_data;
 
diff -ur rawstudio-svn2079.orig/src/x3f-meta.c rawstudio-x3f/src/x3f-meta.c
--- rawstudio-svn2079.orig/src/x3f-meta.c	2008-10-28 04:15:03.000000000 +0100
+++ rawstudio-x3f/src/x3f-meta.c	2008-12-04 10:39:53.000000000 +0100
@@ -140,7 +140,8 @@
 	raw_get_ushort(rawfile, G_STRUCT_OFFSET(X3F_FILE, version_minor), &file.version_minor);
 	raw_get_uint(rawfile, G_STRUCT_OFFSET(X3F_FILE, rotation), &file.rotation);
 	raw_get_uint(rawfile, raw_get_filesize(rawfile)-4, &file.directory_start);
-
+	meta->orientation=file.rotation;
+	
 	if ((file.version_major == 2) && (file.version_minor == 2))
 	{
 		/* Copy all data types in one go */
@@ -279,6 +280,12 @@
 
 	if (pixbuf)
 	{
+		if (file.rotation > 0)
+		{
+			pixbuf2=gdk_pixbuf_rotate_simple(pixbuf,360-file.rotation);
+			g_object_unref(pixbuf);
+			pixbuf=pixbuf2;
+		}
 		ratio = ((gdouble) gdk_pixbuf_get_width(pixbuf))/((gdouble) gdk_pixbuf_get_height(pixbuf));
 		if (ratio>1.0)
 			pixbuf2 = gdk_pixbuf_scale_simple(pixbuf, 128, (gint) (128.0/ratio), GDK_INTERP_BILINEAR);
diff -ur rawstudio-svn2079.orig/src/dcraw.cc rawstudio-svn2079/src/dcraw.cc
--- rawstudio-svn2079.orig/src/dcraw.cc	2008-10-28 04:15:03.000000000 +0100
+++ rawstudio-svn2079/src/dcraw.cc	2008-12-01 11:06:29.000000000 +0100
@@ -3387,6 +3387,7 @@
       FORC3 {
 	i = image[row*width+col][c] + ipix[c] - sum;
 	if (i < 0) i = 0;
+	if (i > 4095) i = 4095;
 	image[row*width+col][c] = i;
       }
     }
diff -ur rawstudio-svn2079.orig/src/rs-image.c rawstudio-svn2079/src/rs-image.c
--- rawstudio-svn2079.orig/src/rs-image.c	2008-10-28 04:15:03.000000000 +0100
+++ rawstudio-svn2079/src/rs-image.c	2008-12-01 13:54:57.000000000 +0100
@@ -1224,7 +1224,7 @@
 	{
 		dcraw_load_raw(raw);
 
-		if (half_size)
+		if (half_size || raw->is_foveon)
 		{
 			image = rs_image16_new(raw->raw.width, raw->raw.height, raw->raw.colors, 4);
 			rs_image16_open_dcraw_apply_black_and_shift_half_size(raw, image);
_______________________________________________
Rawstudio-dev mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-dev

Reply via email to