jonathan: thuban/libraries/thuban gdalwarp.cpp,1.4,1.5
cvs@intevation.de
cvs at intevation.de
Fri Jan 28 20:10:09 CET 2005
Author: jonathan
Update of /thubanrepository/thuban/libraries/thuban
In directory doto:/tmp/cvs-serv2670/libraries/thuban
Modified Files:
gdalwarp.cpp
Log Message:
Recoded how the mask is packed into the bit array.
Index: gdalwarp.cpp
===================================================================
RCS file: /thubanrepository/thuban/libraries/thuban/gdalwarp.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gdalwarp.cpp 28 Jan 2005 15:54:00 -0000 1.4
+++ gdalwarp.cpp 28 Jan 2005 19:10:07 -0000 1.5
@@ -29,6 +29,9 @@
******************************************************************************
*
* $Log$
+ * Revision 1.5 2005/01/28 19:10:07 jonathan
+ * Recoded how the mask is packed into the bit array.
+ *
* Revision 1.4 2005/01/28 15:54:00 jonathan
* Make layer's use_mask flag default to true. Support a bit array describing
* the mask to use. Improve error handling in ProjectRasterFile (also addresses
@@ -475,32 +478,44 @@
if (ret != CE_Failure)
{
- int col = 0;
- int index=0, offs = 0;
+ int i, j, b=1, c=0;
+ unsigned char *ptr = *maskbuf;
+ unsigned char *tptr = tmp;
- memset(*maskbuf, 0, *masklen);
+ //unsigned int empty_count=0;
- for (int i=0; i < nRasterXSize*nRasterYSize; i++)
+ for (i=0; i < nRasterYSize; i++)
{
- (*maskbuf)[index] |= (tmp[i] < 128) << offs;
-
- col++;
- if (col == nRasterXSize)
- {
- col = 0;
- offs = 0;
- index++;
- }
- else
+ for (j=0; j < nRasterXSize;)
{
- offs++;
- if (offs == 8)
+ if (*tptr++ < 128) c |= b;
+
+ b <<= 1;
+ if (!(++j & 7))
{
- offs = 0;
- index++;
+ //if (c==0) empty_count++;
+ *(ptr++) = c;
+ c = 0; b = 1;
}
}
+
+ if (j & 7)
+ {
+ //if (c==0) empty_count++;
+ *(ptr++) = c;
+ c = 0; b = 1;
+ }
+ }
+
+#if 0
+ if (empty_count == *masklen)
+ {
+ fprintf(stderr, "mask not used\n");
+
+ CPLFree(*maskbuf);
+ *maskbuf = NULL;
}
+#endif
}
CPLFree(tmp);
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)