]> granicus.if.org Git - handbrake/commitdiff
libhb: Output result of nlmeans prefilter when passthru enabled.
authorChris Darroch <chrisd@apache.org>
Sat, 30 Dec 2017 08:12:57 +0000 (00:12 -0800)
committerBradley Sepos <bradley@bradleysepos.com>
Sat, 30 Dec 2017 11:26:16 +0000 (06:26 -0500)
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

index 7b6a8deb180c0d3401fabcc46d10b349eaf4326d..8b776f4f17bb6dba490979eb729ea00919eccfd9 100644 (file)
@@ -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);