Chromium Code Reviews| Index: talk/app/webrtc/androidtests/src/org/webrtc/RendererCommonTest.java |
| diff --git a/talk/app/webrtc/androidtests/src/org/webrtc/RendererCommonTest.java b/talk/app/webrtc/androidtests/src/org/webrtc/RendererCommonTest.java |
| index 28c0f283c3909af15d9af73324ee4807c4c97b1d..e9391c7de629d15483f02adc37ff26ba4aa1b2f1 100644 |
| --- a/talk/app/webrtc/androidtests/src/org/webrtc/RendererCommonTest.java |
| +++ b/talk/app/webrtc/androidtests/src/org/webrtc/RendererCommonTest.java |
| @@ -35,7 +35,8 @@ import android.graphics.Point; |
| import static org.webrtc.RendererCommon.ScalingType.*; |
| import static org.webrtc.RendererCommon.getDisplaySize; |
| -import static org.webrtc.RendererCommon.getTextureMatrix; |
| +import static org.webrtc.RendererCommon.getLayoutMatrix; |
| +import static org.webrtc.RendererCommon.getSamplingMatrix; |
| public class RendererCommonTest extends ActivityTestCase { |
| @SmallTest |
| @@ -101,63 +102,69 @@ public class RendererCommonTest extends ActivityTestCase { |
| } |
| @SmallTest |
| - static public void testTexMatrixDefault() { |
| - final float texMatrix[] = new float[16]; |
| - getTextureMatrix(texMatrix, 0, false, 1.0f, 1.0f); |
| - // TODO(magjed): Every tex matrix contains a vertical flip, because we ignore the texture |
| - // transform matrix from the SurfaceTexture (which contains a vertical flip). Update tests when |
| - // this is fixed. |
| + static public void testLayoutMatrixDefault() { |
| + final float layoutMatrix[] = getLayoutMatrix(false, 1.0f, 1.0f); |
| // Assert: |
| // u' = u. |
| - // v' = 1 - v. |
| - MoreAsserts.assertEquals(round(texMatrix), new double[] |
| + // v' = v. |
| + MoreAsserts.assertEquals(round(layoutMatrix), new double[] |
| {1, 0, 0, 0, |
| - 0, -1, 0, 0, |
| + 0, 1, 0, 0, |
| 0, 0, 1, 0, |
| - 0, 1, 0, 1}); |
| + 0, 0, 0, 1}); |
| } |
| @SmallTest |
| - static public void testTexMatrixMirror() { |
| - final float texMatrix[] = new float[16]; |
| - getTextureMatrix(texMatrix, 0, true, 1.0f, 1.0f); |
| + static public void testLayoutMatrixMirror() { |
| + final float layoutMatrix[] = getLayoutMatrix(true, 1.0f, 1.0f); |
| // Assert: |
| // u' = 1 - u. |
| - // v' = 1 - v. |
| - MoreAsserts.assertEquals(round(texMatrix), new double[] |
| + // v' = v. |
| + MoreAsserts.assertEquals(round(layoutMatrix), new double[] |
| {-1, 0, 0, 0, |
| - 0, -1, 0, 0, |
| - 0, 0, 1, 0, |
| - 1, 1, 0, 1}); |
| + 0, 1, 0, 0, |
| + 0, 0, 1, 0, |
| + 1, 0, 0, 1}); |
|
hbos
2015/09/08 14:08:47
I don't fully understand the matrix values in thes
magjed_webrtc
2015/09/08 15:24:28
Done. Also added comment.
hbos
2015/09/09 08:27:54
Acknowledged.
|
| } |
| @SmallTest |
| - static public void testTexMatrixRotation90Deg() { |
| - final float texMatrix[] = new float[16]; |
| - getTextureMatrix(texMatrix, 90, false, 1.0f, 1.0f); |
| + static public void testLayoutMatrixScale() { |
| + // Video has aspect ratio 2, but layout is square. This will cause only the center part of the |
| + // video to be visible, i.e. the u coordinate will go from 0.25 to 0.75 instead of from 0 to 1. |
| + final float layoutMatrix[] = getLayoutMatrix(false, 2.0f, 1.0f); |
| // Assert: |
| - // u' = 1 - v. |
| - // v' = 1 - u. |
| - MoreAsserts.assertEquals(round(texMatrix), new double[] |
| - {0, -1, 0, 0, |
| - -1, 0, 0, 0, |
| - 0, 0, 1, 0, |
| - 1, 1, 0, 1}); |
| + // u' = 0.25 + 0.5 u. |
| + // v' = v. |
| + MoreAsserts.assertEquals(round(layoutMatrix), new double[] |
| + { 0.5, 0, 0, 0, |
| + 0, 1, 0, 0, |
| + 0, 0, 1, 0, |
| + 0.25, 0, 0, 1}); |
| } |
| @SmallTest |
| - static public void testTexMatrixScale() { |
| - final float texMatrix[] = new float[16]; |
| - // Video has aspect ratio 2, but layout is square. This will cause only the center part of the |
| - // video to be visible, i.e. the u coordinate will go from 0.25 to 0.75 instead of from 0 to 1. |
| - getTextureMatrix(texMatrix, 0, false, 2.0f, 1.0f); |
| + static public void testSamplingMatrixDefault() { |
| + final float samplingMatrix[] = getSamplingMatrix(null, 0); |
| // Assert: |
| - // u' = 0.25 + 0.5 u. |
| + // u' = u. |
| // v' = 1 - v. |
| - MoreAsserts.assertEquals(round(texMatrix), new double[] |
| - {0.5, 0, 0, 0, |
| + MoreAsserts.assertEquals(round(samplingMatrix), new double[] |
| + {1, 0, 0, 0, |
| 0, -1, 0, 0, |
| - 0, 0, 1, 0, |
| - 0.25, 1, 0, 1}); |
| + 0, 0, 1, 0, |
| + 0, 1, 0, 1}); |
| + } |
| + |
| + @SmallTest |
| + static public void testSamplingMatrixRotation90Deg() { |
| + final float samplingMatrix[] = getSamplingMatrix(null, 90); |
| + // Assert: |
| + // u' = 1 - u. |
| + // v' = 1 - v. |
| + MoreAsserts.assertEquals(round(samplingMatrix), new double[] |
| + { 0, -1, 0, 0, |
| + -1, 0, 0, 0, |
| + 0, 0, 1, 0, |
| + 1, 1, 0, 1}); |
| } |
| } |