RemoteDesktop: support 16 bits color space

This commit is contained in:
DanyLE 2022-08-17 22:23:09 +02:00
parent f3a8f17ef1
commit 55787b135b
13 changed files with 46 additions and 37 deletions

View File

@ -7,6 +7,7 @@ Further information on **wvnc**: [https://blog.lxsang.me/post/id/23](https://blo
## Change logs ## Change logs
* v0.1.11 - Support 16 bits per pixel
* v0.1.10 - Allow to sync clipboard between local and remote machine, CTRL+SHIF+V to paste text from local to remote machine * v0.1.10 - Allow to sync clipboard between local and remote machine, CTRL+SHIF+V to paste text from local to remote machine
* v0.1.9 - improve stability * v0.1.9 - improve stability
* v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection stability * v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection stability

View File

@ -7,6 +7,7 @@ Further information on **wvnc**: [https://blog.lxsang.me/post/id/23](https://blo
## Change logs ## Change logs
* v0.1.11 - Support 16 bits per pixel
* v0.1.10 - Allow to sync clipboard between local and remote machine, CTRL+SHIF+V to paste text from local to remote machine * v0.1.10 - Allow to sync clipboard between local and remote machine, CTRL+SHIF+V to paste text from local to remote machine
* v0.1.9 - improve stability * v0.1.9 - improve stability
* v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection stability * v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection stability

View File

@ -11,19 +11,20 @@
return api = { return api = {
createBuffer: Module.cwrap('create_buffer', 'number', ['number', 'number']), createBuffer: Module.cwrap('create_buffer', 'number', ['number', 'number']),
destroyBuffer: Module.cwrap('destroy_buffer', '', ['number']), destroyBuffer: Module.cwrap('destroy_buffer', '', ['number']),
updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number', 'number']), updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number']),
decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number', 'number']) decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number'])
}; };
}; };
wasm_update = function(msg) { wasm_update = function(msg) {
var datain, dataout, flag, h, p, po, size, tmp, w, x, y; var bbp, datain, dataout, flag, h, p, po, size, tmp, w, x, y;
datain = new Uint8Array(msg); datain = new Uint8Array(msg);
x = datain[1] | (datain[2] << 8); x = datain[1] | (datain[2] << 8);
y = datain[3] | (datain[4] << 8); y = datain[3] | (datain[4] << 8);
w = datain[5] | (datain[6] << 8); w = datain[5] | (datain[6] << 8);
h = datain[7] | (datain[8] << 8); h = datain[7] | (datain[8] << 8);
flag = datain[9]; flag = datain[9] & 0x01;
bbp = datain[9] & 0xFE;
msg = {}; msg = {};
msg.pixels = void 0; msg.pixels = void 0;
msg.x = x; msg.x = x;
@ -31,13 +32,10 @@
msg.w = w; msg.w = w;
msg.h = h; msg.h = h;
size = w * h * 4; size = w * h * 4;
tmp = new Uint8Array(size); if (size === 0) {
if (flag === 0) {
tmp.set(datain.subarray(10), 0);
msg.pixels = tmp.buffer;
postMessage(msg, [msg.pixels]);
return; return;
} }
tmp = new Uint8Array(size);
p = api.createBuffer(datain.length); p = api.createBuffer(datain.length);
Module.HEAP8.set(datain, p); Module.HEAP8.set(datain, p);
po = api.decodeBuffer(p, datain.length, size); po = api.decodeBuffer(p, datain.length, size);
@ -45,12 +43,14 @@
tmp.set(dataout, 0); tmp.set(dataout, 0);
msg.pixels = tmp.buffer; msg.pixels = tmp.buffer;
postMessage(msg, [msg.pixels]); postMessage(msg, [msg.pixels]);
api.destroyBuffer(po); api.destroyBuffer(p);
return api.destroyBuffer(p); if (flag !== 0x0 || bbp !== 32) {
return api.destroyBuffer(po);
}
}; };
onmessage = function(e) { onmessage = function(e) {
if (e.data.depth) { if (e.data.width) {
return resolution = e.data; return resolution = e.data;
} else { } else {
return wasm_update(e.data); return wasm_update(e.data);

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"author": "Dany LE", "author": "Dany LE",
"email": "contact@iohub.dev" "email": "contact@iohub.dev"
}, },
"version":"0.1.10-b", "version":"0.1.11-b",
"dependencies": [], "dependencies": [],
"category":"Internet", "category":"Internet",
"icon": "icon.png", "icon": "icon.png",

View File

@ -138,13 +138,11 @@ class WVNC
initCanvas: (w, h , d) -> initCanvas: (w, h , d) ->
me = @ me = @
@depth = d
@canvas.width = w @canvas.width = w
@canvas.height = h @canvas.height = h
@resolution = @resolution =
w: w, w: w,
h: h, h: h,
depth: @depth
@decoder.postMessage @resolution @decoder.postMessage @resolution
#me.canvas.style.cursor = "none" #me.canvas.style.cursor = "none"
@setScale @scale @setScale @scale
@ -193,13 +191,15 @@ class WVNC
initConnection: (vncserver, params) -> initConnection: (vncserver, params) ->
#vncserver = "192.168.1.20:5901" #vncserver = "192.168.1.20:5901"
data = new Uint8Array vncserver.length + 1 data = new Uint8Array vncserver.length + 2
data[0] = 50 # jpeg quality data[0] = 16 # bbp
data[1] = 50 # jpeg quality
if params if params
data[0] = params.quality if params.quality data[0] = params.bbp if params.bbp
data[1] = params.quality if params.quality
## rate in milisecond ## rate in milisecond
data.set (new TextEncoder()).encode(vncserver), 1 data.set (new TextEncoder()).encode(vncserver), 2
@socket.send(@buildCommand 0x01, data) @socket.send(@buildCommand 0x01, data)
resetModifierKeys: () -> resetModifierKeys: () ->
@ -308,8 +308,7 @@ class WVNC
when 0x83 when 0x83
w = data[1] | (data[2]<<8) w = data[1] | (data[2]<<8)
h = data[3] | (data[4]<<8) h = data[3] | (data[4]<<8)
depth = 32 @initCanvas w, h
@initCanvas w, h, depth
# status command for ack # status command for ack
@socket.send(@buildCommand 0x04, 1) @socket.send(@buildCommand 0x04, 1)
@enableEvent = true @enableEvent = true

View File

@ -5,12 +5,17 @@ class ConnectionDialog extends this.OS.GUI.BasicDialog
main: () -> main: () ->
super.main() super.main()
@find("bbp").data = [
{ text: "16 bits", value: 16, selected: true },
{ text: "32 bits", value: 32 }
]
@find("jq").value = 40 @find("jq").value = 40
@find("bt-ok").onbtclick = (e) => @find("bt-ok").onbtclick = (e) =>
return unless @handle return unless @handle
data = data =
wvnc: (@find "txtWVNC").value wvnc: (@find "txtWVNC").value
server: (@find "txtServer").value server: (@find "txtServer").value
bbp: (@find "bbp").selectedItem.data.value,
quality:(@find "jq").value quality:(@find "jq").value
@handle data @handle data
@quit() @quit()
@ -19,7 +24,7 @@ class ConnectionDialog extends this.OS.GUI.BasicDialog
@quit() @quit()
ConnectionDialog.scheme = """ ConnectionDialog.scheme = """
<afx-app-window width='350' height='220'> <afx-app-window width='350' height='270'>
<afx-hbox> <afx-hbox>
<div data-width="5"></div> <div data-width="5"></div>
<afx-vbox> <afx-vbox>
@ -28,6 +33,9 @@ ConnectionDialog.scheme = """
<afx-label text="__(VNC Server)" data-height="25" class="header" ></afx-label> <afx-label text="__(VNC Server)" data-height="25" class="header" ></afx-label>
<input data-height="25" data-id="txtServer" value="192.168.1.27:5900"></input> <input data-height="25" data-id="txtServer" value="192.168.1.27:5900"></input>
<div data-height="5"></div> <div data-height="5"></div>
<afx-label text="__(Bits per pixel)" data-height="25" class="header" ></afx-label>
<afx-list-view dropdown = "true" data-id ="bbp" data-height="25" ></afx-list-view>
<div data-height="5"></div>
<afx-label text="__(JPEG quality)" data-height="25" class="header" ></afx-label> <afx-label text="__(JPEG quality)" data-height="25" class="header" ></afx-label>
<afx-slider data-id ="jq" data-height="25" ></afx-slider> <afx-slider data-id ="jq" data-height="25" ></afx-slider>
<afx-hbox data-height = '30'> <afx-hbox data-height = '30'>

View File

@ -11,19 +11,20 @@
return api = { return api = {
createBuffer: Module.cwrap('create_buffer', 'number', ['number', 'number']), createBuffer: Module.cwrap('create_buffer', 'number', ['number', 'number']),
destroyBuffer: Module.cwrap('destroy_buffer', '', ['number']), destroyBuffer: Module.cwrap('destroy_buffer', '', ['number']),
updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number', 'number']), updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number']),
decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number', 'number']) decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number'])
}; };
}; };
wasm_update = function(msg) { wasm_update = function(msg) {
var datain, dataout, flag, h, p, po, size, tmp, w, x, y; var bbp, datain, dataout, flag, h, p, po, size, tmp, w, x, y;
datain = new Uint8Array(msg); datain = new Uint8Array(msg);
x = datain[1] | (datain[2] << 8); x = datain[1] | (datain[2] << 8);
y = datain[3] | (datain[4] << 8); y = datain[3] | (datain[4] << 8);
w = datain[5] | (datain[6] << 8); w = datain[5] | (datain[6] << 8);
h = datain[7] | (datain[8] << 8); h = datain[7] | (datain[8] << 8);
flag = datain[9]; flag = datain[9] & 0x01;
bbp = datain[9] & 0xFE;
msg = {}; msg = {};
msg.pixels = void 0; msg.pixels = void 0;
msg.x = x; msg.x = x;
@ -31,13 +32,10 @@
msg.w = w; msg.w = w;
msg.h = h; msg.h = h;
size = w * h * 4; size = w * h * 4;
tmp = new Uint8Array(size); if (size === 0) {
if (flag === 0) {
tmp.set(datain.subarray(10), 0);
msg.pixels = tmp.buffer;
postMessage(msg, [msg.pixels]);
return; return;
} }
tmp = new Uint8Array(size);
p = api.createBuffer(datain.length); p = api.createBuffer(datain.length);
Module.HEAP8.set(datain, p); Module.HEAP8.set(datain, p);
po = api.decodeBuffer(p, datain.length, size); po = api.decodeBuffer(p, datain.length, size);
@ -45,12 +43,14 @@
tmp.set(dataout, 0); tmp.set(dataout, 0);
msg.pixels = tmp.buffer; msg.pixels = tmp.buffer;
postMessage(msg, [msg.pixels]); postMessage(msg, [msg.pixels]);
api.destroyBuffer(po); api.destroyBuffer(p);
return api.destroyBuffer(p); if (flag !== 0x0 || bbp !== 32) {
return api.destroyBuffer(po);
}
}; };
onmessage = function(e) { onmessage = function(e) {
if (e.data.depth) { if (e.data.width) {
return resolution = e.data; return resolution = e.data;
} else { } else {
return wasm_update(e.data); return wasm_update(e.data);

View File

@ -7,7 +7,7 @@
"author": "Dany LE", "author": "Dany LE",
"email": "contact@iohub.dev" "email": "contact@iohub.dev"
}, },
"version":"0.1.10-b", "version":"0.1.11-b",
"dependencies": [], "dependencies": [],
"category":"Internet", "category":"Internet",
"icon": "icon.png", "icon": "icon.png",

View File

@ -365,7 +365,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/README.md", "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/README.md",
"category": "Internet", "category": "Internet",
"author": "Dany LE", "author": "Dany LE",
"version": "0.1.10-b", "version": "0.1.11-b",
"dependencies": [],"category":"Internet","icon":"icon.png","mimes":["none"], "dependencies": [],"category":"Internet","icon":"icon.png","mimes":["none"],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/build/release/RemoteDesktop.zip" "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/build/release/RemoteDesktop.zip"
}, },