Exemplo n.º 1
0
void fwav_atran_z(fwav fw,float *b0,int dx,int dy,int dz)
{
    int j,y,z,dd;
    float *ba0,*ba1,*ba2,*bb,v1,td0,td1;

    td0=fw->td0; td1=fw->td1;
    dd=dx*dy;
    bb=fw->bt;
    for (z=0;z+1<dz;z+=2) {
        for (y=0;y<dy;y++) {
            ba0=b0+(z*dy+y)*dx;
            ba1=ba0+dd;
            ba2=(z+2<dz?ba1+dd:ba0);
            for (j=dx;j--;)
                { v1=(*ba1++)-0.5*((*ba0++)+(*ba2++)); THRESH(v1) *bb++ =v1; }
        }
    }
    bb=b0;
    for (z=0;z<dz;z+=2) {
        for (y=0;y<dy;y++) {
            ba1=b0+(z*dy+y)*dx;
            ba2=(z+1<dz?fw->bt+((z>>1)*dy+y)*dx:fw->zero);
            ba0=(z?fw->bt+(((z>>1)-1)*dy+y)*dx:fw->zero);
            for (j=dx;j--;) *bb++ =(*ba1++)+0.25*((*ba0++)+(*ba2++));
        }
    }
    j=dx*dy*dz-(bb-b0); ba0=fw->bt; while (j--) *bb++ = *ba0++;
}
Exemplo n.º 2
0
void fwav_atran_y(fwav fw,float *b0,int dx,int dy,int dz)
{
    int j,dy2,y,z;
    float *ba0,*ba1,*ba2,*bb,v1,td0,td1;

    td0=fw->td0; td1=fw->td1;
    dy2=HALF(dy); bb=fw->bt;
    for (z=0;z<dz;z++) {
        for (y=0;y+1<dy;y+=2) {
            ba0=b0+(z*dy+y)*dx;
            ba1=ba0+dx;
            ba2=(y+2<dy?ba1+dx:ba0);
            for (j=dx;j--;)
                { v1=(*ba1++)-0.5*((*ba0++)+(*ba2++)); THRESH(v1) *bb++ =v1; }
        }
    }
    bb=b0;
    for (z=0;z<dz;z++) {
        for (y=0;y<dy;y+=2) {
            ba1=b0+(z*dy+y)*dx;
            ba2=(y+1<dy?fw->bt+(z*(dy>>1)+(y>>1))*dx:fw->zero);
            ba0=(y?fw->bt+(z*(dy>>1)+(y>>1)-1)*dx:fw->zero);
            for (j=dx;j--;) *bb++ =(*ba1++)+0.25*((*ba0++)+(*ba2++));
        }
    }
    j=dx*dy*dz-(bb-b0); ba0=fw->bt; while (j--) *bb++ = *ba0++;
}
Exemplo n.º 3
0
void fwav_atran_x(fwav fw,float *ba0,int dx,int dy,int dz)
{
    int j,dx2,y,z;
    float a0,a1,a2,v0,v1;
    float *ba,*bu,*bv,td0,td1;

    td0=fw->td0; td1=fw->td1;
    dx2=HALF(dx); bu=ba0; ba=ba0; bv=fw->bt;
    for (z=0;z<dz;z++) {
        for (y=0;y<dy;y++) {
            v1=0.0; a2= *ba++;
            for (j=dx2-1;j--;) {
                a0=a2; v0=v1; a1= *ba++; a2= *ba++;
                v1=a1-0.5*(a0+a2); THRESH(v1) *bv++ =v1;
                *bu++ =a0+0.25*(v0+v1);
            }
            v0=v1;
            if (dx&1) v1=0.0;
            else { a1= *ba++; v1=a1-0.5*(a2+a2); THRESH(v1) *bv++ =v1; }
            *bu++ =a2+0.25*(v0+v1);
        }
    }
    j=bv-fw->bt; bv=fw->bt; while (j--) *bu++ = *bv++;
}