Author: akv
Date: 2011-01-18 19:30:38 +0100 (Tue, 18 Jan 2011)
New Revision: 3803

Modified:
   trunk/librawstudio/rs-image16.c
   trunk/librawstudio/rs-image16.h
Log:
Added rs_image16_get_checksum() - slow, should only be used for testing 
purposes.

Modified: trunk/librawstudio/rs-image16.c
===================================================================
--- trunk/librawstudio/rs-image16.c     2011-01-14 11:45:02 UTC (rev 3802)
+++ trunk/librawstudio/rs-image16.c     2011-01-18 18:30:38 UTC (rev 3803)
@@ -303,3 +303,31 @@
 
        return pixel;
 }
+
+gchar *
+rs_image16_get_checksum(RS_IMAGE16 *image)
+{
+       gint w = image->w;
+       gint h = image->h;
+       gint c = image->channels;
+
+       gint x, y, z;
+
+       gushort *pixels = g_new0(gushort, w*h*c);
+       gushort *pixel = NULL;
+       gushort *pixels_iter = pixels;
+
+       for (x=0; x<w; x++)
+       {
+               for (y=0; y<h; y++)
+               {
+                       pixel = rs_image16_get_pixel(image, x, y, FALSE);
+                       for (z=0; z<c; z++)
+                       {
+                               *pixels_iter = pixel[z];
+                               pixels_iter++;
+                       }
+               }
+       }
+       return g_compute_checksum_for_data(G_CHECKSUM_SHA256, (guchar *) 
pixels, w*h*c);
+}

Modified: trunk/librawstudio/rs-image16.h
===================================================================
--- trunk/librawstudio/rs-image16.h     2011-01-14 11:45:02 UTC (rev 3802)
+++ trunk/librawstudio/rs-image16.h     2011-01-18 18:30:38 UTC (rev 3803)
@@ -87,4 +87,6 @@
  */
 extern inline gushort *rs_image16_get_pixel(RS_IMAGE16 *image, gint x, gint y, 
gboolean extend_edges);
 
+extern gchar *rs_image16_get_checksum(RS_IMAGE16 *image);
+
 #endif /* RS_IMAGE16_H */


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to