ExBlend
From Avisynth wiki
(Difference between revisions)
Raffriff42 (Talk | contribs) (redirect for convenient searching) |
(add documentation (v1.04)) |
||
Line 1: | Line 1: | ||
− | + | {{FilterCat5|External_filters|Plugins|Plugins_x64|Restoration_filters|Deblenders}} | |
− | {{ | + | {{Filter3 |
+ | |1={{Author/StainlessS}} | ||
+ | |2=1.04 | ||
+ | |3=[https://web.archive.org/web/20200521164831if_/https://files.videohelp.com/u/223002/ExBlend_25_26_x86_x64_dll_v1-04_20181218.zip ExBlend_25_26_x86_x64_dll_v1-04_20181218.zip] | ||
+ | |4=External filters | ||
+ | |5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2] | ||
+ | |6=[http://forum.doom9.org/showthread.php?t=157337 Doom9 Forum] | ||
+ | }} | ||
+ | <br> | ||
+ | == Description == | ||
+ | ExBlend(), is a plugin originally written for telecined clips that were downsized from 720x480 to VCD 352x240. The damage caused by this, looks similar to damage caused by blend Deinterlacing of telecined clips, which results in a double blend, every five frames, GGGBBGGGBBGGGBB etc where 'G' is good and 'B' is blend. Where damage is due to Deinterlacing of telecined clips, it is likely that a denoised detection clip is required as although the damage looks quite similar, it is not exactly the same. | ||
+ | <br> | ||
+ | <br> | ||
+ | == Requirements == | ||
+ | * [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6] | ||
+ | * [x64]: [[AviSynth+]] | ||
+ | *Supported color formats: [[YUY2]], [[Y8]], [[YV12]], [[YV16]], [[YV24]] | ||
+ | <br> | ||
+ | * [https://www.microsoft.com/en-us/download/details.aspx?id=11895 Microsoft Visual C++ 2008 Redistributable Package (x86 / x64)] <includeonly>[[VC_9.0]]</includeonly> | ||
+ | :<span style="color:red">***</span> <tt>vcredist_x86.exe</tt> is required for <tt>ExactDedup-x86</tt> | ||
+ | :<span style="color:red">***</span> <tt>vcredist_x64.exe</tt> is required for <tt>ExactDedup-x64</tt> | ||
+ | <br> | ||
+ | |||
+ | == [[Script variables|Syntax and Parameters]] == | ||
+ | <pre> | ||
+ | Exblend(Clip,int "mode",int "pal",float "lockthresh",float "ithresh",int "show",string "ExBfile",bool "ver",bool "revip", | ||
+ | string "override",int "lv",int "dv",int "disp",clip "Dclip",int "CompUB",bool "Decimate",int "DecompIx",int "DecClpIx", | ||
+ | bool "Debug") | ||
+ | |||
+ | |||
+ | ------------------------------------- | ||
+ | SOME DEFAULTS HAVE CHANGED IN V1.04 | | ||
+ | ------------------------------------- | ||
+ | |||
+ | |||
+ | |||
+ | int mode Running mode Default 1 | ||
+ | |||
+ | 0 Free Running mode (Deprecated) | ||
+ | Mainly for those that might whinge about having to use modes 1 & 2. | ||
+ | In this mode it keeps a record in memory of the blend status of all visited | ||
+ | frames, if you eg scan forwards and then backwards you will get exactly the | ||
+ | same results as the 1st visit. Jumping about is also possible so long as | ||
+ | you have first scanned the entire file although some metrics will be wrong. | ||
+ | 1 Scan and Store mode (Default) | ||
+ | As for Free Running mode but saves a copy of the scan status data when the | ||
+ | clip is closed ('ExBlend.XBD'). Use this prior to mode = 2. | ||
+ | Its pretty pointless having filters following ExBlend() in mode 1. | ||
+ | 2 Pre-calculated mode | ||
+ | Loads in Scan Status Data saved by Scan and Store mode, this is particularly | ||
+ | useful to examine exactly which frames are unblended and you can jump about | ||
+ | without the possibilty of mismatched detections. You should still not jump | ||
+ | about if you are examining the BlendPair count and Ratio or other counts. | ||
+ | In mode 1, Scan & Store, Scan entire file (with or without metrics) and When | ||
+ | you have everything working right you can switch | ||
+ | to mode 2, (with metrics off). You now can add following filters to your hearts | ||
+ | content and ExBlend() should not take up too much CPU. | ||
+ | Switching from modes 1 to 2 may seems awkward but it is intended that | ||
+ | this filter be used in film restoration and so it is likely that many other | ||
+ | filters will follow this one, having a pre-calculated data file allows | ||
+ | Exblend() to use minimal CPU when adding further filters and checking the | ||
+ | resultant video. For the same reasons, Multidecimate() could also be a good | ||
+ | choice. | ||
+ | v1.03b, added native decimation in mode 2. | ||
+ | |||
+ | int pal -1, 0, 1 , Default 0, lets Exblend() know what the original frame rate was. | ||
+ | |||
+ | This sets the filters hints, after a blended pair is found, the detector will preset | ||
+ | 3 (23.976/24 FPS) frames either side of the pair to HINTED meaning No Blend. If 'pal' (25 FPS) | ||
+ | is set to 1, it will preset 4 frames either side to HINTED. This helps it fall | ||
+ | into sync with sequence but may have slight delayed detection if the sequence goes | ||
+ | out of sync. If a frame has already been preset (visited) then the hint will not | ||
+ | be set, this allows hints to work when scanning both forward and backwards. | ||
+ | Not sure if PAL is actually useful or not, never seen any clip that exhibited this | ||
+ | problem with a good/blended signature of GGGGBBGGGGBBGGGG etc, where there are 4 | ||
+ | good frames and 2 blends. As it did not add much difficulty to the plugin, PAL was | ||
+ | implemented just incase it was ever found to be useful. | ||
+ | |||
+ | -1 AutoPal mode. (MODE 0 ONLY) | ||
+ | If you are not sure what the original source was you can set PAL = -1 (MODE 0 Only). | ||
+ | If "Unblended:Blended Pairs" Ratio is between (4.0-0.01) and 5.0 at frame 1500 (1500=60*25 | ||
+ | = 60 seconds @ 25 FPS), it will auto switch to PAL hints, the first 60 seconds | ||
+ | could contain the odd extra false blend pair detection. | ||
+ | If AUTO PAL is activated, the Metrics P (PAL) flag is hi-lited. It's | ||
+ | not a good idea to rely on this auto pal switch, you should set pal=1 when you | ||
+ | see it in orange. If autopal is activated and you later see the ratio rise above | ||
+ | 5.0, then it would seem that the autopal detection was in error, this can happen | ||
+ | if the 1st 60 seconds contains a lot of static scenes with little movement, in this | ||
+ | case you should change to PAL=0 to disable the autopal detection and force it | ||
+ | to 23/24FPS original frame rate. Again, if the 1st 60 seconds contains a lot of static | ||
+ | scenes and it was originally PAL 25 FPS then the autopal may fail to detect and not | ||
+ | auto switch to PAL mode, in this case, ratio will later fall to above 4.0 and below | ||
+ | about 5.0. In this case you should change to PAL=1 to force PAL mode. | ||
+ | |||
+ | 0, Forced 24 (or 23.976) FPS original frame rate (Default). | ||
+ | If the original source was 25 FPS and PAL is set | ||
+ | to 0, then this can reduce the effectiveness of ExBlend() due to it erroneously | ||
+ | detecting false blends where it should have been hinted, thus throwing it out of sync. | ||
+ | |||
+ | 1, Forced PAL 25 FPS original frame rate. If the original source was 24 FPS and PAL is set | ||
+ | to 1, then this can DRAMATICALLY reduce the effectiveness of ExBlend() due to it hinting | ||
+ | out blends and overriding what should have been a blend detection. This will again, throw | ||
+ | it out of sync. | ||
+ | |||
+ | The R (RATIO) metrics flag will be displayed in orange at any time the ratio is not within expected | ||
+ | bounds, including during the AUTO PAL detection period (if it was a 25 FPS clip originally) | ||
+ | but will disappear once AUTO PAL has switched. | ||
+ | |||
+ | |||
+ | float lockthresh Range 0.0 (Off) to about 2.0, Default 1.0 (No longer considered EXPERIMENTAL, so default 1.0) | ||
+ | |||
+ | The lockthresh arg switches on the locking function of ExBlend(). | ||
+ | Purpose being to try and latch on to the sequence when near static scene is encountered. | ||
+ | If the lock is activated, the 'L' Locked flag will be set in metrics. | ||
+ | |||
+ | NoLMN[f]=x.xxxx | ||
+ | L=y.yyyy LMX[f]=z.zzzz | ||
+ | |||
+ | I dont really wanna explain how locking works, it may | ||
+ | change if someone else can implement a better version. However, for locking | ||
+ | to take effect, some pre-conditions have to be satisfied. The frame must | ||
+ | be detected as non-blended, the previous frame should have been hinted, and at | ||
+ | least some of the conditions that would qualify as a blend detection must | ||
+ | be present, so not all frames qualify for the pre-conditions. If a frame does | ||
+ | qualify, then you may see something like L=y.yyyy which would indicate a | ||
+ | locking metric for the current frame, it is this metric that is compared to | ||
+ | LOCKTHRESH, if below or equal, then the frame is locked (converted to a blend | ||
+ | detection). If the frame is locked, the L flag will be set and the metric will | ||
+ | be Hi-lited. Once any frame has been locked, you may see LMX[f]=z.zzzz and | ||
+ | this shows the frame number and lock metric for the frame with the highest | ||
+ | locked metric, yet encountered. There may also be an indication for the frame | ||
+ | with the lowest lock metric that did NOT lock as in NoLMN[f]=x.xxxx | ||
+ | You may want to investigate all of the minimum and maximum flagged frames | ||
+ | both for locking and Ignore functions. Any frame that qualifies and would pass | ||
+ | the locking criteria will fail silently if the merge delta is above the | ||
+ | ithresh Ignore setting, it will not appear or be counted as an ignored frame. | ||
+ | |||
+ | If anyone would like to improve the functionality of lock, then please | ||
+ | be my guest. | ||
+ | This filter outputs a list of LOCKED frames which can be viewed using DebugView, | ||
+ | or may be output to a logging file. | ||
+ | |||
+ | v1.02, can now use eg 'disp=0' to view original blended clip along with metrics to | ||
+ | view frames flagged for investigation for either locking or ignore. | ||
+ | |||
+ | |||
+ | float ithresh 0.0 to 100.0, Default 3.0 | ||
+ | |||
+ | There was a weird transition in the | ||
+ | original clip that prompted this filter to be written, it resulted in an even | ||
+ | more weird effect after unblending (looked sort of embossed). This is an | ||
+ | attempt to avoid future similar problems, but I dont have the original problem | ||
+ | video any more so cant really test it, also, the detection logic has changed | ||
+ | a little and so the it may no longer be a problem. | ||
+ | If merge Delta (MD) for a detected blend pair goes above this number, then the | ||
+ | blends will be ignored. I suppose that you could cut down on the number of false | ||
+ | blend detections by lowering this but it probably does not need it, | ||
+ | it works fairly well as it is. If MD exceeds ithresh, the 'I' Ignored flag will | ||
+ | be set and the detected blended pair will be ignored, and a little futher info | ||
+ | will be given when show=5. If there were any IGNORED blends, then it may be a good | ||
+ | idea to take a look at the offending frames both with ithresh at its setting | ||
+ | of 3.0 and with ithresh set to eg 100.0 where the suspect blend will not be ignored. | ||
+ | |||
+ | Written since above, the ithresh setting does seem to work quite well and it's | ||
+ | default setting of 3.0 may cut down on false detections but may IGNORE good blend | ||
+ | detections too, this is conservatively set so as not to allow any bad ones | ||
+ | through. A clip has been observed that went out of sequence every few minutes by | ||
+ | throwing in a triple blend, this ithresh setting seems to avoid the unpleasant | ||
+ | effects of bad detections at these points. You may need to raise this if many | ||
+ | IGNORED blends occur, perhaps in 'not so good clips'. | ||
+ | This filter outputs a list of IGNORED frames which can be viewed using DebugView, | ||
+ | or may be output to a logging file. | ||
+ | |||
+ | v1.02, can now use eg 'disp=0' to view original blended clip along with metrics to | ||
+ | view frames flagged for investigation for either locking or ignore. | ||
+ | |||
+ | |||
+ | int show Range 0-5 | ||
+ | MODES 0 1, and 2 when Decimate == false: | ||
+ | |||
+ | 0 Off (Default in MODE 2 only) | ||
+ | |||
+ | 1 Show colored block in top left hand of clip when blend detected. | ||
+ | |||
+ | Blue block for 1st blended frame, Red for Second | ||
+ | |||
+ | 2 Show blend detection only as in:- | ||
+ | |||
+ | FFF ExBlend a b ?1RPSHOLIMD | ||
+ | |||
+ | FFF shows the frame number | ||
+ | |||
+ | a & b show '-' No Blend, '1' 1st Blend, '2' 2nd Blend | ||
+ | a & b will usually be the same, 'a' is the used detection, which may | ||
+ | have been newly calculated or pre-calculated and stored in a file. | ||
+ | 'b' is shown as calculated by the metrics, it is possible | ||
+ | that this is different from a pre-calculated detection. | ||
+ | |||
+ | ? is the MODE flag which may be displayed as '¿' (an upside down question | ||
+ | mark) meaning Free running mode 0. | ||
+ | A '?', meaning Mode 1, scan and store mode, where ExBlend creates a precalculated | ||
+ | data file. '!' displayed means Mode 2, Pre-calculated mode, where it will use | ||
+ | data file saved in mode 1. | ||
+ | |||
+ | The '1' flag above, represents the DISP (Display) mode setting and can be | ||
+ | '0', '1', '2', or '3', (the missing mode '4' is not valid unless MODE 2 and Decimate==true | ||
+ | where metrics are different). | ||
+ | '0' represents, disp=0, the original blended clip is returned. | ||
+ | '1' represents, disp=1, ExBlend default returning an identical pair | ||
+ | of unblended frames replacing the blended ones. | ||
+ | '2' represents disp=2, which returns an unblended frame for the first of a blend pair and a | ||
+ | copy of the frame following the blend pair for the second blended frame. This is the SRestore | ||
+ | compatible mode. | ||
+ | '3' Represents disp=3, where the component frames which would be merged together to create the final | ||
+ | recovered frame are returned. In the first blend position, the left component frame is returned and the | ||
+ | right when in blend index 2 postion. You would not in most cases be interested in this. | ||
+ | This setting can be used to view the different return frames using metrics | ||
+ | mode to examine what a frame looks like and the metrics reported for that frame. | ||
+ | |||
+ | The 'R' (RATIO) flag will be displayed hilited at any time the ratio | ||
+ | is not within expected bounds, including during the AUTO PAL detection | ||
+ | period (if it was a 25 FPS clip originally) but will disappear once AUTO | ||
+ | PAL has switched. | ||
+ | |||
+ | |||
+ | The 'P' (PAL) flag indicates that you are in PAL mode. If orange, | ||
+ | then the 'P' flag indicates that the Autopal switch was activated | ||
+ | when the Exblend() argument was set to 'pal = -1' (MODE 0 ONLY, auto detect pal). | ||
+ | The 'F' (FILM) flag indicates Film, if hilited, means that the Autopal switch | ||
+ | was erroneously activated and indicates that you should restart with the argument | ||
+ | set to 'pal=0'. the P and F flags share the same position on screen and | ||
+ | cannot be set simultaneously. | ||
+ | The 'p' (lowercase) flag is shown when 'Auto Detect Pal' is in operation and will | ||
+ | switch to either 'P' or 'F' at frame 1500 where PAL is either detected, or not. | ||
+ | |||
+ | |||
+ | The 'S' (SEQUENCE) flag will display when ExBlend() falls out of | ||
+ | sequence. 1, 2 or HINTED is considered in sequence. 0 is considered out of sequence. | ||
+ | If hilited, means that the current frame is where it went out of sequence. | ||
+ | |||
+ | |||
+ | The 'H' (HINTED) flag indicates that the frame has been hinted. | ||
+ | When Exblend() finds a blended pair, it presets 3 frames on either | ||
+ | side of the blend pair to hinted (NOT-BLENDED), or 4 either side if in | ||
+ | PAL mode. | ||
+ | |||
+ | The 'O' (OVERRIDDEN) flag indicates that the used detection, differs | ||
+ | from the metrics blend detection, this is most likely to happen in static | ||
+ | scenes where false blend detections are overriden by the hints to be | ||
+ | unblended. Will be hi-lited in orange if override not due to hinting. | ||
+ | There is no need to be too concerned about a lot of overrides, the hints | ||
+ | are intended to allow the detector to be quite zealous in its detections. | ||
+ | |||
+ | |||
+ | The 'L' (LOCKED) flag indicates that the (previously EXPERIMENTAL) locking function | ||
+ | has locked onto the sequence dispite a blend detection not being found. | ||
+ | This filter outputs a list of LOCKED frames which can be viewed using DebugView, | ||
+ | or to the logging file. | ||
+ | |||
+ | |||
+ | The I (IGNORED) flag is displayed in the case where the 'merge delta' | ||
+ | exceeds ithresh. The 'I' flag is in Orange if the current frame is | ||
+ | ignored and normal if any frame was ignored (stays on). | ||
+ | Extra 'ignored' info is shown when show=5. | ||
+ | This filter outputs a list of IGNORED frames which can be viewed using DebugView, | ||
+ | or to the logging file. | ||
+ | New in 1.02, writes "New Sequence" and "Lost Sequence" debug messages, can view | ||
+ | in DebugView or in logging file. If you see several "lost sequence", "new sequence" | ||
+ | type messages (in close proximity) in the logs, this is probably down to a false | ||
+ | detection following a lost sequence, this is a prime component for the 'override' | ||
+ | functionality of v1.02. | ||
+ | |||
+ | The 'M' flag denotes a manual override is in effect at the current frame. These | ||
+ | are set using the "override" arg to use the override command file. | ||
+ | |||
+ | The 'D' flag shows if an unblended frame is reconstructed using the DClip (CompUB) | ||
+ | and is hi-lited if adjacent frame also comes from Dclip (CompUB==2). | ||
+ | |||
+ | |||
+ | Show == 2, will also show the colored block in the upper LHS of clip. | ||
+ | |||
+ | 3 Show Metrics:- | ||
+ | |||
+ | |||
+ | <--Prev<---><CUR><--><Next-> | ||
+ | MD x.xxxx x.xxxx x.xxxx x.xxxx | ||
+ | FD x.xxxx x.xxxx x.xxxx x.xxxx | ||
+ | ^ ^ | ||
+ | 2 1 | ||
+ | |||
+ | Right one Hi-lighted for 1st detected blend and Left for 2nd, if blend | ||
+ | pair detected, MD will be smaller than FD and also smaller than the MD | ||
+ | entries on either side. The next frame comes in from the right. | ||
+ | 'FD' is Frame Delta (difference) and 'MD' Merge Delta. FD is the delta | ||
+ | between the frames in the clip, when hi-lited it is the difference | ||
+ | between the two frames of the DETECTED blended pair. | ||
+ | MD is the difference between the two copies of the unblended component | ||
+ | frames (that would be merged together to 'iron out' artifacts for the | ||
+ | final recovery frame). | ||
+ | The MD:FD comparison detects that it is a blend (MD should be smaller | ||
+ | than FD), and the MD to MD on either side comparison detects whether | ||
+ | it is in the 1st or 2nd blended pair position. (MD in the hi-lited column | ||
+ | should be smaller than those on either side). | ||
+ | |||
+ | Show == 3, includes show 1 & 2 metrics. | ||
+ | |||
+ | 4 Show Blend count and ratio | ||
+ | |||
+ | BlendPairs =w (max=x) | ||
+ | Ratio =y (z%) | ||
+ | |||
+ | Gives a count of detected blend pairs and the ratio of | ||
+ | Unblended to BlendPairs. When you have scanned from start to end of the | ||
+ | clip (without jumping about or going backwards) 'Ratio' should give a | ||
+ | result of 3.xxxx for 24 FPS original and 4.xxxx for 25 FPS original, | ||
+ | meaning 3 good frames and 2 blended for 24 FPS or 4 good and 2 blended | ||
+ | for 25 FPS. | ||
+ | Should only scan forward (Otherwise, BlendPairs & Ratio will | ||
+ | be wrong). Following ratio, the percentage of detected blends is displayed, | ||
+ | based on the current pal mode, this may give a more humanistic idea as to | ||
+ | how well ExBlend() is doing. | ||
+ | Following BlendPairs (max=x) is displayed where x is the maximum number of | ||
+ | blend pairs that could exist in the clip using the current PAL mode, this | ||
+ | will change if AUTO PAL switch is activated. The max value displayed assumes | ||
+ | also that the clip stays in sequence throughout, if it does not, the true | ||
+ | max value could well vary from that shown and the true percentage of blends | ||
+ | found could well be higher or lower than shown, but not by much (small | ||
+ | fraction of a percent, probably). | ||
+ | Also note, ExBlend() may not detect the first or last blends in a clip due | ||
+ | to it needing 3 frames both before and after the current frame to do it's | ||
+ | detections. | ||
+ | |||
+ | |||
+ | Show == 4, includes show 1 to 3 metrics. | ||
+ | |||
+ | 5 Shows Lock, Sequence, Overridden and Ignored counts as in:- | ||
+ | [Default when NOT [MODE==2 and Decimate ==true)] | ||
+ | |||
+ | LC=w SC=x OC=y IC=z | ||
+ | |||
+ | In addition, if IC is non-zero, then | ||
+ | |||
+ | IMN[f1]=x.xxxx | ||
+ | IMX[f2]=y.yyyy | ||
+ | |||
+ | Will be displayed where f1 and f2 indicate frame numbers where the minimum | ||
+ | and maximum merge deltas occured that exceeded 'ithresh' and so were | ||
+ | ignored. You might want to investigate these frames with current ithresh | ||
+ | setting and also with ithresh set to 100.0 (ithresh IGNORE switched OFF). | ||
+ | If particularly curious, you might want to set ithresh to 0.0 | ||
+ | (Ignore everything), do a complete scan and take a look to see what the blend | ||
+ | with the worst merge delta looks like, if bad, then lower ithresh a little | ||
+ | (tiny weeny bit below y.yyyy). Dont leave ithresh set to 0.0 for the final | ||
+ | scan as this will avoid almost all detections. | ||
+ | |||
+ | New to v1.02, the 'disp' arg allows return of the original blended frames, | ||
+ | or the de-blended frames and so you could say create | ||
+ | a stacked display to show both before and after with metrics, also better than | ||
+ | the above suggested, changing of ithresh. | ||
+ | |||
+ | Seeking to frame zero will reset the statistics. NOTE, if clip Trimmed, then | ||
+ | may not ever go to frame zero, and so frame 0 statistics reset may not work. | ||
+ | (an offhand example of where this might occur [have not checked this] might be | ||
+ | where you script eg "Last.Trim(100,0).Exblend()" so that a new clip never was | ||
+ | produced, ExBlend was invoked on a part of a clip, and so frame zero will not | ||
+ | be encountered within ExBlend) | ||
+ | |||
+ | NoLMN[f]=x.xxxx | ||
+ | L=y.yyyy LMX[f]=z.zzzz | ||
+ | |||
+ | The above is connected to the lockthresh argument of Exblend(). | ||
+ | See Lockthresh. | ||
+ | |||
+ | MODE 2, when Decimate==true: (Defaults OFF, for MODE==2, Decimate==true). | ||
+ | |||
+ | show == 0, Off | ||
+ | |||
+ | show > 0, show different metrics. | ||
+ | |||
+ | as In:- | ||
+ | |||
+ | '39 ] Using 48 (* SDDS)' | ||
+ | |||
+ | where '39' is the decimated frame number, 48 is the source clip frame, and '(* SDDS)' | ||
+ | indicates an unblended frame using the source clip for adjacent frames and the DClip | ||
+ | frames for the blended frames. | ||
+ | |||
+ | |||
+ | string ExBfile Default "ExBlend" | ||
+ | ExBlend Project file base name. Used to create any required logging file eg | ||
+ | 'ExBlend_1.LOG' when used in MODE==1. | ||
+ | Also used in creating filename of file to store 'mode' 1 Scan and Store data and to also load data file | ||
+ | for mode 2 Pre-calculated mode. | ||
+ | Creates (by default) in local directory where AVS file is located. | ||
+ | In Mode 1, also creates a Decimated Frames command file, by default, 'ExBlend_Decimated.TXT' | ||
+ | for use as a command file giving frame numbers of unblended frames after decimating in MODE==2. | ||
+ | |||
+ | bool ver true or false, Default False | ||
+ | Just shows the version number of ExBlend(), Perhaps other filter writers should | ||
+ | consider whether showing version and copyright stuff serves any positive purpose | ||
+ | (other than ego boosting) when showing metrics. When ver=true, it will show | ||
+ | version info (Also a little ego boosting stuff), without interfering with any | ||
+ | important metrics. ALL args are ignored when 'ver==true'. | ||
+ | |||
+ | bool revip Range false (Off) to true (On), Default false (Off) | ||
+ | |||
+ | Reverses the metrics display as in:- | ||
+ | |||
+ | <--Next<---><CUR><--><Prev-> | ||
+ | MD x.xxxx x.xxxx x.xxxx x.xxxx | ||
+ | FD x.xxxx x.xxxx x.xxxx x.xxxx | ||
+ | ^ ^ | ||
+ | 1 2 | ||
+ | |||
+ | It may seem more intuitive to have the first blend appear on the left | ||
+ | and the second on the right, but the frames come in from the left. | ||
+ | |||
+ | |||
+ | string Override Default "", (not set), eg "Override.txt" (New to v1.01) | ||
+ | Filename of file to force manual override the blend detections. | ||
+ | In v1.03, is only used in MODE=1. Neither Mode 0 nor Mode 2 | ||
+ | allows a manual override, you must force the override's in mode | ||
+ | 1, v1.03 extends the override ability and greatly increases it's effectivness. | ||
+ | Also, logging will assist in setting up the overrides file. | ||
+ | |||
+ | Required command format:- | ||
+ | |||
+ | 444=h1 | ||
+ | 555 | ||
+ | 666=*4 | ||
+ | |||
+ | In the above case, frame 444 is set to HINTED, ie Not A Blend. The number | ||
+ | after the 'h' denotes the hinted count, in this case 1, eg 444=h2 would | ||
+ | set two consecutive hinted frames. | ||
+ | |||
+ | 555 will be set to a SHORT BLEND PAIR ie (H12H), frame 555 (in this case) will | ||
+ | be set to blend index 1, 556 to index 2, and the frames before and after the | ||
+ | blend pair to HINTED. NOTE, in this case frame 555 is the 1st BLEND index and | ||
+ | NOT the first hinted frame. | ||
+ | |||
+ | Frame 666=*4 will set an override at frame 666 to 4 LONG BLEND PAIRS. A long | ||
+ | blend is shown (in logs) as (H12HHH) for FILM or (H12HHHH) for PAL. The frame | ||
+ | (in this case 666) is the position of the 1st blend index, it will (on only | ||
+ | the first LONG BLEND PAIR) be preceded by a hint, and the blend pair followed | ||
+ | by 3 or four hints depending upon whether FILM or PAL mode is in effect. As in | ||
+ | above case, '666=*4' would yield a result of (H12HHH12HHH12HHH12HHH) if in | ||
+ | film mode, or (H12HHHH12HHHH12HHHH12HHHH) in PAL. | ||
+ | With metrics shown, the 'M' flag will show where individual manual override 'H' | ||
+ | hints were set, or blend index 1 postions of either short or long blend pair | ||
+ | overrides (in the 666 example, it will flag the positions of all the 1's | ||
+ | within the parenthesis['(' and ')'] ). | ||
+ | |||
+ | ExBlend is intended to correct clips that do not stay in sequence, if you have | ||
+ | a clip that does stay in sequence (and you are sure of that), you can force | ||
+ | ExBlend to stay in sequence too using the manual override command file. If say | ||
+ | the first, 1st blend index is at frame 2, you could create a text file containing | ||
+ | the manual override command:- | ||
+ | |||
+ | 2=*1000000 | ||
+ | |||
+ | Thats it. (you would also need to set correct pal/film mode and such). Here | ||
+ | we gave a command to set 1 million LONG BLEND PAIR's, it will cease when | ||
+ | it comes to end of clip, and in the logs will tell you how many it actually set. | ||
+ | This excessive repetition count will not be considered an error by the override | ||
+ | command parser, however, trying to start a new command outside of clip range will | ||
+ | be considered an error. Also, NOTE, all manual override commands MUST be in ascending | ||
+ | order of frame number, you are NOT permitted to override previously set overrides, | ||
+ | some sort of order has to be maintained. As an aid (and byproduct of this strict | ||
+ | ordering) the parser can tell you (in logs) where the next permissable command | ||
+ | may be set. If trying to set up a manual override command file, use the logs, they | ||
+ | are your friend when trying to do this. | ||
+ | |||
+ | int lv Log file Verbosity. (Default 0, OFF) | ||
+ | 0=OFF, 1=ERRORS, 2=WARNINGS & ERRORS, 3 INFO & WARNINGS & ERRORS, | ||
+ | 4=VERBOSE INFO & etc, 5 = DEBUG + VERBOSE etc. | ||
+ | |||
+ | lv=4, to show all manual overrides in logs (maybe large logs). | ||
+ | |||
+ | int dv Log to DebugView window Verbosity. (Default 0, OFF) | ||
+ | 0=OFF, 1=ERRORS, 2=WARNINGS & ERRORS, 3 INFO & WARNINGS & ERRORS, | ||
+ | 4=VERBOSE INFO & etc, 5 = DEBUG + VERBOSE etc. | ||
+ | |||
+ | Can use DebugView program to view this log, New in v1.02 | ||
+ | |||
+ | DebugView available here:- | ||
+ | http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx | ||
+ | |||
+ | int disp Display mode, 0 to 4, Default 1 (DISP_EXBLEND). | ||
+ | |||
+ | 0=Original Blended input clip. | ||
+ | |||
+ | 1=ExBlend (default) ie returns two identical copies of deblended frames. | ||
+ | |||
+ | 2=SRestore, ExBlend Returns unblended frame for 1st blend index, and a duplicate of the frame following | ||
+ | the blend pair in the 2nd blend index postion. | ||
+ | This is the compatible with what srestore returns, and implemented to better compare ExBlend with same. | ||
+ | INVALID in mode 2 when decimate==true. | ||
+ | |||
+ | 3=Component frames. Returns both of the frames that would be merged to give the final unblended frames, | ||
+ | blend index 1 and 2 will return the two component frames. | ||
+ | |||
+ | 4=Adjacent frames. Only valid in MODE==2 and when Decimate==true. | ||
+ | Returns frames adjacent to blends, using CompUB and Decompix args. | ||
+ | |||
+ | clip DClip Detection clip, (Default None) | ||
+ | |||
+ | Can use eg a denoised clip for detection instead of source clip. | ||
+ | IF eg a telecined clip exhibiting combing has been vertically downsized a little, it will still appear | ||
+ | combed but cannot be inverse telecined, in this case you might like to try a DClip with the Didee suggested | ||
+ | |||
+ | DClip=blur(0,1.0) # Vertical Blur lines | ||
+ | |||
+ | And use that for the detection clip, you might also like to set CompUB to 2. | ||
+ | |||
+ | int CompUB Component unblend mode (Default 2, [experimental, may change]). | ||
+ | Component Unblend Mode for DISP display mode. | ||
+ | Unblend-ing is achieved in two stages, firstly, two component frames are recoverd, and then the average | ||
+ | of these two components is used to finally recover the unblended frame. Each of the component frames is | ||
+ | unblended using a blended frame and also the good frame adjacent to the blended frame. | ||
+ | CompUB controls which clips are used in reconstruction of the component frames where both Source clip | ||
+ | and Dclip are provided. If no Dclip is supplied then the source clip is always used (Obviously). | ||
+ | |||
+ | CompUB ranges from 0 to 2, where, (below assumes a Dclip) | ||
+ | |||
+ | 0 = No frames of Dclip, both blended And blend adjacent frames comes from source clip. | ||
+ | 1 = One Frame comes from Dclip ie the blended frame. The adjacent frame comes from source clip. | ||
+ | 2 = Both blended and adjacent frames come from Dclip. | ||
+ | |||
+ | An easy way of remembering it is as the number of Dclip frames used in the reconstruction of the Component frames. | ||
+ | (Info:- The Blend detector always uses the Dclip if supplied ie "DDDD"). | ||
+ | 0 == "SSSS", 1 == "SDDS", 2 == "DDDD", where the two middle letters are the blends and outer are adjacent. | ||
+ | |||
+ | bool Decimate (Default true in MODE==2, INVALID in MODE==0 or MODE==1) | ||
+ | False, off, No decimation | ||
+ | True, Decimate output in mode 2, MODE 1 already calculated which frames would be decimated and creates | ||
+ | a file (default "ExBlend_Decimated.TXT") holding the frame numbers of the unblended frames in the | ||
+ | MODE 2 decimated clip. | ||
+ | |||
+ | |||
+ | int Decompix Decimated Component Index, (Only Valid in MODE=2 when Decimate==true, when Default is 1) | ||
+ | |||
+ | When Decimate is true, (MODE 2 only) the only valid DISP Display modes are 0_DISP_BLENDED, 1_DISP_EXBLEND, 3_DISP_COMPONENT | ||
+ | and DISP_ADJACENT. | ||
+ | Decompix Is used in the DISP==0_DISP_BLENDED, DISP==3_DISP_COMPONENT and DISP==4_DISP_ADJACENT, to select which | ||
+ | frames to return in place of decimated unblended frames. | ||
+ | |||
+ | 0_DISP_BLENDED, using both CompUB and Decompix, you can pull out the blended frame from either blend index 1 or 2, | ||
+ | and from either the source clip (most usual) or the Dclip if required, using the CompUB arg. | ||
+ | Might be useful to anyone wanting to do their own advanced un-blending in script, using ExBlend() only as the detector. | ||
+ | |||
+ | 1 DISP_EXBLEND is the usual disp mode and returns a fully unblended frame for each pair of blends. Decompix, not used. | ||
+ | |||
+ | 3 DISP_COMPONENT, returns the component frame for either blend index 1 or blend index 2 (1st or 2nd blend), | ||
+ | Decompix specifies which of the 2 blend component frames are returned. Can be used to 'pull out' component | ||
+ | frames (1 & 2) from a decimated clip for alternative processing. eg, you could do some kind of denoising on the | ||
+ | component frames before blending them together yourself with eg Merge(). You could then replace your denoised | ||
+ | and merged frames back into the decimated clip, using eg ClipClop() plugin. ExBlend() does no denoising itself. | ||
+ | |||
+ | 4 DISP_ADJACENT, returns the source 'S' frame adjacent to the Decompix blend index frame. | ||
+ | Might be useful to anyone wanting to do their own advanced un-blending in script, using ExBlend() only as the detector. | ||
+ | |||
+ | |||
+ | int DecClpIx Decimated Clip index (MODE==1, default 1: MODE 0 & 1, IGNORED) | ||
+ | |||
+ | This setting (-ve to 255 [default 1]), sets the clip index used in the MODE==1 creation of (default) "ExBlend_Decimated.Txt" | ||
+ | file. This command file is a command file intended for the ClipClop() frame replacement plugin. For ClipClop(), the format | ||
+ | would be like so:- | ||
+ | |||
+ | "1 666" | ||
+ | |||
+ | Where '1' is the clip index number for the replacement clip, and '666' is the frame to replace. | ||
+ | This could be used like this, | ||
+ | |||
+ | FixedClip = ClipClop(ExblendedClip,DenoisedExblendedClip,CMD="ExBlend_Decimated.Txt") | ||
+ | |||
+ | DecClpIx can be used to change the clip index (above=='1') from range 0 to 255 with <0 denoting NONE. | ||
+ | |||
+ | |||
+ | bool Debug Debug logging (false/true, default false) | ||
+ | If true, switches on logging to file or DebugView to lv & dv, 1=Errors, 2=Warnings and 5=Debug, this would only | ||
+ | be used to avoid perhaps the info and Verbose logging. To omit only Verbose, set eg dv=3 (INFO) and Debug=true. | ||
+ | Will not effect log to file unless lv is non zero, ie just DebugView window. | ||
+ | </pre> | ||
+ | <br> | ||
+ | == Examples == | ||
+ | ## This is some example code. | ||
+ | Avisource("example.avi") | ||
+ | ExampleFilter(blah=true) | ||
+ | <br> | ||
+ | <br> | ||
+ | ----------------------------------------------- | ||
+ | '''Back to [[External_filters#Fieldblending_and_Frameblending_removal|External Filters]] ←''' |
Latest revision as of 15:55, 21 May 2020
Abstract | |
---|---|
Author | StainlessS |
Version | 1.04 |
Download | ExBlend_25_26_x86_x64_dll_v1-04_20181218.zip |
Category | External filters |
License | GPLv2 |
Discussion | Doom9 Forum |
Contents |
[edit] Description
ExBlend(), is a plugin originally written for telecined clips that were downsized from 720x480 to VCD 352x240. The damage caused by this, looks similar to damage caused by blend Deinterlacing of telecined clips, which results in a double blend, every five frames, GGGBBGGGBBGGGBB etc where 'G' is good and 'B' is blend. Where damage is due to Deinterlacing of telecined clips, it is likely that a denoised detection clip is required as although the damage looks quite similar, it is not exactly the same.
[edit] Requirements
- [x86]: AviSynth+ or AviSynth 2.6
- [x64]: AviSynth+
- Supported color formats: YUY2, Y8, YV12, YV16, YV24
- *** vcredist_x86.exe is required for ExactDedup-x86
- *** vcredist_x64.exe is required for ExactDedup-x64
[edit] Syntax and Parameters
Exblend(Clip,int "mode",int "pal",float "lockthresh",float "ithresh",int "show",string "ExBfile",bool "ver",bool "revip", string "override",int "lv",int "dv",int "disp",clip "Dclip",int "CompUB",bool "Decimate",int "DecompIx",int "DecClpIx", bool "Debug") ------------------------------------- SOME DEFAULTS HAVE CHANGED IN V1.04 | ------------------------------------- int mode Running mode Default 1 0 Free Running mode (Deprecated) Mainly for those that might whinge about having to use modes 1 & 2. In this mode it keeps a record in memory of the blend status of all visited frames, if you eg scan forwards and then backwards you will get exactly the same results as the 1st visit. Jumping about is also possible so long as you have first scanned the entire file although some metrics will be wrong. 1 Scan and Store mode (Default) As for Free Running mode but saves a copy of the scan status data when the clip is closed ('ExBlend.XBD'). Use this prior to mode = 2. Its pretty pointless having filters following ExBlend() in mode 1. 2 Pre-calculated mode Loads in Scan Status Data saved by Scan and Store mode, this is particularly useful to examine exactly which frames are unblended and you can jump about without the possibilty of mismatched detections. You should still not jump about if you are examining the BlendPair count and Ratio or other counts. In mode 1, Scan & Store, Scan entire file (with or without metrics) and When you have everything working right you can switch to mode 2, (with metrics off). You now can add following filters to your hearts content and ExBlend() should not take up too much CPU. Switching from modes 1 to 2 may seems awkward but it is intended that this filter be used in film restoration and so it is likely that many other filters will follow this one, having a pre-calculated data file allows Exblend() to use minimal CPU when adding further filters and checking the resultant video. For the same reasons, Multidecimate() could also be a good choice. v1.03b, added native decimation in mode 2. int pal -1, 0, 1 , Default 0, lets Exblend() know what the original frame rate was. This sets the filters hints, after a blended pair is found, the detector will preset 3 (23.976/24 FPS) frames either side of the pair to HINTED meaning No Blend. If 'pal' (25 FPS) is set to 1, it will preset 4 frames either side to HINTED. This helps it fall into sync with sequence but may have slight delayed detection if the sequence goes out of sync. If a frame has already been preset (visited) then the hint will not be set, this allows hints to work when scanning both forward and backwards. Not sure if PAL is actually useful or not, never seen any clip that exhibited this problem with a good/blended signature of GGGGBBGGGGBBGGGG etc, where there are 4 good frames and 2 blends. As it did not add much difficulty to the plugin, PAL was implemented just incase it was ever found to be useful. -1 AutoPal mode. (MODE 0 ONLY) If you are not sure what the original source was you can set PAL = -1 (MODE 0 Only). If "Unblended:Blended Pairs" Ratio is between (4.0-0.01) and 5.0 at frame 1500 (1500=60*25 = 60 seconds @ 25 FPS), it will auto switch to PAL hints, the first 60 seconds could contain the odd extra false blend pair detection. If AUTO PAL is activated, the Metrics P (PAL) flag is hi-lited. It's not a good idea to rely on this auto pal switch, you should set pal=1 when you see it in orange. If autopal is activated and you later see the ratio rise above 5.0, then it would seem that the autopal detection was in error, this can happen if the 1st 60 seconds contains a lot of static scenes with little movement, in this case you should change to PAL=0 to disable the autopal detection and force it to 23/24FPS original frame rate. Again, if the 1st 60 seconds contains a lot of static scenes and it was originally PAL 25 FPS then the autopal may fail to detect and not auto switch to PAL mode, in this case, ratio will later fall to above 4.0 and below about 5.0. In this case you should change to PAL=1 to force PAL mode. 0, Forced 24 (or 23.976) FPS original frame rate (Default). If the original source was 25 FPS and PAL is set to 0, then this can reduce the effectiveness of ExBlend() due to it erroneously detecting false blends where it should have been hinted, thus throwing it out of sync. 1, Forced PAL 25 FPS original frame rate. If the original source was 24 FPS and PAL is set to 1, then this can DRAMATICALLY reduce the effectiveness of ExBlend() due to it hinting out blends and overriding what should have been a blend detection. This will again, throw it out of sync. The R (RATIO) metrics flag will be displayed in orange at any time the ratio is not within expected bounds, including during the AUTO PAL detection period (if it was a 25 FPS clip originally) but will disappear once AUTO PAL has switched. float lockthresh Range 0.0 (Off) to about 2.0, Default 1.0 (No longer considered EXPERIMENTAL, so default 1.0) The lockthresh arg switches on the locking function of ExBlend(). Purpose being to try and latch on to the sequence when near static scene is encountered. If the lock is activated, the 'L' Locked flag will be set in metrics. NoLMN[f]=x.xxxx L=y.yyyy LMX[f]=z.zzzz I dont really wanna explain how locking works, it may change if someone else can implement a better version. However, for locking to take effect, some pre-conditions have to be satisfied. The frame must be detected as non-blended, the previous frame should have been hinted, and at least some of the conditions that would qualify as a blend detection must be present, so not all frames qualify for the pre-conditions. If a frame does qualify, then you may see something like L=y.yyyy which would indicate a locking metric for the current frame, it is this metric that is compared to LOCKTHRESH, if below or equal, then the frame is locked (converted to a blend detection). If the frame is locked, the L flag will be set and the metric will be Hi-lited. Once any frame has been locked, you may see LMX[f]=z.zzzz and this shows the frame number and lock metric for the frame with the highest locked metric, yet encountered. There may also be an indication for the frame with the lowest lock metric that did NOT lock as in NoLMN[f]=x.xxxx You may want to investigate all of the minimum and maximum flagged frames both for locking and Ignore functions. Any frame that qualifies and would pass the locking criteria will fail silently if the merge delta is above the ithresh Ignore setting, it will not appear or be counted as an ignored frame. If anyone would like to improve the functionality of lock, then please be my guest. This filter outputs a list of LOCKED frames which can be viewed using DebugView, or may be output to a logging file. v1.02, can now use eg 'disp=0' to view original blended clip along with metrics to view frames flagged for investigation for either locking or ignore. float ithresh 0.0 to 100.0, Default 3.0 There was a weird transition in the original clip that prompted this filter to be written, it resulted in an even more weird effect after unblending (looked sort of embossed). This is an attempt to avoid future similar problems, but I dont have the original problem video any more so cant really test it, also, the detection logic has changed a little and so the it may no longer be a problem. If merge Delta (MD) for a detected blend pair goes above this number, then the blends will be ignored. I suppose that you could cut down on the number of false blend detections by lowering this but it probably does not need it, it works fairly well as it is. If MD exceeds ithresh, the 'I' Ignored flag will be set and the detected blended pair will be ignored, and a little futher info will be given when show=5. If there were any IGNORED blends, then it may be a good idea to take a look at the offending frames both with ithresh at its setting of 3.0 and with ithresh set to eg 100.0 where the suspect blend will not be ignored. Written since above, the ithresh setting does seem to work quite well and it's default setting of 3.0 may cut down on false detections but may IGNORE good blend detections too, this is conservatively set so as not to allow any bad ones through. A clip has been observed that went out of sequence every few minutes by throwing in a triple blend, this ithresh setting seems to avoid the unpleasant effects of bad detections at these points. You may need to raise this if many IGNORED blends occur, perhaps in 'not so good clips'. This filter outputs a list of IGNORED frames which can be viewed using DebugView, or may be output to a logging file. v1.02, can now use eg 'disp=0' to view original blended clip along with metrics to view frames flagged for investigation for either locking or ignore. int show Range 0-5 MODES 0 1, and 2 when Decimate == false: 0 Off (Default in MODE 2 only) 1 Show colored block in top left hand of clip when blend detected. Blue block for 1st blended frame, Red for Second 2 Show blend detection only as in:- FFF ExBlend a b ?1RPSHOLIMD FFF shows the frame number a & b show '-' No Blend, '1' 1st Blend, '2' 2nd Blend a & b will usually be the same, 'a' is the used detection, which may have been newly calculated or pre-calculated and stored in a file. 'b' is shown as calculated by the metrics, it is possible that this is different from a pre-calculated detection. ? is the MODE flag which may be displayed as '¿' (an upside down question mark) meaning Free running mode 0. A '?', meaning Mode 1, scan and store mode, where ExBlend creates a precalculated data file. '!' displayed means Mode 2, Pre-calculated mode, where it will use data file saved in mode 1. The '1' flag above, represents the DISP (Display) mode setting and can be '0', '1', '2', or '3', (the missing mode '4' is not valid unless MODE 2 and Decimate==true where metrics are different). '0' represents, disp=0, the original blended clip is returned. '1' represents, disp=1, ExBlend default returning an identical pair of unblended frames replacing the blended ones. '2' represents disp=2, which returns an unblended frame for the first of a blend pair and a copy of the frame following the blend pair for the second blended frame. This is the SRestore compatible mode. '3' Represents disp=3, where the component frames which would be merged together to create the final recovered frame are returned. In the first blend position, the left component frame is returned and the right when in blend index 2 postion. You would not in most cases be interested in this. This setting can be used to view the different return frames using metrics mode to examine what a frame looks like and the metrics reported for that frame. The 'R' (RATIO) flag will be displayed hilited at any time the ratio is not within expected bounds, including during the AUTO PAL detection period (if it was a 25 FPS clip originally) but will disappear once AUTO PAL has switched. The 'P' (PAL) flag indicates that you are in PAL mode. If orange, then the 'P' flag indicates that the Autopal switch was activated when the Exblend() argument was set to 'pal = -1' (MODE 0 ONLY, auto detect pal). The 'F' (FILM) flag indicates Film, if hilited, means that the Autopal switch was erroneously activated and indicates that you should restart with the argument set to 'pal=0'. the P and F flags share the same position on screen and cannot be set simultaneously. The 'p' (lowercase) flag is shown when 'Auto Detect Pal' is in operation and will switch to either 'P' or 'F' at frame 1500 where PAL is either detected, or not. The 'S' (SEQUENCE) flag will display when ExBlend() falls out of sequence. 1, 2 or HINTED is considered in sequence. 0 is considered out of sequence. If hilited, means that the current frame is where it went out of sequence. The 'H' (HINTED) flag indicates that the frame has been hinted. When Exblend() finds a blended pair, it presets 3 frames on either side of the blend pair to hinted (NOT-BLENDED), or 4 either side if in PAL mode. The 'O' (OVERRIDDEN) flag indicates that the used detection, differs from the metrics blend detection, this is most likely to happen in static scenes where false blend detections are overriden by the hints to be unblended. Will be hi-lited in orange if override not due to hinting. There is no need to be too concerned about a lot of overrides, the hints are intended to allow the detector to be quite zealous in its detections. The 'L' (LOCKED) flag indicates that the (previously EXPERIMENTAL) locking function has locked onto the sequence dispite a blend detection not being found. This filter outputs a list of LOCKED frames which can be viewed using DebugView, or to the logging file. The I (IGNORED) flag is displayed in the case where the 'merge delta' exceeds ithresh. The 'I' flag is in Orange if the current frame is ignored and normal if any frame was ignored (stays on). Extra 'ignored' info is shown when show=5. This filter outputs a list of IGNORED frames which can be viewed using DebugView, or to the logging file. New in 1.02, writes "New Sequence" and "Lost Sequence" debug messages, can view in DebugView or in logging file. If you see several "lost sequence", "new sequence" type messages (in close proximity) in the logs, this is probably down to a false detection following a lost sequence, this is a prime component for the 'override' functionality of v1.02. The 'M' flag denotes a manual override is in effect at the current frame. These are set using the "override" arg to use the override command file. The 'D' flag shows if an unblended frame is reconstructed using the DClip (CompUB) and is hi-lited if adjacent frame also comes from Dclip (CompUB==2). Show == 2, will also show the colored block in the upper LHS of clip. 3 Show Metrics:- <--Prev<---><CUR><--><Next-> MD x.xxxx x.xxxx x.xxxx x.xxxx FD x.xxxx x.xxxx x.xxxx x.xxxx ^ ^ 2 1 Right one Hi-lighted for 1st detected blend and Left for 2nd, if blend pair detected, MD will be smaller than FD and also smaller than the MD entries on either side. The next frame comes in from the right. 'FD' is Frame Delta (difference) and 'MD' Merge Delta. FD is the delta between the frames in the clip, when hi-lited it is the difference between the two frames of the DETECTED blended pair. MD is the difference between the two copies of the unblended component frames (that would be merged together to 'iron out' artifacts for the final recovery frame). The MD:FD comparison detects that it is a blend (MD should be smaller than FD), and the MD to MD on either side comparison detects whether it is in the 1st or 2nd blended pair position. (MD in the hi-lited column should be smaller than those on either side). Show == 3, includes show 1 & 2 metrics. 4 Show Blend count and ratio BlendPairs =w (max=x) Ratio =y (z%) Gives a count of detected blend pairs and the ratio of Unblended to BlendPairs. When you have scanned from start to end of the clip (without jumping about or going backwards) 'Ratio' should give a result of 3.xxxx for 24 FPS original and 4.xxxx for 25 FPS original, meaning 3 good frames and 2 blended for 24 FPS or 4 good and 2 blended for 25 FPS. Should only scan forward (Otherwise, BlendPairs & Ratio will be wrong). Following ratio, the percentage of detected blends is displayed, based on the current pal mode, this may give a more humanistic idea as to how well ExBlend() is doing. Following BlendPairs (max=x) is displayed where x is the maximum number of blend pairs that could exist in the clip using the current PAL mode, this will change if AUTO PAL switch is activated. The max value displayed assumes also that the clip stays in sequence throughout, if it does not, the true max value could well vary from that shown and the true percentage of blends found could well be higher or lower than shown, but not by much (small fraction of a percent, probably). Also note, ExBlend() may not detect the first or last blends in a clip due to it needing 3 frames both before and after the current frame to do it's detections. Show == 4, includes show 1 to 3 metrics. 5 Shows Lock, Sequence, Overridden and Ignored counts as in:- [Default when NOT [MODE==2 and Decimate ==true)] LC=w SC=x OC=y IC=z In addition, if IC is non-zero, then IMN[f1]=x.xxxx IMX[f2]=y.yyyy Will be displayed where f1 and f2 indicate frame numbers where the minimum and maximum merge deltas occured that exceeded 'ithresh' and so were ignored. You might want to investigate these frames with current ithresh setting and also with ithresh set to 100.0 (ithresh IGNORE switched OFF). If particularly curious, you might want to set ithresh to 0.0 (Ignore everything), do a complete scan and take a look to see what the blend with the worst merge delta looks like, if bad, then lower ithresh a little (tiny weeny bit below y.yyyy). Dont leave ithresh set to 0.0 for the final scan as this will avoid almost all detections. New to v1.02, the 'disp' arg allows return of the original blended frames, or the de-blended frames and so you could say create a stacked display to show both before and after with metrics, also better than the above suggested, changing of ithresh. Seeking to frame zero will reset the statistics. NOTE, if clip Trimmed, then may not ever go to frame zero, and so frame 0 statistics reset may not work. (an offhand example of where this might occur [have not checked this] might be where you script eg "Last.Trim(100,0).Exblend()" so that a new clip never was produced, ExBlend was invoked on a part of a clip, and so frame zero will not be encountered within ExBlend) NoLMN[f]=x.xxxx L=y.yyyy LMX[f]=z.zzzz The above is connected to the lockthresh argument of Exblend(). See Lockthresh. MODE 2, when Decimate==true: (Defaults OFF, for MODE==2, Decimate==true). show == 0, Off show > 0, show different metrics. as In:- '39 ] Using 48 (* SDDS)' where '39' is the decimated frame number, 48 is the source clip frame, and '(* SDDS)' indicates an unblended frame using the source clip for adjacent frames and the DClip frames for the blended frames. string ExBfile Default "ExBlend" ExBlend Project file base name. Used to create any required logging file eg 'ExBlend_1.LOG' when used in MODE==1. Also used in creating filename of file to store 'mode' 1 Scan and Store data and to also load data file for mode 2 Pre-calculated mode. Creates (by default) in local directory where AVS file is located. In Mode 1, also creates a Decimated Frames command file, by default, 'ExBlend_Decimated.TXT' for use as a command file giving frame numbers of unblended frames after decimating in MODE==2. bool ver true or false, Default False Just shows the version number of ExBlend(), Perhaps other filter writers should consider whether showing version and copyright stuff serves any positive purpose (other than ego boosting) when showing metrics. When ver=true, it will show version info (Also a little ego boosting stuff), without interfering with any important metrics. ALL args are ignored when 'ver==true'. bool revip Range false (Off) to true (On), Default false (Off) Reverses the metrics display as in:- <--Next<---><CUR><--><Prev-> MD x.xxxx x.xxxx x.xxxx x.xxxx FD x.xxxx x.xxxx x.xxxx x.xxxx ^ ^ 1 2 It may seem more intuitive to have the first blend appear on the left and the second on the right, but the frames come in from the left. string Override Default "", (not set), eg "Override.txt" (New to v1.01) Filename of file to force manual override the blend detections. In v1.03, is only used in MODE=1. Neither Mode 0 nor Mode 2 allows a manual override, you must force the override's in mode 1, v1.03 extends the override ability and greatly increases it's effectivness. Also, logging will assist in setting up the overrides file. Required command format:- 444=h1 555 666=*4 In the above case, frame 444 is set to HINTED, ie Not A Blend. The number after the 'h' denotes the hinted count, in this case 1, eg 444=h2 would set two consecutive hinted frames. 555 will be set to a SHORT BLEND PAIR ie (H12H), frame 555 (in this case) will be set to blend index 1, 556 to index 2, and the frames before and after the blend pair to HINTED. NOTE, in this case frame 555 is the 1st BLEND index and NOT the first hinted frame. Frame 666=*4 will set an override at frame 666 to 4 LONG BLEND PAIRS. A long blend is shown (in logs) as (H12HHH) for FILM or (H12HHHH) for PAL. The frame (in this case 666) is the position of the 1st blend index, it will (on only the first LONG BLEND PAIR) be preceded by a hint, and the blend pair followed by 3 or four hints depending upon whether FILM or PAL mode is in effect. As in above case, '666=*4' would yield a result of (H12HHH12HHH12HHH12HHH) if in film mode, or (H12HHHH12HHHH12HHHH12HHHH) in PAL. With metrics shown, the 'M' flag will show where individual manual override 'H' hints were set, or blend index 1 postions of either short or long blend pair overrides (in the 666 example, it will flag the positions of all the 1's within the parenthesis['(' and ')'] ). ExBlend is intended to correct clips that do not stay in sequence, if you have a clip that does stay in sequence (and you are sure of that), you can force ExBlend to stay in sequence too using the manual override command file. If say the first, 1st blend index is at frame 2, you could create a text file containing the manual override command:- 2=*1000000 Thats it. (you would also need to set correct pal/film mode and such). Here we gave a command to set 1 million LONG BLEND PAIR's, it will cease when it comes to end of clip, and in the logs will tell you how many it actually set. This excessive repetition count will not be considered an error by the override command parser, however, trying to start a new command outside of clip range will be considered an error. Also, NOTE, all manual override commands MUST be in ascending order of frame number, you are NOT permitted to override previously set overrides, some sort of order has to be maintained. As an aid (and byproduct of this strict ordering) the parser can tell you (in logs) where the next permissable command may be set. If trying to set up a manual override command file, use the logs, they are your friend when trying to do this. int lv Log file Verbosity. (Default 0, OFF) 0=OFF, 1=ERRORS, 2=WARNINGS & ERRORS, 3 INFO & WARNINGS & ERRORS, 4=VERBOSE INFO & etc, 5 = DEBUG + VERBOSE etc. lv=4, to show all manual overrides in logs (maybe large logs). int dv Log to DebugView window Verbosity. (Default 0, OFF) 0=OFF, 1=ERRORS, 2=WARNINGS & ERRORS, 3 INFO & WARNINGS & ERRORS, 4=VERBOSE INFO & etc, 5 = DEBUG + VERBOSE etc. Can use DebugView program to view this log, New in v1.02 DebugView available here:- http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx int disp Display mode, 0 to 4, Default 1 (DISP_EXBLEND). 0=Original Blended input clip. 1=ExBlend (default) ie returns two identical copies of deblended frames. 2=SRestore, ExBlend Returns unblended frame for 1st blend index, and a duplicate of the frame following the blend pair in the 2nd blend index postion. This is the compatible with what srestore returns, and implemented to better compare ExBlend with same. INVALID in mode 2 when decimate==true. 3=Component frames. Returns both of the frames that would be merged to give the final unblended frames, blend index 1 and 2 will return the two component frames. 4=Adjacent frames. Only valid in MODE==2 and when Decimate==true. Returns frames adjacent to blends, using CompUB and Decompix args. clip DClip Detection clip, (Default None) Can use eg a denoised clip for detection instead of source clip. IF eg a telecined clip exhibiting combing has been vertically downsized a little, it will still appear combed but cannot be inverse telecined, in this case you might like to try a DClip with the Didee suggested DClip=blur(0,1.0) # Vertical Blur lines And use that for the detection clip, you might also like to set CompUB to 2. int CompUB Component unblend mode (Default 2, [experimental, may change]). Component Unblend Mode for DISP display mode. Unblend-ing is achieved in two stages, firstly, two component frames are recoverd, and then the average of these two components is used to finally recover the unblended frame. Each of the component frames is unblended using a blended frame and also the good frame adjacent to the blended frame. CompUB controls which clips are used in reconstruction of the component frames where both Source clip and Dclip are provided. If no Dclip is supplied then the source clip is always used (Obviously). CompUB ranges from 0 to 2, where, (below assumes a Dclip) 0 = No frames of Dclip, both blended And blend adjacent frames comes from source clip. 1 = One Frame comes from Dclip ie the blended frame. The adjacent frame comes from source clip. 2 = Both blended and adjacent frames come from Dclip. An easy way of remembering it is as the number of Dclip frames used in the reconstruction of the Component frames. (Info:- The Blend detector always uses the Dclip if supplied ie "DDDD"). 0 == "SSSS", 1 == "SDDS", 2 == "DDDD", where the two middle letters are the blends and outer are adjacent. bool Decimate (Default true in MODE==2, INVALID in MODE==0 or MODE==1) False, off, No decimation True, Decimate output in mode 2, MODE 1 already calculated which frames would be decimated and creates a file (default "ExBlend_Decimated.TXT") holding the frame numbers of the unblended frames in the MODE 2 decimated clip. int Decompix Decimated Component Index, (Only Valid in MODE=2 when Decimate==true, when Default is 1) When Decimate is true, (MODE 2 only) the only valid DISP Display modes are 0_DISP_BLENDED, 1_DISP_EXBLEND, 3_DISP_COMPONENT and DISP_ADJACENT. Decompix Is used in the DISP==0_DISP_BLENDED, DISP==3_DISP_COMPONENT and DISP==4_DISP_ADJACENT, to select which frames to return in place of decimated unblended frames. 0_DISP_BLENDED, using both CompUB and Decompix, you can pull out the blended frame from either blend index 1 or 2, and from either the source clip (most usual) or the Dclip if required, using the CompUB arg. Might be useful to anyone wanting to do their own advanced un-blending in script, using ExBlend() only as the detector. 1 DISP_EXBLEND is the usual disp mode and returns a fully unblended frame for each pair of blends. Decompix, not used. 3 DISP_COMPONENT, returns the component frame for either blend index 1 or blend index 2 (1st or 2nd blend), Decompix specifies which of the 2 blend component frames are returned. Can be used to 'pull out' component frames (1 & 2) from a decimated clip for alternative processing. eg, you could do some kind of denoising on the component frames before blending them together yourself with eg Merge(). You could then replace your denoised and merged frames back into the decimated clip, using eg ClipClop() plugin. ExBlend() does no denoising itself. 4 DISP_ADJACENT, returns the source 'S' frame adjacent to the Decompix blend index frame. Might be useful to anyone wanting to do their own advanced un-blending in script, using ExBlend() only as the detector. int DecClpIx Decimated Clip index (MODE==1, default 1: MODE 0 & 1, IGNORED) This setting (-ve to 255 [default 1]), sets the clip index used in the MODE==1 creation of (default) "ExBlend_Decimated.Txt" file. This command file is a command file intended for the ClipClop() frame replacement plugin. For ClipClop(), the format would be like so:- "1 666" Where '1' is the clip index number for the replacement clip, and '666' is the frame to replace. This could be used like this, FixedClip = ClipClop(ExblendedClip,DenoisedExblendedClip,CMD="ExBlend_Decimated.Txt") DecClpIx can be used to change the clip index (above=='1') from range 0 to 255 with <0 denoting NONE. bool Debug Debug logging (false/true, default false) If true, switches on logging to file or DebugView to lv & dv, 1=Errors, 2=Warnings and 5=Debug, this would only be used to avoid perhaps the info and Verbose logging. To omit only Verbose, set eg dv=3 (INFO) and Debug=true. Will not effect log to file unless lv is non zero, ie just DebugView window.
[edit] Examples
## This is some example code. Avisource("example.avi") ExampleFilter(blah=true)
Back to External Filters ←