IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 20, 2004, 11:39:42 AM (22 years ago)
Author:
gusciora
Message:

New macros for psCOnstants.h

File:
1 edited

Legend:

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

    r2736 r2762  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-12-16 21:58:55 $
     11 *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-12-20 21:39:42 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    450450XXX: Use static variables for Chebyshev polynomials and scaling factors.
    451451 *****************************************************************************/
    452 psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs)
    453 {
    454     PS_IMAGE_CHECK_NULL(input, NULL);
    455     PS_IMAGE_CHECK_EMPTY(input, NULL);
    456     if ((input->type.type != PS_TYPE_S8) &&
    457             (input->type.type != PS_TYPE_U16) &&
    458             (input->type.type != PS_TYPE_F32) &&
    459             (input->type.type != PS_TYPE_F64)) {
    460         psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    461                 "Unallowable image type.\n");
    462     }
    463     PS_POLY_CHECK_NULL(coeffs, NULL);
     452psImage* p_psImageEvalPolynomialCheb(psImage* input,
     453                                     const psPolynomial2D* coeffs)
     454{
    464455    PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_CHEB, NULL);
    465456
     
    525516    return input;
    526517}
     518
     519psImage* p_psImageEvalPolynomialOrd(psImage* input,
     520                                    const psPolynomial2D* coeffs)
     521{
     522    PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_ORD, NULL);
     523
     524    for (int row = 0; row < input->numRows ; row++) {
     525        for (int col = 0; col < input->numCols ; col++) {
     526            if (input->type.type == PS_TYPE_S8) {
     527                input->data.S8[row][col] = (psS8) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
     528            } else if (input->type.type == PS_TYPE_U16) {
     529                input->data.U16[row][col] = (psS16) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
     530            } else if (input->type.type == PS_TYPE_F32) {
     531                input->data.F32[row][col] = psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
     532            } else if (input->type.type == PS_TYPE_F64) {
     533                input->data.F64[row][col] = (psF64) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
     534            }
     535        }
     536    }
     537
     538    return(input);
     539}
     540
     541
     542/*****************************************************************************
     543XXX: I added normal polynomials to this routine.  Let IfA know, put it in the
     544psLib SDR.
     545 *****************************************************************************/
     546psImage* psImageEvalPolynomial(psImage* input,
     547                               const psPolynomial2D* coeffs)
     548{
     549    PS_IMAGE_CHECK_NULL(input, NULL);
     550    PS_IMAGE_CHECK_EMPTY(input, NULL);
     551    if ((input->type.type != PS_TYPE_S8) &&
     552            (input->type.type != PS_TYPE_U16) &&
     553            (input->type.type != PS_TYPE_F32) &&
     554            (input->type.type != PS_TYPE_F64)) {
     555        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     556                "Unallowable image type.\n");
     557    }
     558    PS_POLY_CHECK_NULL(coeffs, NULL);
     559
     560    if (coeffs->type == PS_POLYNOMIAL_ORD) {
     561        return(p_psImageEvalPolynomialOrd(input, coeffs));
     562    } else if (coeffs->type == PS_POLYNOMIAL_CHEB) {
     563        return(p_psImageEvalPolynomialCheb(input, coeffs));
     564    }
     565    printf("XXX: Error: wrong polynomial type\n");
     566    // XXX: psError()
     567    return(NULL);
     568}
     569
Note: See TracChangeset for help on using the changeset viewer.