[Rawstudio-commit] r2766 - trunk/plugins/load-dcraw

Anders Brander anders at brander.dk
Mon Nov 30 17:54:40 CET 2009


Author: abrander
Date: 2009-11-30 17:54:40 +0100 (Mon, 30 Nov 2009)
New Revision: 2766

Modified:
   trunk/plugins/load-dcraw/dcrawloader.c
Log:
[312] Fixed dcraw loader for monochrome DNG images.

Modified: trunk/plugins/load-dcraw/dcrawloader.c
===================================================================
--- trunk/plugins/load-dcraw/dcrawloader.c	2009-11-29 14:41:51 UTC (rev 2765)
+++ trunk/plugins/load-dcraw/dcrawloader.c	2009-11-30 16:54:40 UTC (rev 2766)
@@ -142,7 +142,32 @@
 			}
 		}
 	}
+	else if (raw->raw.colors == 1)
+	{
+		dcraw_image_type *input;
 
+		image = rs_image16_new(raw->raw.width, raw->raw.height, 3, 4);
+
+		for(row=0 ; row < image->h ; row++)
+		{
+			output = GET_PIXEL(image, 0, row);
+			input = raw->raw.image+row*raw->raw.width;
+			for(col=0 ; col < image->w ; col++)
+			{
+				/* Copy and shift our data to fill 16 bits */
+				output[R] = *(*input) << shift;
+				output[G] = *(*input) << shift;
+				output[B] = *(*input) << shift;
+
+				/* Advance input by one dcraw_image_type */
+				input++;
+
+				/* Advance output by one pixel */
+				output += image->pixelsize;
+			}
+		}
+	}
+
 	return image;
 }
 




More information about the Rawstudio-commit mailing list