Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
2c4623bd
Commit
2c4623bd
authored
Apr 12, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed regular jpegs display
parent
c24f15cc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
21 deletions
+54
-21
jquery-jp4.js
src/jp4-canvas/jquery-jp4.js
+29
-5
webworker.js
src/jp4-canvas/webworker.js
+25
-16
No files found.
src/jp4-canvas/jquery-jp4.js
View file @
2c4623bd
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
// working time
// working time
var
T0
;
var
T0
;
var
TX
;
var
BAYER
=
settings
.
mosaic
;
var
BAYER
=
settings
.
mosaic
;
var
FLIPV
=
0
;
var
FLIPV
=
0
;
...
@@ -81,6 +82,9 @@
...
@@ -81,6 +82,9 @@
//reset format
//reset format
IMAGE_FORMAT
=
"JPEG"
;
IMAGE_FORMAT
=
"JPEG"
;
TX
=
Date
.
now
();
T0
=
Date
.
now
();
var
http
=
new
XMLHttpRequest
();
var
http
=
new
XMLHttpRequest
();
var
rq
=
""
;
var
rq
=
""
;
...
@@ -94,7 +98,12 @@
...
@@ -94,7 +98,12 @@
http
.
open
(
"GET"
,
rq
,
true
);
http
.
open
(
"GET"
,
rq
,
true
);
http
.
responseType
=
"blob"
;
http
.
responseType
=
"blob"
;
http
.
onload
=
function
(
e
)
{
http
.
onload
=
function
(
e
)
{
console
.
log
(
"#"
+
elem
.
attr
(
"id"
)
+
", file load time: "
+
(
Date
.
now
()
-
TX
)
/
1000
+
" s"
);
TX
=
Date
.
now
();
if
(
this
.
status
===
200
)
{
if
(
this
.
status
===
200
)
{
var
heavyImage
=
new
Image
();
var
heavyImage
=
new
Image
();
heavyImage
.
onload
=
function
(){
heavyImage
.
onload
=
function
(){
...
@@ -125,9 +134,18 @@
...
@@ -125,9 +134,18 @@
$
(
this
).
draw
({
$
(
this
).
draw
({
fn
:
function
(
ctx
){
fn
:
function
(
ctx
){
T0
=
Date
.
now
();
console
.
log
(
"#"
+
elem
.
attr
(
"id"
)
+
", raw image drawn time: "
+
(
Date
.
now
()
-
TX
)
/
1000
+
" s"
);
TX
=
Date
.
now
();
if
(
IMAGE_FORMAT
==
"JPEG"
){
// if JP4/JP46 it will work through webworker and exit later on workers message
Elphel
.
Canvas
.
drawScaled
(
cnv_working
,
cnv_display
,
settings
.
width
);
$
(
this
).
trigger
(
"canvas_ready"
);
}
else
if
((
IMAGE_FORMAT
==
"JP4"
)
||
(
IMAGE_FORMAT
==
"JP46"
)){
if
((
IMAGE_FORMAT
==
"JP4"
)
||
(
IMAGE_FORMAT
==
"JP46"
)){
if
(
settings
.
fast
){
if
(
settings
.
fast
){
quickestPreview
(
ctx
);
quickestPreview
(
ctx
);
}
/*else{
}
/*else{
...
@@ -185,6 +203,9 @@
...
@@ -185,6 +203,9 @@
var
image
=
ctx
.
getImageData
(
0
,
0
,
width
,
height
);
var
image
=
ctx
.
getImageData
(
0
,
0
,
width
,
height
);
var
pixels
=
image
.
data
;
var
pixels
=
image
.
data
;
console
.
log
(
"#"
+
elem
.
attr
(
"id"
)
+
", data from canvas for webworker time: "
+
(
Date
.
now
()
-
TX
)
/
1000
+
" s"
);
TX
=
Date
.
now
();
worker
.
postMessage
({
worker
.
postMessage
({
mosaic
:
settings
.
mosaic
,
mosaic
:
settings
.
mosaic
,
format
:
IMAGE_FORMAT
,
format
:
IMAGE_FORMAT
,
...
@@ -207,11 +228,14 @@
...
@@ -207,11 +228,14 @@
var
width
=
e
.
data
.
width
;
var
width
=
e
.
data
.
width
;
var
height
=
e
.
data
.
height
;
var
height
=
e
.
data
.
height
;
console
.
log
(
"#"
+
elem
.
attr
(
"id"
)
+
", worker time: "
+
(
Date
.
now
()
-
TX
)
/
1000
+
" s"
);
TX
=
Date
.
now
();
Elphel
.
Canvas
.
putImageData
(
working_context
,
pixels
,
width
,
height
);
Elphel
.
Canvas
.
putImageData
(
working_context
,
pixels
,
width
,
height
);
Elphel
.
Canvas
.
drawScaled
(
cnv_working
,
cnv_display
,
settings
.
width
);
Elphel
.
Canvas
.
drawScaled
(
cnv_working
,
cnv_display
,
settings
.
width
);
// report time
// report time
console
.
log
(
"#"
+
elem
.
attr
(
"id"
)
+
", time: "
+
(
Date
.
now
()
-
T0
)
/
1000
+
" s"
);
console
.
log
(
"#"
+
elem
.
attr
(
"id"
)
+
",
Total
time: "
+
(
Date
.
now
()
-
T0
)
/
1000
+
" s"
);
//trigger here
//trigger here
cnv_working
.
trigger
(
"canvas_ready"
);
cnv_working
.
trigger
(
"canvas_ready"
);
}
}
...
...
src/jp4-canvas/webworker.js
View file @
2c4623bd
...
@@ -12,8 +12,8 @@ self.onmessage = function(e) {
...
@@ -12,8 +12,8 @@ self.onmessage = function(e) {
var
Pixels
=
new
Uint8Array
(
e
.
data
.
pixels
);
var
Pixels
=
new
Uint8Array
(
e
.
data
.
pixels
);
if
(
Format
!=
"JPEG"
){
var
reorderedPixels
=
Elphel
.
Pixels
.
reorderBlocksJPx
(
Pixels
,
W
,
H
,
Format
,
Mosaic
,
settings
.
fast
);
var
reorderedPixels
=
Elphel
.
Pixels
.
reorderBlocksJPx
(
Pixels
,
W
,
H
,
Format
,
Mosaic
,
settings
.
fast
);
//reorder first then downscale
//reorder first then downscale
if
(
settings
.
fast
){
if
(
settings
.
fast
){
W
=
W
/
2
;
W
=
W
/
2
;
...
@@ -28,6 +28,15 @@ self.onmessage = function(e) {
...
@@ -28,6 +28,15 @@ self.onmessage = function(e) {
pixels
:
reorderedPixels
.
buffer
pixels
:
reorderedPixels
.
buffer
},[
reorderedPixels
.
buffer
]);
},[
reorderedPixels
.
buffer
]);
//Elphel.test();
}
else
{
//just send back
postMessage
({
width
:
W
,
height
:
H
,
pixels
:
Pixels
.
buffer
},[
Pixels
.
buffer
]);
}
};
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment