sr55 [Sat, 13 Jan 2018 20:30:44 +0000 (20:30 +0000)]
WinGui: Reselect the last selected preset (if still available) when editing a queue task. Fix a bug on the summary task not rendering correctly when queue editing.
Bradley Sepos [Wed, 27 Dec 2017 20:10:27 +0000 (15:10 -0500)]
contrib: Update libsamplerate.
I've asked upstream a couple times to push at least one tag, but it seems the maintainer is busy with other projects. Imagining a world where libsamplerate 0.1.9 was tagged, this is libsamplerate 0.1.9-35-g02ebb9f.
Numerous improvements include upstream moving from bzr to git, modernizing and cleaning up the autotools-based build system, fixing issues involving GCC 7, and *nine* years of improvements to the code base.
libsamplerate is now under a 2-clause BSD license.
Bradley Sepos [Thu, 11 Jan 2018 04:50:43 +0000 (23:50 -0500)]
libhb: Plug memory leak in NLMeans.
This reverts 0e072aa42e3affd6280447317375460753f9284b and implements a proper fix for some frames not being prefiltered correctly. Turns out it was an issue with an uninitialized variable.
Bradley Sepos [Fri, 29 Dec 2017 18:09:38 +0000 (13:09 -0500)]
build: Unclobber PATH when shunting build through Xcode.
Tools shipping with Xcode are still in PATH, only moved from first to last priority. Avoids accidentally using old tools where a newer version is installed. This ensures the tools identified by configure will be the exact tools used by make via Xcode.
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().