Registered User
Join Date: Nov 2016
Posts: 151
|
Thanks StainlessS, as always your help is really appreciated, and you are able so solve everything!
I modified my previous functions, including your shaffle ones; yes, blocks are quite big as default, but when compressed (lossless), the shuffled version is only about 4% bigger than the original - while using smaller blocks, let's say 8, it would be more than 20% bigger - and it's more... well, shuffled than your shuffled ones!
Code:
function scramble(clip clip, Int "Seed" , Int "blk") {
# need Shuffle plugin by StainlessS: https://forum.doom9.org/showthread.php?p=1868592
seed = default(seed, 123456789)
blk = default(blk, 120)
w = clip.width/4
h = clip.height/4
clip
a01=crop(0 ,0 ,w,h).fliphorizontal.invert
a02=crop(w ,0 ,w,h).invert("br")
a03=crop(w*2,0 ,w,h).invert
a04=crop(w*3,0 ,0,h).turn180.invert
a05=crop(0 ,h ,w,h).invert
a06=crop(w ,h ,w,h).flipvertical.invert
a07=crop(w*2,h ,w,h).invert
a08=crop(w*3,h ,0,h).invert("rg")
a09=crop(0 ,h*2,w,h).swapuv
a10=crop(w ,h*2,w,h).turn180
a11=crop(w*2,h*2,w,h).flipvertical.swapuv
a12=crop(w*3,h*2,0,h).turn180
a13=crop(0 ,h*3,w,0).swapuv
a14=crop(w ,h*3,w,0).invert("gb")
a15=crop(w*2,h*3,w,0).flipvertical.invert
a16=crop(w*3,h*3,0,0).fliphorizontal.invert
stackvertical(\
stackhorizontal(a12,a05,a08,a15),\
stackhorizontal(a06,a10,a01,a09),\
stackhorizontal(a11,a16,a14,a04),\
stackhorizontal(a03,a13,a07,a02))
Shuffle2D(seed=seed,blkW=blk,blkH=blk)
}
Code:
function descramble(clip clip, Int "Seed" , Int "blk") {
# need Shuffle plugin by StainlessS: https://forum.doom9.org/showthread.php?p=1868592
seed= default(seed, 123456789)
blk = default(blk, 120)
w = clip.width/4
h = clip.height/4
clip
Shuffle2D(seed=seed,blkW=blk,blkH=blk,Inverse=True)
a01=crop(0 ,0 ,w,h)
a02=crop(w ,0 ,w,h)
a03=crop(w*2,0 ,w,h)
a04=crop(w*3,0 ,0,h)
a05=crop(0 ,h ,w,h)
a06=crop(w ,h ,w,h)
a07=crop(w*2,h ,w,h)
a08=crop(w*3,h ,0,h)
a09=crop(0 ,h*2,w,h)
a10=crop(w ,h*2,w,h)
a11=crop(w*2,h*2,w,h)
a12=crop(w*3,h*2,0,h)
a13=crop(0 ,h*3,w,0)
a14=crop(w ,h*3,w,0)
a15=crop(w*2,h*3,w,0)
a16=crop(w*3,h*3,0,0)
stackvertical(\
stackhorizontal(a07,a16,a13,a12),\
stackhorizontal(a02,a05,a15,a03),\
stackhorizontal(a08,a06,a09,a01),\
stackhorizontal(a14,a11,a04,a10))
a01=crop(0 ,0 ,w,h).fliphorizontal.invert
a02=crop(w ,0 ,w,h).invert("br")
a03=crop(w*2,0 ,w,h).invert
a04=crop(w*3,0 ,0,h).turn180.invert
a05=crop(0 ,h ,w,h).invert
a06=crop(w ,h ,w,h).flipvertical.invert
a07=crop(w*2,h ,w,h).invert
a08=crop(w*3,h ,0,h).invert("rg")
a09=crop(0 ,h*2,w,h).swapuv
a10=crop(w ,h*2,w,h).turn180
a11=crop(w*2,h*2,w,h).flipvertical.swapuv
a12=crop(w*3,h*2,0,h).turn180
a13=crop(0 ,h*3,w,0).swapuv
a14=crop(w ,h*3,w,0).invert("gb")
a15=crop(w*2,h*3,w,0).flipvertical.invert
a16=crop(w*3,h*3,0,0).fliphorizontal.invert
stackvertical(\
stackhorizontal(a01,a02,a03,a04),\
stackhorizontal(a05,a06,a07,a08),\
stackhorizontal(a09,a10,a11,a12),\
stackhorizontal(a13,a14,a15,a16))
}
Last edited by spoRv; 13th March 2019 at 03:12.
Reason: replaced previous ShuffleH/V with Shuffle2D
|