VideoHelp Forum


Try DVDFab Video Downloader and rip Netflix video! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. "MC_Spudsmod" has this function to add noise only to the dark areas

    http://avisynth.nl/index.php/MC_Spuds

    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
    I would like to be able to use this mask but to apply other debanding filters only in black areas.

    how could I use this mask,

    thank you for your help
    Quote Quote  
  2. Look up what mt_merge() does.
    Quote Quote  
  3. Originally Posted by jagabo View Post
    Look up what mt_merge() does.
    I tried, but I couldn't make it work so I asked for help, with an example you could help me a lot, please.
    Quote Quote  
  4. mt_merge(unfiltered, filtered, maskdark)
    Quote Quote  
  5. Originally Posted by jagabo View Post
    mt_merge(unfiltered, filtered, maskdark)
    I can't use it, nothing comes out.
    Quote Quote  
  6. My post was symbolic, not literal.
    Quote Quote  
  7. Originally Posted by jagabo View Post
    My post was symbolic, not literal.
    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)
    Please
    Quote Quote  
  8. 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)
    Quote Quote  
  9. Originally Posted by poisondeathray View Post
    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)
    Thank you very much for your help, you know some good method to effectively combat banding,

    the idea I have is to only apply Static Grain to the dark areas where they are most noticeable.

    but maybe you'll stick to some more effective method
    Quote Quote  
  10. 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)
    Quote Quote  
  11. Originally Posted by poisondeathray View Post
    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)
    "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) "

    how to apply the Applying "dancing" grain
    Quote Quote  
  12. 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()
    is shorthand for

    Code:
    last = AviSource("filename.avi")
    last = SomeFilter(last)
    return(last)
    Quote Quote  
  13. Originally Posted by frank_zappa View Post

    how to apply the Applying "dancing" grain

    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
    Quote Quote  
  14. Originally Posted by jagabo View Post
    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()
    is shorthand for

    Code:
    last = AviSource("filename.avi")
    last = SomeFilter(last)
    return(last)
    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.
    Quote Quote  
  15. Originally Posted by poisondeathray View Post
    Originally Posted by frank_zappa View Post

    how to apply the Applying "dancing" grain

    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.
    Quote Quote  
  16. 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
    Then tweak to get exactly what you want. A different mask, different debanding, etc.
    Quote Quote  



Similar Threads