IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 13, 2007, 2:39:51 PM (19 years ago)
Author:
Paul Price
Message:

Removing complex number support. No-one was using it, and it prevents compilation on Solaris.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImagePixelManip.c

    r12256 r12431  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2007-03-06 03:09:58 $
     12 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2007-03-14 00:39:50 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020#endif
    2121
    22 #include <complex.h>
    2322#include <math.h>                          // for isfinite(), etc.
    2423#include <stdlib.h>
     
    9089        break;
    9190
    92         #define psImageClipCaseComplex(type,absfcn)\
    93     case PS_TYPE_##type: { \
    94             if (vmin < PS_MIN_##type || vmin > PS_MAX_##type) { \
    95                 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    96                         _("Specified %s value, %g, is outside of psImage type's range (%s: %g to %g)."), \
    97                         "vmin",vmin, PS_TYPE_##type##_NAME, \
    98                         (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
    99             } \
    100             if (vmax > PS_MAX_##type || vmax < PS_MIN_##type) { \
    101                 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    102                         _("Specified %s value, %g, is outside of psImage type's range (%s: %g to %g)."), \
    103                         "vmax",vmax, PS_TYPE_##type##_NAME, \
    104                         (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
    105             } \
    106             for (psU32 row = 0;row<numRows;row++) { \
    107                 ps##type* inputRow = input->data.type[row]; \
    108                 for (psU32 col = 0; col < numCols; col++) { \
    109                     if (absfcn(inputRow[col]) < min) { \
    110                         inputRow[col] = (ps##type)vmin; \
    111                         numClipped++; \
    112                     } else if (absfcn(inputRow[col]) > max) { \
    113                         inputRow[col] = (ps##type)vmax; \
    114                         numClipped++; \
    115                     } \
    116                 } \
    117             } \
    118         } \
    119         break;
    120 
    12191        psImageClipCase(S8)
    12292        psImageClipCase(S16)
     
    12999        psImageClipCase(F32)
    130100        psImageClipCase(F64)
    131         psImageClipCaseComplex(C32, cabsf)
    132         psImageClipCaseComplex(C64, cabs)
    133101
    134102    default: {
     
    174142        psImageClipNaNCase(F32)
    175143        psImageClipNaNCase(F64)
    176         psImageClipNaNCase(C32)
    177         psImageClipNaNCase(C64)
    178144
    179145    default: {
     
    331297        psImageOverlayCase(F32,NAN);
    332298        psImageOverlayCase(F64,NAN);
    333         psImageOverlayCase(C32,NAN);
    334         psImageOverlayCase(C64,NAN);
    335299
    336300    default: {
     
    347311}
    348312
    349 int psImageClipComplexRegion(psImage* input,
    350                              double complex min,
    351                              double complex vmin,
    352                              double complex max,
    353                              double complex vmax)
    354 {
    355     psS32 numClipped = 0;
    356     psU32 numRows;
    357     psU32 numCols;
    358     psF64 realMin = creal(min);
    359     psF64 imagMin = cimag(min);
    360     psF64 realMax = creal(max);
    361     psF64 imagMax = cimag(max);
    362 
    363     if (input == NULL) {
    364         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    365                 _("Can not operate on a NULL psImage."));
    366         return 0;
    367     }
    368 
    369     if (realMax < realMin) {
    370         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    371                 _("Specified real-portion of min value, %g, can not be greater than the real-portion of max value, %g."),
    372                 (double)realMin, (double)realMax);
    373         return 0;
    374     }
    375     if (imagMax < imagMin) {
    376         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    377                 _("Specified imaginary-portion of min value, %g, can not be greater than the imaginary-portion of max value, %g."),
    378                 (double)imagMin, (double)imagMax);
    379         return 0;
    380     }
    381 
    382     numRows = input->numRows;
    383     numCols = input->numCols;
    384 
    385     #define psImageClipComplexRegionCase(type,realfcn,imagfcn) \
    386 case PS_TYPE_##type: { \
    387         if (realfcn(vmin) < PS_MIN_##type || imagfcn(vmin) < PS_MIN_##type || \
    388                 realfcn(vmin) > PS_MAX_##type || imagfcn(vmin) > PS_MAX_##type ) { \
    389             psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    390                     _("Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."), \
    391                     "vmin", creal(vmin), cimag(vmin), \
    392                     PS_TYPE_##type##_NAME, PS_MIN_##type, PS_MAX_##type); \
    393             break; \
    394         } \
    395         if (realfcn(vmax) > PS_MAX_##type || imagfcn(vmax) > PS_MAX_##type || \
    396                 realfcn(vmax) < PS_MIN_##type || imagfcn(vmax) < PS_MIN_##type ) { \
    397             psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    398                     _("Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."), \
    399                     "vmax", creal(vmax), cimag(vmax), \
    400                     PS_TYPE_##type##_NAME, PS_MIN_##type, PS_MAX_##type); \
    401             break; \
    402         } \
    403         for (psU32 row = 0;row<numRows;row++) { \
    404             ps##type* inputRow = input->data.type[row]; \
    405             for (psU32 col = 0; col < numCols; col++) { \
    406                 if ( (realfcn(inputRow[col]) > realMax) || (imagfcn(inputRow[col]) > imagMax) ) { \
    407                     inputRow[col] = (ps##type)vmax; \
    408                     numClipped++; \
    409                 } else if ( (realfcn(inputRow[col]) < realMin) || (imagfcn(inputRow[col]) < imagMin) ){ \
    410                     inputRow[col] = (ps##type)vmin; \
    411                     numClipped++; \
    412                 } \
    413             } \
    414         } \
    415     } \
    416     break;
    417 
    418     switch (input->type.type) {
    419 
    420         psImageClipComplexRegionCase(C32, crealf, cimagf)
    421         psImageClipComplexRegionCase(C64, creal, cimag)
    422 
    423     default: {
    424             char* typeStr;
    425             PS_TYPE_NAME(typeStr,input->type.type);
    426             psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    427                     _("Specified psImage type, %s, is not supported."),
    428                     typeStr);
    429         }
    430     }
    431 
    432     return numClipped;
    433 }
Note: See TracChangeset for help on using the changeset viewer.