Home
RecentChanges

Search:

» AviSynth is a powerful video FrameServer for Win32.

AviSynth Links:
»Download
»Learn to script
»FAQ
»Manual
»Discussion fora
»Project page
»External filters
»FeedBack

» You can add pages to this website immediately. No login required.
Edit this document

» AboutAviSynth

 

Avisynth 
Logo

VirtualDub_I

This file, when appended with the second half, forms an important tool known

as vdub_filters.avsi. Download it and place it in your plugins directory where it will be

autoloaded. Its usage is described in further detail in [Section 4] of the AviSynthFAQ.

There is also a SimpleVDubFilters file.

#############################################################
# This file provides convenient Avisynth interfaces to	    #
# various VirtualDub plugins. Load it in your script with:  #
#							    #
#    Import("vdub_filters.avs")				    #
#							    #
# Version 1.5+, 05-12-2003;				    #
# sent remarks to [email protected]			    #
#							    #
# I want to thank all the people who helped me providing    #
# these scripts (in particular the people at Doom9).	    #
#############################################################

########################################################
# Change VirtualDub_plugin_directory below to point to #
# the directory containing your VirtualDub plugins.    #
########################################################

global VirtualDub_plugin_directory = "c:\Program Files\virtualdub\plugins"

##################################################################
# Some general notes:						 #
#								 #
# 1) Colorspace:						 #
# VD filters use RGB input as opposed to Avisynth which works	 #
# in both YUV and RGB space. Simply adding ConvertToRGB32 before #
# the VD_xxxx call and everything should work ok and add	 #
# ConvertToYUY2 after the VD_xxxx call.				 #
#								 #
# 2) Interlaced material:					 #
# Some VirtualDub filters (for example Zoom v1.2) have an option #
# to select interlaced while the corresponding script has not.	 # 
# This can be done internally in AviSynth in the following way:	 #
# clip.SeparateFields.VD_Zoom(...).Weave  or			 #
# Weave(VD_Zoom(SeparateFields(clip),...))			 #
#								 #
# 3) If you are using AviSynth2 you can use ConvertbackToYUY2	 #
# instead of ConvertToYUY2 for converting back to YUV.		 #
##################################################################

####################################
# Most filters can be found at:    #
# http://sauron.mordor.net/dgraft/ #
####################################


#####################################
# 2D Cleaner by Jim Casaburi, v0.6b #
#				    #
# threshold (0-255), radius (0-10)  #
#				    #
# For athlon/pIII/pIV users there   #
# is an optimized version.	    #
#####################################

function VD_2DCleaner(clip clip, int "threshold", int "radius", bool "interlaced")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\2dclean.vdf", "_VD_2DCleaner")
  return clip._VD_2DCleaner(default(interlaced,false)?1:0, default(threshold,75), default(radius,1))
}

# example:  
# ConvertToRGB() 
# VD_2DCleaner(75, 1) 
# ConvertToYUY2() 


####################################
# Temporal Cleaner by Jim Casaburi #
####################################

function VD_TemporalCleaner(clip clip, int "threshold", int "pixel_lock", int "threshold2", 
  \  int "pixel_lock2", int "scene", bool "partial", bool "yuv")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\tclean.vdf", "_VD_TemporalCleaner", 10)
  return clip._VD_TemporalCleaner(default(threshold,10), default(pixel_lock,4),
    \  default(threshold2,16), default(pixel_lock2,8), default(scene,30),
    \  default(partial,false)?1:0, default(yuv,true)?1:0)
}

# example:  
# ConvertToRGB() 
# VD_TemporalCleaner(10, 4, 16, 8, 30, false, true) 
# ConvertToYUY2() 


############################
# Colorize by Donald Graft #
############################

function VD_Colorize(clip clip, int "hue", int "sat", int "lum")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\colorize.vdf", "_VD_Colorize")
  return clip._VD_Colorize(default(hue, 0), default(sat, 150), default(lum, 150))
}


############################################
# Hue/Saturation/Intensity by Donald Graft #
#					   #
# there is a version of this filter called #
# "Tweak11 by Donald Graft" which can be   #
# used in Avisynth (directly in YUV-space) #
############################################

function DG_FloatToInt(f) { return round((default(f,1.0) - 1) * 100) }

function VD_Hue(clip clip, int "hue", bool "preserve_luma", float "sat", float "inten",
  \  bool "r", bool "g", bool "b", bool "y", bool "c", bool "m")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\hue.vdf", "_VD_Hue")
  hue = default(hue, 0)
  sat = DG_FloatToInt(sat)
  inten = DG_FloatToInt(inten)
  flags = (default(r,true)?1:0)+(default(g,true)?2:0)+(default(b,true)?4:0)
    \ +(default(y,true)?8:0)+(default(c,true)?16:0)+(default(m,true)?32:0)
  return clip._VD_Hue(hue, default(preserve_luma,false)?1:0, sat, inten, flags)
}


#############################################
# Red/Green/Blue Adjustment by Donald Graft #
#############################################

function VD_RGBAdjustment(clip clip, float "r", float "g", float "b")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\rgb.vdf", "_VD_RGBAdjustment")
  return clip._VD_RGBAdjustment(DG_FloatToInt(r), DG_FloatToInt(g), DG_FloatToInt(b))
}


#############################
# Smart Bob by Donald Graft #
#############################

# NB: the input clip is run through SeparateFields. You may need to use
# AssumeFrameBased, AssumeFieldBased, or ComplementParity beforehand.

function VD_SmartBob(clip clip, bool "show_motion", int "threshold", bool "motion_map_denoising")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\bob.vdf", "_VD_SmartBob", 1)
  return clip.SeparateFields._VD_SmartBob(clip.GetParity()?1:0,
    \  default(show_motion,false)?1:0, default(threshold,10),
    \  default(motion_map_denoising,true)?1:0)
}


#############################################
# Smart Deinterlace by Donald Graft, v2.7b2 #
#					    #
# m(otion)_threshold (0-35 ?),		    #
# s(cene)_c(hange)_threshold (0-10),	    #
# mode = "frame", "field" or "both"         #
# channel = "luma" or "all"		    #
#					    #
# For pII, pIII and pIV users there is an   # 
# optimized version called QS Deinterlace.  #
#############################################

# NB: the "Advanced Processing" options (the last four arguments) duplicate built-in Avisynth functionality.

function VD_SmartDeinterlace(clip clip, string "mode", string "channel", bool "show_motion", bool "blend", 
  \  bool "cubic", bool "motion_map_denoising", int "m_threshold", int "sc_threshold",  
  \  bool "fs_before", bool "shift", bool "fs_after", bool "disable")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\smart.vdf", "_VD_SmartDeinterlace", 1)
  mode = default(mode, "frame")
  mode = (mode=="frame") ? 0 : (mode=="field") ? 1 : (mode=="both") ? 2 : -1
  Assert(mode>=0, """VD_SmartDeinterlace: "mode" parameter must be "frame", "field", or "both"""")
  channel = default(channel, "luma")
  channel = (channel=="luma") ? 0 : (channel=="all") ? 1 : -1
  Assert(channel>=0, """VD_SmartDeinterlace: "channel" parameter must be "luma" or "all"""")
  return clip._VD_SmartDeinterlace(default(show_motion,false)?1:0, default(blend,false)?1:0, 
    \  default(m_threshold,15), default(sc_threshold,100), default(shift,false)?1:0, 
    \  default(fs_before,false)?1:0, default(fs_after,false)?1:0, default(disable,false)?1:0,
    \  default(motion_map_denoising,false)?1:0, mode, channel, default(cubic,true)?1:0)
}

# example:  
# ConvertToRGB() 
# VD_SmartDeinterlace("frame", "luma", false, true, false, false, 15, 100)
# ConvertToYUY2() 


###########################################
# Smart Smoother by Donald Graft, v1.1	  #
#					  #
# diameter (3-11, odd),	threshold (1-200) #
###########################################

function VD_SmartSmoother(clip clip, int "diameter", int "threshold", bool "interlaced")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\smooth.vdf", "_VD_SmartSmoother")
  return clip._VD_SmartSmoother(default(diameter,5), default(threshold,25),
    \  default(interlaced,false)?1:0)
}

# example:
# ConvertToRGB()
# VD_SmartSmoother(5, 25, false)
# ConvertToYUY2()


################################
# Unsharp Mask by Donald Graft #
################################

function VD_UnsharpMask(clip clip, int "diameter", int "strength", int "threshold",
  \  bool "interlaced", int "mask_top", int "mask_bottom", int "mask_left", int "mask_right")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\unsharp.vdf", "_VD_UnsharpMask", 1)
  return clip._VD_UnsharpMask(default(diameter,5), default(strength,32),
    \  default(threshold,0), default(mask_left,0), default(mask_right,0),
    \  default(mask_bottom,0), default(mask_top,0), default(interlaced,false)?1:0)
}


##########################################################
# Subtitler by Avery Lee 				 #
#							 #
# filename is the complete location of the subtitle file #
# with parentheses around it				 #
##########################################################

# NB: non-antialiased mode is not supported, because
# the VD emulation doesn't support NEEDS_HDC

function VD_Subtitler(clip clip, string filename)
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\subtitler.vdf", "_VD_Subtitler")
  return clip._VD_Subtitler(1, filename)
}

# example:  ConvertToRGB()
#           VD_Subtitler("c:\_project\subs.ssa")
#           ConvertToYUY2()


#################################
# Border Smear by Simon Walters #
#################################

function VD_BorderSmear(clip clip, int yt, int yb)
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\brdrsmr.vdf", "_VD_BorderSmear")
  return clip._VD_BorderSmear(yt, yb)
}


##########################
# Cartoon Tool by flaXen #
##########################

# NB: "Show Inverse Map" not supported since it apparently
# is not accessible through the scripting interface

function VD_CartoonTool(clip clip, int "scale_base", int "scale_intensity", int "pixel_base")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\fxtoon.vdf", "_VD_CartoonTool")
  return clip._VD_CartoonTool(default(scale_base,16), default(scale_intensity,200), default(pixel_base,16))
}


########################
# VHS Filter by flaXen #
########################

function VD_VHS(clip clip, bool "stabilize", int "luma_threshold", int "chroma_threshold",
  \  int "temporal_error", int "temporal_bias", int "noise_threshold",
  \  int "pixel_radius", bool "prefilter", bool "postfilter", bool "sharpen",
  \  int "sharpen_amount", bool "eight_direction", int "chroma_shift_x",
  \  int "chroma_shift_y", bool "shift_i", bool "shift_q")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\fxvhs.vdf", "_VD_VHS")
  return clip._VD_VHS(default(stabilize,true)?1:0, default(luma_threshold,5),
    \  default(chroma_threshold,30), default(temporal_error,15), default(temporal_bias,5),
    \  default(noise_threshold,10), default(pixel_radius,1), default(prefilter,false)?1:0,
    \  default(postfilter,false)?1:0, default(sharpen,false)?1:0, default(sharpen_amount,15),
    \  default(eight_direction,false)?1:0, default(chroma_shift_x,-1), default(chroma_shift_y,0),
    \  default(shift_i,false)?1:0, default(shift_q,false)?1:0)
}


# filters from internet:

#################################################
# 2D Cleaner optimized by Jaan Kalda, v0.9      #
# (optimized version of 2D Cleaner, for the     #
# athlon users) 			        #
#					        #
# Threshold (0-255), Radii around source pixel: #
# the values must satisfy              	        #
# x and y >= 0 and (2x+1)(2y+1)<=121.  	        #
# Either value, but not both may be 0. 	        #
#################################################

function VD_2DCleaneroptk7(clip clip, int "threshold", int "radiusx", int "radiusy", bool "interlaced") 
{ 
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\2dcleanopt_k7.vdf", "_VD_2DCleaneroptk7") 
  return clip._VD_2DCleaneroptk7(default(interlaced,false)?1:0, default(threshold,10), default(radiusx,2),
    \  default(radiusy,2)) 
} 

# example:  ConvertToRGB()
#           VD_2DCleaneroptk7(75, 1, 1)
#           ConvertToYUY2()


#################################################
# 2D Cleaner optimized by Jaan Kalda, v0.9      #
# (optimized version of 2D Cleaner, for the     #
# pIII or pIV users) 			        #
#					        #
# Threshold (0-255), Radii around source pixel: #
# the values must satisfy              	        #
# x and y >= 0 and (2x+1)(2y+1)<=121.  	        #
# Either value, but not both may be 0. 	        #
#################################################

function VD_2DCleaneroptp3(clip clip, int "threshold", int "radiusx", int "radiusy", bool "interlaced") 
{ 
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\2dcleanopt_p3.vdf", "_VD_2DCleaneroptp3") 
  return clip._VD_2DCleaneroptp3(default(interlaced,false)?1:0, default(threshold,10), default(radiusx,2),
    \  default(radiusy,2)) 
} 

# example:  ConvertToRGB()
#           VD_2DCleaneroptp3(10, 2, 2)
#           ConvertToYUY2()


####################################### 
# Xsharpen by Donald Graft, v1.0b2    # 
# 		                      # 
# Strength (0-255), Threshold (0-255) #
####################################### 

function VD_Xsharpen(clip clip, int strength, int threshold) 
{ 
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\xsharpen.vdf", "_VD_Xsharpen") 
  return clip._VD_Xsharpen(threshold, strength) 
} 

# example:  ConvertToRGB()
#           VD_Xsharpen(10, 128)
#           ConvertToYUY2()


################################################# 
# WarpSharp by Avery Lee and Donald Graft, v1.1 # 
#					        # 
# depth (0-400)				        #  
#					        #
# make sure that you got a version of	        # 
# WarpSharp that works in Avisynth, see:        #
# http://home.attbi.com/~neuron2/warpsharp.zip  #
################################################# 

function VD_WarpSharp(clip clip, int "depth") 
{ 
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\warpsharp.vdf", "_VD_WarpSharp") 
  return clip._VD_WarpSharp(depth) 
}

# example:  ConvertToRGB() 
#           VD_WarpSharp(50) 
#           ConvertToYUY2()


##########################################################
# Dynamic noise reduction by Steven Don and Donald Graft #
# (has no version number)				 #
#							 #
# threshold (0-31)			    	         #
#							 #
# make sure that you got a version of	       		 #
# WarpSharp that works in AviSynth, see:       		 #
# http://home.attbi.com/~neuron2/warpsharp.zip 		 #
##########################################################

function VD_DNR(clip clip, int threshold) 
{ 
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\dnr.vdf", "_VD_DNR") 
  return clip._VD_DNR(threshold)
}

# example:  ConvertToRGB()
#           VD_Dnr(25)
#           ConvertToYUY2()


##########################################
# SmartResize by Donald Graft, v1.1	 #
#					 #
# colors: green $00ff00			 #
#         red $ff0000			 #
#         blue $0000ff (or 255)		 #
#         black $000000 (or 0)		 #
# (for other colors, look in the filter  #
# in Virtual Dub itself)		 #
#					 #
# mode = "neighbour", "bilinear",	 # 
# "bicubic", "p_bilinear" or "p_bicubic" # 
#					 #
# The calculator isn't included in	 #
# the script, if you want to use it	 #
# I suggest to open your avi/avs in	 #
# Virtual Dub and use the calculator	 #
# to determine how to resize.		 # 
##########################################

function VD_SmartResize(clip clip, int "new_width", int "new_height", bool "interlaced", bool "letterbox", 
  \  int "frame_width", int "frame_height", string "mode", int "color", string "calculator")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\Resize.vdf", "_VD_SmartResize")
  mode = default(mode, "p_bicubic")
  interlaced = default(interlaced, false)
  mode = (mode=="neighbour" && interlaced==false) ? 0 : (mode=="bilinear" && interlaced==false) ? 1 : (mode=="bicubic" && interlaced==false) ? 2 : 
    \  (mode=="p_bilinear" && interlaced==false) ? 3 : (mode=="p_bicubic" && interlaced==false) ? 4 : (mode=="neighbour" && interlaced==true) ? 128 : 
    \  (mode=="bilinear" && interlaced==true) ? 129 : (mode=="bicubic" && interlaced==true) ? 130 : (mode=="p_bilinear" && interlaced==true) ? 131 : 
    \  (mode=="p_bicubic" && interlaced==true) ? 132 : -1
  Assert(mode>=0, """VD_SmartResize: "mode" parameter must be "neighbour", "bilinear", "bicubic", "p_bilinear", "p_bicubic"""")
  return clip._VD_SmartResize(new_width, new_height, default(letterbox,false)?1:0, mode, default(frame_width,new_width), 
    \  default(frame_height,new_height), default(color,0), default(calculator,""))
}

# example1:
# ConvertToRGB()
# VD_SmartResize(320, 240, false, true, 320, 320)
# ConvertToYUY2()

# example2:
# ConvertToRGB()
# VD_SmartResize(320, 240, false, true, 320, 320, "p_bicubic", $ff0000)
# ConvertToYUY2()


####################################################################
# QS Deinterlace by Pavel Kuznetsov, v0.52b (optimized version of  #
# Smart Deinterlace, for the pentium II users)			   #
#								   #
# mode = "frame", "field" or "both"				   #
# channel = "luma" or "all"					   #
#								   #
# http://freetime.sinor.ru/observatory/article.phtml?qsdeinterlace #
# Please use http://babelfish.altavista.com for translation.	   #
####################################################################

function VD_QSdeinterlaceII(clip clip, string "mode", string "channel", bool "show_motion", bool "blend", 
  \  bool "cubic", bool "motion_map_denoising", int "m_threshold", int "sc_threshold",  
  \  bool "fs_before", bool "shift", bool "fs_after", bool "disable")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\QSdeinterlacePII.vdf", "_VD_QSdeinterlaceII", 1)
  mode = default(mode, "frame")
  mode = (mode=="frame") ? 0 : (mode=="field") ? 1 : (mode=="both") ? 2 : -1
  Assert(mode>=0, """VD_QSdeinterlaceIII: "mode" parameter must be "frame", "field", or "both"""")
  channel = default(channel, "luma")
  channel = (channel=="luma") ? 0 : (channel=="all") ? 1 : -1
  Assert(channel>=0, """VD_QSdeinterlaceII: "channel" parameter must be "luma" or "all"""")
  return clip._VD_QSdeinterlaceII(default(show_motion,false)?1:0, default(blend,false)?1:0, 
    \  default(m_threshold,15), default(sc_threshold,100), default(shift,false)?1:0, 
    \  default(fs_before,false)?1:0, default(fs_after,false)?1:0, default(disable,false)?1:0,
    \  default(motion_map_denoising,false)?1:0, mode, channel, default(cubic,true)?1:0)
}

# ConvertToRGB()
# example VD_QSdeinterlaceII("frame", "luma", false, true, false, false, 15, 100)
# ConvertToYUY2()


##############################################################################
# QS Deinterlace by Pavel Kuznetsov, v0.50b and v0.52b (optimized version of #
# Smart Deinterlace, for the pentium III users)				     #
#								   	     #
# mode = "frame", "field" or "both"					     #
# channel = "luma" or "all"						     #
#									     #
# http://freetime.sinor.ru/observatory/article.phtml?qsdeinterlace 	     #
# Please use http://babelfish.altavista.com for translation.	   	     #
##############################################################################

function VD_QSdeinterlaceIII(clip clip, string "mode", string "channel", bool "show_motion", bool "blend", 
  \  bool "cubic", bool "motion_map_denoising", int "m_threshold", int "sc_threshold",  
  \  bool "fs_before", bool "shift", bool "fs_after", bool "disable")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\QSdeinterlacePIII.vdf", "_VD_QSdeinterlaceIII", 1)
  mode = default(mode, "frame")
  mode = (mode=="frame") ? 0 : (mode=="field") ? 1 : (mode=="both") ? 2 : -1
  Assert(mode>=0, """VD_QSdeinterlaceIII: "mode" parameter must be "frame", "field", or "both"""")
  channel = default(channel, "luma")
  channel = (channel=="luma") ? 0 : (channel=="all") ? 1 : -1
  Assert(channel>=0, """VD_QSdeinterlaceIII: "channel" parameter must be "luma" or "all"""")
  return clip._VD_QSdeinterlaceIII(default(show_motion,false)?1:0, default(blend,false)?1:0, 
    \  default(m_threshold,15), default(sc_threshold,100), default(shift,false)?1:0, 
    \  default(fs_before,false)?1:0, default(fs_after,false)?1:0, default(disable,false)?1:0,
    \  default(motion_map_denoising,false)?1:0, mode, channel, default(cubic,true)?1:0)
}

# ConvertToRGB()
# example VD_QSdeinterlaceIII("frame", "luma", false, true, false, false, 15, 100)
# ConvertToYUY2()


##############################################################################
# QS Deinterlace by Pavel Kuznetsov, v0.50b and v0.52b (optimized version of #
# Smart Deinterlace, for the pentium IV users)				     #
#								   	     #
# mode = "frame", "field" or "both"					     #
# channel = "luma" or "all"						     #
#									     #
# http://freetime.sinor.ru/observatory/article.phtml?qsdeinterlace 	     #
# Please use http://babelfish.altavista.com for translation.	   	     #
##############################################################################

function VD_QSdeinterlaceIV(clip clip, string "mode", string "channel", bool "show_motion", bool "blend", 
  \  bool "cubic", bool "motion_map_denoising", int "m_threshold", int "sc_threshold",  
  \  bool "fs_before", bool "shift", bool "fs_after", bool "disable")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\QSdeinterlacePIV.vdf", "_VD_QSdeinterlaceIV", 1)
  mode = default(mode, "frame")
  mode = (mode=="frame") ? 0 : (mode=="field") ? 1 : (mode=="both") ? 2 : -1
  Assert(mode>=0, """VD_QSdeinterlaceIV: "mode" parameter must be "frame", "field", or "both"""")
  channel = default(channel, "luma")
  channel = (channel=="luma") ? 0 : (channel=="all") ? 1 : -1
  Assert(channel>=0, """VD_QSdeinterlaceIV: "channel" parameter must be "luma" or "all"""")
  return clip._VD_QSdeinterlaceIV(default(show_motion,false)?1:0, default(blend,false)?1:0, 
    \  default(m_threshold,15), default(sc_threshold,100), default(shift,false)?1:0, 
    \  default(fs_before,false)?1:0, default(fs_after,false)?1:0, default(disable,false)?1:0,
    \  default(motion_map_denoising,false)?1:0, mode, channel, default(cubic,true)?1:0)
}

# ConvertToRGB()
# example VD_QSdeinterlaceIV("frame", "luma", false, true, false, false, 15, 100)
# ConvertToYUY2()


##############################################
# Zoom by Donald Graft and Avery Lee, v1.2   #
#					     #
# mode = "neighbour", "bilinear", "bicubic", #
# "p_bilinear" or "p_bicubic".		     # 
#					     #
# See "simplified_versions.avs" for some     #
# examples.				     #
##############################################

function VD_Zoom(clip clip, int "width", int "height", int "focusX", int "focusY", 
  \  int "start_per", int "end_per", int "start_Frame", int "end_frame",  
  \  int "red", int "green", int "blue", string "mode", int "start2_per", 
  \  int "end2_per", int "start2_frame", int "end2_frame")  
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\Zoom.vdf", "_VD_Zoom")
  mode = default(mode, "p_bicubic")
  mode = (mode=="neighbour") ? 0 : (mode=="bilinear") ? 1 : (mode=="bicubic") ? 2 : 
    \  (mode=="p_bilinear") ? 3 : (mode=="p_bicubic") ? 4 : -1
  Assert(mode>=0, """VD_Zoom: "mode" parameter must be "neighbour", "bilinear", "bicubic", "p_bilinear", "p_bicubic"""")
  return clip._VD_Zoom(default(width,320), default(height,240), 
    \  default(focusX,160), default(focusY,120), default(start_per,100), default(end_per,500), 
    \  default(start_frame,0), default(end_frame,500), default(start2_per,0), default(end2_per,0), 
    \  default(start2_frame,0), default(end2_frame,0), default(red,0), default(green,140), default(blue,180), mode)
}


# example (clip of 300 frames):
# ConvertToRGB()
# VD_Zoom(512, 384, 256, 80, 100, 300, 134, 144, 0, 0, 0, "p_bicubic", 300, 100, 144, 154)
# ConvertToYUY2()


####################################################################################################################### 
# LogoAway by Krzysztof Wojdon, v3.5fix1									      #
#														      #
# Load your avs in VirtualDub without this script. Select "shape XY" (or "shape UGLARM"), select "visible borders"    #
# and press preview. Enter and adjust "logo border position" and "logo border size" by looking at the preview. After  #
# adjusting close preview and press twice "ok". Move the slider to a suitable frame and copy the output frame to the  #
# clipboard (under "video", or by pressing ctrl+2). Open the picture on the clipboard in paintshop, corel photo-paint # 
# or adobe photo-shop and make the alpha mask file by following the help file of the Logoaway filter (called	      # 
# "alpha.bmp" in the examples below.										      #
#														      #
# When I wrote this script I couldn't find documentation about the "Shape/Lightmap bitmap" option, called "filename2" #  
# in the script. If anyone knows, please mail me.								      #
#														      #
# mode: off, luminance, XY, uglarm, shape_XY, shape_uglarm or solid						      #
# color: see script of SmartResize v1.1										      #
# upper_left, upper_right, down_right or down_left: "NW", "NE", "SW" or "SE"					      #
# border_up, border_right, border_down or border_left: "direct", "opposite", or "interpolate"			      #
#######################################################################################################################

function VD_LogoAway(clip clip, string "mode", int "border_X", int "border_Y", int "logosize_X", int "logosize_Y", bool "alpha", 
  \  bool "visible_border", string "filename1", int "keyframe", int "color", int "XY_weight", int "blur", string "upper_left", 
  \  string "upper_right", string "down_right", string "down_left", string "border_up", string "border_right", string "border_down", 
  \  string "border_left", string "filename2")
{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\logoaway.vdf", "_VD_LogoAway")
  mode = default(mode, "XY")
  mode = (mode=="off") ? 0 : (mode=="luminance") ? 1 : (mode=="XY") ? 2 : 
    \  (mode=="uglarm") ? 3 : (mode=="shape_XY") ? 4 : (mode=="shape_uglarm") ? 5 : (mode=="solid") ? 6 : -1
  Assert(mode>=0, """VD_LogoAway: "mode" parameter must be "off", "luminance", "XY", "uglarm", "shape_XY", "shape_uglarm", "solid"""")
  border_X = default(border_X,560)
  border_Y = default(border_Y,35)
  A = border_X*65536+border_Y
  logosize_X = default(logosize_X,100)
  logosize_Y = default(logosize_Y,75)
  B = logosize_X*65536+logosize_Y
  mode2 = (alpha==false && visible_border==false) ? 0 : (alpha==false && visible_border==true) ? 1 : 
    \ (alpha==true && visible_border==false) ? 2 : (alpha==true && visible_border==true) ? 3 : -1
  upper_left = default(upper_left, "NW")
  upper_left = (upper_left=="NW") ? 0 : (upper_left=="NE") ? 1 : (upper_left=="SW") ? 2 : (upper_left=="SE") ? 3 : -1
  upper_right = default(upper_right, "NE")
  upper_right = (upper_right=="NW") ? 0 : (upper_right=="NE") ? 1 : (upper_right=="SW") ? 2 : (upper_right=="SE") ? 3 : -1
  down_right = default(down_right, "SE")
  down_right = (down_right=="NW") ? 0 : (down_right=="NE") ? 1 : (down_right=="SW") ? 2 : (down_right=="SE") ? 3 : -1
  down_left = default(down_left, "SW")
  down_left = (down_left=="NW") ? 0 : (down_left=="NE") ? 1 : (down_left=="SW") ? 2 : (down_left=="SE") ? 3 : -1
  Assert(upper_left>=0, """VD_LogoAway: "upper_left" parameter must be "NW", "NE", "SE", "SW"""")
  Assert(upper_right>=0, """VD_LogoAway: "upper_right" parameter must be "NW", "NE", "SE", "SW"""")
  Assert(down_right>=0, """VD_LogoAway: "down_right" parameter must be "NW", "NE", "SE", "SW"""")
  Assert(down_left>=0, """VD_LogoAway: "down_left" parameter must be "NW", "NE", "SE", "SW"""")
  border_up = default(border_up, "direct")
  border_up = (border_up=="direct") ? 0 : (border_up=="opposite") ? 1 : (border_up=="interpolate") ? 2 : -1
  border_right = default(border_right, "direct")
  border_right = (border_right=="direct") ? 0 : (border_right=="opposite") ? 1 : (border_right=="interpolate") ? 2 : -1
  border_down = default(border_down, "direct")
  border_down = (border_down=="direct") ? 0 : (border_down=="opposite") ? 1 : (border_down=="interpolate") ? 2 : -1
  border_left = default(border_left, "direct")
  border_left = (border_left=="direct") ? 0 : (border_left=="opposite") ? 1 : (border_left=="interpolate") ? 2 : -1
  Assert(border_up>=0, """VD_LogoAway: "border_up" parameter must be "direct", "opposite", "interpolate"""")
  Assert(border_right>=0, """VD_LogoAway: "border_right" parameter must be "direct", "opposite", "interpolate"""")
  Assert(border_down>=0, """VD_LogoAway: "border_down" parameter must be "direct", "opposite", "interpolate"""")
  Assert(border_left>=0, """VD_LogoAway: "border_left" parameter must be "direct", "opposite", "interpolate"""")
  t = 1*down_right + 256*down_left + 65536*upper_right + 16777216*upper_left
  v = 1*border_left + 256*border_down + 65536*border_right + 16777216*border_up 
  return clip._VD_LogoAway(mode, A, B, default(keyframe,1), default(color,0), default(XY_Weight,5), mode2, t, v, 
    \ default(blur,1), default(filename1,"g:\alpha.bmp"), default(filename2,""))
}

# examples:
# ConvertToRGB()
# VD_LogoAway("XY", 560, 35, 100, 75, true, false, "g:\alpha.bmp", 1, 0, 5, 1)
# VD_LogoAway("XY", 560, 35, 100, 75, true, false, "g:\alpha.bmp", 1, 0, 5, 1, "NW", "NE", "SE", "SW", "direct", "direct", "direct", "direct")
# ConvertToYUY2()

Back to ShareFunctions

SourceForge Logo

 


Edit this document | View document history
Document last modified Sun, 08 Feb 2004 14:27:02