View Single Post
Old 18th December 2018, 23:31   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
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.
StainlessS is offline   Reply With Quote