PixelShiftPlus

From Avisynth wiki
Jump to: navigation, search
Abstract
Author reel.deal
Version v1.1.0
Download pixelshiftplus.avsi
Category Chroma Correction
License
Discussion

Contents

Description

PixelShiftPlus is a script to independently shift pixels with subpixel accuracy.
It includes 4 functions:

  • PixelShiftRGB – shift any plane in an RGB(A) clip.
  • PixelShiftYUV – shift any plane in a YUV(A) clip.
  • PixelShiftUV – shift the chroma in a YUV(A) clip. Similar to ChromaShiftSP2.
  • PixelShiftC – uniformly shifts the chroma in a YUV(A) clip. Similar to ChromaShiftSP.


Requirements


Syntax and Parameters

PixelShiftRGB (clip input, float "RX", float "RY", float "GX", float "GY", float "BX", float "BY", float "AX", float "AY", string "Resizer", int "Mode", bool "Inverse")
PixelShiftYUV (clip input, float "YX", float "YY", float "UX", float "UY", float "VX", float "VY", float "AX", float "AY", string "Resizer", bool "ChromaPixels", int "Mode", bool "Inverse")
PixelShiftUV (clip input, float "UX", float "UY", float "VX", float "VY", string "Resizer", bool "ChromaPixels", int "Mode", bool "Inverse")
PixelShiftC (clip input, float "X", float "Y", string "Resizer", bool "ChromaPixels", int "Mode", bool "Inverse")


clip   =
Input clip.
PixelShiftRGB: all RGB(A) colorspaces are supported.
PixelShiftY(UV): all YUV(A) colorspaces are supported.


float  RX, RY, GX, GY, BX, BY, AX, AY = 0.0
float  YX, YY, UX, UY, VX, VY, AX, AY = 0.0
Specify the shift amount in each (R, G, B, A) or (Y, U, V, A) plane.
  • (X) horizontal shift: positive values shift left, negative values right.
  • (Y) vertical shift: positive values shift upwards, negative values downwards.
Note that the shifting direction will be reversed if Inverse=true.


string  Resizer = "Spline36"
Resizer to use to shift planes.
Available options: "Bicubic", "Bilinear", "Blackman", "Gauss", "Lanczos", "Lanczos4", "Point", "Sinc", "Spline16", "Spline36", "Spline64".
Note that "Point" cannot do subpixel shifting because it uses only integer pixel coordinates, float values will be rounded.


bool  ChromaPixels = false
By default, the X and Y shift values of the chroma planes are shifted in "luma pixels", meaning that the shift values are divided by the subsampling ratio of the input clip.
For example:
  • YUV420, the X and Y shift values are divided by 2 since the chroma planes are half the width and height of the luma plane.
  • YUV422 or YUV411, only the X shift value is divided by 2 and 4, respectively.
  • YUV444, has no effect since the chroma planes are the same size as the luma.
When set to true, the X and Y shift values are not divided.


int  Mode = 1
Border mode:
  • 0 : "fillmargins" - top and bottom borders are filled with a weighted average of its three neighbours from the previous line. Left and right borders are repeated, as in mode 1.
  • 1 : "repeat" - fills the borders using the outermost line or column.
  • 2 : "mirror" - fills the borders by mirroring.
  • 3 : "reflect" - fills the borders by reflecting (whole sample symmetric).
  • 4 : "wrap" - fills the borders by wrapping.
  • 5 : "fade" - fills the borders to constant value.
  • 6 : "fixborders" - A direction "aware" modification of FillMargins. It also works on all four sides.
Default: 1 (all other modes require the FillBorders plugin)


int  Inverse = false
If true, it will reverse the shifting direction:
  • (X) horizontal shift: negative values shift left, positive values right.
  • (Y) vertical shift: negative values shift upwards, positive values downwards.


Examples

Move both chroma planes left 3.2 pixels and down 1.6 pixels:

AviSource("Blah.avi")
PixelShiftUV(UX=3.2, UY=-1.6, VX=3.2, VY=-1.6) # same as PixelShiftC(X=3.2, Y=-1.6)


Changelog

Version      Date            Changes
v1.1.0 2022/12/10 - Add PixelShiftC function - Adaptive PointResize when the x/y shift is whole - No longer overrides the ChromaPixels parameter when Resizer="Point" - Cosmetics v1.0.0 2022/11/29 - Initial release


External Links




Back to External Filters

Personal tools