View Full Version : How to shift RGB planes?
kuchikirukia
7th April 2017, 23:28
I have a Bluray with convergence issues, but I have no idea how to shift or recombine RGB.
LemMotlow
8th April 2017, 02:18
Isn't BluRay YV12 ?
kuchikirukia
8th April 2017, 02:43
Isn't BluRay YV12 ?
Not after converttorgb()
Reel.Deel
8th April 2017, 03:00
Not after converttorgb()
Is there a reason you're doing that? Maybe upload a small sample.
kuchikirukia
8th April 2017, 03:49
Is there a reason you're doing that? Maybe upload a small sample.
It's pretty obvious. Green and blue are a full pixel off. I just don't know if there's a better way to shift than resizing or how to merge since mt_merge doesn't work in RGB.
poisondeathray
8th April 2017, 04:04
It's pretty obvious. Green and blue are a full pixel off. I just don't know if there's a better way to shift than resizing or how to merge since mt_merge doesn't work in RGB.
For RGB, Use showred("YV12"), showgreen("YV12"), showblue("YV12") etc... then your shift manipulation. MergeRGB(r,g,b) once you've shifted
For full pixel shift, crop and addborders. For subpixel shifts, use the additional resize arguments
To shift UV planes instead of RGB, use chromashiftsp
Reel.Deel
8th April 2017, 04:15
Here's how to shift the green and blue channels to the left by one pixel. The shift is done as lossless as possible, one side gets cropped the other gets padded. Only downside is that is not possible to do subpixel shifting. Needs Padding() from here (http://forum.doom9.org/showpost.php?p=1596804&postcount=5). If you need to the right adjust the parameters accordingly.
#RGB source
o = last
r = o
g = ShowGreen(o, "Y8").Crop(1,0,0,0).Padding(0,0,1,0)
b = ShowBlue (o, "Y8").Crop(1,0,0,0).Padding(0,0,1,0)
MergeRGB(r,g,b)
raffriff42
9th April 2017, 15:12
This one does subpixel shifting, and can also fix convergence error changing across the image.
For example:
if red is left-shifted by 2px on the left side of the image, but it's correct on the right side, you would call
ShiftRedBlue(rx=2, rxd=-2)
if red is correct on the on the left side of the image, but it's left-shifted by 2px on the right side, you would call
ShiftRedBlue(rx=0, rxd=2)##################################
### shift and/or resize Red and Blue relative to Green
##
## @ rx, ry, bx, by - "shift" red & blue position
## @ rxd, ryd, bxd, byd - "delta" width & height
##
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))
C
return (C.IsRGB24)
\ ? MergeRGB(
\ ShowRed.Spline64Resize(Width, Height, -rx, -ry, Width-rxd, Height-ryd)
\ , ShowGreen
\ , ShowBlue.Spline64Resize(Width, Height, -bx, -by, Width-bxd, Height-byd)
\ )
\ : MergeARGB(
\ ShowAlpha
\ , ShowRed.Spline64Resize(Width, Height, -rx, -ry, Width-rxd, Height-ryd)
\ , ShowGreen
\ , ShowBlue.Spline64Resize(Width, Height, -bx, -by, Width-bxd, Height-byd)
\ )
}
kuchikirukia
29th April 2017, 08:05
Here's how to shift the green and blue channels to the left by one pixel. The shift is done as lossless as possible, one side gets cropped the other gets padded. Only downside is that is not possible to do subpixel shifting. Needs Padding() from here (http://forum.doom9.org/showpost.php?p=1596804&postcount=5). If you need to the right adjust the parameters accordingly.
#RGB source
o = last
r = o
g = ShowGreen(o, "Y8").Crop(1,0,0,0).Padding(0,0,1,0)
b = ShowBlue (o, "Y8").Crop(1,0,0,0).Padding(0,0,1,0)
MergeRGB(r,g,b)
Thanks. With an added resize for subpixel shifting, that worked.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.