Changeset 1613
- Timestamp:
- Aug 24, 2004, 2:04:01 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 5 edited
-
dataManip/psFFT.c (modified) (1 diff)
-
dataManip/psVectorFFT.c (modified) (1 diff)
-
fft/psVectorFFT.c (modified) (1 diff)
-
image/psImageExtraction.c (modified) (2 diffs)
-
image/psImageExtraction.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psFFT.c
r1452 r1613 1 2 1 /** @file psFFT.c 3 *4 * @brief Contains FFT transforms functions5 *6 * @author Robert DeSonia, MHPCC7 *8 * @version $Revision: 1.21$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-08-10 18:54:38$10 *11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii12 */2 * 3 * @brief Contains FFT transforms functions 4 * 5 * @author Robert DeSonia, MHPCC 6 * 7 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-08-25 00:04:01 $ 9 * 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 */ 13 12 14 13 #include <unistd.h> -
trunk/psLib/src/dataManip/psVectorFFT.c
r1452 r1613 1 2 1 /** @file psFFT.c 3 *4 * @brief Contains FFT transforms functions5 *6 * @author Robert DeSonia, MHPCC7 *8 * @version $Revision: 1.21$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-08-10 18:54:38$10 *11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii12 */2 * 3 * @brief Contains FFT transforms functions 4 * 5 * @author Robert DeSonia, MHPCC 6 * 7 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-08-25 00:04:01 $ 9 * 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 */ 13 12 14 13 #include <unistd.h> -
trunk/psLib/src/fft/psVectorFFT.c
r1452 r1613 1 2 1 /** @file psFFT.c 3 *4 * @brief Contains FFT transforms functions5 *6 * @author Robert DeSonia, MHPCC7 *8 * @version $Revision: 1.21$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-08-10 18:54:38$10 *11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii12 */2 * 3 * @brief Contains FFT transforms functions 4 * 5 * @author Robert DeSonia, MHPCC 6 * 7 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-08-25 00:04:01 $ 9 * 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 */ 13 12 14 13 #include <unistd.h> -
trunk/psLib/src/image/psImageExtraction.c
r1606 r1613 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-2 3 22:36:03$12 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-25 00:04:01 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 93 93 94 94 return (out); 95 } 96 97 psImage* psImageSubsection(psImage* image, const char* section) 98 { 99 int x1; 100 int x2; 101 int y1; 102 int y2; 103 104 // section should be of the form '[x1:x2,y1:y2]' 105 if (section == NULL) { 106 psError(__func__,"The subsection string input can not be NULL."); 107 return NULL; 108 } 109 110 if (sscanf(section,"[%d:%d,%d:%d]",&x1,&x2,&y1,&y2) < 4) { 111 psError(__func__,"The subsection string (%s) can not be parsed. " 112 "Needs to be of the form '[x1:x2,y1:y2]'", 113 section); 114 return NULL; 115 } 116 return psImageSubset(image,x2-x1+1,y2-y1+1,x1,y1); 117 } 118 119 psImage* psImageTrim(psImage* image, int x0, int x1, int y0, int y1) 120 { 121 if (image == NULL || image->data.V == NULL) { 122 psError(__func__, "Can not subset image because input image or its " 123 "pixel buffer is NULL."); 124 return NULL; 125 } 126 127 if (image->parent != NULL) { 128 psError(__func__, "Can not perform a trim on a child image."); 129 return NULL; 130 } 131 132 if (x0 < 0 || x1 < 0 || y0 < 0 || y1 < 0 || 133 x0 >= image->numCols || x1 >= image->numCols || 134 y0 >= image->numRows || y1 >= image->numRows || 135 x0 > x1 || y0 > y1 ) { 136 psError(__func__, "Can not subset image because specified region " 137 "[%d:%d,%d:%d] is not valid for image of size %dx%d.", 138 x0,x1,y0,y1,image->numCols,image->numRows); 139 return NULL; 140 } 141 142 psImageFreeChildren(image); 143 144 unsigned int elementSize = PSELEMTYPE_SIZEOF(image->type.type); 145 unsigned int numCols = x1-x0+1; 146 unsigned int numRows = y1-y0+1; 147 unsigned int rowSize = elementSize*numCols; 148 unsigned int colOffset = elementSize * x0; 149 void* imageData = image->rawDataBuffer; 150 for (int row = y0; row < y1; row++) { 151 memmove(imageData,image->data.U8[row] + colOffset,rowSize); 152 imageData = (psU8*)imageData + rowSize; 153 } 154 155 *(unsigned int*)&image->numRows = numRows; 156 *(unsigned int*)&image->numCols = numCols; 157 158 // XXX: should I really resize the buffers? 159 image->data.V = psRealloc(image->data.V,sizeof(void*)*numRows); 160 image->rawDataBuffer = psRealloc(image->rawDataBuffer,rowSize*numRows); 161 162 image->data.V[0] = image->rawDataBuffer; 163 for (int r = 1; r < numRows; r++) { 164 image->data.U8[r] = image->data.U8[r-1] + rowSize; 165 } 166 167 return (image); 95 168 } 96 169 -
trunk/psLib/src/image/psImageExtraction.h
r1606 r1613 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-2 3 22:36:03$12 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-25 00:04:01 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 62 62 psImage* image, ///< Parent image. 63 63 const char* section ///< Subsection in the form '[x1:x2,y1:y2]' 64 ); 65 66 /** Trim an image 67 * 68 * Trim the specified image in-place, which involves shuffling the pixels 69 * around in memory. The pixels in the region [x0:x1,y0:y1] (inclusive) 70 * shall consist the output image. 71 * 72 * N.b., An image that has a parent image will be orphaned from the parent 73 * upon trimming. Any children of the trimmed image will also be obliterated, 74 * i.e., freed from memory. 75 * 76 * @return psImage* trimmed image result 77 */ 78 psImage* psImageTrim( 79 psImage* image, ///< image to trim 80 int x0, ///< column of trim region's left boundary 81 int x1, ///< column of trim region's right boundary 82 int y0, ///< row of trim region's lower boundary 83 int y1 ///< row of trim region's upper boundary 64 84 ); 65 85
Note:
See TracChangeset
for help on using the changeset viewer.
