-
Notifications
You must be signed in to change notification settings - Fork 0
Inverse Telecine Filters
Pads a clip for analysis (required as input to KFMSuper, etc.)
- CUDA support: Yes
- clip – Source clip
Field‑matching analysis clip (input for KPreCycleAnalyze, etc.)
- CUDA support: Yes
- clip – Source clip
- clip – KFMPadded source clip
Removes combing in static regions from KFMSuper
- CUDA support: Yes
- clip – KFMSuper clip
- int thY = 10 – Y‑component motion threshold for de‑combing
- int thC = 8 – Chroma‑component motion threshold for de‑combing
Computes field‑matching values per frame (equivalent to older KFMFrameAnalyze)
- CUDA support: Yes
- clip – KFMSuper clip
- int threshMY = 20 – Y motion threshold
- int threshSY = 12 – Y combing threshold
- int threshMC = 24 – Chroma motion threshold
- int threshSC = 16 – Chroma combing threshold
Debug visualization filter for KFMSuper. Computes the same values as KPreCycleAnalyze but outputs a visualized clip.
- CUDA support: No
- Arguments are the same as KPreCycleAnalyze (omitted here).
Outputs KPreCycleAnalyze results to a file. Completing output of the last frame completes the file write.
- CUDA support: No
- clip – KPreCycleAnalyze clip
- string filepath = "kfm.txt" – Output file path
Output format (text):
#shima,large shima,move
<shima>,<large shima>,<move>
<shima>,<large shima>,<move>
...
On line N (excluding the first comment line), shima and large shima are the counts of comb lines in frame N of the **DoubleWeave()**d clip. large shima uses a threshold 3× larger than shima to count larger (i.e., more pronounced) comb lines.
The move on line N is the difference between frame N and frame N+2 of the SeparateFields() clip.
Example
LWLibavVideoSource(srcpath,dominance=1,repeat=True).OnCPU(4)
KFMSuper(KFMPad()).KCleanSuper().KPreCycleAnalyze().OnCUDA(4).KFMDumpFM("kfm_dump.txt")
KFMCycleAnalyze(clip, clip, int "mode", float "lscale", float "costth", float "adj2224", float "adj30", int "range", float "thresh", int "past", float "th60", float "th24", float "rel24", string "filepath", int "debug")
Determines the pulldown pattern per cycle from KPreCycleAnalyze results
- CUDA support: No
- clip – KPreCycleAnalyze clip
- clip – Source clip
-
int mode = 0
- 0: Normal (best real‑time)
-
1: Multipass pass‑1 (outputs best real‑time)
- Multipass stabilizes patterns using estimates from adjacent cycles. Pass‑1 accumulates results; pass‑2 outputs results considering surrounding patterns. Pass‑1 must be run to the last frame.
- 2: Multipass pass‑2 (outputs results considering surrounding patterns)
- Default: 0
- float lscale = 5.0 – Weight when taking into account large comb lines (≥3× threshold in KFMFrameAnalyze). Larger values emphasize “large combs.”
- float costth = 1.5 – 24p decision cost threshold. Larger values make the decision stricter and increase cost.
- float adj2224 = 0.5 – Weight for 24fps without combing (larger → harder to select; smaller → easier).
- float adj30 = 1.5 – Weight for 30fps (larger → harder to select; smaller → easier).
Multipass parameters:
- int range = 5
-
float thresh = 1.0
- These two control pattern switching. A switch occurs when
(sum of costs over the past 'range' cycles including current) > (thresh * range). One cycle is 5 frames at 30fps. - To switch appropriately between comb‑less 24fps and 30fps, set
adj2224 < thresh < adj30.
- These two control pattern switching. A switch occurs when
- int past = 180 – On pattern switching, if past cycles would also prefer the new best pattern, retroactively replace up to past cycles.
60fps parameters:
-
float th60 = 3.0
-
float th24 = 0.1
-
float rel24 = 0.2
- Decision logic:
- If cost ≥ th60 → 60fps
- If cost ≤ th24 and unreliability ≤ rel24 → 24fps
- Otherwise, estimate from neighbors
- Decision logic:
-
string filepath = "kfm_cycle.dat" – In multipass, pass‑1 writes results to this file; pass‑2 reads it.
-
int debug = 0 – For debugging/tuning. If 1, writes intermediate pass‑1 data to
"(filepath).debug"and final decisions to"(filepath).pattern".
Inverse telecines the source clip based on KFMCycleAnalyze results.
- CUDA support: Yes
- clip – Source clip
- clip – KFMCycleAnalyze clip
- bool show = false – Display decisions at top‑left
Inverse telecines a KFMSuper clip based on KFMCycleAnalyze results.
- CUDA support: Yes
- clip – KFMSuper clip
- clip – KFMCycleAnalyze clip
Creates flags to paste from the bob clip where combing remains in KTelecine output.
- CUDA support: Yes
- clip – KTelecineSuper clip
- float thY = 60 – Y comb threshold (larger → smaller flagged area; smaller → larger)
- float thC = 80 – UV comb threshold (larger → smaller flagged area; smaller → larger)
Returns whether the KSwitchFlag clip contains regions to paste from the bob clip.
- CUDA support: Yes
- clip – KSwitchFlag clip
Converts KSwitchFlag to a mask.
- CUDA support: Yes
- clip – Source clip (used only to obtain size info)
- clip – KSwitchFlag clip
Removes combing by blending regions whose scores exceed thresholds.
- CUDA support: Yes
- clip – KFMPadded 24p clip
- clip – KTelecineSuper clip (used for comb detection)
- float thY = 6 – Y comb threshold (smaller = wider area detected/removed)
- float thC = 6 – UV comb threshold (smaller = wider area detected/removed)
Replaces combed regions in KTelecine output with frames from the bob clip.
- CUDA support: Yes
- clip – 24p clip
- clip – 60p clip
- clip – KFMCycleAnalyze clip
- clip – KCombeMask clip
- clip – KContainsCombe clip
KFMSwitch(clip, clip, clip, clip, clip, clip "ucfclip", float "thresh", int "mode", string "filepath", bool "show", bool "showflag")
Switches between 60p/30p/24p frames. Output is fixed at 60p.
- CUDA support: Yes
- clip – 60p clip
- clip – KFMCycleAnalyze clip
- clip – 24p clip
- clip – 24p KCombeMask clip
- clip – 24p KContainsCombe clip
- clip – 30p clip
- clip – 30p KCombeMask clip
- clip – 30p KContainsCombe clip
- clip – KDecombUCF60 clip
- float thswitch = 3.0 – Switch threshold between 60p and 24p/30p. Uses 24p/30p costs from KFMCycleAnalyze (larger cost = less likely 24p/30p). Cycles with cost > threshold output 60p; ≤ threshold output 24p/30p.
-
int mode = 0 – Output mode:
- 0: Normal output
- 1: Attach frame durations to frames (for VFR)
- 2: Output only frame durations (for VFR)
- Default: 0
-
string filepath = "kfmswitch" – Path prefix for VFR info:
- Timecodes →
filepath + "timecode.txt", durations →filepath + "duration.txt"
- Timecodes →
- bool show = false – Show decisions at top‑left
- bool showflag = false – For frames judged 24p/30p, paint areas sourced from 60p frames in blue. (CUDA unsupported)
Extracts only valid frames from a 60p clip based on frame durations.
- CUDA support: Yes
- clip – 60p clip
-
string filepath = "kfmswitch" – Path to VFR info files output by KFMSwitch (reads the frame durations
filepath + "duration.txt")