Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st September 2021, 11:31   #1  |  Link
GB452
Registered User
 
Join Date: Mar 2019
Posts: 8
VapourSynth equivalent of AviSynth's ChromaShiftSP?

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!
GB452 is offline   Reply With Quote
Old 1st September 2021, 11:54   #2  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Maybe you need try port avs script to Vapoursynth. I find out MergeChrma here, good luck:
https://github.com/WolframRhodium/mu...sfunc.py#L1643
kedautinh12 is offline   Reply With Quote
Old 1st September 2021, 15:53   #3  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
This seems to work ok. There is no fancy built-in error messages, and the resizer is hardcoded to Spline16 , like the original.

Code:
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
poisondeathray is offline   Reply With Quote
Old 1st September 2021, 16:36   #4  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Should produce the same result with less operations
Code:
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
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 3rd September 2021, 07:56   #5  |  Link
GB452
Registered User
 
Join Date: Mar 2019
Posts: 8
Quote:
Originally Posted by poisondeathray View Post
This seems to work ok. There is no fancy built-in error messages, and the resizer is hardcoded to Spline16 , like the original.

Code:
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

Quote:
Originally Posted by DJATOM View Post
Should produce the same result with less operations
Code:
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!
GB452 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.