Exemple #1
0
void opwd21 (bool der1, bool der2 /* derivative flags */, 
	     const omni2 ap /* OPWD object */, 
	     float* xx     /* input */, 
 	     float* yy     /* output */)
/*< plane-wave destruction >*/
{
    int ix, iy, iw, is, i;

    for (iy=0; iy < ap->ny; iy++) {
	for (ix=0; ix < ap->nx; ix++) {
	    i = ix + ap->nx * iy;
	    ap->t1[iy][ix] = 0.0f;
	    ap->t2[iy][ix] = 0.0f;
	    yy[i] = 0.0f;
	}
    }
  
    for (iy=0; iy < ap->ny-1; iy++) {
	for (ix = ap->nw; ix < ap->nx-ap->nw; ix++) {
	    i = ix + ap->nx * iy;
	    if (der1) {
		aderfilter(ap->p1[i], ap->flt);
	    } else {
		passfilter(ap->p1[i], ap->flt);
	    }
	      
	    for (iw = 0; iw <= 2*ap->nw; iw++) {
		is = iw-ap->nw;
		  
		ap->t1[iy][ix] += xx[i-is] * ap->flt[iw];
		ap->t2[iy][ix] += xx[i+is] * ap->flt[iw];
	    }
	}
    }

    for (iy = ap->nw; iy < ap->ny-ap->nw; iy++) {
	for (ix=0; ix < ap->nx-1; ix++) {
	    i = ix + ap->nx * iy;
	    if (der2) {
		aderfilter(ap->p2[i], ap->flt);
	    } else {
		passfilter(ap->p2[i], ap->flt);
	    }
	      
	    for (iw = 0; iw <= 2*ap->nw; iw++) {
		is = iw-ap->nw;
		  
		yy[i] += (ap->t2[iy+is][ix] -
			  ap->t1[iy-is][ix]) * ap->flt[iw];
	    }
	}
    }

}
Exemple #2
0
void allpass1 (bool left        /* left or right prediction */,
	       bool der         /* derivative flag */, 
	       const allpass ap /* PWD object */, 
	       float* xx        /* input */, 
	       float* yy        /* output */)
/*< in-line plane-wave destruction >*/
{
    int ix, iy, iz, iw, is, i, nx, ny, nz, i1, i2, ip;

    nx = ap->nx;
    ny = ap->ny;
    nz = ap->nz;

    if (left) {
	i1=1; i2=ny;   ip=-nx;
    } else {
	i1=0; i2=ny-1; ip=nx;
    }

    for (iz=0; iz < nz; iz++) {
	for (iy=0; iy < ny; iy++) {
	    for (ix=0; ix < nx; ix++) {
		i = ix + nx * (iy + ny * iz);
		yy[i] = 0.;
	    }
	}
    }
  
    for (iz=0; iz < nz; iz++) {
	for (iy=i1; iy < i2; iy++) {
	    for (ix = ap->nw*ap->nj; ix < nx-ap->nw*ap->nj; ix++) {
		i = ix + nx * (iy + ny * iz);

		if (der) {
		    aderfilter(ap->pp[i], ap->flt);
		} else {
		    passfilter(ap->pp[i], ap->flt);
		}
	      
		for (iw = 0; iw <= 2*ap->nw; iw++) {
		    is = (iw-ap->nw)*ap->nj;
		  
		    yy[i] += (xx[i+is+ip] - xx[i-is]) * ap->flt[iw];
		}
	    }
	}
    }
}