Revision: 56578
http://sourceforge.net/p/brlcad/code/56578
Author: mohitdaga
Date: 2013-08-05 13:56:01 +0000 (Mon, 05 Aug 2013)
Log Message:
-----------
Add ICV_CONV_8BIT macro for encoding conversions. This macro converts the 8bit
pixel values to icv data type(double). Later we can have similar macros for
higher resolution of images. For eg ICV_CONV_16BIT.
Modified Paths:
--------------
brlcad/trunk/include/icv.h
brlcad/trunk/src/libicv/encoding.c
brlcad/trunk/src/libicv/fileformat.c
Modified: brlcad/trunk/include/icv.h
===================================================================
--- brlcad/trunk/include/icv.h 2013-08-05 13:53:09 UTC (rev 56577)
+++ brlcad/trunk/include/icv.h 2013-08-05 13:56:01 UTC (rev 56578)
@@ -129,7 +129,15 @@
*/
#define ICV_IMAGE_IS_INITIALIZED(_i) (((struct icv_image *)(_i) !=
ICV_IMAGE_NULL) && LIKELY((_i)->magic == ICV_IMAGE_MAGIC))
+
+/* Data conversion MACROS */
+
/**
+ * Converts to double (icv data) type from unsigned char(8bit).
+ */
+#define ICV_CONV_8BIT(data) ((double)(data))/255.0
+
+/**
* Finds the Image format based on heuristics depending on the file name.
* @param filename Filename of the image whose format is to be know.
* @param trimmedname Buffer for storing filename after removing extensions
Modified: brlcad/trunk/src/libicv/encoding.c
===================================================================
--- brlcad/trunk/src/libicv/encoding.c 2013-08-05 13:53:09 UTC (rev 56577)
+++ brlcad/trunk/src/libicv/encoding.c 2013-08-05 13:56:01 UTC (rev 56578)
@@ -52,7 +52,7 @@
char_p = data;
double_p = double_data = (double *) bu_malloc(size*sizeof(double),
"uchar2data : double data");
for (i=0; i<size; i++) {
- *double_p = ((double)(*char_p))/255.0;
+ *double_p = ICV_CONV_8BIT(*char_p);
double_p++;
char_p++;
}
Modified: brlcad/trunk/src/libicv/fileformat.c
===================================================================
--- brlcad/trunk/src/libicv/fileformat.c 2013-08-05 13:53:09 UTC (rev
56577)
+++ brlcad/trunk/src/libicv/fileformat.c 2013-08-05 13:56:01 UTC (rev
56578)
@@ -260,7 +260,7 @@
if (type == ICV_DATA_UCHAR) {
p = data;
for (; width_size > 0; width_size--) {
- *dst = (*p)/255.0;
+ *dst = ICV_CONV_8BIT(*p);
p++;
dst++;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits