Blame filter.wind.inc.c

ea5919
ea5919
ea5919
ea5919
void filterWind(Img *img, Img *pattern, double att) {
ea5919
  if (!img->data) return;
ea5919
ea5919
  for(int x = 0; x < img->w; ++x) {
ea5919
    double nk = pattern && pattern->data ? imgCubicHCh(pattern, 0, (double)x/img->w*pattern->w, 0) : 1;
ea5919
    double acc[4] = {};
ea5919
    double a = 1 - pow(1 - att, nk);
ea5919
    for(int y = 0; y < img->h; ++y) {
ea5919
      double *cl = imgPixel(img, x, y);
ea5919
      for(int c = 0; c < 4; ++c) {
ea5919
        if (cl[c] < acc[c]) {
ea5919
          cl[c] = acc[c];
ea5919
        } else
ea5919
        if (acc[c] < cl[c]) {
ea5919
          acc[c] = cl[c];
ea5919
        }
ea5919
        acc[c] *= a;
ea5919
      }
ea5919
    }
ea5919
  }
ea5919
}