Log in

View Full Version : VapourSynth equivalent of AviSynth's ChromaShiftSP?


GB452
1st September 2021, 11:31
Looking to use a similar plugin in VapourSynth to: http://avisynth.nl/index.php/ChromaShiftSP

I've looked at the VapourSynth Database, but can't find any plugins that allow for pixel/sub-pixel adjustment of the chroma. Is there another way to do it in VS, or a way to make the ChromaShiftSP avsi file work with VS?

Thank you for any/all assistance!

kedautinh12
1st September 2021, 11:54
Maybe you need try port avs script to Vapoursynth. I find out MergeChrma here, good luck:
https://github.com/WolframRhodium/muvsfunc/blob/80e99100c78b96b1c925a5989259ef22c1bc6173/muvsfunc.py#L1643

poisondeathray
1st September 2021, 15:53
This seems to work ok. There is no fancy built-in error messages, and the resizer is hardcoded to Spline16 , like the original.


def ChromaShiftSP (clip, X=0.0, Y=0.0):
#Vapoursynth version of Avisynth ChromaShiftSP
#Original AVS ChromaShift_SP: Shift chroma with subpixel accuracy, basic function by IanB, made standalone by McCauley
#X: positive values shift the chroma to left, negative values to right
#Y: positive values shift the chroma upwards, negative values downwards
Yplane = core.std.ShufflePlanes(clip, planes=0, colorfamily=vs.GRAY)
shift = core.resize.Spline16(clip, width=clip.width, height=clip.height, src_left=X, src_top=Y, src_width=clip.width + X, src_height=clip.height + Y)
shiftu = core.std.ShufflePlanes(shift, planes=1, colorfamily=vs.GRAY)
shiftv = core.std.ShufflePlanes(shift, planes=2, colorfamily=vs.GRAY)
merge = core.std.ShufflePlanes(clips=[Yplane, shiftu, shiftv], planes=[0, 0, 0], colorfamily=vs.YUV)
return merge

DJATOM
1st September 2021, 16:36
Should produce the same result with less operations
def ChromaShiftSP (clip, X=0.0, Y=0.0):
#Vapoursynth version of Avisynth ChromaShiftSP
#Original AVS ChromaShift_SP: Shift chroma with subpixel accuracy, basic function by IanB, made standalone by McCauley
#X: positive values shift the chroma to left, negative values to right
#Y: positive values shift the chroma upwards, negative values downwards
Yplane = core.std.ShufflePlanes(clip, planes=0, colorfamily=vs.GRAY)
shift = core.resize.Spline16(clip, width=clip.width, height=clip.height, src_left=X, src_top=Y, src_width=clip.width + X, src_height=clip.height + Y)
merge = core.std.ShufflePlanes(clips=[Yplane, shift], planes=[0, 1, 2], colorfamily=vs.YUV)
return merge

GB452
3rd September 2021, 07:56
This seems to work ok. There is no fancy built-in error messages, and the resizer is hardcoded to Spline16 , like the original.


def ChromaShiftSP (clip, X=0.0, Y=0.0):
#Vapoursynth version of Avisynth ChromaShiftSP
#Original AVS ChromaShift_SP: Shift chroma with subpixel accuracy, basic function by IanB, made standalone by McCauley
#X: positive values shift the chroma to left, negative values to right
#Y: positive values shift the chroma upwards, negative values downwards
Yplane = core.std.ShufflePlanes(clip, planes=0, colorfamily=vs.GRAY)
shift = core.resize.Spline16(clip, width=clip.width, height=clip.height, src_left=X, src_top=Y, src_width=clip.width + X, src_height=clip.height + Y)
shiftu = core.std.ShufflePlanes(shift, planes=1, colorfamily=vs.GRAY)
shiftv = core.std.ShufflePlanes(shift, planes=2, colorfamily=vs.GRAY)
merge = core.std.ShufflePlanes(clips=[Yplane, shiftu, shiftv], planes=[0, 0, 0], colorfamily=vs.YUV)
return merge



Should produce the same result with less operations
def ChromaShiftSP (clip, X=0.0, Y=0.0):
#Vapoursynth version of Avisynth ChromaShiftSP
#Original AVS ChromaShift_SP: Shift chroma with subpixel accuracy, basic function by IanB, made standalone by McCauley
#X: positive values shift the chroma to left, negative values to right
#Y: positive values shift the chroma upwards, negative values downwards
Yplane = core.std.ShufflePlanes(clip, planes=0, colorfamily=vs.GRAY)
shift = core.resize.Spline16(clip, width=clip.width, height=clip.height, src_left=X, src_top=Y, src_width=clip.width + X, src_height=clip.height + Y)
merge = core.std.ShufflePlanes(clips=[Yplane, shift], planes=[0, 1, 2], colorfamily=vs.YUV)
return merge

Thank you both very much! :D