~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to raster/r.mfilter/execute.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <unistd.h>
2
2
#include <grass/rowio.h>
 
3
#include <grass/raster.h>
3
4
#include "glob.h"
4
5
#include "filter.h"
5
6
 
6
 
int execute_filter(ROWIO * r, int out, FILTER * filter, CELL * cell)
 
7
int execute_filter(ROWIO * r, int out, FILTER * filter, DCELL * cell)
7
8
{
8
9
    int i;
9
10
    int count;
13
14
    int startx, starty;
14
15
    int dx, dy;
15
16
    int mid;
16
 
    CELL **bufs, **box, *cp;
17
 
    CELL apply_filter();
 
17
    DCELL **bufs, **box, *cp;
18
18
 
19
19
    size = filter->size;
20
20
    mid = size / 2;
21
 
    bufs = (CELL **) G_malloc(size * sizeof(CELL *));
22
 
    box = (CELL **) G_malloc(size * sizeof(CELL *));
 
21
    bufs = (DCELL **) G_malloc(size * sizeof(DCELL *));
 
22
    box = (DCELL **) G_malloc(size * sizeof(DCELL *));
23
23
 
24
24
    switch (filter->start) {
25
25
    case UR:
61
61
    /* copy border rows to output */
62
62
    row = starty;
63
63
    for (i = 0; i < mid; i++) {
64
 
        cp = (CELL *) rowio_get(r, row);
 
64
        cp = (DCELL *) Rowio_get(r, row);
65
65
        write(out, cp, buflen);
66
66
        row += dy;
67
67
    }
73
73
        starty += dy;
74
74
        /* get "size" rows */
75
75
        for (i = 0; i < size; i++) {
76
 
            bufs[i] = (CELL *) rowio_get(r, row);
 
76
            bufs[i] = (DCELL *) Rowio_get(r, row);
77
77
            box[i] = bufs[i] + startx;
78
78
            row += dy;
79
79
        }
87
87
        /* filter row */
88
88
        col = ccount;
89
89
        while (col--) {
90
 
            if (zero_only) {
91
 
                if (!box[mid][mid])
 
90
            if (null_only) {
 
91
                if (Rast_is_d_null_value(&box[mid][mid]))
92
92
                    *cp++ = apply_filter(filter, box);
93
93
                else
94
94
                    *cp++ = box[mid][mid];
112
112
    /* copy border rows to output */
113
113
    row = starty + mid * dy;
114
114
    for (i = 0; i < mid; i++) {
115
 
        cp = (CELL *) rowio_get(r, row);
 
115
        cp = (DCELL *) Rowio_get(r, row);
116
116
        write(out, cp, buflen);
117
117
        row += dy;
118
118
    }