Log in

View Full Version : Is it possible? Passing a portion of a frame based upon luma intensity to a plugin?


Fullmetal Encoder
9th February 2011, 04:14
I have a problem (the common one) with using denoisers in which increasing the denoising strength, say Sigma in FFT3DFilter or "h" in TNLMeans, destroys noise but also destroys detail. I have an idea which may mitigate this problem and I am wanting to know if it's possible for Avisynth to solve it.

I am dealing exclusively with animated content. The noise I want to get rid of isn't overall grain but instead the artifacts, "mosquito" noise, blotches, DCT artifacts, pixellation, etc. that appear near lines and in the corners where lines intersect and in large flat color spaces.

It has occurred to me that in animated content detail is almost always established by lines which contrast with their surroundings. The darker lines are surrounded by brighter spaces. However, in a darker scene, the dark lines which define detail do not contrast as well with their dark surroundings. That detail is more difficult to discern. It stands to reason that artifacts and unwanted noise are also more difficult to discern in such lower luma scenes. This is because those artifacts and noise are often visible because they appear as darker pixels/smudges, block outlines, etc. on a lighter background. Therefore, denoising isn't as important in the lower luma areas of a frame as it is in higher luma portions.

So my question is this, is there any way at all to, for example, to create a sort of luma map of a frame, determine the higher luma portions of the frame and pass just those areas to a plugin for further denoising processing?

Or is there any way to pre-process the frame before it's passed to the denoising plugin such that the lower luma areas, below a certain threshold, are untouched by the denoiser? If this could be done then values of Sigma for FFT3DFilter, for example, could be calculated on-the-fly and sent to the plugin based upon all sorts of criteria (not just luma).

Another possibility I have been wondering about is if the frame both before and after being denoised could be compared. Then, the lower luma portions of the frame could be determined. The frame could then be re-created by removing those areas from the denoised frame and replacing them with the same areas from the original frame.

I realize that I have not tested ALL of the denoisers out there and that some may have similar user-defined luma-like threshold parameters but what I am talking about would provide a general mechanism for calculating denoising strength on a per frame basis by any number of criteria. That way I can use the denoise plugins that I like :)

So is it possible? Can Avisynth make my dream into reality?

cretindesalpes
9th February 2011, 09:35
You could combine solutions from these posts:
http://forum.doom9.org/showthread.php?p=1469207#post1469207
http://forum.doom9.org/showthread.php?p=1470369#post1470369

Fullmetal Encoder
12th February 2011, 20:37
Thank you!