Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
画像フィルタリング高速化するよ@iOS
Search
Tomoki Kobayashi
July 30, 2016
Programming
150
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
画像フィルタリング高速化するよ@iOS
Tomoki Kobayashi
July 30, 2016
More Decks by Tomoki Kobayashi
See All by Tomoki Kobayashi
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
3.4k
Liquid Glass を Metal Shader で描きたいだけの人生だった…
temoki
0
260
Skip Skip Run Run Run ♫
temoki
0
1k
さようならRxSwift こんにちは*****
temoki
1
640
Androidで不安定なPlatform Viewsとの闘い
temoki
0
1.2k
iOSパッケージマネージャー奮闘記 完結編
temoki
2
770
事業譲渡を受けたアプリとの統合で失敗、 そしてユーザーからの評価回復に至るまで
temoki
1
820
Apple Vision Proデベロッパラボに参加してきた
temoki
0
640
年末年始の成果、そして現状の紹介
temoki
0
340
Other Decks in Programming
See All in Programming
自動化したのに回らない テスト運用の壁―AI時代の品質責任と生産性
mfunaki
0
420
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
360
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
280
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
280
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
200
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
710
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
260
「人を評価する AI」の設計と実装
ryoyanara
0
230
Press start. Python's next generation.
willingc
PRO
2
100
楽しそうなつよつよエンジニアと目が死んでる僕/A brilliant engineer having a blast, and dead-eyed me.
3l4l5
2
230
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
290
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
350
Featured
See All Featured
Leo the Paperboy
mayatellez
8
2.2k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
Making the Leap to Tech Lead
cromwellryan
135
10k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
710
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
A Soul's Torment
seathinner
6
3.5k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
800
Joys of Absence: A Defence of Solitary Play
codingconduct
1
440
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
520
Ruling the World: When Life Gets Gamed
codingconduct
0
310
Docker and Python
trallard
47
4.1k
Transcript
ը૾ϑΟϧλϦϯά ߴԽ͢ΔΑˏJ04 !UFNPLJ
ը૾ϑΟϧλϦϯάͬͯԿʁ ը૾ϑΟϧλϦϯάͷ࣮ ը૾ϑΟϧλϦϯάΛߴԽʂ
ը૾ϑΟϧλϦϯάͬͯԿʁ ը૾ϑΟϧλϦϯάͷ࣮ ը૾ϑΟϧλϦϯάΛߴԽʂ
͜ͷϨφ͞ΜࣸਅΛ
΅͔ͨ͠Γ
ྠֲͱΓͩͨ͠Γ
ϞβΠΫ ͔͚ͨΓ ͢ΔͭͰ͢ ը૾αϯϓϧʮϨφʯͷਖ਼ମʮ1-":#0:ʯࢽͷ ࠷ଟൢച෦Λهͨ͠ϓϨΠϝΠτ IUUQHJHB[JOFOFUOFXT@MFOOB
ը૾ϑΟϧλϦϯάͬͯԿʁ ը૾ϑΟϧλϦϯάͷ࣮ ը૾ϑΟϧλϦϯάΛߴԽʂ
Ұൠతͳը૾σʔλ
QJYFM 3(#"
QJYFM 3FE(SFFO#MVF"MQIB νϟϯωϧʹόΠτʹdͷ ܭνϟϯωϧʹόΠτ
ը૾શମ 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#"
3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#" 3(#"3(#"3(#"3(#"3(#"3(#"3(#"3(#"
ΈࠐΈԋࢉ
ΈࠐΈΧʔωϧ
ೖྗը૾ ग़ྗ º º º º º º º º º × º
ΈࠐΈΧʔωϧ $POWPMVUJPO,FSOFM
ྫ͑ɺ
΅͔͠ʢҠಈฏۉʣ
΅͔͠ʢՙॏฏۉʣ
Τοδநग़ʢਫฏʣ
Τοδநग़ʢਨʣ
ઌӶԽ
αΠζ͍Ζ͍Ζ
ΨγΞϯΧʔωϧº
˞ઌ΄Ͳͷʮ΅͔͠ʢՙॏฏۉʣʯͱಉ͡
ΨγΞϯΧʔωϧº
ΨγΞϯΧʔωϧº
ܭࢉྔ
for ( x of image ) { for ( y
of image ) { for ( x of kernel ) { for ( y of kernel ) { for ( channel ) { operation } } } } }
ສճͷԋࢉ w ೖྗը૾ɿ3(#"Y w ΧʔωϧɿΨγΞϯΧʔωϧº w ºººº
ॲཧ࣌ؒ
͜ΜͳΞϓϦ ͭͬͯ͘ݕূ
'14 w σόΠεɿJ1IPOF w ೖྗը૾ɿ3(#"Y w ΧʔωϧɿΨγΞϯΧʔωϧº
͑ͨΜ͡Όͳ͍ʜ
ը૾ϑΟϧλϦϯάͬͯԿʁ ը૾ϑΟϧλϦϯάͷ࣮ ը૾ϑΟϧλϦϯάΛߴԽʂ
ߴԽ w ΞϧΰϦζϜͷͰܭࢉྔΛݮΒ͢ w σόΠεͷܭࢉࢿݯΛ࠷େݶʹར༻
ߴԽ w ΞϧΰϦζϜͷͰܭࢉྔΛݮΒ͢ w σόΠεͷܭࢉࢿݯΛ࠷େݶʹར༻ ˠͪ͜Β͕͜ͷεϥΠυͷςʔϚͰ͢ɻ
ϚϧνίΞ w ը૾ΛෳͷΤϦΞʹׂ͢Δ ʢྫʣը૾ͷࠨͷӈ w σόΠεͷίΞεϨουΛ࡞͠ ֤εϨουʹΤϦΞΛׂΓͯΔ
ˣ'14ˣ w J1IPOFίΞˠεϨου w εϨουॲཧ($%Ͱ؆୯ʹ w εϨουͷΦʔόʔϔου͕େ͖͍ʁ ͬͱ͕ΜΕΔͣʜ w ͞ΕͲίΞͰخ͠͞ബ͍
4*.% w 4JOHMF*OTUSVDUJPO.VMUJQMF%BUB w ͷ໋ྩͰෳͷσʔλΛԋࢉ w ϕΫτϧԋࢉɺύοΫυԋࢉ w $16ͷ֦ு໋ྩͱͯ͠ Yͷ..944&
"3.ͷ/&0/
ී௨ͷࢉ int a[4] = { 1, 2, 3, 4 };
int b[4] = { 5, 6, 7, 8 }; int c[4]; for ( int i=0; i<4; i++) { c[i] = a[i] * b[i]; }
"3./&0/Ͱࢉ ʢίϯύΠϥΈࠐΈؔʣ int32_t a = { 1, 2, 3, 4
}; int32_t b = { 5, 6, 7, 8 }; int32_t c; c = vmulq_s32( a, b ); IUUQXXXBSNDPNKBQSPEVDUTQSPDFTTPSTUFDIOPMPHJFTOFPOQIQ
ˢ'14ˢ w গ͘͠ͳͬͨʁ w ॲཧΛ࠷దԽ͢Εͬͱ͍͚Δʁ
ͦͯ͠ɺϝχʔίΞ
ϚϧνίΞ $PSF $PSF $PSF $PSF γϯάϧίΞ $PSF ϝχʔίΞ
ϝχʔίΞ w େྔͷίΞΛ࣋ͭϓϩηοαͰܭࢉ w (16/7*%*" ".% *OUFM *NBHJOBUJPO w *OUFM9FPO1IJ
(16Ͱը૾ॲཧ!J04 w J1IPOFͷ(161PXFS73 w $PSF*NBHFGSBNFXPSLͷ$*'JMUFS w "DDFMFSBUFGSBNFXPSLͷW*NBHF w 0QFO$-ʢJ04Ͱ͍ʹͳΒͳ͍ʣ w
0QFO(-(-4-Ͱ͕ΜΔʢ໘ʜʣ 6*&WPMVUJPOதౡ૱ࢯͷ7JEFP4IBEFSΞϓϦ(16*NBHFϥΠϒϥϦ(-4-Ͱ͕Μͬͯ·͢
$*'JMUFS ˢˢ'14ˢˢ ʂ CIImage * src = [CIImage imageWithCVPixelBuffer:imageBuffer]; CIFilter
* filter = [CIFilter filterWithName:@"CIGaussianBlur"]; [filter setValue:src forKey:@"inputImage"]; [filter setValue:[NSNumber numberWithFloat:1.f] forKey:@"inputRadius"]; CIImage * dst = filter.outputImage; ˞ΧʔωϧαΠζ͕ෆ໌ͷͨΊຊདྷൺֱ͖͢Ͱͳ͍͕ʜ
W*NBHF ˢˢˢ'14ˢˢˢ രʂ const vImage_Buffer src = { CVPixelBufferGetBaseAddress(buffer), height,
width, bytesPerRow }; const vImage_Buffer dst = { malloc(bufferSize), height, width, bytesPerRow }; Pixel_8888 backgroundColor = {0,0,0,0}; vImageConvolve_ARGB8888(&src, &dst, NULL, 0, 0, gaussianKernel, 7, 7, divisor, backgroundColor, kvImageCopyInPlace);
(16͏Ͱ͠ΐʂ
ͪͳΈʹ0QFO$7 ˠ'14 w ී௨ʹ$16Ͱԋࢉ w $6%"࣮͕͋ΔΒ͍͠HQV(QV.BU w 0QFO$-࣮͕͋ΔΒ͍͠PDM.BU cv::Mat src
= cv::Mat(height, width, CV_8UC4, baseAddress); cv::Mat dst = cv::Mat(height, width, CV_8UC4); cv::Size kernelSize(7, 7); cv::GaussianBlur(src, dst, kernelSize, 1.f);
͓ΘΓ