Last active
December 27, 2015 19:49
-
-
Save line0/7380383 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function StackedNto16(clip c, int n) | |
{ | |
Assert(8 <= n <= 15, "StackedNto16: bitdepth should be in range 8-15") | |
h = c.Height / 2 | |
msb = c.Crop(0,0,0,-h) | |
lsb = c.Crop(0,h,0,0) | |
shamt = string(16-n) | |
msb16 = (n != 8) ? msb.mt_lutxy(lsb, "x " + shamt + " << y 8 " + shamt + " - >> +", v=3, u=3) : lsb | |
lsb16 = (n != 8) ? lsb.mt_lut("x " + shamt + " << 255 &u", v=3, u=3) : msb | |
return StackVertical(msb16, lsb16) | |
} | |
function InterleavedToStacked(clip c, int bitdepth) | |
{ | |
c.SeparateColumns(2) | |
lsb = SelectEven() | |
msb = SelectOdd() | |
StackVertical(msb, lsb) | |
StackedNto16(bitdepth) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment