2020-05-17 12:40:10 +00:00
|
|
|
.class public Lorg/webrtc/YuvConverter;
|
|
|
|
.super Ljava/lang/Object;
|
|
|
|
.source "YuvConverter.java"
|
|
|
|
|
|
|
|
|
|
|
|
# annotations
|
|
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
|
|
value = {
|
|
|
|
Lorg/webrtc/YuvConverter$ShaderCallbacks;
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
|
|
|
|
# static fields
|
|
|
|
.field public static final FRAGMENT_SHADER:Ljava/lang/String; = "uniform vec2 xUnit;\nuniform vec4 coeffs;\n\nvoid main() {\n gl_FragColor.r = coeffs.a + dot(coeffs.rgb,\n sample(tc - 1.5 * xUnit).rgb);\n gl_FragColor.g = coeffs.a + dot(coeffs.rgb,\n sample(tc - 0.5 * xUnit).rgb);\n gl_FragColor.b = coeffs.a + dot(coeffs.rgb,\n sample(tc + 0.5 * xUnit).rgb);\n gl_FragColor.a = coeffs.a + dot(coeffs.rgb,\n sample(tc + 1.5 * xUnit).rgb);\n}\n"
|
|
|
|
|
|
|
|
|
|
|
|
# instance fields
|
|
|
|
.field public final drawer:Lorg/webrtc/GlGenericDrawer;
|
|
|
|
|
|
|
|
.field public final i420TextureFrameBuffer:Lorg/webrtc/GlTextureFrameBuffer;
|
|
|
|
|
|
|
|
.field public final shaderCallbacks:Lorg/webrtc/YuvConverter$ShaderCallbacks;
|
|
|
|
|
|
|
|
.field public final threadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker;
|
|
|
|
|
|
|
|
|
|
|
|
# direct methods
|
|
|
|
.method public constructor <init>()V
|
|
|
|
.locals 3
|
|
|
|
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
|
|
|
|
new-instance v0, Lorg/webrtc/ThreadUtils$ThreadChecker;
|
|
|
|
|
|
|
|
invoke-direct {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;-><init>()V
|
|
|
|
|
|
|
|
iput-object v0, p0, Lorg/webrtc/YuvConverter;->threadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker;
|
|
|
|
|
|
|
|
new-instance v0, Lorg/webrtc/GlTextureFrameBuffer;
|
|
|
|
|
|
|
|
const/16 v1, 0x1908
|
|
|
|
|
|
|
|
invoke-direct {v0, v1}, Lorg/webrtc/GlTextureFrameBuffer;-><init>(I)V
|
|
|
|
|
|
|
|
iput-object v0, p0, Lorg/webrtc/YuvConverter;->i420TextureFrameBuffer:Lorg/webrtc/GlTextureFrameBuffer;
|
|
|
|
|
|
|
|
new-instance v0, Lorg/webrtc/YuvConverter$ShaderCallbacks;
|
|
|
|
|
|
|
|
const/4 v1, 0x0
|
|
|
|
|
|
|
|
invoke-direct {v0, v1}, Lorg/webrtc/YuvConverter$ShaderCallbacks;-><init>(Lorg/webrtc/YuvConverter$1;)V
|
|
|
|
|
|
|
|
iput-object v0, p0, Lorg/webrtc/YuvConverter;->shaderCallbacks:Lorg/webrtc/YuvConverter$ShaderCallbacks;
|
|
|
|
|
|
|
|
new-instance v0, Lorg/webrtc/GlGenericDrawer;
|
|
|
|
|
|
|
|
iget-object v1, p0, Lorg/webrtc/YuvConverter;->shaderCallbacks:Lorg/webrtc/YuvConverter$ShaderCallbacks;
|
|
|
|
|
|
|
|
const-string v2, "uniform vec2 xUnit;\nuniform vec4 coeffs;\n\nvoid main() {\n gl_FragColor.r = coeffs.a + dot(coeffs.rgb,\n sample(tc - 1.5 * xUnit).rgb);\n gl_FragColor.g = coeffs.a + dot(coeffs.rgb,\n sample(tc - 0.5 * xUnit).rgb);\n gl_FragColor.b = coeffs.a + dot(coeffs.rgb,\n sample(tc + 0.5 * xUnit).rgb);\n gl_FragColor.a = coeffs.a + dot(coeffs.rgb,\n sample(tc + 1.5 * xUnit).rgb);\n}\n"
|
|
|
|
|
|
|
|
invoke-direct {v0, v2, v1}, Lorg/webrtc/GlGenericDrawer;-><init>(Ljava/lang/String;Lorg/webrtc/GlGenericDrawer$ShaderCallbacks;)V
|
|
|
|
|
|
|
|
iput-object v0, p0, Lorg/webrtc/YuvConverter;->drawer:Lorg/webrtc/GlGenericDrawer;
|
|
|
|
|
|
|
|
iget-object v0, p0, Lorg/webrtc/YuvConverter;->threadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->detachThread()V
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
|
|
|
|
# virtual methods
|
|
|
|
.method public convert(Lorg/webrtc/VideoFrame$TextureBuffer;)Lorg/webrtc/VideoFrame$I420Buffer;
|
|
|
|
.locals 17
|
|
|
|
|
|
|
|
move-object/from16 v0, p0
|
|
|
|
|
|
|
|
iget-object v1, v0, Lorg/webrtc/YuvConverter;->threadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker;
|
|
|
|
|
|
|
|
invoke-virtual {v1}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V
|
|
|
|
|
|
|
|
invoke-interface/range {p1 .. p1}, Lorg/webrtc/VideoFrame$Buffer;->getWidth()I
|
|
|
|
|
|
|
|
move-result v1
|
|
|
|
|
|
|
|
invoke-interface/range {p1 .. p1}, Lorg/webrtc/VideoFrame$Buffer;->getHeight()I
|
|
|
|
|
|
|
|
move-result v11
|
|
|
|
|
|
|
|
add-int/lit8 v2, v1, 0x7
|
|
|
|
|
|
|
|
div-int/lit8 v2, v2, 0x8
|
|
|
|
|
|
|
|
mul-int/lit8 v12, v2, 0x8
|
|
|
|
|
|
|
|
add-int/lit8 v2, v11, 0x1
|
|
|
|
|
|
|
|
div-int/lit8 v13, v2, 0x2
|
|
|
|
|
|
|
|
add-int v2, v11, v13
|
|
|
|
|
|
|
|
mul-int v3, v12, v2
|
|
|
|
|
|
|
|
invoke-static {v3}, Lorg/webrtc/JniCommon;->nativeAllocateByteBuffer(I)Ljava/nio/ByteBuffer;
|
|
|
|
|
|
|
|
move-result-object v14
|
|
|
|
|
|
|
|
div-int/lit8 v15, v12, 0x4
|
|
|
|
|
|
|
|
new-instance v10, Landroid/graphics/Matrix;
|
|
|
|
|
|
|
|
invoke-direct {v10}, Landroid/graphics/Matrix;-><init>()V
|
|
|
|
|
|
|
|
const/high16 v3, 0x3f000000 # 0.5f
|
|
|
|
|
|
|
|
invoke-virtual {v10, v3, v3}, Landroid/graphics/Matrix;->preTranslate(FF)Z
|
|
|
|
|
|
|
|
const/high16 v3, 0x3f800000 # 1.0f
|
|
|
|
|
|
|
|
const/high16 v4, -0x40800000 # -1.0f
|
|
|
|
|
|
|
|
invoke-virtual {v10, v3, v4}, Landroid/graphics/Matrix;->preScale(FF)Z
|
|
|
|
|
|
|
|
const/high16 v3, -0x41000000 # -0.5f
|
|
|
|
|
|
|
|
invoke-virtual {v10, v3, v3}, Landroid/graphics/Matrix;->preTranslate(FF)Z
|
|
|
|
|
|
|
|
iget-object v3, v0, Lorg/webrtc/YuvConverter;->i420TextureFrameBuffer:Lorg/webrtc/GlTextureFrameBuffer;
|
|
|
|
|
|
|
|
invoke-virtual {v3, v15, v2}, Lorg/webrtc/GlTextureFrameBuffer;->setSize(II)V
|
|
|
|
|
|
|
|
iget-object v2, v0, Lorg/webrtc/YuvConverter;->i420TextureFrameBuffer:Lorg/webrtc/GlTextureFrameBuffer;
|
|
|
|
|
|
|
|
invoke-virtual {v2}, Lorg/webrtc/GlTextureFrameBuffer;->getFrameBufferId()I
|
|
|
|
|
|
|
|
move-result v2
|
|
|
|
|
|
|
|
const v9, 0x8d40
|
|
|
|
|
|
|
|
invoke-static {v9, v2}, Landroid/opengl/GLES20;->glBindFramebuffer(II)V
|
|
|
|
|
|
|
|
const-string v2, "glBindFramebuffer"
|
|
|
|
|
|
|
|
invoke-static {v2}, Lorg/webrtc/GlUtil;->checkNoGLES2Error(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
iget-object v2, v0, Lorg/webrtc/YuvConverter;->shaderCallbacks:Lorg/webrtc/YuvConverter$ShaderCallbacks;
|
|
|
|
|
|
|
|
invoke-virtual {v2}, Lorg/webrtc/YuvConverter$ShaderCallbacks;->setPlaneY()V
|
|
|
|
|
|
|
|
iget-object v2, v0, Lorg/webrtc/YuvConverter;->drawer:Lorg/webrtc/GlGenericDrawer;
|
|
|
|
|
|
|
|
const/4 v7, 0x0
|
|
|
|
|
|
|
|
const/4 v8, 0x0
|
|
|
|
|
|
|
|
move-object/from16 v3, p1
|
|
|
|
|
|
|
|
move-object v4, v10
|
|
|
|
|
|
|
|
move v5, v1
|
|
|
|
|
|
|
|
move v6, v11
|
|
|
|
|
|
|
|
move v9, v15
|
|
|
|
|
|
|
|
move-object/from16 v16, v10
|
|
|
|
|
|
|
|
move v10, v11
|
|
|
|
|
|
|
|
invoke-static/range {v2 .. v10}, Lorg/webrtc/VideoFrameDrawer;->drawTexture(Lorg/webrtc/RendererCommon$GlDrawer;Lorg/webrtc/VideoFrame$TextureBuffer;Landroid/graphics/Matrix;IIIIII)V
|
|
|
|
|
|
|
|
iget-object v2, v0, Lorg/webrtc/YuvConverter;->shaderCallbacks:Lorg/webrtc/YuvConverter$ShaderCallbacks;
|
|
|
|
|
|
|
|
invoke-virtual {v2}, Lorg/webrtc/YuvConverter$ShaderCallbacks;->setPlaneU()V
|
|
|
|
|
|
|
|
iget-object v2, v0, Lorg/webrtc/YuvConverter;->drawer:Lorg/webrtc/GlGenericDrawer;
|
|
|
|
|
|
|
|
div-int/lit8 v15, v15, 0x2
|
|
|
|
|
|
|
|
move-object/from16 v4, v16
|
|
|
|
|
|
|
|
move v8, v11
|
|
|
|
|
|
|
|
move v9, v15
|
|
|
|
|
|
|
|
move v10, v13
|
|
|
|
|
|
|
|
invoke-static/range {v2 .. v10}, Lorg/webrtc/VideoFrameDrawer;->drawTexture(Lorg/webrtc/RendererCommon$GlDrawer;Lorg/webrtc/VideoFrame$TextureBuffer;Landroid/graphics/Matrix;IIIIII)V
|
|
|
|
|
|
|
|
iget-object v2, v0, Lorg/webrtc/YuvConverter;->shaderCallbacks:Lorg/webrtc/YuvConverter$ShaderCallbacks;
|
|
|
|
|
|
|
|
invoke-virtual {v2}, Lorg/webrtc/YuvConverter$ShaderCallbacks;->setPlaneV()V
|
|
|
|
|
|
|
|
iget-object v2, v0, Lorg/webrtc/YuvConverter;->drawer:Lorg/webrtc/GlGenericDrawer;
|
|
|
|
|
|
|
|
move v7, v15
|
|
|
|
|
|
|
|
invoke-static/range {v2 .. v10}, Lorg/webrtc/VideoFrameDrawer;->drawTexture(Lorg/webrtc/RendererCommon$GlDrawer;Lorg/webrtc/VideoFrame$TextureBuffer;Landroid/graphics/Matrix;IIIIII)V
|
|
|
|
|
|
|
|
iget-object v2, v0, Lorg/webrtc/YuvConverter;->i420TextureFrameBuffer:Lorg/webrtc/GlTextureFrameBuffer;
|
|
|
|
|
|
|
|
invoke-virtual {v2}, Lorg/webrtc/GlTextureFrameBuffer;->getWidth()I
|
|
|
|
|
|
|
|
move-result v6
|
|
|
|
|
|
|
|
iget-object v2, v0, Lorg/webrtc/YuvConverter;->i420TextureFrameBuffer:Lorg/webrtc/GlTextureFrameBuffer;
|
|
|
|
|
|
|
|
invoke-virtual {v2}, Lorg/webrtc/GlTextureFrameBuffer;->getHeight()I
|
|
|
|
|
|
|
|
move-result v7
|
|
|
|
|
|
|
|
const/4 v4, 0x0
|
|
|
|
|
|
|
|
const/4 v5, 0x0
|
|
|
|
|
|
|
|
const/16 v8, 0x1908
|
|
|
|
|
|
|
|
const/16 v9, 0x1401
|
|
|
|
|
|
|
|
move-object v10, v14
|
|
|
|
|
|
|
|
invoke-static/range {v4 .. v10}, Landroid/opengl/GLES20;->glReadPixels(IIIIIILjava/nio/Buffer;)V
|
|
|
|
|
|
|
|
const-string v2, "YuvConverter.convert"
|
|
|
|
|
|
|
|
invoke-static {v2}, Lorg/webrtc/GlUtil;->checkNoGLES2Error(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
const/4 v2, 0x0
|
|
|
|
|
|
|
|
const v3, 0x8d40
|
|
|
|
|
|
|
|
invoke-static {v3, v2}, Landroid/opengl/GLES20;->glBindFramebuffer(II)V
|
|
|
|
|
|
|
|
mul-int v3, v12, v11
|
|
|
|
|
|
|
|
add-int/2addr v3, v2
|
|
|
|
|
|
|
|
div-int/lit8 v4, v12, 0x2
|
|
|
|
|
|
|
|
add-int v5, v3, v4
|
|
|
|
|
|
|
|
invoke-virtual {v14, v2}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;
|
|
|
|
|
|
|
|
invoke-virtual {v14, v3}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
|
|
|
|
|
|
|
|
invoke-virtual {v14}, Ljava/nio/ByteBuffer;->slice()Ljava/nio/ByteBuffer;
|
|
|
|
|
|
|
|
move-result-object v6
|
|
|
|
|
|
|
|
invoke-virtual {v14, v3}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;
|
|
|
|
|
|
|
|
add-int/lit8 v13, v13, -0x1
|
|
|
|
|
|
|
|
mul-int v13, v13, v12
|
|
|
|
|
|
|
|
add-int/2addr v13, v4
|
|
|
|
|
|
|
|
add-int/2addr v3, v13
|
|
|
|
|
|
|
|
invoke-virtual {v14, v3}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
|
|
|
|
|
|
|
|
invoke-virtual {v14}, Ljava/nio/ByteBuffer;->slice()Ljava/nio/ByteBuffer;
|
|
|
|
|
|
|
|
move-result-object v7
|
|
|
|
|
|
|
|
invoke-virtual {v14, v5}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;
|
|
|
|
|
|
|
|
add-int/2addr v5, v13
|
|
|
|
|
|
|
|
invoke-virtual {v14, v5}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
|
|
|
|
|
|
|
|
invoke-virtual {v14}, Ljava/nio/ByteBuffer;->slice()Ljava/nio/ByteBuffer;
|
|
|
|
|
|
|
|
move-result-object v8
|
|
|
|
|
2020-09-22 06:09:03 +00:00
|
|
|
new-instance v10, Lq0/c/e0;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-22 06:09:03 +00:00
|
|
|
invoke-direct {v10, v14}, Lq0/c/e0;-><init>(Ljava/nio/ByteBuffer;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
move v2, v1
|
|
|
|
|
|
|
|
move v3, v11
|
|
|
|
|
|
|
|
move-object v4, v6
|
|
|
|
|
|
|
|
move v5, v12
|
|
|
|
|
|
|
|
move-object v6, v7
|
|
|
|
|
|
|
|
move v7, v12
|
|
|
|
|
|
|
|
move v9, v12
|
|
|
|
|
|
|
|
invoke-static/range {v2 .. v10}, Lorg/webrtc/JavaI420Buffer;->wrap(IILjava/nio/ByteBuffer;ILjava/nio/ByteBuffer;ILjava/nio/ByteBuffer;ILjava/lang/Runnable;)Lorg/webrtc/JavaI420Buffer;
|
|
|
|
|
|
|
|
move-result-object v1
|
|
|
|
|
|
|
|
return-object v1
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public release()V
|
|
|
|
.locals 1
|
|
|
|
|
|
|
|
iget-object v0, p0, Lorg/webrtc/YuvConverter;->threadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V
|
|
|
|
|
|
|
|
iget-object v0, p0, Lorg/webrtc/YuvConverter;->drawer:Lorg/webrtc/GlGenericDrawer;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Lorg/webrtc/GlGenericDrawer;->release()V
|
|
|
|
|
|
|
|
iget-object v0, p0, Lorg/webrtc/YuvConverter;->i420TextureFrameBuffer:Lorg/webrtc/GlTextureFrameBuffer;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Lorg/webrtc/GlTextureFrameBuffer;->release()V
|
|
|
|
|
|
|
|
iget-object v0, p0, Lorg/webrtc/YuvConverter;->threadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->detachThread()V
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|