| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When nlmeans_prefilter() is preparing to apply a pre-filter
to an image plane, it first attempts to make a copy of the
mem image plane into the mem_pre plane which will hold the
pre-filter's output.
However, the existing logic, which mirrors the loop over
all pixel rows in nlmeans_alloc(), improperly leaves the
bottom 2*border rows of the mem_pre plane uninitialized.
Where nlmeans_alloc() correctly copies the source image's rows
into its plane, by adding the correct offset to the memcpy(3)
destination to locate the image pixel data between the
horizontal and vertical borders, in nlmeans_prefilter() the
intention is to copy both the image and the borders. However,
the current loop only iterates h times, i.e., the size of
the image itself, and skips the last (bh - h) = 2*border rows.
Instead, we replace the loop with a single memcpy(3) call
which just duplicates the entire mem image plane, including
the border data.
|
| |
|
|
|
|
|
|
|
| |
Newest versions appear to have a "common.h" somewhere that is
interfering with libhb/common.h.
move headers into "handbrake" subdirectory
|
|
|
|
| |
Rename hb.h to handbrake.h
|
|
|
|
|
|
|
|
|
| |
Propagates pix_fmt, range, primaries, transfer, and matrix everywhere.
Everything that passes or creates video frames tags the frames with
their color matrix info.
All filters know the expected color matrix info of input frames.
|
| |
|
|
|
|
| |
NLMeans has used frame threading for years, so SIMD aside, these areas are sufficiently parallelized overall.
|
|
|
|
| |
Too many threads increases CPU cache pressure, reducing performance.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Closes #1088.
|
|
|
|
|
|
|
|
|
|
|
| |
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().
|
|
|
|
| |
Allows setting number of frames to process in parallel. For testing and experts wanting to fine tune the pipeline; e.g., fewer NLMeans threads may make x265 run slightly faster. Realistically, the defaults are the best choice for most everyone.
|
|
|
|
| |
This is an error that crept in when making nlmeans multithreaded
|
| |
|
|
|
|
|
|
| |
This simplifies accessing and changing filter parameters
programatically. It also changes the custom filter string format to a
':' separated list of key/value pairs.
|
| |
|
|
|
|
|
| |
This brings together several independent implementations of a simple
buffer list manager.
|
|
|
|
|
|
|
| |
Make the nlmeans default (when no string supplied) match "medium"
preset. And make the CLI default the medium preset.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7402 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
|
|
|
|
|
|
|
|
|
|
| |
... instead of a 0 length buffer.
This fixes this issue:
https://forum.handbrake.fr/viewtopic.php?f=12&t=31959
Theora can create 0 length output. These 0 length frames indicate
duplicate frames. So we can't use 0 length buffers to indicate the end
of the stream.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7143 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
|
|
| |
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6945 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
|
|
|
|
|
|
| |
Solves crash in accelerated code when source dimensions are not mod 16.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6915 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
|
|
| |
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6910 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
|
|
|
|
|
|
|
|
|
| |
Assume buffered planes are equal size in nlmeans.
Make nlmeans scalar counters read like accelerated counters (more readable and saves ~2 cycles).
Yet more const correctness.
Clarify some variable names for readability.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6896 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use calloc for nlmeans integral instead of memsets in-loop zeroing.
Replace superfluous const with literal in SSE implementation.
Move exponential table calculation out of the main loop.
More const correctness.
Add some braces.
Overall, slightly more readable/maintainable and (very) slightly faster.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6874 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
|
|
|
|
|
|
| |
Speed improvements of 1-6% seem typical. Most benefit seems to be for older hardware and/or hardware with fewer threads.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6826 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
|
|
|
|
|
| |
Scales well with number of CPUs, so is 4x faster on quad cores.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6397 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
|
|
|
|
|
|
|
| |
Fixes a typo (1/27 instead of 1/127) that caused edgeboost to match on nearly everything, and tweaks this number slightly.
Adds a post-processing step to handle marked pixels having too few marked neighboring pixels as false positives.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6224 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
|
|
| |
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6223 b64f7644-9d1e-0410-96f1-a4d463321fa5
|
|
Non-local means averages multiple patches of similar pixels together, preserving similarities and attenuating variance (usually noise). This is typically more effective than lowpass and more faithfully restores the appearance of structure and detail found in the original source, especially in the high frequency range. Parameters for origin patch weight tuning and pre-filtering further improve on the original algorithm.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6216 b64f7644-9d1e-0410-96f1-a4d463321fa5
|