"MC_Spudsmod" has this function to add noise only to the dark areas
http://avisynth.nl/index.php/MC_Spuds
I would like to be able to use this mask but to apply other debanding filters only in black areas.Code:# add grain to dark areas so encoders dont block them up on a low bitrate, also can give detail illusion maskdark = (addnoise) ? clp7.mt_lut("x " + th_lo + " < 255 x " + th_hi + " > 0 x " + th_lo + " - " + th_hi + " " + th_lo + " - / 255 * ? ? "): nop() clp8 = (addnoise && chro) ? mt_merge(clp7,clp7.sharpen(0.25).addgrain(2,0,0),maskdark,u=3,v=3) \ : (addnoise) ? mt_merge(clp7,clp7.sharpen(0.25).addgrain(2,0,0),maskdark): clp7
how could I use this mask,
thank you for your help
+ Reply to Thread
Results 1 to 16 of 16
-
-
-
my friend could you please make an example the same way you helped me out here.
Code:WhateverSource() denoised = WhateverDenoiser() edgemask = ConvertToRGB32().Kirsch().ConvertToYV12(matrix="pc .601") edgemask = edgemask.mt_binarize(120).Blur(1.0).Blur(1.0) Overlay(denoised, last, mask=edgemask)
-
It's a mask with hard cutoffs (not a good mask for general usage) . So you will get bad problems in some scenes with abrupt transitions, especially when adding grain or noise. There will be clean areas adjacent to noisy areas. In that function, the defaults are 24 and 42 for low and high
eg
Code:th_hi = string(24) th_lo = string(42) a=whateversource() a mt_lut("x " + th_lo + " < 255 x " + th_hi + " > 0 x " + th_lo + " - " + th_hi + " " + th_lo + " - / 255 * ? ? ") mymask=last a #YOUR FILTER HERE b=last mt_merge(a, b, mymask, u=3,v=3,true)
-
-
This is discussed in detail in other threads here and at doom9. Use search.
There is no 1 single solution. It depends on the source and specific scenario. Try a few of the suggestions out in those threads and see what works for your particular source. Also, people have different opinions - some can tolerate heavy grain or noise, others cannot .
Basically it depends on the type of "banding" and the underlying cause . Is it banding from low bit depths, or from poor encoding (high quantization), or overdenoising etc...
If you add noise/grain or dither to shadow areas preferentially it can be one way to address it for any of the causes (you're basically "covering" up the problem) , but you have to encode it properly with proper settings - otherwise high quantization banding comes right back . 10bit encoding helps here, even from an 8bit source
Static grain or fixed pattern dither "costs" less in terms of bitrate, but it often looks very unnatural in some scenes; especially if "bright" areas have normal noise and grain . A hard luma mask like that mc_spuds function there isn't feathered (no fall off function, it's binary between the hi/low values), so it will look very unnatural in some scenes. You will get abrupt transitions between areas with/without grain.
Applying "dancing" grain or random noise is more effective usually compared to fixed pattern types, but you need much more bitrate to preserve it (larger filesizes) -
-
Do you have any idea what mt_merge() does? It blends two videos together. The mask determines which pixels come from which video. Where the mask is black the pixels come from the first video, where the mask is white the pixels come from the second video. Between those two extremes the resulting image is a weighted average of the two source videos. So you create a video without debanding, a video with debanding, and a mask based on brightness of the video, then use them in mt_merge().
Keep in mind that when you don't specify a video stream by name the name "last" is implied. So
Code:AviSource("filename.avi") SomeFilter()
Code:last = AviSource("filename.avi") last = SomeFilter(last) return(last)
-
I mean anything that is not fixed. There should be a list somewhere on the avisynth wiki or doom9 of various functions. But there are pros/cons to each of them.
There are many different dithering algorithms. Have a look at the dither documentation. A well balanced one for general use Floyd-Steinberg
If you're using a luma mask to preferentially apply to dark/shadow areas, you generally want to try to match the pattern roughly with the existing noise/grain . E.g. if you have some live action footage with heavy coarse grain pattern from a specific film stock , it will look bad or mismatched if you added small grain particles or colored grain that look completely different. But this hopefully should be common sense -
for example in this classic anime video, it's a Japanese bluray remastered from a 1982 movie, I see that it has a lot of banding and macroblocks, Or maybe I'm wrong, could help me detect the problem I see that in the dark areas a lot of banding and other problems too,
It's a direct hit of the bluray, a small example.
https://mega.nz/#!hf5X0agC!v0Ecmi3-czQ7D4ksyhblDPbmvCN2mW1V7X-xjbSa5mg
Thank you very much for your help, the idea I have is to apply a filter to avoid banding, only in dark areas where the human eye notices more. Although if you guys have any better methods, it's welcome. -
for example in this classic anime video, it's a Japanese bluray remastered from a 1982 movie, I see that it has a lot of banding and macroblocks, Or maybe I'm wrong, could help me detect the problem I see that in the dark areas a lot of banding and other problems too,
It's a direct hit of the bluray, a small example.
https://mega.nz/#!hf5X0agC!v0Ecmi3-czQ7D4ksyhblDPbmvCN2mW1V7X-xjbSa5mg
Thank you very much for your help, the idea I have is to apply a filter to avoid banding, only in dark areas where the human eye notices more. Although if you guys have any better methods, it's welcome. -
Start with something simple until you understand what's going on.
Code:LWLibavVideoSource("Cobra(1982)(BD)(SAMPLE).mkv") banded = last debanded = GradFun3() darkmask = mt_binarize(40, upper=true) # below 40 --> white, above 40 --> black mt_merge(banded, debanded, darkmask) Interleave(banded, last, darkmask) # show before, after, and mask
Similar Threads
-
ffmpeg noise filter usage based on mplayer noise settings?
By Selur in forum Video ConversionReplies: 5Last Post: 21st Jun 2015, 08:19 -
Failed to add video hook function
By buyahya in forum Video ConversionReplies: 2Last Post: 1st Apr 2014, 19:54 -
What can be done about this kind of noise in dark areas?
By brassplyer in forum RestorationReplies: 2Last Post: 22nd Oct 2013, 02:42 -
Artifacts in dark areas in all video players
By ANONXX in forum Software PlayingReplies: 9Last Post: 19th Aug 2013, 22:35