+ if (s->type == 0) {
+ s->thresholding(s->block, width, height, width, s->threshold, s->percent);
+ } else {
+ for (int n = 0; n < s->nsteps; n++) {
+ float threshold;
+ float *block;
+
+ if (n == s->nsteps - 1) {
+ threshold = bayes_threshold(s->block, s->hlowsize[p][n], s->vlowsize[p][n], width, s->threshold);
+ s->thresholding(s->block, s->hlowsize[p][n], s->vlowsize[p][n], width, threshold, s->percent);
+ }
+ block = s->block + s->hlowsize[p][n];
+ threshold = bayes_threshold(block, s->hhighsize[p][n], s->vlowsize[p][n], width, s->threshold);
+ s->thresholding(block, s->hhighsize[p][n], s->vlowsize[p][n], width, threshold, s->percent);
+ block = s->block + s->vlowsize[p][n] * width;
+ threshold = bayes_threshold(block, s->hlowsize[p][n], s->vhighsize[p][n], width, s->threshold);
+ s->thresholding(block, s->hlowsize[p][n], s->vhighsize[p][n], width, threshold, s->percent);
+ block = s->block + s->hlowsize[p][n] + s->vlowsize[p][n] * width;
+ threshold = bayes_threshold(block, s->hhighsize[p][n], s->vhighsize[p][n], width, s->threshold);
+ s->thresholding(block, s->hhighsize[p][n], s->vhighsize[p][n], width, threshold, s->percent);
+ }
+ }