You need to implement the following function:

void mf(int ny, int nx, int hy, int hx, const float* in, float* out)

Here `in`

and `out`

are pointers to `float`

arrays, each of them contains `ny*nx`

elements (these will be floating point numbers between 0.0 and 1.0). The arrays are already allocated by whoever calls this function; you do not need to do any memory management.

The original value of pixel (x,y) is given in `in[x + nx*y]`

and its new value will be stored in `out[x + nx*y]`

.

In the output, pixel (x,y) will contain the median of all pixels with coordinates (i,j) where

`0 <= i < nx`

,`0 <= j < ny`

,`x - hx <= i <= x + hx`

,`y - hy <= j <= y + hy`

.

This is the *sliding window*. Note that the window will contain at most `(2*hx+1) * (2*hy+1)`

pixels, but near the boundaries there will be fewer pixels.

For our purposes, the median of the vector **a** = (*a*_{1}, *a*_{2}, …, *a*_{n}) is defined as follows:

- Let
*x*_{1},*x*_{2}, …,*x*_{n}be the values of**a**sorted in a non-decreasing order. - If
*n*= 2*k*+ 1, then the median of**a**is*x*_{k+1}. - If
*n*= 2*k*, then the median of**a**is (*x*_{k}+*x*_{k+1})/2.