Commit b7d797ad authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

revisited jquery-jp4 - optimized exif reading (don't need findIPTCinJPEG), simplified image loading

parent 979e470b
......@@ -129,13 +129,13 @@ var Elphel = {
* @lowres - valid values: 1 (not scaled), 2, 4, 8 (lowest resolution)
*
*/
reorderBlocksJP4_lowres: function(pixels,width,height,format="JP4",mosaic=[["Gr","R"],["B" ,"Gb"]],lowres){
//reorderBlocksJP4_lowres: function(pixels,width,height,format="JP4",mosaic=[["Gr","R"],["B" ,"Gb"]],lowres){
reorderBlocksJP4_lowres: async function(pixels,width,height,format="JP4",mosaic=[["Gr","R"],["B" ,"Gb"]],lowres){
// the output image is 1/4 because demosaicing = 4 single color channel pixels are put into 1 rgb pixel
var oPixels = new Uint8Array(pixels.length/4);
// check
if ((lowres!=1)&&(lowres!=2)&&(lowres!=4)&&(lowres!=8)){
if (![1,2,4,8].includes(lowres)){
lowres = 4;
}
......
......@@ -7,12 +7,12 @@
<body>
<table>
<tr>
<td><div id='test1'></div></td>
<td><div id='test2'></div></td>
<td valign='top'><div id='test1'></div></td>
<td valign='top'><div id='test2'></div></td>
</tr>
<tr>
<td><div id='test3'></div></td>
<td><div id='test4'></div></td>
<td valign='top'><div id='test3'></div></td>
<td valign='top'><div id='test4'></div></td>
</tr>
</table>
<script src="js/elphel.js"></script>
......
......@@ -27,9 +27,9 @@
$(function(){
var t1 = $("#test1").jp4({ip:location.host, port:2323,width:600,fast:true,lowres:4});
var t2 = $("#test2").jp4({ip:location.host, port:2324,width:600,fast:true,lowres:4});
var t3 = $("#test3").jp4({ip:location.host, port:2325,width:600,fast:true,lowres:4});
var t4 = $("#test4").jp4({ip:location.host, port:2326,width:600,fast:true,lowres:4});
let t1 = $("#test1").jp4({src:"http://"+location.host+":"+2323+"/img",width:600,fast:true,lowres:4,debug:false,refresh:false});
let t2 = $("#test2").jp4({src:"http://"+location.host+":"+2324+"/img",width:600,fast:true,lowres:4,debug:false,refresh:false});
let t3 = $("#test3").jp4({src:"http://"+location.host+":"+2325+"/img",width:600,fast:true,lowres:4,debug:false,refresh:false});
let t4 = $("#test4").jp4({src:"http://"+location.host+":"+2326+"/img",width:600,fast:true,lowres:4,debug:false,refresh:false});
});
This diff is collapsed.
importScripts('elphel.js');
self.onmessage = function(e) {
onmessage = async (e) => {
var W = e.data.width;
var H = e.data.height;
var Mosaic = e.data.mosaic;
var Format = e.data.format;
let W = e.data.width;
let H = e.data.height;
let Mosaic = e.data.mosaic;
let Format = e.data.format;
var settings = e.data.settings;
let settings = e.data.settings;
var Pixels = new Uint8Array(e.data.pixels);
let Pixels = new Uint8Array(e.data.pixels);
let reorderedPixels;
if (settings.lowres==0){
var reorderedPixels = Elphel.Pixels.reorderBlocksJPx(Pixels,W,H,Format,Mosaic,settings.fast);
reorderedPixels = Elphel.Pixels.reorderBlocksJPx(Pixels,W,H,Format,Mosaic,settings.fast);
//reorder first then downscale
if (settings.fast){
W = W/2;
H = H/2;
}
}else{
var reorderedPixels = Elphel.Pixels.reorderBlocksJP4_lowres(Pixels,W,H,Format,Mosaic,settings.lowres);
reorderedPixels = await Elphel.Pixels.reorderBlocksJP4_lowres(Pixels,W,H,Format,Mosaic,settings.lowres);
W = W/2;
H = H/2;
}
......@@ -35,5 +37,4 @@ self.onmessage = function(e) {
//Elphel.test();
this.close();
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment