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. |
18th December 2018, 23:29 | #1 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
ExBlend deblender - v1.04 - 18 Dec 2018
New Thread due to Forum restriction on editing thread title when over x number of years old.
Old version here:- https://forum.doom9.org/showthread.php?t=157337 Settings.txt Part 1 of 3 : Post #1 of 6 Code:
ExBlend() By Stainless Stephen [StainlessS on Doom9] http://forum.doom9.org/showthread.php?t=157337 New thread:- https://forum.doom9.org/showthread.php?t=175948 ExBlend() v1.04 [Req VS2008 CPP runtimes] YV12, YV16, YV24, YV8, YUY2 PROGRESSIVE source. Avisynth v2.5+ (YV12 & YUY2 only for v2.58 plugin) 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. -------------------------------------------------------------------------------------------- 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. Zip includes 3 dll's + source + full vs 2008 project files (~214KB). See MediaFire or SendSpace in Sig for Downloads
__________________
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; 19th December 2018 at 01:13. |
18th December 2018, 23:29 | #2 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
Settings.txt Part 2 of 3 : Post #2 of 6
Code:
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.
__________________
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; 19th December 2018 at 00:00. |
18th December 2018, 23:30 | #3 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
Settings.txt Part 3 of 3 : Post #3 of 6
Code:
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. ----------------------------------------------------------------------------------- DebugView here:- http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx ClipClop() Plugin here:- http://forum.doom9.org/showthread.php?t=162266 Prune() Plugin here:- http://forum.doom9.org/showthread.php?t=162446 ----------------------------------------------------------------------------------- Change log : 2/Dec/2009 - ver 1.0 - 1st Public Release 26/Feb/2010 - ver 1.01 Changed blend recovery mode to be identical to srestore, Instead of using recovered frame at blend index 2, we now use frame following blended pair so the duplicate is of the frame following blends. Better for compare with srestore. Switched to using DDigit text renderer. 8/Oct/2010 - ver 1.02b Lockthresh, no longer considered EXPERIMENTAL, defaults to 1.0. Added new arg eg Log="Logfile.Log", default ExBlend.Log. Override commands extended and parser enhanced, assisting messages added to logs. Added lv and dv and disp, args. Added "New Sequence" and "Lost Sequence" and other messages to messages log. Moved flags around. Recompiled using the updated DDigit text renderer with Toolkit 2003 optimizing compiler. 15/Feb/2012 - ver 1.03b Added Dclip, Decimate, CompUB, Dcompix, DecClpIx, and Debug args. Added DISP_ADJACENT. Lots of changes. Default back to ExBlend instead of sRestore. 18/Dec/2018 - ver 1.04. Moved to VS 2008, added x64. Added v2.60 standard Planar Colorspaces (excl YV411).
__________________
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; 19th December 2018 at 00:15. |
18th December 2018, 23:30 | #4 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
ExBlend_QwikRef.txt Part 1 of 2 : Post #4 of 6
Code:
EVERYTHING HERE OVERRULES OLD DOCS (See old docs Also) ExBlend() v1.04 QuickRef YV12, YUY2, PROGRESSIVE Only. EDIT: Plus YV16 YV24 Y8. Quick OverView, ExBlend() is a plugin to repair 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. Also used for telecined clips that were downsized from 720x480 to VCD 352x240 which look similar to the above mentioned damage. 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") Mode 0: Free Running Mode (Deprecated) -------------------------------------------------------------- Arg Type Min Max Default Comment clip clip clip clip NONE YV12 & YUY2 PROGRESSIVE Pal int -1 1 0 PAL = -1, ONLY allowed HERE in MODE 0 LockThresh float 0.0 100.0 1.0 default rarely needs change. IThresh float 0.0 100.0 3.0 default rarely needs change. Show int 0 5 5 Metrics (0=OFF,5=FULL, either of these two most usual) Exbfile string - - "ExBlend" Project: (logging Only), 'exbfile'.XBD Not created. Ver bool False True False ALL ARGS IGNORED if true Revip bool False True False Reverse Metrics Direction when show > 1 Override string - - - IGNORED (MODE 1 ONLY) Lv int 0 5 0 Logfile: 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG Dv int 0 5 0 DebugView: 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG Disp int 0 3 1 Display mode, 0=BLENDED(original), 1=EXBLEND, 2= SRESTORE, 3=COMPONENT, (4=ADJACENT Invalid) DClip clip - - UNSET Denoised Detection Clip, Same colorspace & dimensions as Clip. CompUB int 0 2 2 Component Unblend Mode for DISP display mode Decimate bool - - - IGNORED Decompix int 1 2 1 IGNORED (MODE 2 decimated ONLY) DecClpIx int <0 255 1 IGNORED (MODE 1 ONLY) Debug bool false True False Switch On: ERRORS, WARNINGS and DEBUG logging (ie 1,2 and 5) Mode 1: (ExBlend v1.03+ Scan & Store Data, default, Need to do this before using MODE==2) ------------------ Arg Type Min Max Default Comment clip clip clip clip NONE YV12 & YUY2 PROGRESSIVE Pal int 0 1 0 PAL -1 Not Allowed (Error) LockThresh float 0.0 100.0 1.0 default rarely needs change. IThresh float 0.0 100.0 3.0 default rarely needs change. Show int 0 5 5 Metrics (0=OFF,5=FULL) Exbfile string - - "ExBlend" Project: logs,'Exbfile'.XBD & Decimated (Mode 2) Frames Cmd file. Ver bool False True False ALL ARGS IGNORED if true Revip bool False True False Reverse Metrics Direction when show > 1 Override string - - "" Input Override Command file Lv int 0 5 0 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG (logfile) Dv int 0 5 0 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG (DebugView) Disp int 0 3 1 Display mode, 0=BLENDED(original), 1=EXBLEND, 2= SRESTORE, 3=COMPONENT, (4=ADJACENT Invalid) DClip clip - - UNSET Denoised Detection Clip, Same colorspace & dimensions as Clip. CompUB int 0 2 2 Component Unblend Mode for DISP display mode Decimate bool - - - IGNORED (MODE 2 ONLY) Decompix int 1 2 1 IGNORED (MODE 2 decimated ONLY) DecClpIx int <0 255 1 Clip index used in eg Exblend_Decimated.Txt, <0 == NONE. Debug bool false True False Switch On: ERRORS, WARNINGS and DEBUG logging (ie 1,2 and 5) Mode 2: (Final Output mode, needs MODE 1 pass 1st.) ------------------------------------------------------------- Arg Type Min Max Default Comment clip clip clip clip NONE YV12 & YUY2 PROGRESSIVE Pal int - - - Ignored, Set from 'Exbfile'.XBD LockThresh float - - - Ignored, Set from 'Exbfile'.XBD IThresh float - - - Ignored, Set from 'Exbfile'.XBD Show int 0 5 0 Metrics (NON-DECIMATED:0=OFF,5=FULL | DECIMATED:0=OFF,>0 ON) [DEFAULT different to modes 0 & 1] Exbfile string - - "ExBlend" Project: (logging, Inputs Project Mode 1 XBD file) Ver bool False True False ALL ARGS IGNORED if true Revip bool False True False Not used when Decimate (Metrics are different).) Override string - - - IGNORED, Set in Mode 1 Lv int 0 5 0 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG (logfile) Dv int 0 5 0 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG (DebugView) Disp int 0 4 1 If Decimate, 0_BLENDED, 1_EXBLEND, 3_COMPONENT & 4_ADJACENT valid (2_SRESTORE converted to EXBLEND) DClip clip - - UNSET Usually as Mode 1 (or NONE), Same colorspace as Clip. CompUB int 0 2 2 Component Unblend Mode for DISP display mode Decimate bool false True True Decompix int 1 2 1 Decimated Component Index. Valid if DECIMATE & disp=0_BLENDED/3_COMPONENT/3_ADJACENT else Ignored. DecClpIx int <0 255 1 IGNORED (MODE 1 ONLY) Debug bool false True False Switch On: ERRORS, WARNINGS and DEBUG logging (ie 1,2 and 5)
__________________
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; 19th December 2018 at 00:25. |
18th December 2018, 23:31 | #5 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
ExBlend_QwikRef.txt Part 2 of 2 : Post #5 of 6
Code:
To use ExBlend(), you need to do a scan of the clip first using eg: ExBlend(clip, Mode=1) # AssumeFPS(250.0) or ExBlend(clip, Mode=1,dclip=DCLIP) # AssumeFPS(250.0) Where DCLIP is a denoised detection clip if required. Scan through the file and it will create an ExBlend.XBD file for Mode 2 as in below example. ExblendedClip=ExBlend(clip, Mode=2,dclip=DCLIP) DISP: (Display Mode) Controls which frames are returned instead of Blended Frames, using CompUB & Decompix as additional controls. Non-Blended frames will ALWAYS return frames from source clip. Where 'S' is Source Clip Frame, 'D' is DCLIP Detection clip frame (if supplied Else 'S') In 'mode' 0, 1, & 2 (mode 2 when Decimate == False): 0 DISP_BLENDED If (CompUB !=0), Returns blended frame from D, else blended frame from S. 1 DISP_EXBLEND Blended frames are unblended as for CompUB. 2 DISP_SRESTORE 1st Blended frame is unblended as for CompUB, 2nd replaced with frame after 2nd blend. 3 DISP_COMPONENT Blended frames replaced with COMPONENT frame as for CompUB. In 'mode' 2 with Decimate==True: (only DISP 0, 1,3 and 4 valid) 0 DISP_BLENDED If (CompUB !=0), Returns BLENDED frame from D, else blended frame from S, further control via Decompix to select 1st or 2nd blend frame of blend pair. You might want to set CompUB to 0 here to return the original blended source frame and not from the DClip. 1 DISP_EXBLEND Blended frames are unblended as for CompUB (Same as NOT Decimated). 3 DISP_COMPONENT Returns COMPONENT frame as for CompUB, Decompix==1 = 1st Component frame, 2 =2nd. 4 DISP_ADJACENT Returns source frame 'S' adjacent to Decompix blend index. CompUB: (Component Unblend 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 (Default [experimental, may change]). 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. Decompix: (Decimated Component Index) 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 (only valid in mode==2 and when Decimate==true). 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. 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. ExbFile: (ExBlend Project File, [default "ExBlend"], Changed function a little in v1.03) The Exbfile project name is used to create log file names (eg "ExBlend_1.LOG", where '_1' represents the active MODE at the time). In MODE 1 only, it is also used to create eg an "ExBlend.XBD" file which totally replaces any detection stage in MODE 2 and all of the info required to Decimate in Mode 2 is contained in the XBD file. Mode 1, also creates an eg "ExBlend_Decimated.TXT", which is a command file for use in a range/frame replacement plugin. [eg ClipClop()], This "ExBlend_Decimated.TXT" is a file containing frame numbers that can be used to select MODE 2 decimated output blend recovered frames. In Mode 2, you can choose to not Decimate, in which case it would be as previous versions of ExBlend and require later Decimation using your favorite Decimator. Or, you can Decimate if you choose, you can process the Decimated output of ExBlend 1_DISP_EXBLEND using your favorite Motion Compensated denoiser, and feed the original ExBlend output and the denoised output into ClipClop, using the ExBlend_Decimated.TXT command file to replace the ExBlend recovered un-blended frames with the denoised ones, and NOT requiring yet another pass. Pass 1 to generate the XBD and decimated frames file and Pass 2 to unblend, decimate, motion compensated denoise and replace back into the ExBlended clip again. DecClpIx: (Decimated Clip Index, MODE 1 Only) 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") In the above, 'ExblendedClip' would be clip 0, and 'DenoisedExblendedClip' clip 1, it would replace the cleaned up frames back into the deblended clip after eg post Exblend recovery denoising (eg MCDegrain). You could also use the Prune() plugin to view ONLY the unblended Denoised frames, Prune requires clip index's starting at 0 BUT, the below should work OK. FixedFramesOnlyClip = Prune(FixedClip,FixedClip,CMD="ExBlend_Decimated.Txt") OR FixedFramesOnlyClip = Prune(DenoisedExblendedClip,DenoisedExblendedClip,CMD="ExBlend_Decimated.Txt") without putting them back into the ExblendedClip clip first. As Prune()'s clips index starts at zero, we used the input clip name twice so we can use clip 1 (2nd FixedClip) to match the command file. To view just the ExBlended frames (without denoise) eg: Prune(ExblendedClip,ExblendedClip,CMD="ExBlend_Decimated.Txt") To extract the two component clips recovered frames only, and view them side by side COMPUB=2 # you choose C1=ExBlend(clip,Mode=2,disp=3,CompUB=COMPUB,Decompix=1) C2=ExBlend(clip,Mode=2,disp=3,CompUB=COMPUB,Decompix=2) C1_2=(Prune(C1,C1,CMD="ExBlend_Decimated.Txt") C2_2=(Prune(C2,C2,CMD="ExBlend_Decimated.Txt") StackHorizontal(C1_2,C2_2) To extract the two component recovered frames, denoise them, merge together put back into ExBlended decimated clip. COMPUB=2 # you choose C1=ExBlend(clip,Mode=2,disp=3,CompUB=COMPUB,Decompix=1).MCDegrain(3) C2=ExBlend(clip,Mode=2,disp=3,CompUB=COMPUB,Decompix=2).MCDegrain(3) #Return StackHorizontal(C1,C2) Combine = Merge(C1,C2) # Repaired. Average of the two denoised component frame clips. FixedClip=ClipClop(C1,Combine,CMD="ExBlend_Decimated.Txt") As an alternative to using double clip names in Prune, you can change the default clip index in the "ExBlend_Decimated.Txt" (Decimated Frames file) so that Prune or some other alternative could be used with another clip index, a -ve "DecClpIx" will miss out the clip index altogether, but you would then have to use another frame replacement plugin alternative to ClipCLop() (Whose index needs to be 1). Together, Disp, Decimate, CompUB, Decompix, and eg ExBlend_Decimated.Txt allows ExBlend() to expose both of the component frames (Decompix) fashioned with the desired CompUB method, after eg Motion compensated processing, merged together to create the finally recovered frame, this result would then be fed back into either one of the two ExBlend unblended component clips via ClipClop() and the ExBlend_Decimated.Txt command file. Advanced scriptors may wish to extract the clips containing the blended frames and adjacent frames for both blend index 1 and blend index 2 and do some clever masking and such to recover the unblended frames themselves. ----------------------------------------------------------------------------------- DebugView here:- http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx ClipClop() Plugin here:- http://forum.doom9.org/showthread.php?t=162266 Prune() Plugin here:- http://forum.doom9.org/showthread.php?t=162446 -----------------------------------------------------------------------------------
__________________
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; 19th December 2018 at 00:12. |
18th December 2018, 23:31 | #6 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
Post #6 of 6.
Here from an example clip courtesy of JohnMeyer from his thread here:- http://forum.doom9.org/showthread.php?t=162599 The clip in question is 3:2 pulldown that has been resized as if progressive. See Here for extended use demo to fix above(in old thread):- https://forum.doom9.org/showthread.p...46#post1558846
__________________
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; 19th December 2018 at 00:20. |
20th December 2018, 19:14 | #7 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,799
|
I just finished the test encode of my screwed up Dream Theater Blu-ray and you know what? It's perfect! I muxed it to mkv and checked many places and everything seems fine. I really thought that there was no saving that one, but I guess it was tricky enough to challenge the scripters
So, thanks a lot and have a Merry Christmas
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
20th December 2018, 20:52 | #8 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
Boulder problem here:- https://forum.doom9.org/showthread.p...19#post1859719
Boulder, Just curious, did you need blur? Also, were there left over blends [EDIT: I mean dupes] as in SRestore, and if so did you need DropDeadGorgeous ? Glad you got it sorted, and a very merry xmas to you too sir EDIT: Had connection problem, double post removed.
__________________
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; 20th December 2018 at 20:59. |
21st December 2018, 06:44 | #9 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,799
|
I didn't check the result frame-by-frame, I just watched it play with the normal framerate. The difficult sections like some crossfades seemed ok and longer pans also didn't have any jerkiness. I used the basic script you gave me to try so blur was being used.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
21st December 2018, 08:50 | #10 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
Ok, thanx.
The script with SHARP=0.333 was just demo to show SHARP use and more a wild guess than anything, default sharp in McDegrainSharp is I think about 0.6, thought that might be too much. I can feel Hanfruns itching to post some time soon, have a guddun.
__________________
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 ??? |
15th March 2019, 09:17 | #11 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,799
|
I have a new clip with some restoration needed:
https://drive.google.com/open?id=1O1...dNAplNFP5oUVnw I tried figuring out a pattern and it looks like 4 good frames, 2 blended ones. Then if you look closer, it looks more like 3 good frames and 3 blended ones where the middle one is a real blended mess and the surrounding frames much less so The standard settings don't seem to work properly because of that.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
15th March 2019, 11:03 | #12 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
Sorry, cant help with triple blends, good luck in your endeavour.
__________________
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 ??? |
15th March 2019, 11:14 | #13 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,799
|
Thanks for the confirmation so I won't try hitting my head against the wall with ExDeblend I'll post in the SRestore thread, maybe someone has some ideas.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
15th March 2019, 11:24 | #14 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
Thought I might include this, its in the source folder for coders, but might assist a little for those trying to figure out what it does.
Findblend_Method.txt [EDIT: Below MD_??_?? is the difference between two potentially unblended 'component' pixels when merged together for final unblended pixel. eg MD_10_23 and FD_12 etc are the names of actual variables in the source code. FD_12 etc are the actual differences between adjacent frame pixels in blended clip.] We use the same names pre-prended with "W_" as per frame weighted [0.0 -> 100.0%] variable names. Code:
|-----------------------------------------------| ExBlend [ FindBlend() ] Rough description of ExBlend() blend detection |-----------------------------------------------| -------- -------- -------- -------- |MD_10_23| |MD_21_34| |MD_32_45| |MD_43_56| | | | | | | | | | | | | | | | | |--------| |--------| |--------| |--------| | | | | | | | | _| |\ _| |____ | |____ | | | \ | \ /| |\ | | | /| | | \ \ \ / | | \ /| | | / | | | \ \ \ / | | \/ | / | / | | | \ \ \_ /__ |_________ | /\/________/_____|____/ __| /| | \ \__ /_ | ___\___|_/ // / ____|_____/ ________/ | -------- \ --------/ \--|-----/ -\--|--// \-----/--/ -|------/ --------/ |Frame_0 | |Frame_1 | |Frame_2 | |Frame_3 | |Frame_4 | |Frame_5 | |Frame_6 | | | | | | | | Current| | | | | | | | in_n-3 | | in_n-2 | | in_n-1 | | in_n | | in_n+1 | | in_n+2 | | in_n+3 | | p0 | | p1 | | p2 | | p3 | | p4 | | p5 | | p6 | -------- -------- -------- -------- -------- -------- -------- | | | | | | | | | | | | | | | | -------- -------- -------- -------- Metrics display->| FD_12 | | FD_23 | | FD_34 | | FD_45 |<-Metrics display ONLY | | | | | | | | ONLY | | | | | | | | -------- -------- -------- -------- ------------------------------------------------------------------------------- PER PIXEL VARIABLES:- (at current x,y postion in frame) ---- px = Pixel Luma from Frame_x (x = 0 to 6). ---- FD_ab = abs(pa - pb) Delta between adj frames[a & b] pixels ---- UP_ab = (pa * 2) - pb; Pixel, unblended from 2 frames, two of these are later merged to recover original frame. These are the inputs to MD_ab_cd and are not shown above as it just makes it look confusing (I tried it), but each pair of lines into MD_ab_cd can be thought of as UP_ab. The ordering of the frame numbers (a,b) IS IMPORTANT and can be gotten from the description of MD_ab_cd ---- MD_ab_cd = abs(UP_ab - UP_cd) Merge Delta, between component pixels of the potentially recovered (unblended) pixel. If we find a blended pair of frames and at the current frame position we have the first blended frame, then current frame in_n (frame_3) will be replaced with a recovered frame the equivalent unblended pixels of MD_32_45 and the second blended frame in_n+1 (frame_4) also will be filled with the same content when the next frame is requested, (after doing all this again), however, next time around, in_n will be the second blended frame as the contents of everything would have shifted left by 1 frame, and so, MD_32_45 will NO LONGER be the recovered frame, it will now be MD_21_34. When the recovered frame is finally rendered it will go sort of like:- RecoveredPixel = (UP_ab + UP_cd + 1) / 2; (for luma) ------------------------------------------------------------------------------- PER FRAME VARIABLES --- WEIGHTINGS:- (float) Accumulated weighting for pixels; Obviously clear to zero at beginning. ---- W_MD_ab_cd += MD_ab_cd; W_FD_ab += FD_ab; ---- METRIC:- Final scaling of measurements for whole frames before deciding if blended. ---- float mx = (vi.width * vi.height) * 255.0; For scaling weighting into more managable & meaningful numbers. W_MD_ab_cd = W_MD_ab_cd * 100.0 / mx; W_UP_ab = W_UP_ab * 100.0 / mx; W_FD_ab = W_FD_ab * 100.0 / mx; If ((W_MD_32_45 < W_MD_21_34) && (W_MD_32_45 < W_MD_43_56)) { // then, is possible 1st of pair of blends if (W_MD_32_45 < W_FD_34) { // then IS 1st blend index } } else If ((W_MD_21_34 < W_MD_10_23) && (W_MD_21_34 < W_MD_32_45)) { // then is possible 2nd of pair of blends if (W_MD_21_34 < W_FD_23) { // then IS 2nd blend index } } else { // Is NOT a blend } EDIT: After staring at below gobble-de-gook for a while, added the stuff in blue [will be modded as below in next release]. Code:
Below written to assist understanding of how the screwed up clip was created, and is from point of view of the pre-blended clip. The 'IN' (ie W,X,Y,Z) are frames before the bad blends were created, and 'OUT' is the resultant bad blending sequence that need be fixed, C and D are the blended pair, and Y is the missing frame that is partially present in both C and D blended pair. [Missing Y frame is the one that needs recovering]. IN W X Y Z # Pre blended frames. | | \ /\ /| OUT A B C D E # Bad frames that we have to deal with. A = W B = X C = (X + Y) / 2 : X = 2C - Y : B = 2C - Y : Y = 2C - X : Y = 2C - B D = (Y + Z) / 2 : Y = 2D - Z : Y = 2D - E : Z = 2D - Y : E = 2D - Y E = Z FD_CD = | ((X + Y) / 2) - ((Y + Z) / 2) | == | ((X + Y - Y - Z) / 2) | == | (X - Z) / 2 | == | (B - E) / 2 | == | B - E | / 2 FD_BC = | X - ((X + Y) / 2) | == | (2X - (X + Y)) /2 | == |(2X - X - Y)/2| == | (X - Y) / 2 | == | (B - Y) / 2 | == | B - Y | / 2 FD_DE = | ((Y + Z) / 2) - Z | == | (Y + Z - 2Z) / 2 | == | (Y - Z) / 2 | == | (Y - E) / 2 | == | Y - E | / 2 # Above FD_nm is expected Frame Difference between frames n and m.
__________________
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; 16th March 2019 at 01:22. |
20th March 2019, 15:18 | #15 | Link |
Registered User
Join Date: Mar 2019
Posts: 14
|
Hi StainlessS,
I think your plugin could help me fix a problem with Sliders DVD. I tried using it but I didn't get good results. Maybe you could take a look? This is the problem: https://forum.doom9.org/showthread.p...24#post1869424 And this is original file: http://5.196.74.194/domek/VTS_02_1.demuxed.m2v And this is my AviSynth script which didn't fix the problem: LoadPlugin("Exblend_25.dll") LoadPlugin("DGDecode.dll") LoadPlugin("TIVTC.dll") MPEG2Source("VTS_02_1.d2v") TFM() ExBlend() |
20th March 2019, 20:14 | #16 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
ExBlend not intended for your kind of blending, sorry.
__________________
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 ??? |
24th January 2021, 01:14 | #18 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
Maybe best to ask in staxRip thread, I aint ever used it.
__________________
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 ??? |
24th January 2021, 19:12 | #20 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
|
Blackout_Out,
Not sure but I seem to remember that XBD path is a bit broken on Vista+ (or maybe W7+), default XBD directory is I think "C:\", but OS dont allow to be written there so does not exist, need give either full path or eg ".\MyFile.xbd" for current directory relative, for both Mode=1 and 2. Hope that helps. [Above from memory, could be wrong] EDIT: Also, you need do Mode=1 scan before Mode=2 pass.
__________________
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; 25th January 2021 at 00:29. |
Tags |
blending, unblending |
Thread Tools | Search this Thread |
Display Modes | |
|
|