Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
LoadPlugin("mvtools2.dll") LoadPlugin("mt_masktools-26.dll") function ng_deblink(clip clp, \ float "ratio", \ int "level", \ clip "blinkmask" \){ #Version 10 2012.04.22 blink = default(blinkmask, clp.ng_blinkmask()) ratio = default(ratio, 2.0 /3) assert(ratio >= 0.0 && 1.0 >= ratio, \ "[ng_deblink] 1.0 >= ratio >= 0.0, it was " + string(ratio)) level = default(level, round(ratio * 257)) assert(level >= 0 && 257 >= level, \ "[ng_deblink] 257 >= level >= 0, it was " + string(level)) m01=mt_logic(blink.SelectEvery(4,0), \ blink.SelectEvery(4,1), \ mode="or").ConvertToRGB32() m23=mt_logic(blink.SelectEvery(4,2), \ blink.SelectEvery(4,3), \ mode="or").ConvertToRGB32() f0=Layer(clp.SelectEvery(4,0), \ clp.SelectEvery(4,1).Mask(m01), \ level=level) f1=Layer(clp.SelectEvery(4,1), \ clp.SelectEvery(4,0).Mask(m01), \ level=level) f2=Layer(clp.SelectEvery(4,2), \ clp.SelectEvery(4,3).Mask(m23), \ level=(257-level) ) f3=Layer(clp.SelectEvery(4,3), \ clp.SelectEvery(4,2).Mask(m23), \ level=(257-level) ) Interleave(f0,f1,f2,f3) } function ng_blinkmask(clip clp, \ bool "TEST", \ bool "STABILIZE", \ bool "SHARP", \ bool "HYSTER", \ int "inpand", \ int "expand", \ int "ml" \){ #Version 10 2012.04.22 #BLINK # Blinking is a block that alternates on/off each frame # SelectEven would only see either the on or the off #FLASH # Flashing is a block that is only on for a single frame # SelectEven might miss the flash #SHAKE # Shaking is a block that moves back/forth each frame # SelectEven would only see one position # The goal of this function is to make a blink mask for use with # ng_deblink. For overly complicated scenes where a clean blinkmask # can't be found, just use TASBlend. Uniform softness looks better # than sharp artifacts. # This function calculates flash and shake info for the test script, # but those effects should be handled in different ways. # Flash - choose frames to make sure the flash is in your final clip. # Shake - SelectEvery(4,0,2,1,3) or SelectEvery(4,1,0,2,3) # SelectEvery doesn't generally work because it messes with the fluidity # of motion. But that won't be noticable on a shaking screen. # Be careful if 2 frame blinking is present, as the selectevery can turn # it into 1 frame blinking. TEST = default( TEST, false) STABILIZE = default(STABILIZE, true) SHARP = default( SHARP, true) HYSTER = default( HYSTER, false) inpand = default( inpand, 1) expand = default( expand, 1) ml = default( ml, 128) # The functions used to make the masks work in the YV12 colorspace. Once # the masks are created they can be used in the RGB32 colorspace direcly src=clp.ConvertToYV12() # Blinking is located by looking for blocks that don't exist in # consecutive frames. The motion vector will match blocks that exist in # both frames. The blocks that aren't in both will end up with huge # values that are picked out by the motion mask. super = MSuper(src, pel=1) fvec = MAnalyse(super, isb=false, blksize=4) bvec = MAnalyse(super, isb=true , blksize=4) fmask = Mmask(src, fvec, kind=1, ml=ml).mt_binarize() bmask = Mmask(src, bvec, kind=1, ml=ml).mt_binarize() blink = mt_logic(fmask, bmask, mode="and") # Blinking usually occurs against a stable background. This is found # by looking at blocks 2 frames apart. This distinguishes a blink from # blocks that are just changing every frame. ee_src = src.SelectEven() ee_super = MSuper(ee_src, pel=1) ee_fvec = MAnalyse(ee_super, isb=false, blksize=4) ee_bvec = MAnalyse(ee_super, isb=true , blksize=4) ee_fmask = Mmask(ee_src, ee_fvec, kind=1, ml=ml).mt_binarize() ee_bmask = Mmask(ee_src, ee_bvec, kind=1, ml=ml).mt_binarize() oo_src = src.SelectOdd() oo_super = MSuper(oo_src, pel=1) oo_fvec = MAnalyse(oo_super, isb=false, blksize=4) oo_bvec = MAnalyse(oo_super, isb=true , blksize=4) oo_fmask = Mmask(oo_src, oo_fvec, kind=1, ml=ml).mt_binarize() oo_bmask = Mmask(oo_src, oo_bvec, kind=1, ml=ml).mt_binarize() fmask_2 = Interleave(ee_fmask, oo_fmask) bmask_2 = Interleave(ee_bmask, oo_bmask) background = mt_logic(fmask_2.SelectEvery(1,1), \ bmask_2.SelectEvery(1,-1), \ mode="or") stable_blink = mt_hysteresis(background.mt_invert, blink) blink2 = (STABILIZE) ? stable_blink : blink # Shrinking the blink mask can get rid of noise, # too much will lose signal as well. blink3 = blink2.mt_inpand(mode=mt_diamond(inpand)) # Using just pixels that changed helps sharpen the mask diff = ng_diff(clp.SelectEvery(1,-1), clp) diff_2 = mt_logic(diff, diff.SelectEvery(1,1), mode="and") #Hysteresis # Matches continuous blocks of pixels. # Use with care, will match the whole screen on fades. hyster_blink = mt_hysteresis(blink3, diff_2) # Expand the mask to make up for shrinking it (or just use hysteresis) blink4 = blink3.mt_expand(mode=mt_circle(expand)) sharp_blink = mt_logic(blink4, diff_2, mode="and") blink5 = (HYSTER) ? hyster_blink : \ (SHARP) ? sharp_blink : blink4 # A flash won't match blocks 1 or 2 frames away. sub_flash = mt_logic(fmask_2, bmask_2, mode="and") flash = mt_logic(blink, sub_flash, mode="and") # A shake changes in one frame and changes back in the next. # This isn't detected by the motion vectors because the blocks exist in # both frames, they are just shifting around. same = ng_same(clp.SelectEvery(1,-1), clp.SelectEvery(1,1)) shake = mt_logic(same, diff_2, mode="and") (TEST) ? stackhorizontal(clp, mergeRGB(blink5, flash, shake)) \ : blink5.GreyScale() } function ng_diff(clip A, clip B, int "thr"){ thr=default(thr,0) TAD=ng_TAD(A,B) return mt_binarize(TAD, threshold=thr) } function ng_same(clip A, clip B, int "thr"){ thr=default(thr,0) TAD=ng_TAD(A,B) return mt_binarize(TAD, threshold=thr, upper=true) } function ng_TAD(clip A, clip B){ R=ng_AD(A .showRed("YV12"),B .showRed("YV12")) G=ng_AD(A.showGreen("YV12"),B.showGreen("YV12")) B=ng_AD(A .showBlue("YV12"),B .showBlue("YV12")) return ng_plus(R, ng_plus(G, B)) } function ng_AD(clip A, clip B){ return mt_lutxy(A,B,"x y - abs") } function ng_plus(clip A, clip B){ return mt_lutxy(A,B,"x y +") }
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
✅ Make huge profits on trading
JavaScript | 3 sec ago | 0.25 KB
⭐ChangeNOW Bug (Get more on BTC swaps)
JavaScript | 4 sec ago | 0.25 KB
✅ Make $2500 in 20 minutes 3
JavaScript | 6 sec ago | 0.27 KB
⭐⭐⭐MAKE $9OO INSTANTLY D A⭐⭐⭐
Java | 11 sec ago | 0.06 KB
Free Crypto Method ✅ NEVER SEEN BEFORE
JavaScript | 15 sec ago | 0.25 KB
✅ Crypto Exchange Exploit
JavaScript | 15 sec ago | 0.25 KB
⭐⭐⭐Profit Method⭐⭐⭐
Java | 22 sec ago | 0.06 KB
✅ Make $2500 in 15 minutes
JavaScript | 26 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!