Revert of Android GlRectDrawer: Add test for RGB rendering (patchset #3 id:40001 of https://codereview.webrtc.org/1367923002/ )
Reason for revert:
The test fails on Nexus 9.
Original issue's description:
> Android GlRectDrawer: Add test for RGB rendering
>
> BUG=webrtc:4742
> R=hbos@webrtc.org
>
> Committed: https://crrev.com/6b20ad99e04f594a9a131bea5d80940698e6e8fd
> Cr-Commit-Position: refs/heads/master@{#10050}
TBR=hbos@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4742
Review URL: https://codereview.webrtc.org/1363613003
Cr-Commit-Position: refs/heads/master@{#10058}
diff --git a/talk/app/webrtc/androidtests/src/org/webrtc/GlRectDrawerTest.java b/talk/app/webrtc/androidtests/src/org/webrtc/GlRectDrawerTest.java
index c28b5d1..71bd5e3 100644
--- a/talk/app/webrtc/androidtests/src/org/webrtc/GlRectDrawerTest.java
+++ b/talk/app/webrtc/androidtests/src/org/webrtc/GlRectDrawerTest.java
@@ -53,71 +53,10 @@
return 255.0f * Math.max(0, Math.min(c, 1));
}
- // Assert RGB ByteBuffers are pixel perfect identical.
- private static void assertEquals(int width, int height, ByteBuffer actual, ByteBuffer expected) {
- actual.rewind();
- expected.rewind();
- assertEquals(actual.capacity(), width * height * 3);
- assertEquals(expected.capacity(), width * height * 3);
- for (int y = 0; y < HEIGHT; ++y) {
- for (int x = 0; x < WIDTH; ++x) {
- final int actualR = actual.get() & 0xFF;
- final int actualG = actual.get() & 0xFF;
- final int actualB = actual.get() & 0xFF;
- final int expectedR = expected.get() & 0xFF;
- final int expectedG = expected.get() & 0xFF;
- final int expectedB = expected.get() & 0xFF;
- if (actualR != expectedR || actualG != expectedG || actualB != expectedB) {
- fail("ByteBuffers of size " + width + "x" + height + " not equal at position "
- + "(" + x + ", " + y + "). Expected color (R,G,B): "
- + "(" + expectedR + ", " + expectedG + ", " + expectedB + ")"
- + " but was: " + "(" + actualR + ", " + actualG + ", " + actualB + ").");
- }
- }
- }
- }
-
- @SmallTest
- public void testRgbRendering() throws Exception {
- // Create EGL base with a pixel buffer as display output.
- final EglBase eglBase = new EglBase(EGL14.EGL_NO_CONTEXT, EglBase.ConfigType.PIXEL_BUFFER);
- eglBase.createPbufferSurface(WIDTH, HEIGHT);
- eglBase.makeCurrent();
-
- // Create RGB byte buffer plane with random content.
- final ByteBuffer rgbPlane = ByteBuffer.allocateDirect(WIDTH * HEIGHT * 3);
- final Random random = new Random(SEED);
- random.nextBytes(rgbPlane.array());
-
- // Upload the RGB byte buffer data as a texture.
- final int rgbTexture = GlUtil.generateTexture(GLES20.GL_TEXTURE_2D);
- GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
- GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, rgbTexture);
- GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGB, WIDTH,
- HEIGHT, 0, GLES20.GL_RGB, GLES20.GL_UNSIGNED_BYTE, rgbPlane);
-
- // Draw the RGB frame onto the pixel buffer.
- final GlRectDrawer drawer = new GlRectDrawer();
- final float[] identityMatrix = new float[16];
- Matrix.setIdentityM(identityMatrix, 0);
- drawer.drawRgb(rgbTexture, identityMatrix);
-
- // Download the pixels in the pixel buffer as RGB.
- final ByteBuffer data = ByteBuffer.allocateDirect(WIDTH * HEIGHT * 3);
- GLES20.glReadPixels(0, 0, WIDTH, HEIGHT, GLES20.GL_RGB, GLES20.GL_UNSIGNED_BYTE, data);
-
- // Assert rendered image is pixel perfect to source RGB.
- assertEquals(WIDTH, HEIGHT, data, rgbPlane);
-
- drawer.release();
- GLES20.glDeleteTextures(1, new int[] {rgbTexture}, 0);
- eglBase.release();
- }
-
@SmallTest
public void testYuvRendering() throws Exception {
// Create EGL base with a pixel buffer as display output.
- EglBase eglBase = new EglBase(EGL14.EGL_NO_CONTEXT, EglBase.ConfigType.PIXEL_BUFFER);
+ EglBase eglBase = eglBase = new EglBase(EGL14.EGL_NO_CONTEXT, EglBase.ConfigType.PIXEL_BUFFER);
eglBase.createPbufferSurface(WIDTH, HEIGHT);
eglBase.makeCurrent();