[Rawstudio-commit] rawspeed r55 - RawSpeed

Klaus Post klauspost at gmail.com
Sun Feb 8 11:59:48 CET 2009


Author: post
Date: 2009-02-08 11:59:48 +0100 (Sun, 08 Feb 2009)
New Revision: 55

Modified:
   RawSpeed/TiffEntry.cpp
   RawSpeed/rawstudio-plugin-api.cpp
Log:
- RS API: Unpack 3pixels to 3 pixels+padding.
- Removed fullfilled TODO

Modified: RawSpeed/TiffEntry.cpp
===================================================================
--- RawSpeed/TiffEntry.cpp	2009-02-08 10:35:27 UTC (rev 54)
+++ RawSpeed/TiffEntry.cpp	2009-02-08 10:59:48 UTC (rev 55)
@@ -23,7 +23,6 @@
     http://www.klauspost.com
 */
 
-//TODO: Harden type checks, to be able to error out if type is wrong
 
 TiffEntry::TiffEntry() {
 }

Modified: RawSpeed/rawstudio-plugin-api.cpp
===================================================================
--- RawSpeed/rawstudio-plugin-api.cpp	2009-02-08 10:35:27 UTC (rev 54)
+++ RawSpeed/rawstudio-plugin-api.cpp	2009-02-08 10:59:48 UTC (rev 55)
@@ -64,10 +64,29 @@
 			RawImage r = d->mRaw;
 
 			cpp = r->getCpp();
+      if (cpp == 1) {
+			  image = rs_image16_new(r->dim.x, r->dim.y, cpp, cpp);
+			  BitBlt((guchar *) GET_PIXEL(image, 0, 0), image->pitch*2*cpp, r->getData(), r->pitch, r->dim.x*r->bpp, r->dim.y);
+      } else if (cpp == 3) {
+        image = rs_image16_new(r->dim.x, r->dim.y, 3, 4);
+        for(row=0;row<image->h;row++)
+        {
+          gushort *inpixel = (gushort*)&r->getData()[row*r->pitch];
+          gushort *outpixel = GET_PIXEL(image, 0, row);
+          for(col=0;col<image->w;col++)
+          {
+            *outpixel++ =  *inpixel++;
+            *outpixel++ =  *inpixel++;
+            *outpixel++ =  *inpixel++;
+             outpixel++;
+          }
+        }
+        
+      } else {
+        printf("Unsupported component per pixel count");
+        return NULL;
+      }
 
-			image = rs_image16_new(r->dim.x, r->dim.y, cpp, cpp);
-			BitBlt((guchar *) GET_PIXEL(image, 0, 0), image->pitch*2*cpp, r->getData(), r->pitch, r->dim.x*r->bpp, r->dim.y);
-
 			if (cpp==1)
 				image->filters = r->cfa.getDcrawFilter();
 




More information about the Rawstudio-commit mailing list