Contour based blurring
Compute the distance transform. You can do that very efficiently. This will give you the Euclidean distance to the closest boundary pixel, as well as the index of that pixel. Then, normalize all the distances in the mask so that the maximum becomes 1. This is required for the next stage: At each point initiate a Gaussian kernel. The kernel size $h$ (and similarly the standard deviation $\sigma$) should be a function of the weight, obtained from distance normalization. You can either use a coefficient - linear proportionality - or a complex kernel, depending on the blurring requirements. 

Finally, blur the signal at each pixel using the generated mask. Each pixel gets a unique mask and thus a different blurring. Note that, some of the pixels could get the same blur.

You only need to adjust the kernel size $h$, as for typical Gaussian kernels, $\sigma$ is a function of $h$. The function is simply a lookup table:

   $h$  $\sigma$
    3    (0.65)
    5    (0.87)
    7    (1.43)
    9    (1.88)
    11   (2.31)