Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libhb: Initial implementation of Deskeeter filter. #1872

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

bradleysepos
Copy link
Contributor

Removes mosquito noise from video.

The concept is simply denoising applied to high frequency picture information. Median filter is implemented as a proof of concept and works reasonably well. Other denoise methods such as NLMeans could be implemented for higher quality, if someone is interested in wiring things up.

Test using --deskeeter=ultralight/light/medium/strong/stronger/verystrong.

Removes mosquito noise from video.
@bradleysepos
Copy link
Contributor Author

@jstebbins I suspect there is either a bug in my code or in the new alignment/stride code, as there are some artifacts present depending on the settings. Try strong and/or y-kernel=lap when you get a chance.

@bradleysepos
Copy link
Contributor Author

Some screenshots:

Off / Medium
deskeeter-0-off
deskeeter-0-medium

Off / Strong
deskeeter-1-off
deskeeter-1-strong

At the moment the algorithm still seems too much like a generalized low pass, so it's mostly useful on animation and low resolution analog sources without much true high frequency information. It could probably be improved to only filter areas near edges, and possibly add more logic to better preserve or reconstruct strong edges themselves. And of course, a better denoising algorithm would likely improve the overall quality.

copying pixels on borders results in "edge" between copied pixels and
computed "high frequency" values.  This edge caused the artefacts. Make
"copied" pixels roughtly the same value range a computed "high
frequency" values.
Allow using values in the left margin up to half the stride border.
strength_scaled was 0 whenever src pix was less than 64
@jstebbins
Copy link
Contributor

I "fixed" the artefacts and a few other issues. The artefacts are gone, but I'm uncertain of the math that's going on. I just made the numbers work 😉

@bradleysepos
Copy link
Contributor Author

Thanks. I realized I forgot to free tmp but never pushed a fix.

@bradleysepos
Copy link
Contributor Author

What really needs to happen is edge detection and only filter near edges.

@bradleysepos
Copy link
Contributor Author

bradleysepos commented Apr 23, 2019

Off / Strong+None / Strong+Skip

deskeeter-1-off

deskeeter-1-strong

Screen Shot 2019-04-23 at 7 55 03 PM

The dark outlines are aliased now, either because the filtering is occurring on the edges or fixing the integer value clipping made things worse, despite being mathematically correct.

Still a lot of mosquito noise with tune none; I'm not sure the radius around the edges is wide enough. Looks better with tune skip.

@jstebbins
Copy link
Contributor

So exactly what pixels would you like the filter to be applied to. You said the black outline is aliased so I assume you would like to avoid touching black outlines. The white highlight on the pillar is also being aliased (as would white outlines if there were any). I'm thinking maybe what you are looking for is to avoid touching thin line features. How do you want to treat edges that have no outline, i.e. just a gradient from one intensity to another?

@bradleysepos
Copy link
Contributor Author

Pixels around but not including strong borders. Image example roughly highlighting some, but not all, of the affected areas:

mosquito

See also: https://www.pcmag.com/encyclopedia/term/55914/mosquito-noise

Since deskeeter needs to filter pixels around edges, construct an mask
from the edge mask that excludes edge pixels and includes non-edge
pixels within a configurable radius of edge pixels.

Also fixes a threading problem.  My mask buffers where getting shared
across multiple threads.  Not good.
@bradleysepos
Copy link
Contributor Author

Progress!

Off / Strong+None

deskeeter-1-off

deskeeter-1-strong

deskeeter-1-off-zoom

deskeeter-1-strong-zoom

@bradleysepos
Copy link
Contributor Author

Chroma artifacts appear where using custom settings, even simply y-strength=1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

4 participants