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
How to contribute android-gpuimage
Search
Yuji Koketsu
November 16, 2018
Programming
680
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How to contribute android-gpuimage
Yuji Koketsu
November 16, 2018
More Decks by Yuji Koketsu
See All by Yuji Koketsu
AutoSizingTextView
kettsun0123
0
230
Replace with dagger.android
kettsun0123
0
2.4k
Android Instant Apps or Progressive Web Apps
kettsun0123
1
490
Other Decks in Programming
See All in Programming
No More NoSuchMethodError
exoego
1
120
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
7.1k
Kotlinの15年とServer-Side Kotlin
n_takehata
1
180
PyConTW 2026 - AI Coding 不只是工具升級, 區域醫院醫療資訊系統協作開發與資訊團隊轉型實踐
cclai999
0
210
続・コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions-again
handlename
0
160
Performance Optimization With LLMs
xleitix
0
230
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
12
7.8k
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.3k
dotNET_vulnclicker_intro.pdf
deka_morita
0
160
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
1.7k
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
390
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
260
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
4k
How GitHub (no longer) Works
holman
316
150k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
640
First, design no harm
axbom
PRO
2
1.4k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
780
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
550
Joys of Absence: A Defence of Solitary Play
codingconduct
1
560
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
390
Become a Pro
speakerdeck
PRO
31
6.3k
Transcript
How to contribute android-gpuimage
About Me Yuji Koketsu @kettsun0123 CATS
android-gpuimageͱ GPUImage2͕ͱʹͳ͍ͬͯΔFilterΛ͔͚Δ ϥΠϒϥϦ
࣍ 1. ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. ·ͱΊ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ ࠷؆୯ͳContributeFilterΛՃ͢Δ͜ͱ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ ·ͩ·ͩFilter͕Γͳ͍
ࠓ͙͢Ͱ͖Δʂcontributeͷํ GPUImage2(iOS)ΛࢀߟʹFilterΛ࡞ͬͯPRΛग़͢
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 1. Ճ͢ΔFilterΛܾΊΔ 2. ຊՈGPUImage2ΛࢀߟʹFilterΛ࣮͢Δ 3. sampleͰ࡞ͬͨFilterΛ͑ΔΑ͏ʹ͢Δ 4. PRΛग़͢
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 1. Ճ͢ΔFilterΛܾΊΔ README͔ΒબͿ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ GPUImage2/framework/Source/Operations/Shaders
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ varying highp vec2 textureCoordinate; uniform sampler2D inputImageTexture;
uniform highp float threshold; const highp vec3 W = vec3(0.2125, 0.7154, 0.0721); void main() { highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); highp float luminance = dot(textureColor.rgb, W); highp float thresholdResult = step(luminance, threshold); highp vec3 finalColor = abs(thresholdResult - textureColor.rgb); gl_FragColor = vec4(finalColor, textureColor.w); } Operations/Shaders/Solarize_GLES.fsh
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ public static final String SOLARIZE_FRAGMENT_SHADER = ""
+ "varying highp vec2 textureCoordinate;\n" + "\n" + "uniform sampler2D inputImageTexture;\n" + "uniform highp float threshold;\n" + "\n" + "const highp vec3 W = vec3(0.2125, 0.7154, 0.0721);\n" + "\n" + "void main()\n" + "{\n" + " highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + " highp float luminance = dot(textureColor.rgb, W);\n" + " highp float thresholdResult = step(luminance, threshold);\n" + " highp vec3 finalColor = abs(thresholdResult - textureColor.rgb);\n" + " \n" + " gl_FragColor = vec4(finalColor, textureColor.w);\n" + "}"; /filter/GPUImageSolarizeFilter.java
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ public static final String SOLARIZE_FRAGMENT_SHADER = ""
+ "varying highp vec2 textureCoordinate;\n" + "\n" + "uniform sampler2D inputImageTexture;\n" + "uniform highp float threshold;\n" + "\n" + "const highp vec3 W = vec3(0.2125, 0.7154, 0.0721);\n" + "\n" + "void main()\n" + "{\n" + " highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + " highp float luminance = dot(textureColor.rgb, W);\n" + " highp float thresholdResult = step(luminance, threshold);\n" + " highp vec3 finalColor = abs(thresholdResult - textureColor.rgb);\n" + " \n" + " gl_FragColor = vec4(finalColor, textureColor.w);\n" + "}"; /filter/GPUImageSolarizeFilter.java มΛ४උ͢Δ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ /filter/GPUImageSolarizeFilter.java @Override public void onInit() { super.onInit();
uniformThresholdLocation = GLES20.glGetUniformLocation(getProgram(), "threshold"); }
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 2. FilterΛ࣮͢Δ /filter/GPUImageSolarizeFilter.java @Override public void onInitialized() { super.onInitialized();
setThreshold(threshold); } public void setThreshold(final float threshold) { this.threshold = threshold; setFloat(uniformThresholdLocation, threshold); } ֎෦͔ΒΛͤΔΑ͏ʹ͢Δ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ sample/GPUImageFilterTools.kt FilterTypeʹՃ private enum class FilterType {
CONTRAST, GRAYSCALE, SHARPEN, SEPIA, SOBEL_EDGE_DETECTION, THRESHOLD_EDGE_DETECTION, THREE_X_THREE_CONVOLUTION, FILTER_GROUP, EMBOSS, …, SOLARIZE }
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ fun showDialog( context: Context, listener: (filter: GPUImageFilter)
-> Unit ) { val filters = FilterList().apply { addFilter("Contrast", FilterType.CONTRAST) addFilter("Invert", FilterType.INVERT) addFilter("Pixelation", FilterType.PIXELATION) addFilter("Hue", FilterType.HUE) addFilter("Gamma", FilterType.GAMMA) addFilter("Brightness", FilterType.BRIGHTNESS) addFilter("Sepia", FilterType.SEPIA) addFilter("Grayscale", FilterType.GRAYSCALE) … addFilter("Solarize", FilterType.SOLARIZE) } … } sample/GPUImageFilterTools.kt FilterListʹՃ
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ sample/GPUImageFilterTools.kt ࡞ͬͨFilterΛબͰ͖ΔΑ͏ʹ private fun createFilterForType(context: Context, type:
FilterType): GPUImageFilter { return when (type) { FilterType.CONTRAST -> GPUImageContrastFilter(2.0f) FilterType.GAMMA -> GPUImageGammaFilter(2.0f) FilterType.INVERT -> GPUImageColorInvertFilter() FilterType.PIXELATION -> GPUImagePixelationFilter() FilterType.HUE -> GPUImageHueFilter(90.0f) FilterType.BRIGHTNESS -> GPUImageBrightnessFilter(1.5f) FilterType.GRAYSCALE -> GPUImageGrayscaleFilter() FilterType.LEVELS_FILTER_MIN -> GPUImageLevelsFilter() FilterType.HALFTONE -> GPUImageHalftoneFilter() FilterType.BILATERAL_BLUR -> GPUImageBilateralBlurFilter() FilterType.TRANSFORM2D -> GPUImageTransformFilter() … FilterType.SOLARIZE -> GPUImageSolarizeFilter() } }
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ Ϧετʹදࣔ͞ΕΔΑ͏ʹͳΓ·ͨ͠
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ ͜ͷ··Ͱ֬ೝͰ͖ͳ͍ͷͰ AdjusterΛ࡞ͬͯFilterͱͯ͠ಈ͔͢
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ sample/GPUImageFilterTools.kt AdjusterΫϥεΛ࡞ class FilterAdjuster(filter: GPUImageFilter) { …
private inner class BilateralAdjuster(filter: GPUImageBilateralBlurFilter) : Adjuster<GPUImageBilateralBlurFilter>(filter) { override fun adjust(percentage: Int) { filter.setDistanceNormalizationFactor(range(percentage, 0.0f, 15.0f)) } } … private inner class SolarizeAdjuster(filter: GPUImageSolarizeFilter) : Adjuster<GPUImageSolarizeFilter>(filter) { override fun adjust(percentage: Int) { filter.setThreshold(range(percentage, 0.0f, 1.0f)) } } }
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ sample/GPUImageFilterTools.kt ࡞ͬͨAdjusterΛՃ class FilterAdjuster(filter: GPUImageFilter) { private
val adjuster: Adjuster<out GPUImageFilter>? init { adjuster = when (filter) { … is GPUImageLevelsFilter -> LevelsMinMidAdjuster(filter) is GPUImageBilateralBlurFilter -> BilateralAdjuster(filter) is GPUImageTransformFilter -> RotateAdjuster(filter) is GPUImageSolarizeFilter -> SolarizeAdjuster(filter) else -> null } }
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 3. sampleͰࢼͤΔΑ͏ʹ͢Δ ಈ͖·ͨ͠
ࠓ͙͢Ͱ͖Δʂcontributeͷํ 4. PRΛग़͢ - [x] Color Inversion - [x] Solarize
- [x] Vibrance - [x] Highlight and Shadow Tint ࡞ͬͨFilterͷCheckboxΛΕͣʹ㾎
ࠓ͙͢Ͱ͖Δʂcontributeͷํ ௨ৗͷखॱͰPRΛग़ͤOK 4. PRΛग़͢
ࠓ͙͢Ͱ͖Δʂcontributeͷํ CLA͕ඞཁͳͷͰɺCONTRIBUTING.mdͷϦϯΫ͔Β 4. PRΛग़͢
·ͱΊ
·ͱΊ 1. Ճ͢ΔFilterΛܾΊΔ 2. ຊՈGPUImage2ΛࢀߟʹFilterΛ࣮͢Δ 3. sampleͰ࡞ͬͨFilterΛ͑ΔΑ͏ʹ͢Δ 4. PRΛग़͢ ※࠶ܝ
·ͱΊ ͱͯ؆୯
·ͱΊ Thanks:)