Bradley Sepos [Tue, 9 Jan 2018 09:30:28 +0000 (04:30 -0500)]
libhb: Add CSM prefilter to NLMeans.
CSM is a Conservative Smoothing filter with Median-like tendencies.
Conservative Smoothing is a basic noise reduction method that ensures a given pixel is within the values of those around it. A value higher than all the others is clamped to the maximum value in the neighborhood. Likewise, a value lower than all the others is clamped to the minimum value in the neighborhood. Basically, pixel values that seem to "fit in" are left alone, and extreme values are brought in line.
CSM takes this a step further. A pixel not affected by the previous part of the algorithm is subjected to additional thresholding. If the pixel value is closer to the minimum or maximum neighborhood value than the median, it is clamped to the half-way point. Finally, a pixel still not affected is subjected to a third level of thresholding, clamping to the half-way point between the median and the previous half-way point. Any other pixel value is deemed close enough to its peers and left alone.
In effect, this creates a "soft" median-like filter, where relatively similar values are left alone and increasingly disparate values are nudged closer together.
Practically, CSM is the best prefilter to date for improving weight decisions with sources containing a type or amount of noise proving difficult for NLMeans to uniformly dampen or completely remove on its own. Additionally, it does not significantly alter the strength metric in most cases, so it can simply be enabled wherever desired. From what I can tell in my limited testing, the algorithm respects proper detail and edges well enough that it seems to be safe with nearly any source. Perhaps it should be the default if I ever get around to creating NLMeans 2.
Unlike the mean and median prefilters where a larger neighborhood increases the strength of the prefilter, a larger CSM neighborhood merely takes more pixels into account, theoretically decreasing the strength of the filter. In practice, the provided 3x3 and 5x5 neighborhoods typically do not produce significantly differing results.
Basic usage: Add y-prefilter=16 to your desired parameters and NLMeans will use CSM for weighting decisions. Use y-prefilter=2064 if you want to see the output of the prefilter itself—the visual effect is mild. Adjust these values to 32 and 2080 for a 5x5 neighborhood; 3x3 works well in all cases I've tried.
Chris Darroch [Sat, 30 Dec 2017 08:12:57 +0000 (00:12 -0800)]
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.
In commit 29a49a8, the nlmeans_prefilter() call in nlmeans_filter_thread()
was fixed, but a corresponding change was not made to the similar
call site in nlmeans_filter_flush().
Bradley Sepos [Wed, 27 Dec 2017 19:03:33 +0000 (14:03 -0500)]
contrib: Update fribidi url to use GitHub tarball.
fribidi.org is gone. The official release archive we were using is gone. Only release tags on GitHub remain, and they are not direct replacements for the proper release archives we were using previously.
Some changes were necessary for compilation from source, namely:
- Removal of an ugly hack that resulted in configure being run more than once. Apparently the same fix is already upstream https://github.com/fribidi/fribidi/commit/0efbaa9052320a951823a6e776b30a580e3a2b4e
- Modification of Makefile.am to avoid building the doc subdirectory, since this will fail wherever c2man isn't available such as on Mac. We don't need these docs
- Modification of gen.tab/Makefile.in to use the host compiler when cross-compiling. This cannot be done as a normal patch since Makefile.in is generated in the bootstrap phase. This is an open issue upstream: https://github.com/fribidi/fribidi/issues/7
This is all a good lesson on the importance of maintaining urls. I'm still a bit stunned a widely used GNU project would shutter its domain and release archive.
Bradley Sepos [Wed, 27 Dec 2017 23:03:01 +0000 (18:03 -0500)]
contrib: Fix issues with fribidi.
The source tarball isn't exactly the same as the release tarball found on fribidi.org before it shuttered. Needs a little extra care and an anvil dropped on Mr. Horrible.
John Stebbins [Wed, 20 Dec 2017 17:53:43 +0000 (09:53 -0800)]
LinGui: remove "Reset All Titles" button
Replace with a preference option that synchronizes all title settings by
default. This makes the linux gui behaviour consistant with the other
guis by default. Titles can have independent settings by unchecking the
preference option.