View Full Version : Problem with shifted chroma
McCauley
31st July 2008, 22:32
Hi,
i have a problem with some interlaced footage from a DVD i'm trying to encode.
The chroma is shifted four pixels to the right, see the sample (http://www.mediafire.com/?xm7zl8jwjde).
It shouldn't be hard to fix that, but i found nothing in the Avisynth docs and on the forums.
Looking forward to help on this.
Regards and thanks in advance
McCauuley
martino
31st July 2008, 22:45
ChromaShift (http://www.geocities.com/siwalters_uk/chromashift.html)
IanB
31st July 2008, 23:54
And if you need sub-pixel accuracy in the movement :-X=3.2 # Move chroma left 3.2 pixels
Y=-1.6 # Move chroma down 1.6 pixels
MergeChroma(Spline16Resize(Width(), Height(), X, Y, Width()+X, Height()+Y))
McCauley
1st August 2008, 17:52
Thanks for the fast replies to both of you, i will try it when getting home.
Regards
McCauley
McCauley
13th February 2009, 21:46
Can i add that to wiki, or have i missed something?
#ChromaShift_SP: Shift chroma with subpixel accuracy
function ChromaShift_SP (clip clp, float "X",float "Y") {
X = default(X, 0.0) # positive values shift the chroma to left, negative values to right
Y = default(Y, 0.0) # positive values shift the chroma upwards, negative values downwards
w = clp.Width()
h = clp.Height()
clp.MergeChroma(clp.Spline16Resize(w, h, X, Y, w+X, h+Y)) }
Regards
McCauley
l33tmeatwad
17th September 2018, 15:58
I had a need to shift U and V separately so I modded ChromaShiftSP to allow that, figured I'd throw it in here in case anyone else needed it.
#ChromaShiftSP2: Shift U & V chroma separately with subpixel accuracy, based on the ChromaShiftSP function by IanB & McCauley
function ChromaShiftSP2 (clip clp, float "UX",float "UY", float "VX",float "VY", string "ResizeMethod") {
UX = default(UX, 0.0) # positive values shift the U chroma to left, negative values to right
UY = default(UY, 0.0) # positive values shift the U chroma upwards, negative values downwards
VX = default(VX, 0.0) # positive values shift the V chroma to left, negative values to right
VY = default(VY, 0.0) # positive values shift the V chroma upwards, negative values downwards
ResizeMethod = Default(ResizeMethod, "Spline36")
U = clp.UToY()
U = Eval("U." + ResizeMethod + "Resize(U.Width(), U.Height(), UX, UY, U.Width()+UX, U.Height()+UY)")
V = clp.VToY()
V = Eval("V." + ResizeMethod + "Resize(V.Width(), V.Height(), VX, VY, V.Width()+VX, V.Height()+VY)")
YToUV(U, V, clp) }
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.