AfterDawn.com

Resizing



Changing the resolution of the video in a clip is generally referred to (at least in AviSynth) as resizing. In reality, size isn't really a function of resolution, but thinking in terms of size is probably the simplest way to think of resolution changes. It also works well for computer based editing, as resolution changes are generally reflected as larger or smaller video frames in most player software.

Resizing Algorithms

Proper resizing is a much more complex operation than you might think, particularly in cases where the destination resolution isn't a multiple or factor of the input clip's original resolution. There are varying algorithms used to resize frames, each of which produces unique results. Some result in a sharper image, while others tend to smooth the image more. Which resizer to use is a decision that can only be made after visually inspecting the results of different resize filters. Your choice may be affected by qualities in (and the quality of) your source video, as well as the display you're viewing it on. Most importantly, the only tools that can truly measure the quality of different resizing options are your own eyes. Most people find that sharper resizers like BicubicResize and LanczosResize look better than smoother filters like BilinearResize, but they require more bits to compress at high quality, and may result in low quality video.

Resizing Interlaced Video

Since resizing is a spatial operation, you should always convert frame based interlaced video to field based using SeparateFields (or something similar) before applying a resize filter. Once the resizing is done you can weave the fields back together into a frame based clip again.




BilinearResize


BilinearResize (clip, int target_width, int target_height)
ArgumentTypeDefaultReqDescription
clipCliplastClip to resize
target_widthInteger*Horizontal resolution of resized clip
target_heightInteger*Vertical resolution of resized clip


BilinearResize uses a fairly simple algorithm that results in a smoother image. It's also a relatively quick resizer.

Example Code

Resize a widescreen DVD to square pixels:
BilinearResize(640, 272)

When To Use It

BilinearResize is particularly effective when you're encoding the resized video at a low bitrate. Since it smooths the image, the encoder won't have to struggle as much to maintain what's left.




BicubicResize


BicubicResize (clip, int target_width, int target_height, float "b", float "c")

ArgumentTypeDefaultReqDescription
clipCliplastClip to resize
target_widthInteger*Horizontal resolution of resized clip
target_heightInteger*Vertical resolution of resized clip
"b"floatb value for bicubic algorithm
"c"floatc value for bicubic algorithm


BicubicResize uses a somewhat more sophisticated resizing algorithm than BilinearResize, and also does some sharpening. Although adjustments to the algorithm are possible through the b and c properties, unless you know what you're doing you're more likely to create artifacts in the image than improve it.

Example Code

Resize a widescreen DVD to square pixels:
BicubicResize(640, 272)

Duplicate VirtualDub's Precise Bicubic Resize filter:
BicubicResize(640, 272, b = 0, c = 0.75)

When To Use It

BicubicResize should give better looking results than BilinearResize, except for cases where you're encoding to very low bitrates, which doesn't work well with BicubicResize's sharpening.




LanczosResize


LanczosResize (clip, int target_width, int target_height)

ArgumentTypeDefaultReqDescription
clipCliplastClip to resize
target_widthInteger*Horizontal resolution of resized clip
target_heightInteger*Vertical resolution of resized clip


LanczosResize is somewhat more sophisticated than BicubicResize, producing sharper clips with fewer artifacts (errors).

Example Code

Resize widescreen DVD to square pixels:
LanczosResize(640, 272)

When To Use It

LanczosResize is generally preferred over BicubicResize for sharp images because it produces generally better quality and fewer artifacts.




Lanczos4Resize


Lanczos4Resize (clip, int target_width, int target_height)

ArgumentTypeDefaultReqDescription
clipCliplastClip to resize
target_widthInteger*Horizontal resolution of resized clip
target_heightInteger*Vertical resolution of resized clip


Lanczos4Resize is a more accurate alternative to the regular LanczosResize. Like that filter it's sharper and less prone to artifacts than BicubicResize.

Example Code

Resize widescreen DVD to square pixels:
Lanczos4Resize(640, 272)

When To Use It

Lanczos4Resize works as a direct replacement for LanczosResize. Both are generally preferred over BicubicResize for sharp images because they produce generally better quality and fewer artifacts.




Spline16Resize

Spline16Resize (clip, int target_width, int target_height)

ArgumentTypeDefaultReqDescription
clipCliplastClip to resize
target_widthInteger*Horizontal resolution of resized clip
target_heightInteger*Vertical resolution of resized clip


Spline Resizing uses different algorithms than either Lanczos resizer in an attempt to deliver the sharpest possible image with no artifacts. Although they will tend to give you similar results to Lanczos resizers when upscaling to a higher resolution, when downscaling they tend to produce a better looking image. Spline16Resize is somewhat faster than Spline36Resize, while generally providing slightly lower quality.

Example Code

Resize widescreen DVD to square pixels:
Lanczos4Resize(640, 272)

When To Use It

Spline resizers can be used in place of Bicubic or Lanczos alternatives in most situations, but they tend to give you particularly good results when downsizing, where they can typically provide very sharp results with little in the way or artifacts.




Spline36Resize


Spline36Resize (clip, int target_width, int target_height)

ArgumentTypeDefaultReqDescription
clipCliplastClip to resize
target_widthInteger*Horizontal resolution of resized clip
target_heightInteger*Vertical resolution of resized clip


Spline Resizing uses different algorithms than either Lanczos resizer in an attempt to deliver the sharpest possible image with no artifacts. Although they will tend to give you similar results to Lanczos resizers when upscaling to a higher resolution, when downscaling they tend to produce a better looking image. Spline36Resize is somewhat slower than Spline16Resize, while generally providing slightly higher quality.

Example Code

Resize widescreen DVD to square pixels:
Lanczos4Resize(640, 272)

When To Use It

Spline resizers can be used in place of Bicubic or Lanczos alternatives in most situations, but they tend to give you particularly good results when downsizing, where they can typically provide very sharp results with little in the way or artifacts.
Written by: Rich Fiscus