Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GCI] Added Lightning Bolt for WASM accelerated modules #1365

Merged
merged 6 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,19 @@ a.name-header{
cursor: default;
}

.dimension-tooltip:hover{
.general-tooltip:hover{
text-decoration: none;
}

.dimension-tooltip:focus{
.general-tooltip:focus{
outline: none;
}

.dimension-tooltip:focus-within{
.general-tooltip:focus-within{
outline: none;
}

.dimension-tooltip{
.general-tooltip{
position: relative;
bottom: 7px;
font-size: 16px;
Expand Down
19 changes: 17 additions & 2 deletions examples/lib/defaultHtmlStepUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ function DefaultHtmlStepUi(_sequencer, options) {
<div class="container-fluid step-container">\
<div class="panel panel-default">\
<div class="panel-heading">\
<div class="trash-container pull-right"><button type="button" class="btn btn-link ' + step.name + ' dimension-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title=""><i class="fa fa-info-circle"></i></button></div>\
<div class="trash-container pull-right">\
<a type="button" target="_blank" href="https://developer.mozilla.org/en-US/docs/WebAssembly" style="display: none;" class="btn btn-link general-tooltip wasm-tooltip" data-toggle="tooltip" data-html="true" data-original-title="<div style=\'text-align: center\'><p>This step is Web Assembly accelerated. Click to Read More</div>">\
<i class="fa fa-bolt"></i>\
</a>\
<button type="button" class="btn btn-link ' + step.name + ' general-tooltip dimension-tooltip" data-toggle="tooltip" data-html="true" data-original-title="">\
<i class="fa fa-info-circle"></i>\
</button>\
</div>\
<h3 class="panel-title">' +
'<span class="toggle mouse">' + step.name + ' <span class="caret toggleIcon rotated"></span>\
<span class="load-spin pull-right" style="display:none;padding:1px 8px;"><i class="fa fa-circle-o-notch fa-spin"></i></span>\
Expand Down Expand Up @@ -335,7 +342,15 @@ function DefaultHtmlStepUi(_sequencer, options) {
_sequencer.getImageDimensions(step.imgElement.src, function (dim) {
step.ui.querySelector('.' + step.name).attributes['data-original-title'].value = `<div style="text-align: center"><p>Image Width: ${dim.width}<br>Image Height: ${dim.height}</br></div>`;
});
});
})

// Handle the wasm bolt display

if (step.useWasm) {
if (step.wasmSuccess) $step('.wasm-tooltip').fadeIn();
else $step('.wasm-tooltip').fadeOut();
}
else $step('.wasm-tooltip').fadeOut();
}

function imageHover(step){
Expand Down
2 changes: 2 additions & 0 deletions src/Run.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ function Run(ref, json_q, callback, ind, progressObj) {

// This output is accessible by UI
ref.steps[i].options.step.output = ref.steps[i].output.src;
ref.steps[i].options.step.wasmSuccess = ref.steps[i].output.wasmSuccess || false;
ref.steps[i].options.step.useWasm = ref.steps[i].output.useWasm || false;

// Tell UI that step has been drawn.
ref.steps[i].UI.onComplete(ref.steps[i].options.step);
Expand Down
7 changes: 4 additions & 3 deletions src/modules/AddQR/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ module.exports = function AddQR(options, UI) {
}
require('./QR')(options, pixels, oldPixels, generateOutput);
}
function output(image, datauri, mimetype) {
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
output: output,
ui: options.step.ui,
Expand All @@ -40,7 +42,6 @@ module.exports = function AddQR(options, UI) {
useWasm:options.useWasm
});
});

}

return {
Expand Down
9 changes: 2 additions & 7 deletions src/modules/Average/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,8 @@ module.exports = function Average(options, UI) {
return pixels;
}

function output(image, datauri, mimetype) {

// This output is accessible by Image Sequencer
step.output = {
src: datauri,
format: mimetype
};
function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
7 changes: 2 additions & 5 deletions src/modules/Blend/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ module.exports = function Dynamic(options, UI, util) {
);
}

function output(image, datauri, mimetype) {

// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

// run PixelManipulatin on second image's pixels
Expand Down
5 changes: 2 additions & 3 deletions src/modules/BlobAnalysis/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ module.exports = function BlobAnalysis(options, UI){
return pixels;
}

function output(image, datauri, mimetype){

step.output = { src: datauri, format: mimetype};
function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
7 changes: 2 additions & 5 deletions src/modules/Blur/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ module.exports = function Blur(options, UI) {
return pixels;
}

function output(image, datauri, mimetype) {

// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
7 changes: 2 additions & 5 deletions src/modules/Brightness/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ module.exports = function Brightness(options, UI) {
return [r, g, b, a];
}

function output(image, datauri, mimetype) {

// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
7 changes: 2 additions & 5 deletions src/modules/CanvasResize/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ module.exports = function canvasResize(options, UI) {
return newPixels;
}

function output(image, datauri, mimetype) {

// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
7 changes: 2 additions & 5 deletions src/modules/Channel/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ module.exports = function Channel(options, UI) {
if (options.channel === 'blue') return [0, 0, b, a];
}

function output(image, datauri, mimetype) {

// This output is accesible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
6 changes: 2 additions & 4 deletions src/modules/ColorTemperature/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ module.exports = function ColorTemperature(options, UI) {
return pixels;
}

function output(image, datauri, mimetype) {

step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
8 changes: 3 additions & 5 deletions src/modules/Colormap/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ module.exports = function Colormap(options, UI) {
return [res[0], res[1], res[2], 255];
}

function output(image, datauri, mimetype) {

// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
output: output,
ui: options.step.ui,
Expand Down
7 changes: 2 additions & 5 deletions src/modules/Contrast/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ module.exports = function Contrast(options, UI) {
return pixels;
}

function output(image, datauri, mimetype) {

// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
6 changes: 2 additions & 4 deletions src/modules/Convolution/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ module.exports = function Convolution(options, UI) {
return pixels;
}

function output(image, datauri, mimetype) {

step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
9 changes: 3 additions & 6 deletions src/modules/DecodeQr/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ module.exports = function DoNothing(options, UI) {
options.step.qrval = (decoded) ? decoded.data : 'undefined';
});

function output(image, datauri, mimetype) {
// This output is accessible by Image Sequencer
step.output = {
src: datauri,
format: mimetype
};
function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
output: output,
ui: options.step.ui,
Expand Down
6 changes: 2 additions & 4 deletions src/modules/Dither/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ module.exports = function Dither(options, UI) {
return pixels;
}

function output(image, datauri, mimetype) {
// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
6 changes: 2 additions & 4 deletions src/modules/DrawRectangle/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ module.exports = function DrawRectangle(options, UI) {
return pixels;
}

function output(image, datauri, mimetype) {

step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
8 changes: 3 additions & 5 deletions src/modules/Dynamic/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ module.exports = function Dynamic(options, UI) {
}
}

function output(image, datauri, mimetype) {

// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
output: output,
ui: options.step.ui,
Expand Down
4 changes: 2 additions & 2 deletions src/modules/EdgeDetect/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ module.exports = function edgeDetect(options, UI) {
return require('./EdgeUtils')(blurPixels, options.highThresholdRatio, options.lowThresholdRatio, options.hysteresis);
}

function output(image, datauri, mimetype) {
step.output = { src: datauri, format: mimetype };
function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
7 changes: 2 additions & 5 deletions src/modules/Exposure/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ module.exports = function Exposure(options, UI) {
return [r, g, b, a];
}

function output(image, datauri, mimetype) {

// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
5 changes: 3 additions & 2 deletions src/modules/FlipImage/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ module.exports = function FlipImage(options, UI) {
}
return require('./flipImage')(oldPixels, pixels, options.Axis);
}
function output(image, datauri, mimetype) {
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
6 changes: 2 additions & 4 deletions src/modules/GammaCorrection/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ module.exports = function Gamma(options, UI) {
return [r, g, b, a];
}

function output(image, datauri, mimetype) {

step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
7 changes: 2 additions & 5 deletions src/modules/Gradient/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ module.exports = function Invert(options, UI) {
});
});

function output(image, datauri, mimetype) {

// This output is accessible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}
}

Expand Down
7 changes: 2 additions & 5 deletions src/modules/GridOverlay/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ module.exports = function GridOverlay(options, UI) {
return pixels;
}

function output(image, datauri, mimetype) {

// This output is accesible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
7 changes: 2 additions & 5 deletions src/modules/Histogram/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,8 @@ module.exports = function Channel(options, UI) {
return pixels;
}

function output(image, datauri, mimetype) {

// This output is accesible by Image Sequencer
step.output = { src: datauri, format: mimetype };

function output(image, datauri, mimetype, wasmSuccess) {
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
}

return require('../_nomodule/PixelManipulation.js')(input, {
Expand Down
Loading