gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master a495468b 2/2: Library (pool.h): Added the stri


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master a495468b 2/2: Library (pool.h): Added the stride operand to the pooling functions
Date: Sun, 20 Aug 2023 15:37:01 -0400 (EDT)

branch: master
commit a495468b1552ac15f279e544b12b2b22826f9f55
Author: Faezeh Bidjarchian <fbidjarchian@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Library (pool.h): Added the stride operand to the pooling functions
    
    Until now, in the pooling functions, we assumed that the stride is equal to
    the pool size. Therefore, we had constraints for applying pooling.
    
    With this commit, the stride operand has been added. Also, there were some
    issues that have been fixed.
---
 NEWS                |  8 +++---
 doc/gnuastro.texi   | 41 +++++++++++++++++----------
 lib/arithmetic.c    | 59 +++++++++++++++++++++++++--------------
 lib/gnuastro/pool.h | 19 ++++++++-----
 lib/pool.c          | 80 ++++++++++++++++++++++++++++++++---------------------
 5 files changed, 129 insertions(+), 78 deletions(-)

diff --git a/NEWS b/NEWS
index 08cdc0ff..9ef26157 100644
--- a/NEWS
+++ b/NEWS
@@ -46,10 +46,10 @@ See the end of the file for license conditions.
       dimensions it has. Suggested by Faezeh Bidjarchian.
     - trim: remove all fully-blank outer regions of the input dataset.
     - pool-min: Min-pooling to reduce the size of the input by calculating
-                the minimum of a the pixels within the pooling window. See
-                the new "Pooling opeators" section of the book for
-                more. This and the rest of the pooling operators introduced
-                here were implemented by Faezeh Bidjarchian.
+      the minimum of a the pixels within the pooling window (accounting for
+      a stride). See the new "Pooling opeators" section of the book for
+      more. The pooling operators were all implemented by Faezeh
+      Bidjarchian.
     - pool-max: Similar to 'pool-min' but using maximum.
     - pool-sum: Similar to 'pool-min' but using sum.
     - pool-mean: Similar to 'pool-min' but using mean.
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 7def4ef8..e4038118 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -20408,20 +20408,26 @@ Pooling is one way of reducing the complexity of the 
input image by grouping mul
 As a result, the output image has fewer pixels (less complexity).
 In Computer Vision, Pooling is commonly used in 
@url{https://en.wikipedia.org/wiki/Convolutional_neural_network, Convolutional 
Neural Networks} (CNNs).
 
-In pooling, the inputs are an image (e.g., a FITS file) and a square window 
pixel size (known as a pooling window).
-The window has to be smaller than the input's number of pixels in both 
dimensions and its width is called the pool size.
-This window slides over all pixels in the input from the top-left corner to 
the bottom-right corner (covering each input pixel only once).
-Currently the ``stride'' (or spacing between the windows as they slide over 
the input) is equal to the window-size in Arithmetic.
+@cindex Stride
+In pooling, the inputs are an image (e.g., a FITS file) and a square window 
pixel size that is known as a pooling window.
+The window has to be smaller than the input's number of pixels in both 
dimensions and its width is called the ``pool size''.
+The pooling window starts at the top-left corner pixel of the input and 
calculates statistical operations on the pixels that overlap with it.
+It slides forward by the ``stride'' pixels, moving over all pixels in the 
input from the top-left corner to the bottom-right corner, and repeats the same 
calculation for the overlapping pixels in each position.
+
+Usually, the stride (or spacing between the windows as they slide over the 
input) is equal to the window-size.
 In other words, in pooling, the separate ``windows'' do not overlap with each 
other on the input.
+However, you can choose any size for the stride.
+Remember this, It's crucial to ensure that the stride size is less than the 
pool size.
+If not, some pixels may be missed during the pooling process.
 Therefore there are two major differences with @ref{Spatial domain 
convolution} or @ref{Filtering operators}, but pooling has some similarities to 
the @ref{Warp}.
 @itemize
 @item
 In convolution or filtering the input and output sizes are the same.
-However, the output of pooling has fewer pixels.
+However, when the stride is larger than 1 then, the output of pooling must 
have fewer pixels.
 @item
-In convolution or filters, the kernels slide of the input in a pixel-by-pixel 
manner.
+In convolution or filters, the kernels slide over the input in a 
pixel-by-pixel manner.
 As a result, the same pixel's value will be used in many of the output pixels.
-However, in pooling each input pixel is only used in a single output pixel.
+However, in pooling each input pixel may be only used in a single output pixel 
(if the stride and the pool size are the same).
 @item
 Special cases of Warping an image are similar to pooling.
 For example calling @code{pool-sum} with pool size of 2 will give the same 
pixel values (except the outer edges) as giving the same image to 
@command{astwarp} with @option{--scale=1/2 --centeroncorner}.
@@ -20436,12 +20442,12 @@ Please inform us of your interest in having it, by 
contacting us at @command{bug
 If you need @code{pool-sum}, you can use @ref{Warp} (which also modifies the 
WCS, see note above).
 @end cartouche
 
-If the width or height of input is not divisible by the pool size, the pool 
window will go beyond the input pixel grid.
+If the width or height of input is not divisible by the stride size, the pool 
window will go beyond the input pixel grid.
 In this case, the window pixels that do not overlap with the input are given a 
blank value (and thus ignored in the calculation of the desired statistical 
operation).
 
 The simple ASCII figure below shows the pooling operation where the input is a 
@mymath{3\times3} pixel image with a pool size of 2 pixels.
 In the center of the second row, you see the intermediate input matrix that 
highlights how the input and output pixels relate with each other.
-Since the input is @mymath{3\times3} and we have a pool size of 2, as 
mentioned above blank pseudo-pixels are added with a value of @code{B} (for 
blank).
+Since the input is @mymath{3\times3} and we have a stride size of 2, as 
mentioned above blank pseudo-pixels are added with a value of @code{B} (for 
blank).
 
 @example
         Pool window:                             Input:
@@ -20472,14 +20478,15 @@ Below, the various pool operators of arithmetic are 
listed:
 
 @item pool-max
 Apply max-pooling on the input dataset.
-This operator takes two operands: the first popped operand is the width of the 
square pooling window (which should be a single integer), and the second should 
be the input image.
+This operator takes three operands: the first popped operand is the stride and 
the second is the width of the square pooling window (which should be a single 
integer).
+Also, The third operand should be the input image.
 Within the pooling window, this operator will place the largest value in the 
output pixel (any blank pixels will be ignored).
 
 See the ASCII diagram above for a demonstration of how max-pooling works.
 Here is an example of using this operator:
 
 @example
-$ astarithmetic image.fits 2 pool-max
+$ astarithmetic image.fits 2 2 pool-max
 @end example
 
 Max-pooling retains the largest value of the input window in the output, so 
the returned image is sharper where you have strong signal-to-noise ratio and 
more noisy in regions with no significant signal (only noise).
@@ -20487,7 +20494,8 @@ It is therefore useful when the background of the image 
is dark and we are inter
 
 @item pool-min
 Apply min-pooling on the input dataset.
-This operator takes two operands: the first popped operand is the width of the 
square pooling window (which should be a single integer), and the second should 
be the input image.
+This operator takes three operands: the first popped operand is the stride and 
the second is the width of the square pooling window (which should be a single 
integer).
+Also, The third operand should be the input image.
 Except the used statistical measurement, this operator is similar to 
@code{pool-max}, see the description there for more.
 
 Min-pooling is mostly used when the image has a high signal-to-noise ratio and 
a light background: min-pooling will select darker (lower-valued) pixels.
@@ -20495,14 +20503,16 @@ For low signal-to-noise regions, this operator will 
increase the noise level (si
 
 @item pool-sum
 Apply sum-pooling to the input dataset.
-This operator takes two operands: the first popped operand is the width of the 
square pooling window (which should be a single integer), and the second should 
be the input image.
+This operator takes three operands: the first popped operand is the stride and 
the second is the width of the square pooling window (which should be a single 
integer).
+Also, The third operand should be the input image.
 Except the used statistical measurement, this operator is similar to 
@code{pool-max}, see the description there for more.
 
 Sum-pooling will increase the signal-to-noise ratio at the cost of having a 
smoother output (less resolution).
 
 @item pool-mean
 Apply mean pooling on the input dataset.
-This operator takes two operands: the first popped operand is the width of the 
square pooling window (which should be a single integer), and the second should 
be the input image.
+This operator takes three operands: the first popped operand is the stride and 
the second is the width of the square pooling window (which should be a single 
integer).
+Also, The third operand should be the input image.
 Except the used statistical measurement, this operator is similar to 
@code{pool-max}, see the description there for more.
 
 The mean pooling method smooths out the image and hence the sharp features may 
not be identified when this pooling method is used.
@@ -20511,7 +20521,8 @@ Mean is often used where a more accurate representation 
of the input is required
 
 @item pool-median
 Apply median pooling on the input dataset.
-This operator takes two operands: the first popped operand is the width of the 
square pooling window (which should be a single integer), and the second should 
be the input image.
+This operator takes three operands: the first popped operand is the stride and 
the second is the width of the square pooling window (which should be a single 
integer).
+Also, The third operand should be the input image.
 Except the used statistical measurement, this operator is similar to 
@code{pool-max}, see the description there for more.
 
 In general, the mean is mathematically easier to interpret and more 
susceptible to outliers, while the median outputs as being less subject to the 
influence of outliers compared to the mean so we have a smoother image.
diff --git a/lib/arithmetic.c b/lib/arithmetic.c
index 700f49ef..4f0f6438 100644
--- a/lib/arithmetic.c
+++ b/lib/arithmetic.c
@@ -3013,45 +3013,61 @@ arithmetic_constant(gal_data_t *input, gal_data_t 
*constant, int operator,
 
 
 static gal_data_t *
-arithmetic_pool(gal_data_t *input, gal_data_t *psize, int operator,
-                size_t numthreads, int flags)
+arithmetic_pool(gal_data_t *input, gal_data_t *psize, gal_data_t *stride,
+                int operator, size_t numthreads, int flags)
 {
   gal_data_t *out=NULL;
-  size_t *psizearr;
+  size_t *pstrarr, *psizearr;
 
-  /* Sanity check. */
+
+  /* The pool size and the stride must have a single element. */
   if(psize->size!=1)
-    error(EXIT_FAILURE, 0, "%s: the pooling operand should only contain "
-          "a single element.", __func__);
+    error(EXIT_FAILURE, 0, "%s: the pooling operand should only "
+          "contain a single element.", __func__);
+  if(stride->size!=1)
+    error(EXIT_FAILURE, 0, "%s: the stride operand should only "
+        "contain a single element.", __func__);
 
   /* This function is only for a integer operand, so make sure the user
-     has given an integer type. */
+     has given an integer type for the poolsize and the stride. */
   if(psize->type==GAL_TYPE_FLOAT32 || psize->type==GAL_TYPE_FLOAT64)
     error(EXIT_FAILURE, 0, "lengths of pooling along dimensions "
           "must be integer values, not floats. The given length "
           "along dimension %zu is a float.", psize->dsize[0]);
+  if(stride->type==GAL_TYPE_FLOAT32 || stride->type==GAL_TYPE_FLOAT64)
+    error(EXIT_FAILURE, 0, "the stride of pooling along dimensions "
+          "must be integer values, not floats. The given value is a "
+          "float.");
+
+  /* Convert the type of the poolsize and the stride into size_t. */
+  psize=( psize->type==GAL_TYPE_SIZE_T
+        ? psize
+        : gal_data_copy_to_new_type_free(psize, GAL_TYPE_SIZE_T) );
+  stride=( stride->type==GAL_TYPE_SIZE_T
+        ? stride
+        : gal_data_copy_to_new_type_free(stride, GAL_TYPE_SIZE_T) );
+
 
-  /* Convert psize to size_t. */
-  psize=gal_data_copy_to_new_type_free(psize, GAL_TYPE_SIZE_T);
   psizearr=psize->array;
+  pstrarr=stride->array;
 
   /* Call the separate functions. */
   switch(operator)
     {
     case GAL_ARITHMETIC_OP_POOLMAX:
-      out=gal_pool_max(input, psizearr[0], numthreads);
+      out=gal_pool_max(input, psizearr[0], pstrarr[0], numthreads);
       break;
     case GAL_ARITHMETIC_OP_POOLMIN:
-      out=gal_pool_min(input, psizearr[0], numthreads);
+      out=gal_pool_min(input, psizearr[0], pstrarr[0], numthreads);
       break;
     case GAL_ARITHMETIC_OP_POOLSUM:
-      out=gal_pool_sum(input, psizearr[0], numthreads);
+      out=gal_pool_sum(input, psizearr[0], pstrarr[0], numthreads);
       break;
     case GAL_ARITHMETIC_OP_POOLMEAN:
-      out=gal_pool_mean(input, psizearr[0], numthreads);
+      out=gal_pool_mean(input, psizearr[0], pstrarr[0], numthreads);
       break;
     case GAL_ARITHMETIC_OP_POOLMEDIAN:
-      out=gal_pool_median(input, psizearr[0], numthreads);
+      out=gal_pool_median(input, psizearr[0], pstrarr[0], numthreads);
       break;
     default:
       error(EXIT_FAILURE, 0, "%s: a bug! please contact us at "
@@ -3476,15 +3492,15 @@ gal_arithmetic_set_operator(char *string, size_t 
*num_operands)
 
   /* Pooling operators. */
   else if (!strcmp(string, "pool-max"))
-    { op=GAL_ARITHMETIC_OP_POOLMAX;           *num_operands=2;  }
+    { op=GAL_ARITHMETIC_OP_POOLMAX;           *num_operands=3;  }
   else if (!strcmp(string, "pool-min"))
-    { op=GAL_ARITHMETIC_OP_POOLMIN;           *num_operands=2;  }
+    { op=GAL_ARITHMETIC_OP_POOLMIN;           *num_operands=3;  }
   else if (!strcmp(string, "pool-sum"))
-    { op=GAL_ARITHMETIC_OP_POOLSUM;           *num_operands=2;  }
+    { op=GAL_ARITHMETIC_OP_POOLSUM;           *num_operands=3;  }
   else if (!strcmp(string, "pool-mean"))
-    { op=GAL_ARITHMETIC_OP_POOLMEAN;          *num_operands=2;  }
+    { op=GAL_ARITHMETIC_OP_POOLMEAN;          *num_operands=3;  }
   else if (!strcmp(string, "pool-median"))
-    { op=GAL_ARITHMETIC_OP_POOLMEDIAN;        *num_operands=2;  }
+    { op=GAL_ARITHMETIC_OP_POOLMEDIAN;        *num_operands=3;  }
 
   /* Operator not defined. */
   else
@@ -3925,7 +3941,7 @@ gal_arithmetic(int operator, size_t numthreads, int 
flags, ...)
       out=arithmetic_constant(d1, d2, operator, flags);
       break;
 
-      /* Pooling operators. */
+    /* Pooling operators. */
     case GAL_ARITHMETIC_OP_POOLMAX:
     case GAL_ARITHMETIC_OP_POOLMIN:
     case GAL_ARITHMETIC_OP_POOLSUM:
@@ -3933,7 +3949,8 @@ gal_arithmetic(int operator, size_t numthreads, int 
flags, ...)
     case GAL_ARITHMETIC_OP_POOLMEDIAN:
       d1 = va_arg(va, gal_data_t *);
       d2 = va_arg(va, gal_data_t *);
-      out=arithmetic_pool(d1, d2, operator, numthreads, flags);
+      d3 = va_arg(va, gal_data_t *);
+      out=arithmetic_pool(d1, d2, d3, operator, numthreads, flags);
       break;
 
     /* When the operator is not recognized. */
diff --git a/lib/gnuastro/pool.h b/lib/gnuastro/pool.h
index c574ab58..65043e95 100644
--- a/lib/gnuastro/pool.h
+++ b/lib/gnuastro/pool.h
@@ -1,6 +1,6 @@
 /*********************************************************************
-Pool - Pool input data and create a new dataset.
-Pool is part of GNU Astronomy Utilities (Gnuastro) package.
+Pool -- Pool input data and create a new dataset.
+This is part of GNU Astronomy Utilities (Gnuastro) package.
 
 Original author:
      Faezeh Bidjarchian <fbidjarchian@gmail.com>
@@ -46,19 +46,24 @@ __BEGIN_C_DECLS  /* From C++ preparations */
 
 
 gal_data_t *
-gal_pool_max(gal_data_t *input, size_t psize, size_t numthreads);
+gal_pool_max(gal_data_t *input, size_t psize, size_t stride,
+             size_t numthreads);
 
 gal_data_t *
-gal_pool_min(gal_data_t *input, size_t psize, size_t numthreads);
+gal_pool_min(gal_data_t *input, size_t psize, size_t stride,
+             size_t numthreads);
 
 gal_data_t *
-gal_pool_sum(gal_data_t *input, size_t psize, size_t numthreads);
+gal_pool_sum(gal_data_t *input, size_t psize, size_t stride,
+             size_t numthreads);
 
 gal_data_t *
-gal_pool_mean(gal_data_t *input, size_t psize, size_t numthreads);
+gal_pool_mean(gal_data_t *input, size_t psize, size_t stride,
+              size_t numthreads);
 
 gal_data_t *
-gal_pool_median(gal_data_t *input, size_t psize, size_t numthreads);
+gal_pool_median(gal_data_t *input, size_t psize, size_t stride,
+                size_t numthreads);
 
 
 __END_C_DECLS    /* From C++ preparations */
diff --git a/lib/pool.c b/lib/pool.c
index dcf754f3..57df1684 100644
--- a/lib/pool.c
+++ b/lib/pool.c
@@ -1,6 +1,6 @@
 /*********************************************************************
-Pool - Pool input data and create a new dataset.
-Pool is part of GNU Astronomy Utilities (Gnuastro) package.
+Pool -- Pool input data and create a new dataset.
+This is part of GNU Astronomy Utilities (Gnuastro) package.
 
 Original author:
      Faezeh Bidjarchian <fbidjarchian@gmail.com>
@@ -68,6 +68,7 @@ struct pooling
 {
   int       operator;     /* The type of pooling.             */
   size_t    poolsize;     /* The size of pooling.             */
+  size_t     pstride;     /* The stride of pooling.           */
   size_t      *osize;     /* The output size.                 */
   gal_data_t  *input;     /* Dataset to print values of.      */
   gal_data_t    *out;     /* Output data structure.           */
@@ -81,13 +82,14 @@ struct pooling
 
    Current assumptions:
 
-   - The size of pooling can be every single number (the pooling window is
-     a square).
+   - The size of pooling can be every single number (the pooling window
+     is a square).
    - The width and height of the input are not necessarily divisible
      by the size of the pooling. In other words, the image can be both
      square and rectangular.
-   - We apply the pooling to our input with a stride of poolsize. So,
-     for example the stride is 2 when poolsize is equal to 2. */
+   - We apply pooling to our input with any stride length that may be
+     differ from the poolsize. Remember that, the size of the poolsize
+     must be greater than the stride size. */
 static void *
 pool_type_on_thread(void *in_prm)
 {
@@ -95,10 +97,10 @@ pool_type_on_thread(void *in_prm)
   struct pooling *pp=(struct pooling *)tprm->params;
   gal_data_t *input=pp->input;
 
-  size_t pools= pp->poolsize;
+  size_t strd=pp->pstride;
   size_t ndim=input->ndim;
+  size_t pools=pp->poolsize;
   size_t w=input->dsize[1], wr;
-  size_t h=input->dsize[0], hr;
   gal_data_t *statv=NULL, *result=NULL;
   size_t i, a, b, oind, iind, vc, numpixs, coord[POOLING_DIM], index;
 
@@ -114,7 +116,7 @@ pool_type_on_thread(void *in_prm)
   /* Go over all the pixels that were assigned to this thread. */
   for(i=0; tprm->indexs[i] != GAL_BLANK_SIZE_T; ++i)
     {
-      /* For easy reading, put the index in 'ind'. */
+      /* For easy reading, put the index in 'oind'. */
       oind=tprm->indexs[i];
 
       /* Get the coordinate of the pixel. */
@@ -122,15 +124,14 @@ pool_type_on_thread(void *in_prm)
 
       /* Convert the pixel coordinate to the desired pixel that we must
          select to set the pooling's starting pointer. */
-      iind=pools*w*coord[0]+pools*coord[1];
-      hr=iind%h;
+      iind=strd*w*coord[0]+strd*coord[1];
       wr=iind%w;
 
       /* In some cases, the pooling window doesn't cover a whole squared
          window and only has maybe one pixel. So since we initialize the
          statv by Null (=0 in C), some of these values fill with input
          values and others remain zero. So these zeros will affect the
-         outputs.  Therefore we initialize the statv by blank value. */
+         outputs. Therefore we initialize the statv by blank value. */
       gal_blank_initialize(statv);
 
       /* Set the sorted and blank check flags to 0 so the statistical
@@ -141,7 +142,7 @@ pool_type_on_thread(void *in_prm)
         and fill the temporary 'values' array. Then we do the required
          operation on them. */
       vc=0;
-      for(a=0;a<pools && hr+a<=input->dsize[0];++a)
+      for(a=0;a<pools;++a)
        for(b=0;b<pools && wr+b<input->dsize[1];++b)
          {
            index=iind + a*w + b;
@@ -197,28 +198,40 @@ pool_type_on_thread(void *in_prm)
 
 
 static gal_data_t *
-pool_generic(gal_data_t *input, size_t psize, int operator, size_t numthreads)
+pool_generic(gal_data_t *input, size_t psize, size_t stride, int operator,
+             size_t numthreads)
 {
   struct pooling pp={0};
 
   int otype=GAL_TYPE_INVALID;
   size_t outndim=input->ndim, i, r, diff;
 
-  /* Print a warning if the psize has a wrong value. It happens when the
-     user writes a negative value for the poolsize. */
+  /* Print a warning if the psize or the stride have a wrong value. It
+     happens when the user writes a negative value for them. */
   if(psize>(size_t)(-1)/2 || psize==0)
     error(EXIT_FAILURE, 0, "the value of poolsize must be positive, and "
           "non zero)");
+  if(stride>(size_t)(-1)/2 || stride==0)
+    error(EXIT_FAILURE, 0, "the value of stride must be positive, and "
+          "non zero)");
 
   /* Make sure the given poolsize is lower than the input's width or
-     hight. */
-  if(psize>input->dsize[0] || psize>input->dsize[1])
+     height. */
+  if(psize>input->dsize[0] && psize>input->dsize[1])
     error(EXIT_FAILURE, 0, "%s: the pool size along dimension must be "
-         "greater than the input's width or hight in that dimension",
+         "lower than the input's width or height in that dimension",
          __func__);
 
+  /* Make sure the size of the stride is lower than the poolsize. If not,
+     some pixels may not be considered during the pooling process. */
+  if(stride>psize)
+    error(EXIT_FAILURE, 0, "%s: the size of the stride must be lower "
+          "than the poolsize. Otherwise, there are some pixels that are "
+          "not in any of the pooling windows.", __func__);
+
   /* Set the pointers in the structure of the parameter. */
   pp.input=input;
+  pp.pstride=stride;
   pp.poolsize=psize;
   pp.operator=operator;
 
@@ -235,9 +248,9 @@ pool_generic(gal_data_t *input, size_t psize, int operator, 
size_t numthreads)
          dimension to the output dimension for these remaining pixels. */
       for(i=0;i<input->ndim;++i)
         {
-          r=(input->dsize[i])%psize;
+          r=(input->dsize[i])%stride;
           diff=((r==0)?0:1);
-          pp.osize[i]=(input->dsize[i]/psize)+diff;
+          pp.osize[i]=(input->dsize[i]/stride)+diff;
         }
 
       /* Set the type of the output dataset. */
@@ -298,9 +311,10 @@ pool_generic(gal_data_t *input, size_t psize, int 
operator, size_t numthreads)
 
 
 gal_data_t *
-gal_pool_max(gal_data_t *input, size_t psize, size_t numthreads)
+gal_pool_max(gal_data_t *input, size_t psize, size_t stride,
+             size_t numthreads)
 {
-  return pool_generic(input, psize, POOL_MAX, numthreads);
+  return pool_generic(input, psize, stride, POOL_MAX, numthreads);
 }
 
 
@@ -308,9 +322,10 @@ gal_pool_max(gal_data_t *input, size_t psize, size_t 
numthreads)
 
 
 gal_data_t *
-gal_pool_min(gal_data_t *input, size_t psize, size_t numthreads)
+gal_pool_min(gal_data_t *input, size_t psize, size_t stride,
+             size_t numthreads)
 {
-  return pool_generic(input, psize, POOL_MIN, numthreads);
+  return pool_generic(input, psize, stride, POOL_MIN, numthreads);
 }
 
 
@@ -318,9 +333,10 @@ gal_pool_min(gal_data_t *input, size_t psize, size_t 
numthreads)
 
 
 gal_data_t *
-gal_pool_sum(gal_data_t *input, size_t psize, size_t numthreads)
+gal_pool_sum(gal_data_t *input, size_t psize, size_t stride,
+             size_t numthreads)
 {
-  return pool_generic(input, psize, POOL_SUM, numthreads);
+  return pool_generic(input, psize, stride, POOL_SUM, numthreads);
 }
 
 
@@ -328,9 +344,10 @@ gal_pool_sum(gal_data_t *input, size_t psize, size_t 
numthreads)
 
 
 gal_data_t *
-gal_pool_mean(gal_data_t *input, size_t psize, size_t numthreads)
+gal_pool_mean(gal_data_t *input, size_t psize, size_t stride,
+              size_t numthreads)
 {
-  return pool_generic(input, psize, POOL_MEAN, numthreads);
+  return pool_generic(input, psize, stride, POOL_MEAN, numthreads);
 }
 
 
@@ -338,7 +355,8 @@ gal_pool_mean(gal_data_t *input, size_t psize, size_t 
numthreads)
 
 
 gal_data_t *
-gal_pool_median(gal_data_t *input, size_t psize, size_t numthreads)
+gal_pool_median(gal_data_t *input, size_t psize, size_t stride,
+                size_t numthreads)
 {
-  return pool_generic(input, psize, POOL_MEDIAN, numthreads);
+  return pool_generic(input, psize, stride, POOL_MEDIAN, numthreads);
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]