Log in

View Full Version : ChromaShift


Si
10th September 2002, 14:43
Having studied hard and spent many days brushing up on Avisynth plugins using YUY2 colourspace ;) , I've finally come up with:-

ChromaShift (http://www.geocities.com/siwalters_uk/chromashift.html)

which shifts the chroma information over to the right by two pixels :D

I wrote it because my whole capture/edit/output to TV chain can sometimes seem to have shifted chrominance over to the left a bit and this makes things look better on the TV next to my PC :)

Please don't rush to download it as I don't have much bandwidth :p

Simon

Marc FD
10th September 2002, 17:11
a = *source()
shift=a.Crop(x,0,0,0).MergeLuma(a.Crop(0,0,-x,0)

:stupid:
possible ?

@simon
of course it would be much slower than your filter.
i just want to know if it's doable.

BTW, Welcome in the "avisynth plugins writers horde" :)

Si
10th September 2002, 17:16
@MarcFD
I don't write fast filters - I write easy ones that you clever people are too busy to write :)

regards
Simon

Archiwa
11th September 2002, 10:04
siwalters

Cannot download it ........


:(

Guest
11th September 2002, 11:17
Geocities doesn't allow linking to files.

Go to Simon's home page and then navigate to My Filter News. You'll find it there.

http://www.geocities.com/siwalters_uk/

Simon, you can attach it here to avoid this problem.

Si
11th September 2002, 14:13
I can download it myself by right-clicking and saving - thats why I put the bit in underneath the link. (Hey but who reads instructions? :)

I use IE6 - is this a unique feature to IE that doesn't work in other browsers?

I put the direct link in because
1. I hadn't added any link to it on my website at the time.

2. I didn't want to see that no-one had downloaded it from here :D

I'll make sure I've got a link from my main page in future.

regards
Simon

Guest
11th September 2002, 14:17
Your instructions were not totally adequate. Try right click and then select Open. :)

Si
11th September 2002, 14:47
And next time I'll mention switching PC on first :p

Si
14th September 2002, 00:06
A new version is available via

http://www.geocities.com/siwalters_uk/chromashift.html

(I'm better prepared this time:) )

It gives you control over how many pixels to shift right (even number of pixels only) and whether to shift U and V together or seperately.


regards
Simon

Si
14th September 2002, 23:48
Latest available at previous link.

Now shifts in all directions horizontally and vertically and runs a bit quicker.

regards
Simon

Wilbert
13th July 2003, 15:28
Hi Simon,

Could you add an option to move the luminance, in both directions?

Si
13th July 2003, 16:30
I know the customer is always right but why :confused: :confused:

Doesn't ChromaShift left/up equal Luma shift right/down and vice versa ;)

regards

Simon

Wilbert
13th July 2003, 17:15
Doesn't ChromaShift left/up equal Luma shift right/down and vice versa :)
Hmm, luma are chroma are independent. So, I don't understand this remark.

I was looking at the avi of Defiler, in this thread: http://forum.doom9.org/showthread.php?s=&threadid=33482&highlight=chromashift

The suggestion of Belgabor doesn't make any sense to me:

ChromaShift(u=-2, v=2)
# u: green -> blue
# v: green -> red

IMO, the solution should be:
shift green ~ 2 pixels to the right
shift blue ~ 2 pixels to the left
shift red ~ 1 pixel to the right

By controlling only u and v, you can't shift all three colors with ChromaShift (which is needed in this case, I think). But, maybe I'm totally incorrect ...

Si
14th July 2003, 22:05
I never really looked at the avi itself in that thread - it looks beyond recovery to me :(

Chromashift was designed to allow people to move Chrominance (U or V) information relative to the luminance (Y) information. It works in YUV (specifically YUY2) colourspace and doesn't work in RGB colourspace and therefore can't shift Red separately from Blue or Green.

I've a request to make it work in YV12 as well and I'll try and add the option to work in RGB as well.

Unfortunately - its summer and gardening time not programming time :(
And I have problems running RGB filters using 2.52 release - I have to revert to an old beta for testing

regards
Simon

Si
4th November 2003, 17:56
Wilbert Dijkhof has kindly modified Chromashift (http://www.geocities.com/siwalters_uk/chromashift.html) so that it can also be used to shift Red, Green or Blue colours independantly if the input to the filter is in RGB32 colourspace.

regards
Simon

Si
4th November 2003, 21:20
The new tablets are working wonders :D

Version 2.7 (http://www.geocities.com/siwalters_uk/chromashift.html) now handles YV12 colourspace as well :)

regards
Simon

TCmullet
27th January 2018, 22:35
Gosh, it's 15 years later, I discover I need to use this filter, and I discover that the zip file linked from
http://avisynth.nl/index.php/ChromaShift
is corrupt. I don't know the correct procedure to report this, so I felt I should leave a message here.

Groucho2004
27th January 2018, 22:47
I discover that the zip file linked from
http://avisynth.nl/index.php/ChromaShift
is corrupt.Works fine for me.

StainlessS
27th January 2018, 22:51
My download of that link was a web page (~46KB).

EDIT: How did you get it G2K4 ?

TCmullet
27th January 2018, 22:56
The link I gave was to the Avisynth documentation page for the filter. The download link is there. The file I get (and I've tried twice) is only 12k, and Windows 10, which normally allows easy access to a "zip folder" says

Compressed (zip) Folder error

! (yellow) Windows cannot open the folder.

The Compressed (zipped) Folder
'(path)\chromashift27.zip' is invalid.

StainlessS
27th January 2018, 22:59
Yeh, first one I downloaded (from WayBackMachine) was (renamed to, via FreeDownLoadManager) Index.html .
Right click Save File as, downed a 12KB chromashift27.zip which was also a web page (from wayBackMachine, the orig was some adverts page).

poisondeathray
27th January 2018, 23:01
works for me too chromashift27.zip 21.4kb from wayback machine, extracts ok

here is a mirror
http://www.mediafire.com/file/zkskdrj6otxyr6h/chromashift27.zip

Groucho2004
27th January 2018, 23:03
I just get a download prompt to save the file:
http://web.archive.org/web/20091026153334/http://www.geocities.com/siwalters_uk/chromashift27.zip

The file is 21,940 bytes.

Anyway, I put it in my dropbox:
https://www.dropbox.com/s/rnd9huopnqzot9z/chromashift27.zip?dl=1

StainlessS
27th January 2018, 23:08
Seems to be available here:-
http://www.digitalfaq.com/forum/misc.php?do=showattachments&t=7695
but need an account.

EDIT: Damn, download worked fine this time, did not do anything first time, I had to copy link and paste into FDM (where I got a web page).
Thanx G2K4, and PDR.

TCmullet
28th January 2018, 00:03
I discovered I can use the ChromaShiftSP script. But for tidiness' sake, I hope the corrupt zip of Chromashift can be fixed eventually.

StainlessS
28th January 2018, 00:33
I hope the corrupt zip of Chromashift can be fixed eventually.

I went back to WayBackMachine link and it worked the 2nd time, or Groucho2004 and PoisonDeathRay both provided links to working zip.

wonkey_monkey
28th January 2018, 01:09
For the sake of 22k, could it not be hosted on the Wiki server instead of linking to the Wayback machine?

raffriff42
28th January 2018, 01:38
Works fine for me. Anyway this task does not require a plugin - a simple script will do.
There is no need to limit the shift to increments of 2 pixels - or even 1 whole pixel.
Resizers can shift the image in sub-pixel increments (https://forum.doom9.org/showpost.php?p=938102&postcount=2).
There's one example here (http://avisynth.nl/index.php/ChromaShiftSP), but it shifts U and V together.
Here's one that can shift U & V separately (AVS+ required):##################################
### shift Chroma relative to Luma (YUV, YUVA) (AVS+ required)
##
function ShiftUV(clip C, float "ux", float "uy", float "vx", float "vy")
{
Assert(C.IsYUV || C.IsYUVA,
\ "ShiftUV: source must be YUV(A)")
ux = Float(Default(ux, 0))
uy = Float(Default(uy, 0))
vx = Float(Default(vx, ux))
vy = Float(Default(vy, uy))

U = C.ExtractU
V = C.ExtractV

U = U.BilinearResize(U.Width, U.Height, -ux, -uy, U.Width, U.Height)
V = V.BilinearResize(V.Width, V.Height, -vx, -vy, V.Width, V.Height)

return (C.NumComponents==3)
\ ? CombinePlanes(C.ExtractY, U, V, "YUV")
\ : CombinePlanes(C.ExtractY, U, V, C.ExtractA, "YUVA")
}


And here's an RGB version that not only shifts, but scales as well (first posted here (https://forum.doom9.org/showthread.php?p=1803247#post1803247)):##################################
### shift and/or resize Red and Blue relative to Green
## (RGB24, RGB32, RGB48, RGB64, RGB10/12/14/16/32, RGBA10/12/14/16/32)
##
## @ rx, ry, bx, by - ± "shift" red & blue position
## @ rxd, ryd, bxd, byd - ± "delta" width & height for advanced convergence
##
function ShiftRedBlue(clip C,
\ float "rx", float "ry",
\ float "bx", float "by",
\ float "rxd", float "ryd",
\ float "bxd", float "byd")
{
Assert(C.IsRGB,
\ "ShiftRedBlue: source must be RGB")
rx = Float(Default(rx, 0))
ry = Float(Default(ry, 0))
bx = Float(Default(bx, 0))
by = Float(Default(by, 0))
rxd = Float(Default(rxd, 0))
ryd = Float(Default(ryd, 0))
bxd = Float(Default(bxd, 0))
byd = Float(Default(byd, 0))

R=C.ExtractR.Spline64Resize(C.Width, C.Height, -rx, -ry, C.Width-rxd, C.Height-ryd)
B=C.ExtractB.Spline64Resize(C.Width, C.Height, -bx, -by, C.Width-bxd, C.Height-byd)

return (C.NumComponents==3)
\ ? CombinePlanes(R, C.ExtractG, B, "RGB")
\ : CombinePlanes(R, C.ExtractG, B, C.ExtractA, "RGBA")
}