video delta encoding wip

This commit is contained in:
minjaesong
2025-04-15 21:38:33 +09:00
parent 9ce7e3dfd2
commit 4c4f24be37
11 changed files with 466 additions and 29 deletions

View File

@@ -1,9 +1,9 @@
if (exec_args[1] === undefined) {
println("Usage: compile myfile")
println("Usage: compile myfile.js")
println("The compiled file will be myfile.bin")
return 1
}
_G.shell.execute(`gzip -c ${exec_args[1]} | writeto ${exec_args[1]}.gz`)
_G.shell.execute(`enc ${exec_args[1]}.gz ${exec_args[1]}.bin`)
_G.shell.execute(`rm ${exec_args[1]}.gz`)
const filenameWithoutExt = exec_args[1].substringBeforeLast(".")
_G.shell.execute(`gzip -c ${exec_args[1]} | writeto ${filenameWithoutExt}.gz`)
_G.shell.execute(`enc ${filenameWithoutExt}.gz ${filenameWithoutExt}.bin`)
_G.shell.execute(`rm ${filenameWithoutExt}.gz`)

View File

@@ -3,7 +3,6 @@ if (exec_args[1] === undefined) {
println("The compiled file will be myfile.bin.js")
return 1
}
_G.shell.execute(`enc ${exec_args[1]} ${exec_args[1]}.gz`)
_G.shell.execute(`gzip -c -d ${exec_args[1]}.gz | writeto ${exec_args[1]}.js`)
_G.shell.execute(`rm ${exec_args[1]}.gz`)

View File

@@ -8,7 +8,10 @@ if (exec_args[1] === undefined || exec_args[2] === undefined) {
let infilePath = _G.shell.resolvePathInput(exec_args[2]).full
let infile = files.open(infilePath)
let outfile = files.open(infilePath + ".out")
if (!infile.exists) throw Error("No such file: " + infilePath)
let outfile = files.open(infilePath.substringBeforeLast(".") + ".out")
let outMode = exec_args[1].toLowerCase()
let type = {