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
How to contribute android-gpuimage
Search
Yuji Koketsu
November 16, 2018
Programming
660
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
470
Other Decks in Programming
See All in Programming
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
820
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
230
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
2
640
SLOをサービス品質の共通言語にするために 取り組んできたこと
wakana0222
0
270
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
630
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
200
どこまでゆるくて許されるのか
tk3fftk
0
300
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.7k
Creating Composable Callables in Contemporary C++
rollbear
0
180
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
210
The NotImplementedError Problem in Ruby
koic
1
1.1k
Performance Engineering for Everyone
elenatanasoiu
0
250
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Everyday Curiosity
cassininazir
0
250
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
210
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
370
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
760
KATA
mclloyd
PRO
35
15k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
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:)