From 0067b00e9cd251c776ec3d0b02f4e95ef0382601 Mon Sep 17 00:00:00 2001 From: Chris Darroch Date: Sat, 30 Dec 2017 00:12:57 -0800 Subject: [PATCH] libhb: Output result of nlmeans prefilter when passthru enabled. 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. --- libhb/nlmeans.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libhb/nlmeans.c b/libhb/nlmeans.c index 7b6a8deb1..8b776f4f1 100644 --- a/libhb/nlmeans.c +++ b/libhb/nlmeans.c @@ -581,8 +581,17 @@ static void nlmeans_prefilter(BorderedPlane *src, } // 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); -- 2.40.0