Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
RenderScript for Android
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Daichi Furiya (Wasabeef)
September 29, 2015
Programming
2.2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RenderScript for Android
RenderScript + Blur
Daichi Furiya (Wasabeef)
September 29, 2015
More Decks by Daichi Furiya (Wasabeef)
See All by Daichi Furiya (Wasabeef)
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
6
3k
About Flutter Architecture
wasabeef
1
340
2023 Flutter/Dart Summary
wasabeef
0
150
I/O Extended 2023 - Dart と Flutter の新機能
wasabeef
0
250
I/O Extended 2023 - Flutter 活用事例
wasabeef
10
3.1k
What it Takes to be a Flutter Developer
wasabeef
0
270
FlutterKaigi 2022 Keynote
wasabeef
1
760
Flutter Hooks を使ったアプリ開発 / App Development with the Flutter Hooks
wasabeef
2
1.6k
Flutter 2021 の振り返りと今後のアプリ開発に向けて / Looking back on Flutter 2021 and for future app development.
wasabeef
4
2.3k
Other Decks in Programming
See All in Programming
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1.2k
phperだってパンチカードでコーディングしたい
o0h
PRO
0
330
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
880
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
5.1k
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
2
540
カツオ、ご期待ください
suneo3476
0
190
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
2
630
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
1.1k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
516
110k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
The Pragmatic Product Professional
lauravandoore
37
7.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Claude Code のすすめ
schroneko
67
230k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
From π to Pie charts
rasagy
1
400
Raft: Consensus for Rubyists
vanstee
142
7.8k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.2k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
460
Transcript
RenderScript + Blur Wasabeef
About Me @wasabeef_jp CyberAgent, Inc.
RenderScript?
RenderScript? ɾAPI Level 11 (Support Library v8) ɾUsing C99 lang
(RenderScript Kernel) ɾUsing Java API ɾImage Processing ɾBlur … etc
RenderScript Kernel? blur.rs LLVM RS CC blur.bc ScriptC_blur .java ScriptField_point
.java
RenderScript Intrinsics ɾScriptIntrinsicConvolve3x3 ɾScriptIntrinsicConvolve5x5 ɾScriptIntrinsicBlur ɾScriptIntrinsicYuvToRGB ɾScriptIntrinsicColorMatrix ɾScriptIntrinsicBlend ɾScriptIntrinsicLUT ɾScriptIntrinsic3DLUT
RenderScript Settings
Gradle android { compileSdkVersion 23 buildToolsVersion “23.0.1” defaultConfig { minSdkVersion
23 targetSdkVersion 23 renderscriptTargetApi 23 renderscriptSupportModeEnabled true } }
Gradle android { compileSdkVersion 23 buildToolsVersion “23.0.1” defaultConfig { minSdkVersion
23 targetSdkVersion 23 renderscriptTargetApi 23 renderscriptSupportModeEnabled true } }
Blur?
Blur
Algorithms ɾRS Gaussian Fast (ScriptIntrinsicBlur) ɾRS Box, Gaussian 5x5 (ScriptIntrinsicConvolve5x5)
ɾStack Blur ɾGaussian Fast Blur ɾBox Blur
Gaussian Blur (Java) public static void blur(Bitmap bmp, int radius)
{ int w = bmp.getWidth(); int h = bmp.getHeight(); int[] pix = new int[w * h]; bmp.getPixels(pix, 0, w, 0, 0, w, h); for (int r = radius; r >= 1; r /= 2) { for (int i = r; i < h - r; i++) { for (int j = r; j < w - r; j++) { int tl = pix[(i - r) * w + j - r]; int tr = pix[(i - r) * w + j + r]; int tc = pix[(i - r) * w + j]; int bl = pix[(i + r) * w + j - r]; int br = pix[(i + r) * w + j + r]; int bc = pix[(i + r) * w + j]; int cl = pix[i * w + j - r]; int cr = pix[i * w + j + r]; pix[(i * w) + j] = 0xFF000000 | (((tl & 0xFF) + (tr & 0xFF) + (tc & 0xFF) + (bl & 0xFF) + (br & 0xFF) + (bc & 0xFF) + (cl & 0xFF) + (cr & 0xFF)) >> 3) & 0xFF | (((tl & 0xFF00) + (tr & 0xFF00) + (tc & 0xFF00) + (bl & 0xFF00) + (br & 0xFF00) + (bc & 0xFF00) + (cl & 0xFF00) + (cr & 0xFF00)) >> 3) & 0xFF00 | (((tl & 0xFF0000) + (tr & 0xFF0000) + (tc & 0xFF0000) + (bl & 0xFF0000) + (br & 0xFF0000) + (bc & 0xFF0000) + (cl & 0xFF0000) + (cr & 0xFF0000)) >> 3) & 0xFF0000; } } } bmp.setPixels(pix, 0, w, 0, 0, w, h); }
RS Gaussian Blur (Java) public static void blur(Bitmap src, int
radius) { RenderScript rs = RenderScript.create(context); Allocation input = Allocation.createFromBitmap(rs, src); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius); script.setInput(input); script.forEach(output); output.copyTo(src); rs.destroy(); }
RenderScript public static void blur(Bitmap src, int radius) { RenderScript
rs = RenderScript.create(context); Allocation input = Allocation.createFromBitmap(rs, src); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius); script.setInput(input); script.forEach(output); output.copyTo(src); rs.destroy(); }
Allocation public static void blur(Bitmap src, int radius) { RenderScript
rs = RenderScript.create(context); Allocation input = Allocation.createFromBitmap(rs, src); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius); script.setInput(input); script.forEach(output); output.copyTo(src); rs.destroy(); }
ScriptIntrinsicBlur public static void blur(Bitmap src, int radius) { RenderScript
rs = RenderScript.create(context); Allocation input = Allocation.createFromBitmap(rs, src); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius); script.setInput(input); script.forEach(output); output.copyTo(src); rs.destroy(); }
RenderScript Intrinsics ɾScriptIntrinsicConvolve3x3 ɾScriptIntrinsicConvolve5x5 ɾScriptIntrinsicBlur ɾScriptIntrinsicYuvToRGB ɾScriptIntrinsicColorMatrix ɾScriptIntrinsicBlend ɾScriptIntrinsicLUT ɾScriptIntrinsic3DLUT
Element ɾRoughly equivalent to a C type ɾfloat ɾfloat4 ɾunsigned
32-bit int ɾsigned 8-bit int
ScriptIntrinsicBlur::setRadius public static void blur(Bitmap src, int radius) { RenderScript
rs = RenderScript.create(context); Allocation input = Allocation.createFromBitmap(rs, src); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius); script.setInput(input); script.forEach(output); output.copyTo(src); rs.destroy(); }
ScriptIntrinsicBlur::setInput public static void blur(Bitmap src, int radius) { RenderScript
rs = RenderScript.create(context); Allocation input = Allocation.createFromBitmap(rs, src); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius); script.setInput(input); script.forEach(output); output.copyTo(src); rs.destroy(); }
ScriptIntrinsicBlur::forEach public static void blur(Bitmap src, int radius) { RenderScript
rs = RenderScript.create(context); Allocation input = Allocation.createFromBitmap(rs, src); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius); script.setInput(input); script.forEach(output); output.copyTo(src); rs.destroy(); }
Allocation::copyTo public static void blur(Bitmap src, int radius) { RenderScript
rs = RenderScript.create(context); Allocation input = Allocation.createFromBitmap(rs, src); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius); script.setInput(input); script.forEach(output); output.copyTo(src); rs.destroy(); }
RenderScript::destroy public static void blur(Bitmap src, int radius) { RenderScript
rs = RenderScript.create(context); Allocation input = Allocation.createFromBitmap(rs, src); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius); script.setInput(input); script.forEach(output); output.copyTo(src); rs.destroy(); }
RS Gaussian Blur public static void blur(Bitmap src, int radius)
{ RenderScript rs = RenderScript.create(context); Allocation input = Allocation.createFromBitmap(rs, src); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius); script.setInput(input); script.forEach(output); output.copyTo(src); rs.destroy(); }
github.com/wasabeef Blurry Glide Transformations Picasso Transformations Fresco Processors
Thanks.