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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 11th June 2010, 01:27   #10  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,567
Add this to your script, top or bottom, or save it to an avsi file in your \avisynth 2.5\plugins folder:

Code:
function makemod(clip c,int "xmod",int "ymod",bool "crop") {
	xmod=default(xmod,16)
	ymod=default(ymod,xmod)
	crop=default(crop,false)
	c
	ox=width
	oy=height
	xm=width%xmod
	ym=height%ymod
	w=c.isrgb32() || c.isrgb24() ? 1 : 2
	right=c.crop(ox-w,0,w,0)
	right=right.stackhorizontal(right,right,right)
	right=xmod>w*4 ? right.stackhorizontal(right,right,right) : right	
	vx=ox % xmod==0 ? c : stackhorizontal(c,right.crop(0,0,xmod-(ox % xmod),0))
	bottom=vx.crop(0,oy-w,0,w)
	bottom=bottom.stackvertical(bottom,bottom,bottom)
	bottom=ymod>w*4 ? bottom.stackvertical(bottom,bottom,bottom) : bottom	
	vy=oy % ymod==0 ? vx : stackvertical(vx,bottom.crop(0,0,0,ymod-(oy % ymod)))
	cropped = c.crop(0,0,width-xm,height-ym)
	return crop == true ? cropped : vy
}
Use it as:

MakeMod(4)

It'll mirror the edge pixels so that filters don't munge a huge black border into the image. I used to use it a lot when I did a lot of upscaling & filtering of web images, and it had to be fairly memory efficient.
foxyshadis is offline   Reply With Quote
 

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 11:24.


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