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. |
5th June 2019, 17:39 | #1 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
AutoLevels v0.10
AutoLevels v0.10 (avs v2.58, avs/+ v2.6 x86 & x64)
Req VS 2008 Runtimes. 8 Bit Only. This thread continued from thread in Avisynth Development forum, here:- http://forum.doom9.org/showthread.ph...11#post1876311 AutoLevels only has thread in devs forum, and probably a good idea that it has one in Usage forum, so posting this here. Includes 3 dll's, + source + Full VS2008 project files for easy rebuild. See HOSTED directory @ MediaFire in sig below this post. Now looks like this. Top line shows Frame number: and averaging range start and end frames
__________________
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; 11th June 2019 at 17:45. Reason: Update |
11th June 2019, 16:19 | #2 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
AutoLevels() v0.10, update see above post.
BugFix Code:
// 11/06/2019 Ver 0.10 + Oops, limited gamma max in adjust to 1.0 instead of 10.0 (so only ever reduced gamma, never increased). // Mods to debug output, shows output Y frame average. Code:
gamma = min(max(gamma,0.1f),10.0f); // ssS: Added sane range limiting (& avoid div by zero on gamma) As it stands it calcs input midpoint relative 0->255, and output midpoint same 0->255 (after input coring if required, and before output coring). I think it would produce better results if we could figure out a way to calc required gamma based on input and output ranges, any maths geniuses (or should that be genii) knocking about round here ? I cant even figure out how to do it disregarding coring, and if coring then even bigger problem. Here source. Code:
// use user specified input high/low points, if specified. // if coring is specified but input high/low aren't specified, // we must do the inverse mapping to counteract the mapping that // gets done inside adjust(). double in_low = (force_input_low) ? double(input_low) : (do_coring) ? inv_coring_func(ymin_avg) : ymin_avg; double in_high = (force_input_high) ? double(input_high) : (do_coring) ? inv_coring_func(ymax_avg) : ymax_avg; // pick a gamma curve double do_gamma = (autogamma) ? log(ymean_avg/255.0) / log(gamma_midpoint) : gamma; // double do_gamma = (autogamma) ? log((ymean_avg-ymin_avg) / (in_high-in_low) ) / log(gamma_midpoint) : gamma; // IDEALLY GAMMA MIDPIOINT COMPUTED FOR INPUT RANGE (REQUIRES MORE WEIRD METHOD WHERE CORING) // NEED ALSO ALLOW FOR SETTING MIDPOINT RELATIVE OUTPUT RANGE (WELL WEIRD WHERE CORING) // HOW ??? // use levels() code to do remapping adjust(frame,dst, int(in_low+0.5), float(do_gamma), int(in_high+0.5),int(output_low+0.5), int(output_high+0.5), do_coring); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// void Autolevels::adjust( PVideoFrame &frame, PVideoFrame &dst, int in_min, float gamma, int in_max, int out_min, int out_max, bool coring) { BYTE map[256], mapchroma[256]; // ----- this section is taken from: ------ //Levels::Levels( PClip _child, int in_min, double gamma, int in_max, int out_min, int out_max, bool coring, // IScriptEnvironment* env ) gamma = min(max(gamma,0.1f),10.0f); // ssS: Added sane range limiting (& avoid div by zero on gamma) gamma = 1/gamma; int divisor = (in_max == in_min) ? 1 : (in_max - in_min); // avoid zero divide if (vi.IsYUV()) { for (int i=0; i<256; ++i) { float p; if (coring) p = ((i-16)*(255.0f/219.0f) - in_min) / divisor; else p = float(i - in_min) / divisor; // range 0.0 -> 1.0 of input range p = pow(min(max(p, 0.0f), 1.0f), gamma); // gamma p = p * (out_max - out_min) + out_min; // output range with out_min offset int pp; if (coring) pp = int(p*(219.0f/255.0f)+16.5f); else pp = int(p+0.5f); // round to nearest luma level map[i] = min(max(pp, (coring) ? 16 : 0), (coring) ? 235 : 255); int q = ((i-128) * (out_max-out_min) + (divisor>>1)) / divisor + 128; mapchroma[i] = min(max(q, (coring) ? 16 : 0), (coring) ? 240 : 255); } } else if (vi.IsRGB()) { for (int i=0; i<256; ++i) { float p = float(i - in_min) / divisor; p = pow(min(max(p, 0.0f), 1.0f), gamma); p = p * (out_max - out_min) + out_min; int z=int(p+0.5f); map[i] = (z < 0) ? 0 : (z>255) ? 255 : z; } } }
__________________
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 ??? |
11th June 2019, 16:42 | #3 | Link |
Cary Knoop
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
|
I would convert the code values to float, then convert gamma to linear then determine the midpoint and put it all back to the original gamma.
You might want to add an input gamma parameter (Rec.709 2.2, Rec.709 2.4, etc) to determine how to convert to linear and scale the float values to limited or data as required if the output range is different. I would at least have an option to have a float32 in and out as opposed to 8-bit only. Last edited by Cary Knoop; 11th June 2019 at 16:54. |
11th June 2019, 17:12 | #4 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Thankyou Mr Knoop, now I just have to figure out how to do that.
It would seem easiest (if not the only way [it did not even remotely occur to me]). I had intended (If Pinterf did not just jump in) to attempt 10, 12 14, 16 bit source, not sure that I would bother with Float, but I guess that would now make sense too. Not gonna attempt just yet, would like to apply stuff from this mod to GamMac, soon. Again, thanx, you be a superstar.
__________________
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; 11th June 2019 at 17:14. |
12th June 2019, 19:08 | #5 | Link | |
Registered User
Join Date: Jan 2019
Location: Lake District UK
Posts: 48
|
Quote:
What are your thoughts on how you would classify the next version of GamMac - bugfix / performance improvements release / Quality of results release ? Are you able to give rough timescales? ........[lie]Asking the above for a friend[/lie] (who's a serial procrastinator and needs to stop p*$$ing about waiting to see what the next best version of plugin might bring and actually get on with something productive and process some actual footage to use.) |
|
12th June 2019, 19:18 | #6 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Is gonna be Exploratory, timescale, Hmm, When all the lights go out in the Universe.
I would prefer if somebody else did it, you game ? Also, just twigged I think, for the AutoLevels thing, would need convert to RGB, then linear, then do midpoint, and then back pedel to original colorspace. Not that easy (for me) really.
__________________
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 ??? |
8th July 2019, 14:48 | #9 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Some bug fixes[crashes, access violations], Avs v2,60 colorspaces, and x64 bit.
I found a file that shows lots of flickering (head bobbing back and forth in front of a small sun lit window), so am currently trying to improve that. Same clip also fades to black at end and where very dark almost black, is amped so much that it looks awful [still not managed to find fix for that]. (autogamma=true). Will try up a v0.11 test dll, say if any better than 0.7.
__________________
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 ??? |
8th July 2019, 16:41 | #10 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Here v0.011Beta (Beta really as two new args that may or may not survive as is to next update).
See MediaFire in sig below this post, HOSTED folder. Code:
// 01-09-2010 Ver. 0.6 + added support for the "coring" flag // Jim Battle + revised/improved the readme document // // StainlessS // 31/05/2019 Ver 0.7 + Convert for avs v2.6/+ x86 and x64. revised a bit. // 06/05/2019 Ver 0.9 + Switch off debugging in v0.8, oops. // 11/06/2019 Ver 0.10 + Oops, limited gamma max in adjust to 1.0 instead of 10.0 (so only ever reduced gamma, never increased). // Mods to debug output, shows output Y frame average. // 08/07/2019 Ver 0.11Beta1 + Basic scene change detect also now takes into account diffLumaMean((n,n-1))>=(sceneChgThresh*0.5), as well as min and max luma diff. // + Added sc2Th=8, and sc2Perc=33.33, a check and possible override to sceneChgThresh detected scene change. // + Changed default filterRadius from 5 to 7. Code:
AviSource(".\ALTEST.AVI").Trim(74,11154).crop(0,46,0,-46) ###################### ORG=Last AUTOGAMMA=True DEBUG=true # DEFAULT SCENECHGTHRESH=20 # SC if diff of min or max Y to prev frame is more than this : NEW additional SC if DiffMeanY(n,n-1) is more than 1/2 this. [If either, recheck for override to non SC via SC2 stuff] # NON DEFAULT MIDPOINT=0.42 # Default stays 0.5 # NEW, If Scene change detected via SceneChgThresh, then re-check and override to NOT SC if not at least SC2PERC(33.33%) of luma pixels differ by more than SC2TH(8) when compared with prev frame. SC2TH=8 SC2PERC=33.33 ###################### A=AutoLevels(autogamma=AUTOGAMMA,midpoint=MIDPOINT,debug=true, sceneChgThresh=sceneChgThresh,FilterRadius=5,sc2Th=256) # Nearly same as 0.7. sc2Th=256 switch off new sc overrides [still does 1/2 mean SC chk] B=AutoLevels(autogamma=AUTOGAMMA,midpoint=MIDPOINT,debug=DEBUG,sceneChgThresh=sceneChgThresh,FilterRadius=7,sc2Th=SC2TH,sc2Perc=SC2PERC) # New Settings LFT=StackVertical(ORG,A) RGT=StackVertical(ORG,B) StackHorizontal(LFT,RGT) EDIT: From above source docs Code:
// 11/06/2019 Ver 0.10 + Oops, limited gamma max in adjust to 1.0 instead of 10.0 (so only ever reduced gamma, never increased).
__________________
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 July 2019 at 16:48. |
8th July 2019, 18:46 | #11 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
V0.11Beta2, In sig below this post, HOSTED folder.
Code:
// 08/07/2019 Ver 0.11Beta1 + Basic scene change detect also now takes into account diffLumaMean((n,n-1))>=(sceneChgThresh*0.5), as well as min and max luma diff. // + Added sc2Th=8, and sc2Perc=33.33, a check and possible override to sceneChgThresh detected scene change. // + Changed default filterRadius from 5 to 7. // 08/07/2019 Ver 0.11Beta2 + Added GamMax, GamMin. [Allowing Gamma max of 10.0 a bit monsterous, most clips require nothing at all like that, even current default of 1.01 is a lot of correction allowed [together with min/max corrections]. Code:
AviSource(".\ALTEST.AVI").Trim(74,11154).crop(0,46,0,-46) ###################### ORG=Last AUTOGAMMA=True DEBUG=true # DEFAULT SCENECHGTHRESH=20 # SC if diff of min or max Y to prev frame is more than this : NEW additional SC if DiffMeanY(n,n-1) is more than 1/2 this. [If either, recheck for override to non SC via SC2 stuff] # NON DEFAULT MIDPOINT=0.45 # Default stays 0.5 # NEW, If Scene change detected via SceneChgThresh, then re-check and override to NOT SC if not at least SC2PERC(33.33%) of luma pixels differ by more than SC2TH(8) when compared with prev frame. SC2TH=8 SC2PERC=33.33 # NEW NEW GAMMAX = 1.01 # Default 1.01, : 1.0 <= GamMax <= 10.0 : Limit upwards Gamma corrections GAMMIN = 1.0/GAMMAX # Default 1.0/GAMMAX : 1.0/10.0 <= GamMim <= 1.0 : Limit Downwards gamma corrections ###################### # Nearly same as 0.7. sc2Th=256 switch off new sc overrides [still does 1/2 mean SC chk] : GammMax Unrestricted (well max 10.0) A=AutoLevels(autogamma=AUTOGAMMA,midpoint=MIDPOINT,debug=true, sceneChgThresh=sceneChgThresh,FilterRadius=5,sc2Th=256,Gammax=10.0) # New Settings B=AutoLevels(autogamma=AUTOGAMMA,midpoint=MIDPOINT,debug=DEBUG,sceneChgThresh=sceneChgThresh,FilterRadius=7,sc2Th=SC2TH,sc2Perc=SC2PERC,gammax=GAMMAX,gammin=GAMMIN) ###################### LFT=StackVertical(ORG,A) RGT=StackVertical(ORG,B) StackHorizontal(LFT,RGT) "And I commend this budget to the House". [Come on Wonkey, explain it to me again - EDIT: no that was " I refer the honourable gentleman to the reply I gave some moments ago" thing]. EDIT: For AutoLevels and similar, scenechange detect is really whether or not colors change much rather than real scene cut. EDIT: Perhaps for AutoGamma(autolevels=false) we need not limit gamma corrections, but for the moment I'm just playing with autoLeves(AutoGamma=true), exact same code just diff args submitted. EDIT: The two step Scenchange stuff is because 1st step is pretty fast and almost insignificant to speed, 2nd test a check on whether or not 1st test got it right, a bit slower but not often occurs. EDIT: Also, default Ignore is 1.0/256, suggest better 1.0/512, ie half a luma level rather than a whole one. [I will not change default for that], but suggest may be better. EDIT: Maybe I was a bit cautious, perhaps more sane GamMax would be eg 1.05 or 1.1 rather than 1.01, clip I'm testing with has wildly changing levels, some frames with lots of white, others with almost none.
__________________
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; 9th July 2019 at 06:14. |
11th July 2019, 16:19 | #12 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
V0.12Beta3, In sig below this post, HOSTED folder. [v2.58, avs/+ x86 & x64]
Code:
// 11/07/2019 Ver 0.12Beta_3 + Changes to debug metrics. Code:
AviSource("D:\Parade.AVI") #AviSource(".\ALTEST.AVI").Trim(74,11154).crop(0,46,0,-46) #AviSource(".\ALTEST2.avi") #convertToRGB32 #ConvertToY8 ORG=Last ###################### TITLES = True DEBUG_A = true DEBUG_B = true DEBUG_C = true # DEFAULT SCENECHGTHRESH=20 # SC if diff of min or max Y to prev frame is more than this : NEW additional SC if DiffMeanY(n,n-1) is more than 1/2 this. [If either, recheck for override to non SC via SC2 stuff] # MIDPOINT = 0.42 # Default stays 0.5 IGNORE_A = 1.0/256 # 1.0/256 # OLD Default IGNORE_B = 1.0/512 # 1.0/512 # NEW Default IGNORE_C = 1.0/512 # 1.0/512 # NEW Default # If Scene change detected via SceneChgThresh, then re-check and override to NOT SC if not at least SC2PERC(33.33%) of luma pixels differ by more than SC2TH(8) when compared with prev frame. SC2TH=12 # 12 Default SC2PERC=33.33 # 33.33 Default # NEW NEW GAMMAX_A = 10.0 # OLD Default for AutoLevels(AutoGamma=true) GAMMIN_A = 1.0/GAMMAX_A # OLD Default for AutoLevels(AutoGamma=true) GAMMAX_B = 1.5 # Default 1.5, : 1.0 <= GamMax <= 10.0 : Limit upwards Gamma corrections GAMMIN_B = 1.0/GAMMAX_B # Default 1.0/GAMMAX : 1.0/10.0 <= GamMim <= 1.0 : Limit Downwards Gamma corrections GAMMAX_C = 1.25 # GAMMIN_C = 1.0/GAMMAX_C # ###################### MINRNG_B=100 # Default 100 : Input Y range less than this will hae corrections reduced. MINRNG_C=100 # Default 100 ###################### # A, Nearly same as 0.7. sc2Th=256 switch off new sc overrides [still does 1/2 mean SC chk], also switch off MinRng : GammMax Unrestricted (well 10.0) A=AutoLevels(autogamma=true,midpoint=MIDPOINT,sceneChgThresh=sceneChgThresh,ignore=IGNORE_A,debug=DEBUG_A,FilterRadius=5,gammax=GAMMAX_A,gammin=GAMMIN_A,sc2Th=256,MinRng=0) B=AutoLevels(autogamma=true,midpoint=MIDPOINT,sceneChgThresh=sceneChgThresh,ignore=IGNORE_B,debug=DEBUG_B,FilterRadius=7,gammax=GAMMAX_B,gammin=GAMMIN_B,sc2Th=SC2TH,sc2Perc=SC2PERC,MinRng=MINRNG_B) C=AutoLevels(autogamma=true,midpoint=MIDPOINT,sceneChgThresh=sceneChgThresh,ignore=IGNORE_C,debug=DEBUG_C,FilterRadius=7,gammax=GAMMAX_C,gammin=GAMMIN_C,sc2Th=SC2TH,sc2Perc=SC2PERC,MinRng=MINRNG_C) ###################### ORG=TITLES?ORG.TSub("ORG",True):ORG A =TITLES?A.TSub("A: "+String(GAMMAX_A," Gammax=%.3f")+String(IGNORE_A," Ignore=%.3f")+" SC2=OFF MinRNG=OFF"):A B =TITLES?B.TSub("B: "+String(GAMMAX_B," Gammax=%.3f")+String(IGNORE_B," Ignore=%.3f")+String(MINRNG_B," MinRng=%.3f")):B C =TITLES?C.TSub("C: "+String(GAMMAX_C," Gammax=%.3f")+String(IGNORE_C," Ignore=%.3f")+String(MINRNG_C," MinRng=%.3f")):C RGT=StackVertical(A,C) LFT=StackVertical(ORG,B) Return StackHorizontal(LFT,RGT) # Stack Overhead Subtitle Text, with optional FrameNumber shown. Function TSub(clip c,string Tit,Bool "ShowFrameNo",Int "Col"){ c.BlankClip(height=20,Color=Default(Col,0)) (Default(ShowFrameNo,False))?ScriptClip("""Subtitle(String(current_frame,"%.f] """+Tit+""""))"""):Trim(0,-1).Subtitle(Tit) Return StackVertical(c).AudioDubEx(c) } Code:
GamMax, 1.0->10.0. Default 1.5 where AutoLevels(AutoGamma=true) and Default 10.0 Where AutoGamma(). Limits amount of gamma correction, maybe only want to darken clip sor something. GamMin, 0.1->1.0. Default 1.0/GammMax. Darken Limit for gamma. Sc2th, Default 12. 0->256. 256=OFF. Secondary scene change detection, a check and possible override to primary detector which is quick but not so good. Sc2Perc, Default 33.33. Range 0.0 <= Sc2Perc < 100.0. Secong arg to secondary scene change detector. If Scene change detected via SceneChgThresh, then re-check and override to NOT SC if not at least Sc2PErc(33.33%) of luma pixels differ by more than Sc2Th(12) when compared with prev frame. MinRng, Default 100. 64->128 and also 0=OFF. If luma range less than this, then amount of autolevel/autogamma is reduced, more so where range approaches 0. [avoid horrible fade to black autolevels] Debug 226:224,233] LHG+sSF : sc2=38.8% ymin= 3 ymin_avg = 3.5 { 3.5} ymax=217 ymax_avg =224.2 {224.2} mean= 79.7 ymean_avg= 82.2 gamm=1.250 out_mean =105.80(0.41) Top line. 226:224,233] ... Current frame: Frames sample range, limited by arg FilterRadius and detected Scene Changes. Flags, 'LHG+sSF', where hi-lited: L ... Low input to levels adjustment is changed from that of ymin. H ... High input to levels adjustment is changed from that of ymax. G ... Gamma to levels adjustment is not 1.0. + ... (Actually a single character with '+' appearing above '-'), Gamma levels adjustment is limited by GamMin, GamMax or low range fading. s ... Scene change detection via primary scene change detector arg sceneChgThresh. S ... Scene change detection via secondary scene change detector args sc2Th and sc2Perc. [Only hilited if primary detector also fired] F ... Low Luma Range detected via arg MinRng, levels inputs of ymin, ymax and gamma are adjusted to have lesser effect [F=Fade]. sc2=38.8% Secondary detector percentage of luma pixel difference greater than arg Sc2th (WRT corresponding pixels of prev frame). ymin=3, Luma Minimum of current frame ignoring at most arg ignore_low extreme (noise) pixels [as for YPlaneMin(threshold)]. ymax=217, Luma Maximum of current frame ignoring at most arg ignore_high extreme (noise) pixels [as for YPlaneMax(threshold)]. mean=1.250 AverageLuma of current frame. ymin_avg=3.5, Average of all luma ymin values of the current range of frames (range limited by FilterRadius and scene change detection). { 3.5}, in this case same as ymin_avg, but will be hilited & different if levelling strength reduction due to arg MinRng. ymax_avg=224.2, Average of all luma ymax values of the current range of frames. {224.2}, in this case same as ymax_avg, but will be hilited & different if levelling strength reduction due to arg MinRng. ymean_avg=82.2, Average of all AverageLuma values of the current range of frames. Gamm=12.250, Gamma input to levels adjustment. out_mean=105.80, Resulting AverageLuma, on current frame after levelling. (0.41), in this case 105.80/255.0, ie equivalent to the full PC levels range midpoint. At some future stage, will be implemented as eg (out_mean-out_min)/(out_max-out_min). EDIT: The below hi-lited flag +/- symbol indicates that Gamma has been restricted by the GamMax arg [in this case 1.25]. Also, the sc2=38.8% in status line, indicates that number of pixels with a difference greater than Sc2Th(12) is 38.8%, which is greater than arg Sc2Perc(33.33), but as primary scene change detector is not fired, is not a scene change.(neither s nor S flag is hi-lited) [The scene is panning]
__________________
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; 11th July 2019 at 16:52. |
11th July 2019, 17:21 | #13 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Here a demo of the arg MinRng fade effect on movie intro
The effect reductions shown via orange hi-lited values in metrics of lower two images. Nuther one And another random pick (just because I liked it) EDIT: That whole PAL format movie is a bit horrible, very dark, probably to hide the appalling blending and other problems that it has.
__________________
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; 12th July 2019 at 12:40. |
27th March 2020, 14:16 | #15 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
I'm kinda curious about that too (dont know, I dont usually use MT).
Maybe someone has done tests. I'm trying to get back to this plugin, but have other things I must do first.
__________________
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 ??? |
27th March 2020, 20:39 | #16 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
The only time that I've ever used AutoLevels with MT, I've used this in setMTMode.avsi
Code:
SetFilterMTMode("RoboCrop", MT_SERIALIZED) SetFilterMTMode("AutoLevels", MT_SERIALIZED) EDIT: RoboCrop samples entire clip (by default 40 samples spread throughout clip) and you want this done first, pretty much before anything else. RoboCrop Scanning is done in constructor before frame serving even starts, and you dont want to be scanning heavy proceed frame eg MC processed frames in RoboCrop constructor, real bad idea, so have it as first filter after source filter. During Frame serving, RoboCrop is not much different to crop, ie fairly light-weight. Any kind of auto leveling, auto color correction, ideally requires borders cropped off beforehand so as not to mess up auto corrections. AutoLevels (or eg AutoAdjust) would also best be done prior to any heavy duty processing, ideally 2nd filter after auto crop filter.
__________________
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; 27th March 2020 at 22:32. |
13th April 2020, 12:32 | #17 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,744
|
Hi,
I tried you filter today, the result is quite impressive. I first tried Autolevels(), then Autogamma(), then both together. Are they supposed to be used together ? If yes, is there a preferable order ? After reading the doc, I believed that Autolevels().Autogamma() would produce the same result than Autogamma().Autolevels() or Autolevels(autogamma=true) but this is not the case. Here is an exemple ; From left to right (darkest to clearest) ; -the original (just avisource, this is Lagarith yuy2 captured from a Hi8 tape with a S-video cable) -avisource(...).crop(24,2,-20,-14).Autolevels(autogamma=true) -avisource(...).crop(24,2,-20,-14).Autogamma().Autolevels() I also tried Autolevels().Autogamma() which is a little bit clearer than Autogamma().Autolevels(). And finally Autogamma(autolevel=true) which is much clearer than Autolevels(autogamma=true). At first sight, I prefer Autolevels(autogamma=true) (in the middle of the image). Is this the correct way to use it ? Last edited by Music Fan; 13th April 2020 at 12:37. |
13th April 2020, 13:44 | #18 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
You can use both together (IF CLIP REQUIRES IT).
AutoLevels has arg AutoGamma=False by default. AutoGamma has arg AutoLevel=False by default. AutoLevel() and AutoGamma() are pretty much the same with slightly different defaults [each of them can do both]. Code:
Autolevels(clip c, int "filterRadius" = 7, [* Original plugin = 5 *] int "sceneChgThresh" = 20, string "frameOverrides" = "", float "gamma" = 1.0, [* Auto if autogamma *] bool "autogamma" = false, # <<<<<<<<<<<<<<<<<< float "midpoint" = 0.5, bool "autolevel" = true, # <<<<<<<<<<<<<<<<<< int "input_low" = undefined, [* measured by statistics *] int "input_high" = undefined, [* measured by statistics *] int "output_low" = (c.IsYUV)?16 :0, [* 16 for yuv, 0 for rgb *] int "output_high", = (c.IsYUV)?235:255 [* 235 for yuv, 255 for rgb *] bool "coring" = false, float "ignore" = 1.0/256.0, # 1.0/512 in currrent beta float "ignore_low" = ignore, float "ignore_high" = ignore, int "border" = 0, int "border_l" = border, int "border_r" = border, int "border_t" = border, int "border_b" = border, bool "debug" = false [* Additional to original args *] int "sc2th" = 12 Float "sc2Perc" = 33.33 [* Where scene change via sceneChgThresh, and % of pixels different by at least sc2th is less than sc2Perc, then Override to NOT scene change *] Float "GamMax" = 1.5 [* Max limit on Gamma correct *] Float "GamMin" = 1.0/GamMax [* Min limit on Gamma correct *] int "minRng" = 100 [* If dynamic range of luma is less than minRng then corrections are reduced *] ) It is not my filter, was written by Theodor Anschütz, and then updated by Jim Battle[Frustum] I've only really ever use AutoLevels(AutoGamma=Whatever,AutoLevel=Whatever). Most clips would not need gamma adjustment. On use, read authors intro. EDIT: Some clips do exhibit flickering, I want to try reduce or eliminate that. If flickering is a problem, then maybe could try this:- https://forum.doom9.org/showthread.p...61#post1757661
__________________
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; 13th April 2020 at 13:53. |
13th April 2020, 14:45 | #19 | Link | |||
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,744
|
Quote:
Ok, but my sample looks really different (and better) with the gamma adjustment. Quote:
Quote:
edit : I didn't see that RT_Stats was also needed, it works now. edit 2 : it works but I didn't notice any difference with AutoContrast(). Last edited by Music Fan; 13th April 2020 at 15:05. |
|||
13th April 2020, 16:27 | #20 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
Mainly of use where global [ie clip wide] levels are badly set, eg PC->TV levels on already TV levels clip results in real bad contrast. Strength=1.0 = full adjustment, default 0.75 = 75% of full adjustment to levels [might be deliberately low contrast dark clip so we dont want to overdo it]. Also, if levels are eg PC range then will (by default) compress to TV levels 16->235, strength 0.75 will also only partly adjust that too. Long clip, maybe set SAMPLES = Round(clip.Framecount * Required_Scan_Percent / 100.0), will take time where lots of frames scanned, default 40. Most clips would not need both levels and gamma adjust.
__________________
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; 13th April 2020 at 16:42. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|