IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32729 for trunk/psLib


Ignore:
Timestamp:
Nov 21, 2011, 10:51:45 AM (15 years ago)
Author:
eugene
Message:

(another) counting error in psImageSmooth_PreAlloc

File:
1 edited

Legend:

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

    r32728 r32729  
    834834                double s = 0.0;
    835835                for (int n = -i; n < convRange; n++, vr++, vg++) {
     836                    psAssert (vr - image->data.F32[j] < image->numCols, "counting error");
    836837                    s += *vg * *vr;
    837838                    g += *vg;
     
    841842            /* If that's all the pixels we have, then we're done already */
    842843            if (Nx > Nrange) {
    843                 /* Smooth middle pixels */
     844                /* Smooth middle pixels; if Nx < 2*Nrange, this pass is skipped */
    844845                for (int i = Nrange; i < Nx - Nrange; i++, vi++) {
    845846                    psF32 *vr = vi - Nrange;
     
    847848                    double s = 0;
    848849                    for (int n = -Nrange; n < Nrange + 1; n++, vr++, vg++) {
     850                        psAssert (vr - image->data.F32[j] < image->numCols, "counting error");
    849851                        s += *vg * *vr;
    850852                    }
     
    852854                }
    853855                /* Smooth last Nrange pixels, with renorm */
    854                 for (int i = Nx - Nrange; i < Nx; i++, vi++) {
     856                // if Nx < 2*Nrange, this pass starts at i == Nrange
     857                int xMin = PS_MAX(Nx - Nrange, Nrange);
     858                for (int i = xMin; i < Nx; i++, vi++) {
    855859                    psF32 *vr = vi - Nrange;
    856860                    psF32 *vg = gauss - Nrange;
     
    858862                    double s = 0.0;
    859863                    for (int n = -Nrange; n < Nx - i; n++, vr++, vg++) {
     864                        psAssert (vr - image->data.F32[j] < image->numCols, "counting error");
    860865                        s += *vg * *vr;
    861866                        g += *vg;
Note: See TracChangeset for help on using the changeset viewer.