View Single Post
Old 14th April 2019, 00:03   #3  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
For the record, a simple way to round is to do this (rounded down to mod2 in this example)

floor(NonRoundedNumber / 2.0) * 2

Normally you'd crop the existing picture to 16:9 first, or resize and then add borders as required for 16:9. If the source is 16:9 already, you can just resize to 16:9 dimensions. You can crop with the resizers though, and the cropping can be float.
The function below would crop for the correct aspect ratio rather than add borders as FranceBB's function does.

Code:
function MyResizing(clip Source, int "NewWidth", int "NewHeight")
{
SourceWidth = float(width(Source))
SourceHeight = float(height(Source))
SourceAspect = SourceWidth / SourceHeight

NewWidth = default(NewWidth, 1366)
NewHeight = default(NewHeight, 768)
NewAspect = float(NewWidth) / float(NewHeight)

SourceAspect < NewAspect ? eval("""
HeightCrop = SourceHeight - (SourceWidth / NewAspect)
WidthCrop = 0
""") : SourceAspect > NewAspect ? eval("""
WidthCrop = SourceWidth - (SourceHeight * NewAspect)
HeightCrop = 0
""") : eval("""
WidthCrop = 0
HeightCrop = 0
""")

return Source.BicubicResize(NewWidth,NewHeight, \
src_left=WidthCrop/2.0, src_top=HeightCrop/2.0, \
src_width=SourceWidth-WidthCrop, src_height=SourceHeight-HeightCrop, \
b=0,c=0.75)
}
MyResizing(1366,768)

That's only been tested in my head, but it should be okay.
It's pretty much the basis of this function, although it can crop or add borders. Unfortunately it won't resize with BicubicResize (unless it resizes with the Resize8 script), but it'd be easy enough to find the resizing in the function and change Spline36Resize to BicubicResize. The screenshots in the opening post I linked to have gone AWOL and I haven't replaced them as there's a new version of the function on the way. It will allow the use of any resizer but I've still got a few things to test.

I've no idea how any of that would relate to SVP. I've never used it.

Last edited by hello_hello; 14th April 2019 at 00:55.
hello_hello is offline   Reply With Quote