When the prefilter passthru flag is enabled, write the nlmeans prefilter
result into the "main" memory buffer (mem) instead of the prefilter one
(mem_pre) so that the prefilter result will be output as if it was the
result of the nlmeans filter itself.
Otherwise, when the passthru flag is enabled, the prefilter result is
lost and the filter effectively just outputs its source input without
any changes.
}
// Assign result
- src->mem_pre = mem_pre;
- src->image_pre = image_pre;
+ if (filter_type & NLMEANS_PREFILTER_MODE_PASSTHRU)
+ {
+ // No swap needed as nlmeans_alloc() set src->mem_pre == src->mem
+ src->mem = mem_pre;
+ src->image = image_pre;
+ }
+ else
+ {
+ src->mem_pre = mem_pre;
+ src->image_pre = image_pre;
+ }
// Recreate borders
nlmeans_border(mem_pre, w, h, border);