mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
encoder no alpha option
This commit is contained in:
@@ -73,11 +73,11 @@ Image is divided into 4x4 blocks and each block is serialised, then the entire f
|
||||
*/
|
||||
|
||||
if (!exec_args[2]) {
|
||||
printerrln("Usage: encodeipf input.jpg output.ipf")
|
||||
printerrln("Usage: encodeipf input.jpg output.ipf [/noalpha]")
|
||||
return 1
|
||||
}
|
||||
|
||||
let configUseAlpha = true
|
||||
let configUseAlpha = !(exec_args[3].toLowerCase() == "/noalpha")
|
||||
|
||||
filesystem.open("A", exec_args[1], "R")
|
||||
|
||||
@@ -104,6 +104,33 @@ println(`Dim: ${imgw}x${imgh}, channels: ${channels}, Has alpha: ${hasAlpha}`)
|
||||
let writeCount = 0
|
||||
let writeBuf = sys.malloc(blockSize * ((hasAlpha) ? 20 : 12))
|
||||
|
||||
let bayerKernels = [
|
||||
[
|
||||
0,8,2,10,
|
||||
12,4,14,6,
|
||||
3,11,1,9,
|
||||
15,7,13,5,
|
||||
],
|
||||
[
|
||||
8,2,10,0,
|
||||
4,14,6,12,
|
||||
11,1,9,3,
|
||||
7,13,5,15,
|
||||
],
|
||||
[
|
||||
7,13,5,15,
|
||||
8,2,10,0,
|
||||
4,14,6,12,
|
||||
11,1,9,3,
|
||||
],
|
||||
[
|
||||
15,7,13,5,
|
||||
0,8,2,10,
|
||||
12,4,14,6,
|
||||
3,11,1,9,
|
||||
]
|
||||
].map(it => { it.map(it => { (it + 0.5) / 16 }) })
|
||||
|
||||
function chromaToFourBits(f) {
|
||||
let r = Math.round(f * 8) + 7
|
||||
return (r < 0) ? 0 : (r > 15) ? 15 : r
|
||||
|
||||
Reference in New Issue
Block a user