SlideShare a Scribd company logo
HTML5 VIDEO FILTERS 
IN SEARCH OF THE DRAGON BALLS 
Created by giorgio.beggiora@artigianidelweb.it
OBJECTIVE 
Show in a browser a video with the following controls: 
Grayscale 
Brightness 
Contrast 
RGB channels
LOOKING FOR AN IDEA 
1. The mysterious SVG filters? 
✗ potentially the best option, but 2014 is too early because... 
✗ not so good browsers' support 
✗ IE9- (XP/Vista) don't support SVG at all 
2. The lightweight CSS filters? 
✗ bad browsers' support 
✗ no support for feColorMatrix SVG filter 
3. The powerful WebGL? 
✗ bad browsers' support 
✗ unfamiliar enviroment for most developers 
✗ not W3C, depends from graphic board's drivers 
4. The hungry Canvas? 
✓ good browsers' support (IE9+) 
✓ polyfills for IE8 (but don't rely on them) 
✓ familiar enviroment for most developers
A VIDEO IN A CANVAS 
var videoElement = document.getElementById('myVideo') ; 
var canvasElement = document.getElementById('myCanvas') ; 
var canvasContext = canvasElement.getContext('2d') ; 
canvasContext.drawImage(videoElement,0,0,width,height) ; // loop
DEMO 
VIDEO 
854 × 480 = 409.920 px 
× 4 channels = 1.639.680 byte 
CANVAS 
Red 80% 
Green 80% 
Blue 80% 
Contrast 80% 
Brightness 80% 
Black & white 
FPS 13.9
BONUS 
CHROMA KEY
LET'S TRY FULL HD
DEMO FULL HD
WHAT DO WE NEED?
MORE POWER!
PROGRAMMING TIPS 
consider not using frameworks or polyfills 
access DOM as little as possible 
reduce the number of dots 
cache everything (i said EVERITHING!) 
don't write 2 times the same thing 
use while(i--) insead of for(i++) 
multiply instead of divide 
requestAnimationFrame() 
['a','b'].join('') instead of 'a'+'b' 
bitwise operations when convenient (i.e. floor if n>=0) 
O'Reilly - High Performance JavaScript 
jsPerf, StackOverflow, Google
AND NOW, WHAT DO WE NEED?
MORE POWER!
TYPED ARRAYS 
Direct access to RAM (IE10+) 
// Floating point arrays. 
var f64 = new Float64Array(8); 
var f32 = new Float32Array(16); 
// Signed integer arrays. 
var i32 = new Int32Array(16); 
var i16 = new Int16Array(32); 
var i8 = new Int8Array(64); 
// Unsigned integer arrays. 
var u32 = new Uint32Array(16); 
var u16 = new Uint16Array(32); 
var u8 = new Uint8Array(64); 
var pixels = new Uint8ClampedArray(64); 
Example 
var a = new Uint8Array(64); // length = 64 // 0 < value < 2^8 ; 
a[0] = 300 ; 
console.log (a[0]) // 44 = 300 - 256
BUFFERS AND VIEWS 
var buffer = new ArrayBuffer(16); // 16 byte = 128 bit of RAM 
// to access it, you need to create a view 
var int32View = new Uint32Array(buffer); // length = 4 (128/32) 
// each element = 0 < value < 2^32 
// you can create multiple views of the same buffer 
var int8View = new Uint8Array(buffer); // length = 16 (128/8) 
// each element = 0 < value < 2^8 
// what does it mean? 
int32View[0]=300; 
console.log(int32View[0]); // 300 
console.log(int32View[1]); // 0 
console.log(int8View[0]); // 44 
console.log(int8View[1]); // 1 
// it means that the Endianess is "Little-endian" (first byte = less significant)
YOU ARE ALREADY USING THEM 
Canvas 2D 
alert(canvasElement.getContext('2d').getImageData(0,0,w,h).data); 
// in most recent browsers, "data" is an [object Uint8ClampedArray] 
// in older browsers, "data" is an [object CanvasPixelArray] 
// the cause is an HTML5 spec change 
var a = new Uint8ClampedArray(2); // length = 2 < value < 2^8 ; 
a[0] = 300 ; 
console.log (a[0]) // 255 
console.log (a[1]) // 0 
XMLHttpRequest2 
File APIs 
Media Source API 
WebGL 
Transferable objects 
Binary WebSockets
AND NOW, WHAT DO WE NEED?
MORE POWER!
WEB WORKERS (IE10+) 
Execute JavaScript in background (multithreading!!!) 
Honestly, i had no time to try them :P 
demo by Conor Buckley using getUserMedia() 
http://bit.ly/10YhHoK
LET'S TRY ALL THIS STUFF 
(except for web workers)
DEMO FULL HD OPTIMIZED
AND NOW, WHAT DO WE NEED?
MORE POWER!
PIXI.JS 
2D WebGL framework with canvas fallback O.O 
pixijs.com 
(video with audio will autoplay on next slide)
DEMO FULL HD WEBGL
WHAT IS THE (COLOR)MATRIX? 
var brightness_colorMatrix = [ 
// r g b a 
/*R*/ 1, 0, 0, x, 
/*G*/ 0, 1, 0, x, 
/*B*/ 0, 0, 1, x, 
/*A*/ 0, 0, 0, 1 
]; 
// R = r*1 + g*0 + b*0 + a*x ; 
// G = r*0 + g*1 + b*0 + a*x ; 
// B = r*0 + g*0 + b*1 + a*x ; 
// A = r*1 + g*0 + b*0 + a*1 ;
THANK YOU 
BY 
GIORGIO . BEGGIORA @ ARTIGIANI DEL WEB . IT
Ad

More Related Content

What's hot (20)

Principios básicos de Garbage Collector en Java
Principios básicos de Garbage Collector en JavaPrincipios básicos de Garbage Collector en Java
Principios básicos de Garbage Collector en Java
Víctor Leonel Orozco López
 
Intro to node and non blocking io
Intro to node and non blocking ioIntro to node and non blocking io
Intro to node and non blocking io
Amy Hua
 
Bs webgl소모임004
Bs webgl소모임004Bs webgl소모임004
Bs webgl소모임004
Seonki Paik
 
Node Architecture and Getting Started with Express
Node Architecture and Getting Started with ExpressNode Architecture and Getting Started with Express
Node Architecture and Getting Started with Express
jguerrero999
 
Running JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java WorldRunning JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java World
irbull
 
Add Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSAdd Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJS
Ryan Anklam
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
Akshay Mathur
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
jacekbecela
 
Cassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
Cassandra Day Chicago 2015: Building Java Applications with Apache CassandraCassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
Cassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
DataStax Academy
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
 
Google App Engine Developer - Day4
Google App Engine Developer - Day4Google App Engine Developer - Day4
Google App Engine Developer - Day4
Simon Su
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
David Boyer
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
Pascal Rettig
 
PyCon KR 2019 sprint - RustPython by example
PyCon KR 2019 sprint  - RustPython by examplePyCon KR 2019 sprint  - RustPython by example
PyCon KR 2019 sprint - RustPython by example
YunWon Jeong
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
Ricardo Silva
 
KrakenJS
KrakenJSKrakenJS
KrakenJS
PayPal
 
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
DevDay Dresden
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh
 
Kraken js at paypal
Kraken js at paypalKraken js at paypal
Kraken js at paypal
Lenny Markus
 
2 docker engine_hands_on
2 docker engine_hands_on2 docker engine_hands_on
2 docker engine_hands_on
FEG
 
Intro to node and non blocking io
Intro to node and non blocking ioIntro to node and non blocking io
Intro to node and non blocking io
Amy Hua
 
Bs webgl소모임004
Bs webgl소모임004Bs webgl소모임004
Bs webgl소모임004
Seonki Paik
 
Node Architecture and Getting Started with Express
Node Architecture and Getting Started with ExpressNode Architecture and Getting Started with Express
Node Architecture and Getting Started with Express
jguerrero999
 
Running JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java WorldRunning JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java World
irbull
 
Add Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSAdd Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJS
Ryan Anklam
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
Akshay Mathur
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
jacekbecela
 
Cassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
Cassandra Day Chicago 2015: Building Java Applications with Apache CassandraCassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
Cassandra Day Chicago 2015: Building Java Applications with Apache Cassandra
DataStax Academy
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
 
Google App Engine Developer - Day4
Google App Engine Developer - Day4Google App Engine Developer - Day4
Google App Engine Developer - Day4
Simon Su
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
David Boyer
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
Pascal Rettig
 
PyCon KR 2019 sprint - RustPython by example
PyCon KR 2019 sprint  - RustPython by examplePyCon KR 2019 sprint  - RustPython by example
PyCon KR 2019 sprint - RustPython by example
YunWon Jeong
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
Ricardo Silva
 
KrakenJS
KrakenJSKrakenJS
KrakenJS
PayPal
 
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
DevDay Dresden
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh
 
Kraken js at paypal
Kraken js at paypalKraken js at paypal
Kraken js at paypal
Lenny Markus
 
2 docker engine_hands_on
2 docker engine_hands_on2 docker engine_hands_on
2 docker engine_hands_on
FEG
 

Similar to HTML5 video filters (20)

JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Simon Willison
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech
vincent_scheib
 
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
Patrick Lauke
 
Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?
Patrick Chanezon
 
Get Ahead with HTML5 on Moible
Get Ahead with HTML5 on MoibleGet Ahead with HTML5 on Moible
Get Ahead with HTML5 on Moible
markuskobler
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
David Padbury
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
Simon Willison
 
Python, WebRTC and You (v2)
Python, WebRTC and You (v2)Python, WebRTC and You (v2)
Python, WebRTC and You (v2)
Saúl Ibarra Corretgé
 
Speak the Web 15.02.2010
Speak the Web 15.02.2010Speak the Web 15.02.2010
Speak the Web 15.02.2010
Patrick Lauke
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
GuardSquare
 
Next Generation Indexes For Big Data Engineering (ODSC East 2018)
Next Generation Indexes For Big Data Engineering (ODSC East 2018)Next Generation Indexes For Big Data Engineering (ODSC East 2018)
Next Generation Indexes For Big Data Engineering (ODSC East 2018)
Daniel Lemire
 
Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010
Christian Heilmann
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
Jussi Pohjolainen
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?
Ankara JUG
 
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Sadaaki HIRAI
 
W3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascriptW3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascript
Changhwan Yi
 
DIY- computer vision with GWT
DIY- computer vision with GWTDIY- computer vision with GWT
DIY- computer vision with GWT
Francesca Tosi
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.
JooinK
 
node.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Servernode.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Server
David Ruiz
 
Brave new world of HTML5
Brave new world of HTML5Brave new world of HTML5
Brave new world of HTML5
Chris Mills
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Simon Willison
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech
vincent_scheib
 
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
Patrick Lauke
 
Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?
Patrick Chanezon
 
Get Ahead with HTML5 on Moible
Get Ahead with HTML5 on MoibleGet Ahead with HTML5 on Moible
Get Ahead with HTML5 on Moible
markuskobler
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
David Padbury
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
Simon Willison
 
Speak the Web 15.02.2010
Speak the Web 15.02.2010Speak the Web 15.02.2010
Speak the Web 15.02.2010
Patrick Lauke
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
GuardSquare
 
Next Generation Indexes For Big Data Engineering (ODSC East 2018)
Next Generation Indexes For Big Data Engineering (ODSC East 2018)Next Generation Indexes For Big Data Engineering (ODSC East 2018)
Next Generation Indexes For Big Data Engineering (ODSC East 2018)
Daniel Lemire
 
Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010
Christian Heilmann
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?
Ankara JUG
 
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Sadaaki HIRAI
 
W3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascriptW3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascript
Changhwan Yi
 
DIY- computer vision with GWT
DIY- computer vision with GWTDIY- computer vision with GWT
DIY- computer vision with GWT
Francesca Tosi
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.
JooinK
 
node.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Servernode.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Server
David Ruiz
 
Brave new world of HTML5
Brave new world of HTML5Brave new world of HTML5
Brave new world of HTML5
Chris Mills
 
Ad

More from Artigiani del Web (16)

Innovazione sociale alimentata dalle persone
Innovazione sociale alimentata dalle personeInnovazione sociale alimentata dalle persone
Innovazione sociale alimentata dalle persone
Artigiani del Web
 
Dal fordismo al toyotismo asso
Dal fordismo al toyotismo assoDal fordismo al toyotismo asso
Dal fordismo al toyotismo asso
Artigiani del Web
 
Costruire la comunità globale
Costruire la comunità globaleCostruire la comunità globale
Costruire la comunità globale
Artigiani del Web
 
La produzione domestica
La produzione domesticaLa produzione domestica
La produzione domestica
Artigiani del Web
 
Il "Bravo Ragazzo di Quartiere"
Il "Bravo Ragazzo di Quartiere"Il "Bravo Ragazzo di Quartiere"
Il "Bravo Ragazzo di Quartiere"
Artigiani del Web
 
Taralla di Agerola
Taralla di AgerolaTaralla di Agerola
Taralla di Agerola
Artigiani del Web
 
Cuci Scuci
Cuci ScuciCuci Scuci
Cuci Scuci
Artigiani del Web
 
Noivotiamo
NoivotiamoNoivotiamo
Noivotiamo
Artigiani del Web
 
Agerola frutta e verdura
Agerola frutta e verduraAgerola frutta e verdura
Agerola frutta e verdura
Artigiani del Web
 
Presentazione food ita ottobre 2013
Presentazione food ita ottobre 2013Presentazione food ita ottobre 2013
Presentazione food ita ottobre 2013
Artigiani del Web
 
Il discorso del cortile
Il discorso del cortileIl discorso del cortile
Il discorso del cortile
Artigiani del Web
 
Agerola
AgerolaAgerola
Agerola
Artigiani del Web
 
Pantuost
PantuostPantuost
Pantuost
Artigiani del Web
 
Beati i Secondi
Beati i SecondiBeati i Secondi
Beati i Secondi
Artigiani del Web
 
KOLLEMA
KOLLEMAKOLLEMA
KOLLEMA
Artigiani del Web
 
Kollema
KollemaKollema
Kollema
Artigiani del Web
 
Ad

Recently uploaded (19)

Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 

HTML5 video filters

  • 1. HTML5 VIDEO FILTERS IN SEARCH OF THE DRAGON BALLS Created by [email protected]
  • 2. OBJECTIVE Show in a browser a video with the following controls: Grayscale Brightness Contrast RGB channels
  • 3. LOOKING FOR AN IDEA 1. The mysterious SVG filters? ✗ potentially the best option, but 2014 is too early because... ✗ not so good browsers' support ✗ IE9- (XP/Vista) don't support SVG at all 2. The lightweight CSS filters? ✗ bad browsers' support ✗ no support for feColorMatrix SVG filter 3. The powerful WebGL? ✗ bad browsers' support ✗ unfamiliar enviroment for most developers ✗ not W3C, depends from graphic board's drivers 4. The hungry Canvas? ✓ good browsers' support (IE9+) ✓ polyfills for IE8 (but don't rely on them) ✓ familiar enviroment for most developers
  • 4. A VIDEO IN A CANVAS var videoElement = document.getElementById('myVideo') ; var canvasElement = document.getElementById('myCanvas') ; var canvasContext = canvasElement.getContext('2d') ; canvasContext.drawImage(videoElement,0,0,width,height) ; // loop
  • 5. DEMO VIDEO 854 × 480 = 409.920 px × 4 channels = 1.639.680 byte CANVAS Red 80% Green 80% Blue 80% Contrast 80% Brightness 80% Black & white FPS 13.9
  • 9. WHAT DO WE NEED?
  • 11. PROGRAMMING TIPS consider not using frameworks or polyfills access DOM as little as possible reduce the number of dots cache everything (i said EVERITHING!) don't write 2 times the same thing use while(i--) insead of for(i++) multiply instead of divide requestAnimationFrame() ['a','b'].join('') instead of 'a'+'b' bitwise operations when convenient (i.e. floor if n>=0) O'Reilly - High Performance JavaScript jsPerf, StackOverflow, Google
  • 12. AND NOW, WHAT DO WE NEED?
  • 14. TYPED ARRAYS Direct access to RAM (IE10+) // Floating point arrays. var f64 = new Float64Array(8); var f32 = new Float32Array(16); // Signed integer arrays. var i32 = new Int32Array(16); var i16 = new Int16Array(32); var i8 = new Int8Array(64); // Unsigned integer arrays. var u32 = new Uint32Array(16); var u16 = new Uint16Array(32); var u8 = new Uint8Array(64); var pixels = new Uint8ClampedArray(64); Example var a = new Uint8Array(64); // length = 64 // 0 < value < 2^8 ; a[0] = 300 ; console.log (a[0]) // 44 = 300 - 256
  • 15. BUFFERS AND VIEWS var buffer = new ArrayBuffer(16); // 16 byte = 128 bit of RAM // to access it, you need to create a view var int32View = new Uint32Array(buffer); // length = 4 (128/32) // each element = 0 < value < 2^32 // you can create multiple views of the same buffer var int8View = new Uint8Array(buffer); // length = 16 (128/8) // each element = 0 < value < 2^8 // what does it mean? int32View[0]=300; console.log(int32View[0]); // 300 console.log(int32View[1]); // 0 console.log(int8View[0]); // 44 console.log(int8View[1]); // 1 // it means that the Endianess is "Little-endian" (first byte = less significant)
  • 16. YOU ARE ALREADY USING THEM Canvas 2D alert(canvasElement.getContext('2d').getImageData(0,0,w,h).data); // in most recent browsers, "data" is an [object Uint8ClampedArray] // in older browsers, "data" is an [object CanvasPixelArray] // the cause is an HTML5 spec change var a = new Uint8ClampedArray(2); // length = 2 < value < 2^8 ; a[0] = 300 ; console.log (a[0]) // 255 console.log (a[1]) // 0 XMLHttpRequest2 File APIs Media Source API WebGL Transferable objects Binary WebSockets
  • 17. AND NOW, WHAT DO WE NEED?
  • 19. WEB WORKERS (IE10+) Execute JavaScript in background (multithreading!!!) Honestly, i had no time to try them :P demo by Conor Buckley using getUserMedia() http://bit.ly/10YhHoK
  • 20. LET'S TRY ALL THIS STUFF (except for web workers)
  • 21. DEMO FULL HD OPTIMIZED
  • 22. AND NOW, WHAT DO WE NEED?
  • 24. PIXI.JS 2D WebGL framework with canvas fallback O.O pixijs.com (video with audio will autoplay on next slide)
  • 25. DEMO FULL HD WEBGL
  • 26. WHAT IS THE (COLOR)MATRIX? var brightness_colorMatrix = [ // r g b a /*R*/ 1, 0, 0, x, /*G*/ 0, 1, 0, x, /*B*/ 0, 0, 1, x, /*A*/ 0, 0, 0, 1 ]; // R = r*1 + g*0 + b*0 + a*x ; // G = r*0 + g*1 + b*0 + a*x ; // B = r*0 + g*0 + b*1 + a*x ; // A = r*1 + g*0 + b*0 + a*1 ;
  • 27. THANK YOU BY GIORGIO . BEGGIORA @ ARTIGIANI DEL WEB . IT