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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th August 2016, 22:06   #1  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,129
qCombed() v1.02 - 13 Dec 2016.

qCombed() v1.02, mod of IsCombed (c)Donald Graft.

Code:
qCombed(),  by StainlessS @ Doom9.org.  http://forum.doom9.org/showthread.php?p=1776495#post1776495

Runtime function to establish combing status of video frames, or to write a frames file of combed frames [Intent for ClipClop() use].

ColorSpace, Planar and YUY2. (v2.5 dll but as only examines the luma channel can also function with v2.6 colorspaces).

qCombed() is a mod of IsCombed from DeComb plugin for Avisynth, (c) Donald Graft. [can be found here:- http://rationalqm.us/mine.html].


qCombed has two modes of operation, can use in conditional filter eg Scriptclip() or ConditionFilter() [just like IsCombed()],
and also has complete clip scan and frames file writing capability builtin.

    qCombed(clip c,int "Threshold"=20,String "FileName"="",int "ClipIndex"=1,Bool "Range"=False,String "RngSep"="",int "n"=current_frame,Bool "Debug"=true)

    Args:-

        Threshold, default 20.      Threshold used to establish combed-ness, 0 <= Th <= 255. [same as for IsCombed(Threshold)].

        FileName, default "".       When filename is default "", qCombed will behave the same as IsCombed() and all other args with exception
                                    of Threshold (and additional 'n') are totally ignored.
                                        When in this mode it uses current_frame as set at each frame by runtime script functions eg Scriptclip()
                                        and WriteFileIf() or ConditionalFilter(). In addition, you can use it within at compile time eg in a GScript
                                        script and interogate frames by setting the n arg to the desired frame number. In this mode the function returns
                                        a Bool status, True = Combed.
                                    If you set FileName to eg "ClipClop_Cmd.txt", it will switch modes from default IsCombed() style
                                        function, to a function which scans entire clip and writes a frames command file. In this mode, all other
                                        args (with exception of 'n', which is ignored) are also valid. Will take time to scan entire clip but
                                        output file will exist on return, and qCombed() will return the number of combed frames in clip as Int.

        ClipIndex, default 1.       Ignored unless FileName != "", ie in File Writing mode. By Default writes a ClipClop() style frame command file
                                    where commands may look like:
                                        1 100        # Clip index 1, frame 100.  (where arg Range=False, or single frame range).
                                        1 200,210    # Clip index 1, frames 200 -> 210 (where arg Range=true).
                                    The clip index (1 as above) is a requirement in ClipClop which supports up to 256 clips, and so needs a clip index.
                                    A ClipIndex of -1, will omit the clip index and just write the frames or ranges.
                                    Valid range -1 -> 255 although 1 is probably the only sensible setting for ClipClop (clip 0 being the unaltered source clip).

        Range, Default false.       If False (default), writes all frame numbers on individual lines, else if true, then concatenates adjacent
                                    frames into ranges (single frame range will write only a single frame number).

        RngSep, Default "".         RangSep of "" will be converted to ',' COMMA and used only if Range is True, as shown above in "1 200,210".
                                    Can set RngSep to any character Chr(32) SPACE to Chr(126), only the first character in string is used.

        n,                          n defaults to current_frame when FileName is default "", ie Conditional filter mode, but can be given explicitly as
                                    arg in eg GScript script. When FileName != "", n has no function.

        Debug,                      default True, show debug info.


        Example 1:
            Below single pass script deinterlaces as clip is played.

            EVEN=False                                                          # Odd frames wanted from double rate deinterlaced clip.
            SHOW=True                                                           # Show status on frame
            COMBEDTHRESH=20                                                     # Default Threshold
            ###
            Avisource(...)
            AssumeTFF                                                           # For Deinterlacer [NNedi3(Field=-2) ie Double rate, internal parity].
            UNLACED=NNedi3(Field=-2, nns=2)                                     # Or whatever you use to deinterlace.
            UNLACED=(EVEN)?UNLACED.SelectEven:UNLACED.SelectOdd
            UNLACED=(SHOW)?UNLACED.Subtitle("COMBED",align=5,size=48):UNLACED
            SSS=RT_String("qCombed(Threshold=%d)",COMBEDTHRESH)                 # Make runtime condition script string with embedded threshold.
            ORG=Last                                                            # Remember Original clip
            ConditionalFilter(Last,UNLACED,Last,SSS,"=","true")
            Return (SHOW)?StackVertical(ORG,Last):Last

        Example 2:
            Below two pass example allows fast access (via ClipClop) to non-deinterlaced frames where multiple pass processing and/or avoiding
            intermediate writing of lossless AVI's before additional processing can be carried out.

            EVEN=False                                                          # Odd frames wanted
            SHOW=True                                                           # Show status on frame
            COMBEDTHRESH=20                                                     # Default Threshold
            RANGE=True                                                          # We Want Ranges, not frames.
            RNGSEP=" "                                                          # SPACE separator instead of COMMA (Also allowed in ClipClop).
            FN="ClipClop_Cmd.Txt"
            ###
            Avisource(...)
            AssumeTFF                                                           # For Deinterlacer [NNedi3(Field=-2) ie Double rate, internal parity].
            UNLACED=NNedi3(Field=-2, nns=2)                                     # Or whatever you use to deinterlace.
            UNLACED=(EVEN)?UNLACED.SelectEven:UNLACED.SelectOdd
            UNLACED=(SHOW)?UNLACED.Subtitle("COMBED",align=5,size=48):UNLACED
            StartT=RT_TimerHP
            nCombedFrames = qCombed(Last,Threshold=COMBEDTHRESH,FileName=FN,Range=RANGE,RngSep=RNGSEP)  # Returns only after complete clip scan.
            Tim = RT_TimerHP - StartT
            RT_DebugF("Result=%d Time = %.3fsecs (%.3fmins) FPS=%.3f",nCombedFrames,Tim,Tim/60.0,Framecount/Tim)
            ORG=Last                                                            # Remember Original clip
            ClipClop(ORG,UNLACED,cmd=FN,Show=Show)                              # Replace combed frames/ranges with deinterlaced ones.
            Return (SHOW)?StackVertical(ORG,Last):Last

###########
ssS
dll and source (52KB) @ MediaFire or SendSpace below in my sig.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 13th December 2016 at 21:17.
StainlessS is online now   Reply With Quote
Old 6th August 2016, 23:02   #2  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 506
Tin man, this plugin is an early edition (2016/08/16) ?
__________________
By law and justice!

Flea Market
GMJCZP is offline   Reply With Quote
Old 6th August 2016, 23:10   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,129
You are such a stickler for the niceties

Thanx, corrected.
__________________
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 ???
StainlessS is online now   Reply With Quote
Reply

Tags
combing, deinterlace, iscombed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.