VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors.
Please consider supporting us by disabling your ad blocker or buy PlayOn and record Netflix! :)
+ Reply to Thread
Results 1 to 18 of 18
Thread
  1. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Bad toon tape here, chroma is destroyed.

    How much can be fixed?

    What Avisynth filter can do an aggressive temporal NR that only attacks the chroma?

    Don't worry about audio, tearing -- just the color issue.

    Click image for larger version

Name:	BadToonSample-still.png
Views:	45
Size:	598.9 KB
ID:	43356
    Image Attached Files
    Quote Quote  
  2. You need a good tbc to begin with, that's for sure
    Quote Quote  
  3. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    No TBC will help this. It's nth gen. Embedded errors.
    Quote Quote  
  4. As you doubtless know, the chroma problems are quite different in each field. I was able to get some improvement by separating (via lossless bob), merging the chroma of one field with the other, applying CNR2 and then recombining. However, no miracles. I would say the result was about half as bad. I was going to post the result but had to quit to finish some work.

    If the bogus colors are not used elsewhere in the frame, you might be able to use RT_Stats to detect the horizontal chroma stripes and then replace the chroma with the pixels immediately above and below, or pixels from the other field.

    I was able to detect horizontal stripes using the code discussed in this thread:

    Bad 1950s Kinescope

    This shows how I was able to remove a moving horizontal stripe:

    https://www.youtube.com/watch?v=qx26T6WOZ_4

    So, the idea would be to

    1. do stripe detection on each separated field:
    2. compare stripes of one field with another
    3. when stripes don't match, merge the chroma from the "good" field to fill in the stripe in the bad field

    The tough part will be determining which field has the good color, and also what to do when the stripes in both fields BOTH need to be removed.

    You may also be able to use the fact that animation sometimes has several frames which repeat. You can do a duplicate detection, using the B&W version of the frames, perhaps with some blur applied, and then do averaging across those duplicate frames.

    As you can tell, I don't quite have a good solution to this.
    Quote Quote  
  5. Originally Posted by lordsmurf View Post

    What Avisynth filter can do an aggressive temporal NR that only attacks the chroma?

    You can force any filter to affect chroma only - by applying to U and V directly (and on separated even/odd grouped fields if you want to preserve interlace) .

    Or, another way is to filter using whatever, then merge back the original unfiltered Y with mergeluma()

    I wouldn't have high expectations given the condition of the source. So I don't think it matters much what you use - just use something heavy like neat video, mctd, ttempsmooth , ccd , with strong settings , etc...


    In this example, I used some vertical and general blurring to start breaking up the horizontal bars and ttempsmooth for temporal smoothing , some heavy knlmeanscl for general denoising on the separate u,v planes of each separate odd/even field. To smooth things over more, I ran it through neat video, then merged back the luma .

    The color bars are pretty much gone, but there is still some tiny color flicker, so I probably wasn't aggressive enough with the settings. You're going to get chroma ghosting with strong ttempsmooth settings, especially on shots where there is more motion. This sample wasn't a good one to demonstrate that problem but you're going to have to make trade offs

    Image
    [Attachment 43371 - Click to enlarge]


    avisynth prefilter
    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    AVISource("BadToonSample.avi")
    ConvertToYV16(interlaced=true)
    orig=last
    
    ev=orig.assumetff().separatefields().selecteven()
    od=orig.assumetff().separatefields().selectodd()
    
    ev
    ue_chroma = UToY(ev).blur(0,1.5).binomialblur(5).ttempsmooth(maxr=6,lthresh=150, strength=6).KNLMeansCL(d=3, a=8, h=6, device_type = "GPU", device_id = 1, channels="Y")
    ve_chroma = VToY(ev).blur(0,1.5).binomialblur(5).ttempsmooth(maxr=6,lthresh=150, strength=6).KNLMeansCL(d=3, a=8, h=6, device_type = "GPU", device_id = 1, channels="Y")
    YToUV(ue_chroma, ve_chroma)
    MergeLuma(ev)
    ev_filtered=last
    
    od
    uo_chroma = UToY(od).blur(0,1.5).binomialblur(5).ttempsmooth(maxr=6,lthresh=150, strength=6).KNLMeansCL(d=3, a=8, h=6, device_type = "GPU", device_id = 1, channels="Y")
    vo_chroma = VToY(od).blur(0,1.5).binomialblur(5).ttempsmooth(maxr=6,lthresh=150, strength=6).KNLMeansCL(d=3, a=8, h=6, device_type = "GPU", device_id = 1, channels="Y")
    YToUV(uo_chroma, vo_chroma)
    MergeLuma(od)
    od_filtered=last
    
    interleave(ev_filtered,od_filtered)
    assumefieldbased().assumetff().weave()
    Prefetch(6)

    Input to neat video , then Merge back original luma
    Code:
    orig=AVISource("BadToonSample.avi")
    
    AVISource("NV_output.avi") #output from NV will be RGB
    ConvertToYUY2(interlaced=true)
    MergeLuma(orig)
    Image Attached Files
    Quote Quote  
  6. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Attached is my attempt. I was just seeing if anybody had anything better.

    Mine is a bit aggressive. If you go frame-by-frame, chroma blending is obvious. But in full motion, when watching it (the intention after all, right?), you rarely see any major distractions. The timebase/timing on this tape was blah, but not horrid. The worst could be cropped/masked, and was intermittent full-frame. The tracking was terrible, but my stacked stabmod() got most of it, with occasional false fixes.

    Edit:
    poison was typing at the same time I was! Hmm... I may like your method better than my own. I need to test it on the full clip.

    .
    Image Attached Files
    Quote Quote  
  7. You can improve chroma filtering by stabilizing first - it will reduce the temporal smoothing errors because x,y translations/ rotation fluctuations will be less severe .

    That example demonstrated pure chroma filtering only, but you wouldn't do that in real life, because some operations like stabilization and at least some Y filtering will be in common, so you'd probably combine at least some things to make it faster

    Maybe less so on "toons", but another way to get back details from overfiltering is to use a weighted merge(a,b, weight=x) to bring back some texture. So if your heavy duty filter chain affets Y,U,V and kills the Y too much you can bring back some of the original signal
    Quote Quote  
  8. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    I'm getting an error on that script.
    Code:
    KNLMeansCL: no compatible opencl platforms available!
    line 10
    I see some conversations about this error, possibly related to CPU, but I'm using a Intel i7-6700K (Skylake).

    I'm also curious what your NeatVideo settings were.

    And I can provide another clip, more motion.
    Quote Quote  
  9. use device_id=0 for iCPU , or just omit the device_id parameter . Typically "0" is iCPU, "1" is 1st discrete GPU, "2" is 2nd discrete GPU etc.... that filter can't use multiple GPU's (yet)


    Neat video was just strong temporal , strong everything especially cb, cr . Detail preservation / blurring didn't really matter for this example because the luma was being discarded anyway
    Quote Quote  
  10. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    I set device_id=0m, and it at least loads.

    I see:
    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    Prefetch(6)
    Are you using Avisynth+ ?

    Do you have a suggestion for regular Avisynth?
    Code:
    SetMemoryMax(2048)
    SetMTMode(5,8)
    AviSource
    SetMTMode(4,8)
    That often works well for me, but getting OOM error on the filter.
    Honestly, I don't remember why I have those values, or what it means anymore. The wiki reads like "blah blah blah".

    Right now, without MT, I'm getting 0.5 frames per second -- on 16gb RAM i7-6700K!!! At that speed, it's a proof-of-concept filter only, not anything real-world usable.

    What speed are you getting from this?
    Quote Quote  
  11. Originally Posted by poisondeathray View Post
    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    AVISource("BadToonSample.avi")
    ConvertToYV16(interlaced=true)
    orig=last
    ev=orig.assumetff().separatefields().selecteven()
    od=orig.assumetff().separatefields().selectodd()
    ev
    ue_chroma = UToY(ev).blur(0,1.5).binomialblur(5).ttempsmooth(maxr=6,lthresh=150, strength=6).KNLMeansCL(d=3, a=8, h=6, device_type = "GPU", device_id = 1, channels="Y")
    ve_chroma = VToY(ev).blur(0,1.5).binomialblur(5).ttempsmooth(maxr=6,lthresh=150, strength=6).KNLMeansCL(d=3, a=8, h=6, device_type = "GPU", device_id = 1, channels="Y")
    YToUV(ue_chroma, ve_chroma)
    MergeLuma(ev)
    ev_filtered=last
    od
    uo_chroma = UToY(od).blur(0,1.5).binomialblur(5).ttempsmooth(maxr=6,lthresh=150, strength=6).KNLMeansCL(d=3, a=8, h=6, device_type = "GPU", device_id = 1, channels="Y")
    vo_chroma = VToY(od).blur(0,1.5).binomialblur(5).ttempsmooth(maxr=6,lthresh=150, strength=6).KNLMeansCL(d=3, a=8, h=6, device_type = "GPU", device_id = 1, channels="Y")
    YToUV(uo_chroma, vo_chroma)
    MergeLuma(od)
    od_filtered=last
    interleave(ev_filtered,od_filtered)
    assumefieldbased().assumetff().weave()
    Prefetch(6)
    This the best solution to remove multiples color stripes i've seen yet. I had my own solutions with ccd and other complex scripting that didn't remove all the stripes. I've tested your script on another video to make sure

    this Toon video also need to have the chroma upped/moved to the right i believe:
    Quote Quote  
  12. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Originally Posted by themaster1 View Post
    I've tested your script
    What fps speed are you getting?
    Quote Quote  
  13. Yes avisynth+ x64

    There is no question will get faster results with x64 or avisynth+ or MT, but the large bottleneck is the GPU filter, so you can replace that with something else faster, or just increase the NV settings a bit more.

    There is nothing "special" about this - you can replace any of the filters with a similar filter. For example ttempsmooth could be replaced by temporal smoother in vdub. You could use any variation of preblurring (but you probably want vertical blurring more than horizontal blurring) . You're just denoising chroma selectively as per original topic, and given that it's a cartoon, and the poor condition of source - it's not as if you're trying to preserve massive amounts of chroma detail so just use some strong filters
    Quote Quote  
  14. Damn PoisonDeathRay, you sure have a lot of experience with crazy unusual fix ups. I wouldn't have even began to know where to start to fix that and I been working with animation for years. I didn't think it was going to be possible to clean it up as well as your example looks. I expected at least some of those color artifacts to be impossible to remove, but you sure impressed me. I really need to get better at chroma and luma stuff.
    Quote Quote  
  15. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Can Avisynth+ and standard 2.6 be installed concurrently?

    Is it as simple as letting both install in their native folders?

    I don't have time to mess with a borked system, if there will be known conflicts.
    Quote Quote  
  16. Originally Posted by lordsmurf View Post
    Can Avisynth+ and standard 2.6 be installed concurrently?
    Yes, that's how I have it set up on my 2 main avisynth computers. The "vanilla" original 32bit 2.6 (and mt is just a .dll swap) , concurrent with x64 avisynth+ mt. I have it set up that way, because I still need some ancient stuff and this 100% ensures the old stuff works, but you still are able to use the new stuff

    Other people have completely moved over to avisynth+ , 32bit/64bit / MT without any regrets - I would say that's the way the majority of people migrating set it up. You can still load original 2.6 plugins in 32bit avisynth+, so in theory you shouldn't need to set it up the way I have


    Is it as simple as letting both install in their native folders?
    It can be, or you can customize it

    I don't have time to mess with a borked system, if there will be known conflicts.
    Groucho2004 has a universal installer that makes things "easier" to install and swap things around. But for some people, for whatever reason, had problems with it. So I wouldn't recommend doing it on a "regularly used" rig until you have spare time to fiddle around in case something goes wrong. But I'm more cautious than typical user
    https://forum.doom9.org/showthread.php?t=172124

    In the end it's worth it. More stable, no memory issues, significantly faster (even in single threaded vs. single threaded) . But it takes some fiddling around to get working, along with x64 plugins , updated version etc...It's like "dll hell" all over, or learning to walk again.
    Quote Quote  
  17. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    It's been a while since I last installed Avisynth, so I'd forgotten that no program is actually in the program folder, just the plugins.

    I'm actually using 2.6 MT (had forgotten that fact), and simply renamed the default avisynth.dll to something else, and replaced with the 2.6MT. I downloaded the binary zip from the + site, and again renamed the old 2.6MT DLL, and copied the + DLL 32-bit to the syswow64 folder. But it's not working. Getting script errors in AvsPmod ("no function named setfiltermtmode").

    Saved the existing plugins folder (rar backup), overwrote plugins for +

    Where'd I go wrong?

    Guessing devil.dll in syswow64 also needs replacing.

    I see a quote by Groucho:
    Don't use the system32/syswow64 directories for the avisynth/devil DLLs, use a directory to which your PATH environment variable points.
    ^ No idea what that means. It would be smarter to have DLL outside Windows system folders, but I see no further details on this. Does it refer to the registry? Ifso, where exactly?
    Quote Quote  
  18. Originally Posted by lordsmurf View Post
    It's been a while since I last installed Avisynth, so I'd forgotten that no program is actually in the program folder, just the plugins.

    I'm actually using 2.6 MT (had forgotten that fact), and simply renamed the default avisynth.dll to something else, and replaced with the 2.6MT. I downloaded the binary zip from the + site, and again renamed the old 2.6MT DLL, and copied the + DLL 32-bit to the syswow64 folder. But it's not working. Getting script errors in AvsPmod ("no function named setfiltermtmode").

    Saved the existing plugins folder (rar backup), overwrote plugins for +

    Where'd I go wrong?

    Guessing devil.dll in syswow64 also needs replacing.

    I see a quote by Groucho:
    Don't use the system32/syswow64 directories for the avisynth/devil DLLs, use a directory to which your PATH environment variable points.
    ^ No idea what that means. It would be smarter to have DLL outside Windows system folders, but I see no further details on this. Does it refer to the registry? Ifso, where exactly?

    1) You need the full original avisynth+ install first, before you overwrite with the newer MT updates . The updates don't include everything. So it's a very old version you have to install first

    I just used the Groucho2004 batch file to set the directory path(s). Open it up in notepad and you can edit the paths. It has simple explanations of what is going on. You can set custom paths if you want things placed differently

    So my old 32bit vanilla install is untouched. I just installed avisynth+ x64 on top of it, with it's own separate directory and plugin paths. For example mine was on a different drive

    Code:
    set AVS_SRC_DIR=D:\AvisynthRepository
    By default, it will create a plugins directory inside that, unless you specify differently in the bat file (there are separate parameters you can customize in the bat)
    Quote Quote  



Similar Threads