You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
4.6 KiB
62 lines
4.6 KiB
2 years ago
|
.class public Lcom/via/gpuimage/GPUImageSobelEdgeDetection;
|
||
|
.super Lcom/via/gpuimage/GPUImageFilterGroup;
|
||
|
.source "GPUImageSobelEdgeDetection.java"
|
||
|
|
||
|
|
||
|
# static fields
|
||
|
.field public static final SOBEL_EDGE_DETECTION:Ljava/lang/String; = "precision mediump float;\n\nvarying vec2 textureCoordinate;\nvarying vec2 leftTextureCoordinate;\nvarying vec2 rightTextureCoordinate;\n\nvarying vec2 topTextureCoordinate;\nvarying vec2 topLeftTextureCoordinate;\nvarying vec2 topRightTextureCoordinate;\n\nvarying vec2 bottomTextureCoordinate;\nvarying vec2 bottomLeftTextureCoordinate;\nvarying vec2 bottomRightTextureCoordinate;\n\nuniform sampler2D inputImageTexture;\n\nvoid main()\n{\n float bottomLeftIntensity = texture2D(inputImageTexture, bottomLeftTextureCoordinate).r;\n float topRightIntensity = texture2D(inputImageTexture, topRightTextureCoordinate).r;\n float topLeftIntensity = texture2D(inputImageTexture, topLeftTextureCoordinate).r;\n float bottomRightIntensity = texture2D(inputImageTexture, bottomRightTextureCoordinate).r;\n float leftIntensity = texture2D(inputImageTexture, leftTextureCoordinate).r;\n float rightIntensity = texture2D(inputImageTexture, rightTextureCoordinate).r;\n float bottomIntensity = texture2D(inputImageTexture, bottomTextureCoordinate).r;\n float topIntensity = texture2D(inputImageTexture, topTextureCoordinate).r;\n float h = -topLeftIntensity - 2.0 * topIntensity - topRightIntensity + bottomLeftIntensity + 2.0 * bottomIntensity + bottomRightIntensity;\n float v = -bottomLeftIntensity - 2.0 * leftIntensity - topLeftIntensity + bottomRightIntensity + 2.0 * rightIntensity + topRightIntensity;\n\n float mag = length(vec2(h, v));\n\n gl_FragColor = vec4(vec3(mag), 1.0);\n}"
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method public constructor <init>()V
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 46
|
||
|
invoke-direct {p0}, Lcom/via/gpuimage/GPUImageFilterGroup;-><init>()V
|
||
|
|
||
|
.line 47
|
||
|
new-instance v0, Lcom/via/gpuimage/GPUImageGrayscaleFilter;
|
||
|
|
||
|
invoke-direct {v0}, Lcom/via/gpuimage/GPUImageGrayscaleFilter;-><init>()V
|
||
|
|
||
|
invoke-virtual {p0, v0}, Lcom/via/gpuimage/GPUImageSobelEdgeDetection;->addFilter(Lcom/via/gpuimage/GPUImageFilter;)V
|
||
|
|
||
|
.line 48
|
||
|
new-instance v0, Lcom/via/gpuimage/GPUImage3x3TextureSamplingFilter;
|
||
|
|
||
|
const-string v1, "precision mediump float;\n\nvarying vec2 textureCoordinate;\nvarying vec2 leftTextureCoordinate;\nvarying vec2 rightTextureCoordinate;\n\nvarying vec2 topTextureCoordinate;\nvarying vec2 topLeftTextureCoordinate;\nvarying vec2 topRightTextureCoordinate;\n\nvarying vec2 bottomTextureCoordinate;\nvarying vec2 bottomLeftTextureCoordinate;\nvarying vec2 bottomRightTextureCoordinate;\n\nuniform sampler2D inputImageTexture;\n\nvoid main()\n{\n float bottomLeftIntensity = texture2D(inputImageTexture, bottomLeftTextureCoordinate).r;\n float topRightIntensity = texture2D(inputImageTexture, topRightTextureCoordinate).r;\n float topLeftIntensity = texture2D(inputImageTexture, topLeftTextureCoordinate).r;\n float bottomRightIntensity = texture2D(inputImageTexture, bottomRightTextureCoordinate).r;\n float leftIntensity = texture2D(inputImageTexture, leftTextureCoordinate).r;\n float rightIntensity = texture2D(inputImageTexture, rightTextureCoordinate).r;\n float bottomIntensity = texture2D(inputImageTexture, bottomTextureCoordinate).r;\n float topIntensity = texture2D(inputImageTexture, topTextureCoordinate).r;\n float h = -topLeftIntensity - 2.0 * topIntensity - topRightIntensity + bottomLeftIntensity + 2.0 * bottomIntensity + bottomRightIntensity;\n float v = -bottomLeftIntensity - 2.0 * leftIntensity - topLeftIntensity + bottomRightIntensity + 2.0 * rightIntensity + topRightIntensity;\n\n float mag = length(vec2(h, v));\n\n gl_FragColor = vec4(vec3(mag), 1.0);\n}"
|
||
|
|
||
|
invoke-direct {v0, v1}, Lcom/via/gpuimage/GPUImage3x3TextureSamplingFilter;-><init>(Ljava/lang/String;)V
|
||
|
|
||
|
invoke-virtual {p0, v0}, Lcom/via/gpuimage/GPUImageSobelEdgeDetection;->addFilter(Lcom/via/gpuimage/GPUImageFilter;)V
|
||
|
|
||
|
.line 49
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
|
||
|
# virtual methods
|
||
|
.method public setLineSize(F)V
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 52
|
||
|
invoke-virtual {p0}, Lcom/via/gpuimage/GPUImageSobelEdgeDetection;->getFilters()Ljava/util/List;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const/4 v1, 0x1
|
||
|
|
||
|
invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
check-cast v0, Lcom/via/gpuimage/GPUImage3x3TextureSamplingFilter;
|
||
|
|
||
|
invoke-virtual {v0, p1}, Lcom/via/gpuimage/GPUImage3x3TextureSamplingFilter;->setLineSize(F)V
|
||
|
|
||
|
.line 53
|
||
|
return-void
|
||
|
.end method
|