[gimp] plug-ins: 64bit double saving support for file-fits



commit d9cebfadb0401a4a62577612e484a00d68ffe1dd
Author: Michael Natterer <mitch gimp org>
Date:   Mon Oct 6 13:19:20 2014 +0200

    plug-ins: 64bit double saving support for file-fits
    
    Quickly hacked up, loads again using the plug-in.

 plug-ins/file-fits/fits.c |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/file-fits/fits.c b/plug-ins/file-fits/fits.c
index a4d4a4a..5889fe9 100644
--- a/plug-ins/file-fits/fits.c
+++ b/plug-ins/file-fits/fits.c
@@ -596,7 +596,7 @@ load_fits (const gchar *filename,
       replacetransform = 1.0 / 255.0;
       break;
     case -64:
-      iprecision = GIMP_PRECISION_FLOAT_LINEAR;
+      iprecision = GIMP_PRECISION_DOUBLE_LINEAR;
       type = babl_type ("double");
       datamax = 1.0;
       replacetransform = 1.0 / 255.0;
@@ -649,7 +649,8 @@ load_fits (const gchar *filename,
                                 NULL);
     }
 
-  image_ID = create_new_image (filename, picnum, width, height, itype, dtype, iprecision,
+  image_ID = create_new_image (filename, picnum, width, height,
+                               itype, dtype, iprecision,
                                &layer_ID, &buffer);
 
   tile_height = gimp_tile_height ();
@@ -870,6 +871,7 @@ create_fits_header (FitsFile *ofp,
       break;
     case -64:
       hdulist->datamax = 1.0;
+      break;
     default:
       return NULL;
     }
@@ -933,14 +935,18 @@ save_fits (FitsFile *ofp,
     {
       bitpix = 32;
     }
-  else if (type == babl_type ("float"))
+  else if (type == babl_type ("half"))
     {
       bitpix = -32;
+      type = babl_type ("float");
     }
-  else if (type == babl_type ("half"))
+  else if (type == babl_type ("float"))
     {
       bitpix = -32;
-      type = babl_type ("float");
+    }
+  else if (type == babl_type ("double"))
+    {
+      bitpix = -64;
     }
   else
     {
@@ -1073,6 +1079,20 @@ save_fits (FitsFile *ofp,
                     src += bpp;
                   }
                 break;
+              case -64:
+                for (j = 0; j < width; j++)
+                  {
+                    putc (*(src + 7), ofp->fp);
+                    putc (*(src + 6), ofp->fp);
+                    putc (*(src + 5), ofp->fp);
+                    putc (*(src + 4), ofp->fp);
+                    putc (*(src + 3), ofp->fp);
+                    putc (*(src + 2), ofp->fp);
+                    putc (*(src + 1), ofp->fp);
+                    putc (*(src + 0), ofp->fp);
+                    src += bpp;
+                  }
+                break;
               default:
                 return FALSE;
               }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]