Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#21 | Link | |
|
Registered User
Join Date: Apr 2010
Posts: 175
|
@Didée,
Quote:
![]() Also the double makediff seems a bit recursive ? |
|
|
|
|
|
|
#22 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
Don't ask. Just trust.
![]() Code:
o = last sm = o.bicubicresize(88,144) # can be altered, but ~25% of original resolution seems reasonable smm = sm.temporalsoften(1,32,255,24,2).merge(sm,0.25) smm = smm.temporalsoften(2,12,255,20,2) o2 = o.mt_makediff(mt_makediff(sm,smm,U=3,V=3).bicubicresize(width(o),height(o),0,0),U=3,V=3) Effectively, this is (very similar to) a spatial lowpass on the difference of a normal temporalsoften. (This little script does also chroma processing just for the heck of it. Since the clip effectively is B/W, it's not really needed. You could just call greyscale() .) Maybe the initial downsize even could be made a little smaller. Try (68,112,0,0) instead of (88,144,0,0)
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
|
|
#24 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
Yes, there is only one clip IN the parantheses. This one clip is the 2nd clip argument of mt_makediff(). The 1st clip argument is the leading "o." oh-dot.
Code:
o2 = o.mt_makediff( mt_makediff(sm,smm,U=3,V=3) .bicubicresize(width(o),height(o),0,0) , U=3,V=3) Generally, it doesn't matter if you write "Filter(clip1,clip2)" or "clip1.Filter(clip2)". It's mostly a matter of habit. In the special case of mt_makediff (or mt_adddiff), it is my personal preference to mix both ways of syntax, depending on the "intention" of the action: - when getting a difference from two clips, I write "mt_makediff(clip1,clip2)" - (Having two "normal" clips, and getting a 128-centered difference-clip as result) - when applying a difference-clip to a normal clip, I write "clip1.mt_makediff(clip2)" - (clip2 being the difference-clip) There is no "must be so" behind this. It's just my personal way using the freedom of syntax. ===== /edit ===== Code:
o2 = o.mt_makediff( something ) <==> (the same as) o2 = mt_makediff( o, something ) # with # something = mt_makediff(sm,smm,U=3,V=3).bicubicresize(width(o),height(o),0,0) Or, dissecting the script in another way: Code:
o = last small = o.bicubicresize(...) small_ts = small.temporalsoften(...) diff_small = mt_makediff(small,small_ts) diff_small_resized = diff_small.bicubicresize(width(o),height(o)) o2 = o.mt_makediff(diff_small_resized)
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) Last edited by Didée; 8th November 2012 at 15:01. |
|
|
|
|
|
#25 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,406
|
Yes, first clip is o, second is result of "mt_makediff(sm,smm,U=3,V=3).bicubicresize(width(o),height(o),0,0)"
EDIT: Beaten to it, as Didée said.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 8th November 2012 at 15:50. |
|
|
|
|
|
#26 | Link |
|
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,442
|
@lisztfr9: see "OOP notation" here: http://avisynth.org/mediawiki/Grammar
|
|
|
|
|
|
#27 | Link | ||
|
Registered User
Join Date: Apr 2010
Posts: 175
|
This is working great ! But i don't know why, i tried to play a bit with the code :
Quote:
All is in the title, the subsampled temporal softening, i guess the antiflicker effect is there, mt_makediff(sm,smm I just see that the subsampling does the trick, but why ? i never would have thought it, because the reduced image isn't that small.... Edit : now i believe the temporal soften does it all. Edit : this seems most effective : Quote:
Last edited by lisztfr9; 9th November 2012 at 10:36. |
||
|
|
|
|
|
#28 | Link |
|
Registered User
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
|
Hi all!
I try two motion compensated scripts with ReduceFlicker Code:
SetMTMode(3,8)
source=AVISource("TC_Sample.avi")
SetMTMode(2,8)
super=source.MSuper(pel=2, sharp=1)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=16, overlap=8, chroma=false, dct=1)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=16, overlap=8, chroma=false, dct=1)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=16, overlap=8, chroma=false, dct=1)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=16, overlap=8, chroma=false, dct=1)
backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=16, overlap=8, chroma=false, dct=1)
forward_vec3 = MAnalyse(super, isb = false, delta = 3, blksize=16, overlap=8, chroma=false, dct=1)
bc1 = source.MCompensate(super, backward_vec1, thSAD=1000)
fc1 = source.MCompensate(super, forward_vec1, thSAD=1000)
bc2 = source.MCompensate(super, backward_vec2, thSAD=1000)
fc2 = source.MCompensate(super, forward_vec2, thSAD=1000)
bc3 = source.MCompensate(super, backward_vec3, thSAD=1000)
fc3 = source.MCompensate(super, forward_vec3, thSAD=1000)
Interleave(bc3,bc2,bc1,source,fc1,fc2,fc3)
ReduceFlicker(strength=3,aggressive=true)
SelectEvery(7,3)
Code:
SetMTMode(3,8)
AVISource("TC_Sample.avi")
SetMTMode(2,8)
super=source.MSuper(pel=2, sharp=1)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=16, overlap=8, chroma=false, dct=1)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=16, overlap=8, chroma=false, dct=1)
backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=16, overlap=8, chroma=false, dct=1)
backward_vec4 = MAnalyse(super, isb = true, delta = 4, blksize=16, overlap=8, chroma=false, dct=1)
bc1 = source.MCompensate(super, backward_vec1, thSAD=1000)
bc2 = source.MCompensate(super, backward_vec2, thSAD=1000)
bc3 = source.MCompensate(super, backward_vec3, thSAD=1000)
bc4 = source.MCompensate(super, backward_vec4, thSAD=1000)
Interleave(bc4,bc3,bc2,bc1,source)
DeFlicker(scene=30,lag=4)
SelectEvery(5,4)
yup. |
|
|
|
|
|
#29 | Link |
|
Warm and fuzzy
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 206
|
yup
Is it so ? . Code:
#
# http://forum.doom9.org/showthread.php?t=166355&page=2
# motion compensated scripts with ReduceFlicker
#
function ReduceFlicker2(clip clp)
{
source = clp
super = source.MSuper(pel=2, sharp=1)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=16, overlap=8, chroma=false, dct=1)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=16, overlap=8, chroma=false, dct=1)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=16, overlap=8, chroma=false, dct=1)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=16, overlap=8, chroma=false, dct=1)
backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=16, overlap=8, chroma=false, dct=1)
forward_vec3 = MAnalyse(super, isb = false, delta = 3, blksize=16, overlap=8, chroma=false, dct=1)
bc1 = source.MCompensate(super, backward_vec1, thSAD=1000)
fc1 = source.MCompensate(super, forward_vec1, thSAD=1000)
bc2 = source.MCompensate(super, backward_vec2, thSAD=1000)
fc2 = source.MCompensate(super, forward_vec2, thSAD=1000)
bc3 = source.MCompensate(super, backward_vec3, thSAD=1000)
fc3 = source.MCompensate(super, forward_vec3, thSAD=1000)
Interleave(bc3, bc2, bc1, source, fc1, fc2, fc3)
ReduceFlicker(strength=3, aggressive=true)
SelectEvery(7, 3)
return (last)
}
#
# http://forum.doom9.org/showthread.php?t=166355&page=2
# motion compensated scripts with Deflicker from Fizick
#
function DeFlicker2(clip clp)
{
source = clp
super = source.MSuper(pel=2, sharp=1)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=16, overlap=8, chroma=false, dct=1)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=16, overlap=8, chroma=false, dct=1)
backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=16, overlap=8, chroma=false, dct=1)
backward_vec4 = MAnalyse(super, isb = true, delta = 4, blksize=16, overlap=8, chroma=false, dct=1)
bc1 = source.MCompensate(super, backward_vec1, thSAD=1000)
bc2 = source.MCompensate(super, backward_vec2, thSAD=1000)
bc3 = source.MCompensate(super, backward_vec3, thSAD=1000)
bc4 = source.MCompensate(super, backward_vec4, thSAD=1000)
Interleave(bc4, bc3, bc2, bc1, source)
DeFlicker(scene=30, lag=4)
SelectEvery(5, 4)
return (last)
}
__________________
Warm and fuzzy (white and fluffy) |
|
|
|
|
|
#30 | Link |
|
Registered User
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
|
Jenyok!
I do not read Your post. First script written 3 days before http://forum.doom9.org/showthread.ph...35#post1599435 when I am waiting sample. Two different man can think like one. For me also interesting using Deflicker but one need a lot of MC frames only from one side. yup. |
|
|
|
|
|
#31 | Link | |
|
Registered User
Join Date: Nov 2006
Posts: 19
|
Quote:
The script as written above presented two issues for me. First, it produced shimmering in areas with high-contrast and movement (eg, a dark shirtsleeve moving against a light background). Second, the temporal softening was a bit too strong for my source, and produced "ghost edges" during movement (remnants/foreshadowing of adjacent frames). The shimmering was eliminated with an edge (contrast) mask, and the ghosting required some tuning of the temporal softening. I ended up with this: Code:
o = last sm = o.bicubicresize(174,88) #25% of source smm = sm.temporalsoften(1,12,255,24,2).merge(sm,0.25) smm = smm.temporalsoften(2,7,255,20,2) o2 = o.mt_makediff(mt_makediff(sm,smm,U=3,V=3).bicubicresize(width(o),height(o),0,0),U=3,V=3) overlay(o2,o,mask=o.mt_edge(mode="min/max",u=2,v=2).blur(1.5).blur(1.5)) |
|
|
|
|
|
|
#32 | Link |
|
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 761
|
Small_Deflicker
I've been testing this script to mitigate flickering and I've adapted it to be less aggressive (now exists presets):
Code:
# Small Deflicker 2.4 # Based in idea by Didée, kurish (http://forum.doom9.org/showthread.ph...35#post1601335) # Adapted by GMJCZP # Requirements: Masktools2, RGTools, vsCnr2, vsMSmooth. # USAGE: # Small_Deflicker(clip, width_clip=width(clip)/4, height_clip=height(clip)/4, preset=2, cnr=false, rep=false) (default values) # PRESETS: # preset = 1 Soft deflickering (GMJCZP values) # preset = 2 Medium deflickering (kurish values, preset by default) # preset = 3 Hard deflickering (Didée values) # REPAIR MODE: # - Chroma noise reduction it is an experimental attempt to mitigate the side effects of the script # By default it is disabled (only for presets 2 and 3) # - Repair is an option for certain sources or anime/cartoon content, where ghosting may be evident # By default it is disabled (maybe for preset = 1 it is not necessary to activate it) function Small_Deflicker(clip o, int "width_clip", int "height_clip", int "preset", bool "cnr", bool "rep") { width_clip = default(width_clip,AdjustMOD(width(o)/4,16)) # Width of small clip height_clip = default(height_clip,AdjustMOD(height(o)/4,16)) # Height of small clip preset = default(preset,2) # Medium Deflickering cnr = default(cnr,false) # Chroma noise reduction (experimental) rep = default(rep,false) # Repair mode Assert(((width_clip % 16) == 0), "width_clip must be mod 16") Assert(((height_clip % 16) == 0), "height_clip must be mod 16") sm=o.bicubicresize(width_clip,height_clip,0,0) # can be altered, but ~25% of original resolution seems reasonable smm = (preset==1) ? sm.Preset1() : (preset==2) ? sm.Preset2(cnr) : (preset==3) ? sm.Preset3(cnr) : Assert(false, "Preset not valid (1, 2 or 3)") o2=o.mt_makediff(mt_makediff(sm,smm,u=3,v=3).bicubicresize(width(o),height(o),0,0),u=3,v=3) o2 = rep ? Repair(o2, o, mode=10, modeU=10, modeV=10) : o2 return o2 } # Function that adjusts parameters to mod 16 Function AdjustMOD(int value, int "factor") { factor = default(factor,16) adjust = value - (value % factor) return adjust } # Presets Function Preset1(clip sm) { smm=sm.temporalsoften(1,6,9,10,2).vsMSmooth(threshold=0.8,strength=25.0,chroma=true,luma=false).merge (sm,0.25).merge (sm,0.25) smm=smm.temporalsoften(2,3,5,6,2).vsMSmooth(threshold=2.0,strength=1.0,chroma=true,luma=false) Return smm } Function Preset2(clip sm, bool cnr) { smm=sm.temporalsoften(1,12,255,24,2).vsMSmooth(threshold=0.8,strength=25.0,chroma=true,luma=false).merge (sm,0.25).merge (sm,0.25) smm=smm.temporalsoften(2,7,255,20,2).vsMSmooth(threshold=2.0,strength=1.0,chroma=true,luma=false) smm = cnr ? smm.vsCnr2(mode="ooo",ln=5,un=40,vn=40, scdthr=2.0) : smm Return smm } Function Preset3(clip sm, bool cnr) { smm=sm.temporalsoften(1,32,255,24,2).vsMSmooth(threshold=0.8,strength=25.0,chroma=true,luma=false).merge (sm,0.25).merge (sm,0.25) smm=smm.temporalsoften(2,12,255,20,2).vsMSmooth(threshold=2.0,strength=1.0,chroma=true,luma=false) smm = cnr ? smm.vsCnr2(mode="ooo",ln=10,lm=255,un=35,vn=35, scdthr=2.0) : smm Return smm } Last edited by GMJCZP; 10th June 2021 at 03:31. Reason: Update function to version 2.4 |
|
|
|
|
|
#33 | Link |
|
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,783
|
I'll have to try that out the next time I'm doing a film transfer. Currently I use the Deflicker function and, if the flicker is really bad, I the DCT=1 setting in the MVTools2 desnoising. That setting, which unfortunately is turtle slow, does make a huge reduction in flickering. That benefit is a side effect, i.e., that was not its original intended purpose.
I'll have to see if this function works as well, or better, and whether the performance (fps) is faster. Thanks for doing this! Last edited by johnmeyer; 12th July 2017 at 16:32. Reason: Hit "save" before I was finished |
|
|
|
|
|
#35 | Link |
|
Moderator
![]() Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
Hi,
I was just trying this out and got the message: AviSynth open failure: BlindPP: Need mod 16 height But the DVD sourced video is 704x480. The total script used is: AVISource("Movie3.avi") Small_Deflicker() return last Do you need more information? |
|
|
|
|
|
#36 | Link | ||
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,406
|
Quote:
For the upsize he used 0.0. for both, what is that called (the b=0.0,c=0.0) and what is the effect ? Quote:
I suspect that using b=0.0 and c=0.0 for downsize is wrong (does not reflect Didée intent). ![]() EDIT: GMJCZP, You get better CODE block layout if converting TAB's to SPACE's prior to copy onto forum, I use PSPad "Menu/Edit/Special Conversion/Convert Tabs To Spaces/". Also, Tab step setting best set to 4 in text editor settings. EDIT: Also, for the downsize / 4, see ResizePadded(), probably be able to persuade it to cooperate (although lots of code). https://forum.doom9.org/showthread.p...t=ResizePadded Perhaps of use, perhaps not, would it cause probs if not exact /4.0 reduction ? (it of cause would cause probs if src / 4, not colorspace compatible). ResizePadded(), would solve both my above points. [EDIT: as would eg width(o)/(4*2)*2 # for YV12/YUY2, for colorspace width point only]
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 2nd August 2017 at 12:38. |
||
|
|
|
|
|
#37 | Link |
|
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 761
|
manono, TinMan, let me digest all these things.
TinMan, you have given me so much information that I will have to look for a digestive. ![]() For SD video I have used for example Small_Deflicker (height_clip = 128) without problems, but I understand that the function must be robust. Thanks for your feedback. |
|
|
|
|
|
#38 | Link |
|
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 761
|
At the moment manono can test the function without problems, I hope.
- Small_Deflicker function, now takes into account if any value is not mod 16. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|