Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f5ad4e09
authored
Oct 25, 2022
by
claincly
Committed by
microkatz
Oct 31, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add GL utility methods to get 4x4 identity and set identity
PiperOrigin-RevId: 483671580
parent
eaf1f215
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
35 additions
and
32 deletions
library/common/src/main/java/com/google/android/exoplayer2/util/GlUtil.java
library/core/src/main/java/com/google/android/exoplayer2/video/spherical/FrameRotationQueue.java
library/core/src/main/java/com/google/android/exoplayer2/video/spherical/SceneRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/video/spherical/SphericalGLSurfaceView.java
library/core/src/test/java/com/google/android/exoplayer2/video/spherical/FrameRotationQueueTest.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/ColorLutProcessor.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/ContrastProcessor.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/FinalMatrixTextureProcessorWrapper.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/HslProcessor.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/MatrixTextureProcessor.java
library/effect/src/main/java/com/google/android/exoplayer2/effect/RgbAdjustment.java
library/effect/src/test/java/com/google/android/exoplayer2/effect/MatrixUtilsTest.java
library/common/src/main/java/com/google/android/exoplayer2/util/GlUtil.java
View file @
f5ad4e09
...
@@ -29,6 +29,7 @@ import android.opengl.EGLSurface;
...
@@ -29,6 +29,7 @@ import android.opengl.EGLSurface;
import
android.opengl.GLES11Ext
;
import
android.opengl.GLES11Ext
;
import
android.opengl.GLES20
;
import
android.opengl.GLES20
;
import
android.opengl.GLES30
;
import
android.opengl.GLES30
;
import
android.opengl.Matrix
;
import
androidx.annotation.DoNotInline
;
import
androidx.annotation.DoNotInline
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.RequiresApi
;
import
androidx.annotation.RequiresApi
;
...
@@ -113,6 +114,18 @@ public final class GlUtil {
...
@@ -113,6 +114,18 @@ public final class GlUtil {
};
};
}
}
/** Creates a 4x4 identity matrix. */
public
static
float
[]
create4x4IdentityMatrix
()
{
float
[]
matrix
=
new
float
[
16
];
setToIdentity
(
matrix
);
return
matrix
;
}
/** Sets the input {@code matrix} to an identity matrix. */
public
static
void
setToIdentity
(
float
[]
matrix
)
{
Matrix
.
setIdentityM
(
matrix
,
/* smOffset= */
0
);
}
/** Flattens the list of 4 element NDC coordinate vectors into a buffer. */
/** Flattens the list of 4 element NDC coordinate vectors into a buffer. */
public
static
float
[]
createVertexBuffer
(
List
<
float
[]>
vertexList
)
{
public
static
float
[]
createVertexBuffer
(
List
<
float
[]>
vertexList
)
{
float
[]
vertexBuffer
=
new
float
[
HOMOGENEOUS_COORDINATE_VECTOR_SIZE
*
vertexList
.
size
()];
float
[]
vertexBuffer
=
new
float
[
HOMOGENEOUS_COORDINATE_VECTOR_SIZE
*
vertexList
.
size
()];
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/spherical/FrameRotationQueue.java
View file @
f5ad4e09
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
com
.
google
.
android
.
exoplayer2
.
video
.
spherical
;
package
com
.
google
.
android
.
exoplayer2
.
video
.
spherical
;
import
android.opengl.Matrix
;
import
android.opengl.Matrix
;
import
com.google.android.exoplayer2.util.GlUtil
;
import
com.google.android.exoplayer2.util.TimedValueQueue
;
import
com.google.android.exoplayer2.util.TimedValueQueue
;
/**
/**
...
@@ -96,7 +97,7 @@ import com.google.android.exoplayer2.util.TimedValueQueue;
...
@@ -96,7 +97,7 @@ import com.google.android.exoplayer2.util.TimedValueQueue;
// | 0 1 0 0|
// | 0 1 0 0|
// recenter = | temp[8] 0 temp[10] 0|
// recenter = | temp[8] 0 temp[10] 0|
// | 0 0 0 1|
// | 0 0 0 1|
Matrix
.
setIdentityM
(
recenterMatrix
,
0
);
GlUtil
.
setToIdentity
(
recenterMatrix
);
float
normRowSqr
=
float
normRowSqr
=
rotationMatrix
[
10
]
*
rotationMatrix
[
10
]
+
rotationMatrix
[
8
]
*
rotationMatrix
[
8
];
rotationMatrix
[
10
]
*
rotationMatrix
[
10
]
+
rotationMatrix
[
8
]
*
rotationMatrix
[
8
];
float
normRow
=
(
float
)
Math
.
sqrt
(
normRowSqr
);
float
normRow
=
(
float
)
Math
.
sqrt
(
normRowSqr
);
...
@@ -118,7 +119,7 @@ import com.google.android.exoplayer2.util.TimedValueQueue;
...
@@ -118,7 +119,7 @@ import com.google.android.exoplayer2.util.TimedValueQueue;
float
angleDeg
=
(
float
)
Math
.
toDegrees
(
angleRad
);
float
angleDeg
=
(
float
)
Math
.
toDegrees
(
angleRad
);
Matrix
.
setRotateM
(
matrix
,
0
,
angleDeg
,
x
/
angleRad
,
y
/
angleRad
,
z
/
angleRad
);
Matrix
.
setRotateM
(
matrix
,
0
,
angleDeg
,
x
/
angleRad
,
y
/
angleRad
,
z
/
angleRad
);
}
else
{
}
else
{
Matrix
.
setIdentityM
(
matrix
,
0
);
GlUtil
.
setToIdentity
(
matrix
);
}
}
}
}
}
}
library/core/src/main/java/com/google/android/exoplayer2/video/spherical/SceneRenderer.java
View file @
f5ad4e09
...
@@ -129,7 +129,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -129,7 +129,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
Log
.
e
(
TAG
,
"Failed to draw a frame"
,
e
);
Log
.
e
(
TAG
,
"Failed to draw a frame"
,
e
);
}
}
if
(
resetRotationAtNextFrame
.
compareAndSet
(
true
,
false
))
{
if
(
resetRotationAtNextFrame
.
compareAndSet
(
true
,
false
))
{
Matrix
.
setIdentityM
(
rotationMatrix
,
0
);
GlUtil
.
setToIdentity
(
rotationMatrix
);
}
}
long
lastFrameTimestampNs
=
surfaceTexture
.
getTimestamp
();
long
lastFrameTimestampNs
=
surfaceTexture
.
getTimestamp
();
Long
sampleTimestampUs
=
sampleTimestampQueue
.
poll
(
lastFrameTimestampNs
);
Long
sampleTimestampUs
=
sampleTimestampQueue
.
poll
(
lastFrameTimestampNs
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/spherical/SphericalGLSurfaceView.java
View file @
f5ad4e09
...
@@ -37,6 +37,7 @@ import androidx.annotation.UiThread;
...
@@ -37,6 +37,7 @@ import androidx.annotation.UiThread;
import
androidx.annotation.VisibleForTesting
;
import
androidx.annotation.VisibleForTesting
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.GlUtil
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.video.VideoFrameMetadataListener
;
import
com.google.android.exoplayer2.video.VideoFrameMetadataListener
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
java.util.concurrent.CopyOnWriteArrayList
;
...
@@ -284,9 +285,9 @@ public final class SphericalGLSurfaceView extends GLSurfaceView {
...
@@ -284,9 +285,9 @@ public final class SphericalGLSurfaceView extends GLSurfaceView {
public
Renderer
(
SceneRenderer
scene
)
{
public
Renderer
(
SceneRenderer
scene
)
{
this
.
scene
=
scene
;
this
.
scene
=
scene
;
Matrix
.
setIdentityM
(
deviceOrientationMatrix
,
0
);
GlUtil
.
setToIdentity
(
deviceOrientationMatrix
);
Matrix
.
setIdentityM
(
touchPitchMatrix
,
0
);
GlUtil
.
setToIdentity
(
touchPitchMatrix
);
Matrix
.
setIdentityM
(
touchYawMatrix
,
0
);
GlUtil
.
setToIdentity
(
touchYawMatrix
);
deviceRoll
=
UPRIGHT_ROLL
;
deviceRoll
=
UPRIGHT_ROLL
;
}
}
...
...
library/core/src/test/java/com/google/android/exoplayer2/video/spherical/FrameRotationQueueTest.java
View file @
f5ad4e09
...
@@ -19,6 +19,7 @@ import static com.google.common.truth.Truth.assertThat;
...
@@ -19,6 +19,7 @@ import static com.google.common.truth.Truth.assertThat;
import
android.opengl.Matrix
;
import
android.opengl.Matrix
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.util.GlUtil
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
...
@@ -65,9 +66,7 @@ public class FrameRotationQueueTest {
...
@@ -65,9 +66,7 @@ public class FrameRotationQueueTest {
float
[]
actualMatrix
=
float
[]
actualMatrix
=
getRotationMatrixFromAngleAxis
(
getRotationMatrixFromAngleAxis
(
/* angleRadian= */
(
float
)
Math
.
PI
,
/* x= */
0
,
/* y= */
1
,
/* z= */
0
);
/* angleRadian= */
(
float
)
Math
.
PI
,
/* x= */
0
,
/* y= */
1
,
/* z= */
0
);
float
[]
expectedMatrix
=
new
float
[
16
];
assertEquals
(
actualMatrix
,
GlUtil
.
create4x4IdentityMatrix
());
Matrix
.
setIdentityM
(
expectedMatrix
,
0
);
assertEquals
(
actualMatrix
,
expectedMatrix
);
}
}
@Test
@Test
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/ColorLutProcessor.java
View file @
f5ad4e09
...
@@ -20,7 +20,6 @@ import static com.google.android.exoplayer2.util.Assertions.checkArgument;
...
@@ -20,7 +20,6 @@ import static com.google.android.exoplayer2.util.Assertions.checkArgument;
import
android.content.Context
;
import
android.content.Context
;
import
android.opengl.GLES20
;
import
android.opengl.GLES20
;
import
android.opengl.Matrix
;
import
android.util.Pair
;
import
android.util.Pair
;
import
com.google.android.exoplayer2.util.FrameProcessingException
;
import
com.google.android.exoplayer2.util.FrameProcessingException
;
import
com.google.android.exoplayer2.util.GlProgram
;
import
com.google.android.exoplayer2.util.GlProgram
;
...
@@ -63,8 +62,7 @@ import java.io.IOException;
...
@@ -63,8 +62,7 @@ import java.io.IOException;
GlUtil
.
getNormalizedCoordinateBounds
(),
GlUtil
.
getNormalizedCoordinateBounds
(),
GlUtil
.
HOMOGENEOUS_COORDINATE_VECTOR_SIZE
);
GlUtil
.
HOMOGENEOUS_COORDINATE_VECTOR_SIZE
);
float
[]
identityMatrix
=
new
float
[
16
];
float
[]
identityMatrix
=
GlUtil
.
create4x4IdentityMatrix
();
Matrix
.
setIdentityM
(
identityMatrix
,
/* smOffset= */
0
);
glProgram
.
setFloatsUniform
(
"uTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatsUniform
(
"uTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatsUniform
(
"uTexTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatsUniform
(
"uTexTransformationMatrix"
,
identityMatrix
);
}
}
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/ContrastProcessor.java
View file @
f5ad4e09
...
@@ -18,7 +18,6 @@ package com.google.android.exoplayer2.effect;
...
@@ -18,7 +18,6 @@ package com.google.android.exoplayer2.effect;
import
android.content.Context
;
import
android.content.Context
;
import
android.opengl.GLES20
;
import
android.opengl.GLES20
;
import
android.opengl.Matrix
;
import
android.util.Pair
;
import
android.util.Pair
;
import
com.google.android.exoplayer2.util.FrameProcessingException
;
import
com.google.android.exoplayer2.util.FrameProcessingException
;
import
com.google.android.exoplayer2.util.GlProgram
;
import
com.google.android.exoplayer2.util.GlProgram
;
...
@@ -59,8 +58,7 @@ import java.io.IOException;
...
@@ -59,8 +58,7 @@ import java.io.IOException;
GlUtil
.
getNormalizedCoordinateBounds
(),
GlUtil
.
getNormalizedCoordinateBounds
(),
GlUtil
.
HOMOGENEOUS_COORDINATE_VECTOR_SIZE
);
GlUtil
.
HOMOGENEOUS_COORDINATE_VECTOR_SIZE
);
float
[]
identityMatrix
=
new
float
[
16
];
float
[]
identityMatrix
=
GlUtil
.
create4x4IdentityMatrix
();
Matrix
.
setIdentityM
(
identityMatrix
,
/* smOffset= */
0
);
glProgram
.
setFloatsUniform
(
"uTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatsUniform
(
"uTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatsUniform
(
"uTexTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatsUniform
(
"uTexTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatUniform
(
"uContrastFactor"
,
contrastFactor
);
glProgram
.
setFloatUniform
(
"uContrastFactor"
,
contrastFactor
);
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/FinalMatrixTextureProcessorWrapper.java
View file @
f5ad4e09
...
@@ -25,7 +25,6 @@ import android.opengl.EGLDisplay;
...
@@ -25,7 +25,6 @@ import android.opengl.EGLDisplay;
import
android.opengl.EGLExt
;
import
android.opengl.EGLExt
;
import
android.opengl.EGLSurface
;
import
android.opengl.EGLSurface
;
import
android.opengl.GLES20
;
import
android.opengl.GLES20
;
import
android.opengl.Matrix
;
import
android.util.Pair
;
import
android.util.Pair
;
import
android.view.Surface
;
import
android.view.Surface
;
import
android.view.SurfaceHolder
;
import
android.view.SurfaceHolder
;
...
@@ -117,8 +116,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -117,8 +116,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
this
.
colorInfo
=
colorInfo
;
this
.
colorInfo
=
colorInfo
;
this
.
releaseFramesAutomatically
=
releaseFramesAutomatically
;
this
.
releaseFramesAutomatically
=
releaseFramesAutomatically
;
textureTransformMatrix
=
new
float
[
16
];
textureTransformMatrix
=
GlUtil
.
create4x4IdentityMatrix
();
Matrix
.
setIdentityM
(
textureTransformMatrix
,
/* smOffset= */
0
);
streamOffsetUsQueue
=
new
ConcurrentLinkedQueue
<>();
streamOffsetUsQueue
=
new
ConcurrentLinkedQueue
<>();
inputListener
=
new
InputListener
()
{};
inputListener
=
new
InputListener
()
{};
availableFrames
=
new
ConcurrentLinkedQueue
<>();
availableFrames
=
new
ConcurrentLinkedQueue
<>();
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/HslProcessor.java
View file @
f5ad4e09
...
@@ -20,7 +20,6 @@ import static com.google.android.exoplayer2.util.Assertions.checkArgument;
...
@@ -20,7 +20,6 @@ import static com.google.android.exoplayer2.util.Assertions.checkArgument;
import
android.content.Context
;
import
android.content.Context
;
import
android.opengl.GLES20
;
import
android.opengl.GLES20
;
import
android.opengl.Matrix
;
import
android.util.Pair
;
import
android.util.Pair
;
import
com.google.android.exoplayer2.util.FrameProcessingException
;
import
com.google.android.exoplayer2.util.FrameProcessingException
;
import
com.google.android.exoplayer2.util.GlProgram
;
import
com.google.android.exoplayer2.util.GlProgram
;
...
@@ -61,8 +60,7 @@ import java.io.IOException;
...
@@ -61,8 +60,7 @@ import java.io.IOException;
GlUtil
.
getNormalizedCoordinateBounds
(),
GlUtil
.
getNormalizedCoordinateBounds
(),
GlUtil
.
HOMOGENEOUS_COORDINATE_VECTOR_SIZE
);
GlUtil
.
HOMOGENEOUS_COORDINATE_VECTOR_SIZE
);
float
[]
identityMatrix
=
new
float
[
16
];
float
[]
identityMatrix
=
GlUtil
.
create4x4IdentityMatrix
();
Matrix
.
setIdentityM
(
identityMatrix
,
/* smOffset= */
0
);
glProgram
.
setFloatsUniform
(
"uTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatsUniform
(
"uTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatsUniform
(
"uTexTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatsUniform
(
"uTexTransformationMatrix"
,
identityMatrix
);
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/MatrixTextureProcessor.java
View file @
f5ad4e09
...
@@ -354,10 +354,8 @@ import java.util.List;
...
@@ -354,10 +354,8 @@ import java.util.List;
transformationMatrixCache
=
new
float
[
matrixTransformations
.
size
()][
16
];
transformationMatrixCache
=
new
float
[
matrixTransformations
.
size
()][
16
];
rgbMatrixCache
=
new
float
[
rgbMatrices
.
size
()][
16
];
rgbMatrixCache
=
new
float
[
rgbMatrices
.
size
()][
16
];
compositeTransformationMatrixArray
=
new
float
[
16
];
compositeTransformationMatrixArray
=
GlUtil
.
create4x4IdentityMatrix
();
Matrix
.
setIdentityM
(
compositeTransformationMatrixArray
,
/* smOffset= */
0
);
compositeRgbMatrixArray
=
GlUtil
.
create4x4IdentityMatrix
();
compositeRgbMatrixArray
=
new
float
[
16
];
Matrix
.
setIdentityM
(
compositeRgbMatrixArray
,
/* smOffset= */
0
);
tempResultMatrix
=
new
float
[
16
];
tempResultMatrix
=
new
float
[
16
];
visiblePolygon
=
NDC_SQUARE
;
visiblePolygon
=
NDC_SQUARE
;
}
}
...
@@ -373,8 +371,7 @@ import java.util.List;
...
@@ -373,8 +371,7 @@ import java.util.List;
throw
new
FrameProcessingException
(
e
);
throw
new
FrameProcessingException
(
e
);
}
}
float
[]
identityMatrix
=
new
float
[
16
];
float
[]
identityMatrix
=
GlUtil
.
create4x4IdentityMatrix
();
Matrix
.
setIdentityM
(
identityMatrix
,
/* smOffset= */
0
);
glProgram
.
setFloatsUniform
(
"uTexTransformationMatrix"
,
identityMatrix
);
glProgram
.
setFloatsUniform
(
"uTexTransformationMatrix"
,
identityMatrix
);
return
glProgram
;
return
glProgram
;
}
}
...
@@ -442,7 +439,7 @@ import java.util.List;
...
@@ -442,7 +439,7 @@ import java.util.List;
// Compute the compositeTransformationMatrix and transform and clip the visiblePolygon for each
// Compute the compositeTransformationMatrix and transform and clip the visiblePolygon for each
// MatrixTransformation's matrix.
// MatrixTransformation's matrix.
Matrix
.
setIdentityM
(
compositeTransformationMatrixArray
,
/* smOffset= */
0
);
GlUtil
.
setToIdentity
(
compositeTransformationMatrixArray
);
visiblePolygon
=
NDC_SQUARE
;
visiblePolygon
=
NDC_SQUARE
;
for
(
float
[]
transformationMatrix
:
transformationMatrixCache
)
{
for
(
float
[]
transformationMatrix
:
transformationMatrixCache
)
{
Matrix
.
multiplyMM
(
Matrix
.
multiplyMM
(
...
...
library/effect/src/main/java/com/google/android/exoplayer2/effect/RgbAdjustment.java
View file @
f5ad4e09
...
@@ -19,6 +19,7 @@ package com.google.android.exoplayer2.effect;
...
@@ -19,6 +19,7 @@ package com.google.android.exoplayer2.effect;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkArgument
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkArgument
;
import
android.opengl.Matrix
;
import
android.opengl.Matrix
;
import
com.google.android.exoplayer2.util.GlUtil
;
import
com.google.errorprone.annotations.CanIgnoreReturnValue
;
import
com.google.errorprone.annotations.CanIgnoreReturnValue
;
/** Scales the red, green, and blue color channels of a frame. */
/** Scales the red, green, and blue color channels of a frame. */
...
@@ -78,8 +79,7 @@ public final class RgbAdjustment implements RgbMatrix {
...
@@ -78,8 +79,7 @@ public final class RgbAdjustment implements RgbMatrix {
/** Creates a new {@link RgbAdjustment} instance. */
/** Creates a new {@link RgbAdjustment} instance. */
public
RgbAdjustment
build
()
{
public
RgbAdjustment
build
()
{
float
[]
rgbMatrix
=
new
float
[
16
];
float
[]
rgbMatrix
=
GlUtil
.
create4x4IdentityMatrix
();
Matrix
.
setIdentityM
(
rgbMatrix
,
/* smOffset= */
0
);
Matrix
.
scaleM
(
Matrix
.
scaleM
(
rgbMatrix
,
/* smOffset= */
0
,
/* x= */
redScale
,
/* y= */
greenScale
,
/* z= */
blueScale
);
rgbMatrix
,
/* smOffset= */
0
,
/* x= */
redScale
,
/* y= */
greenScale
,
/* z= */
blueScale
);
...
...
library/effect/src/test/java/com/google/android/exoplayer2/effect/MatrixUtilsTest.java
View file @
f5ad4e09
...
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertThrows;
...
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertThrows;
import
android.opengl.Matrix
;
import
android.opengl.Matrix
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.util.GlUtil
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableList
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
...
@@ -162,8 +163,7 @@ public class MatrixUtilsTest {
...
@@ -162,8 +163,7 @@ public class MatrixUtilsTest {
ImmutableList
<
float
[]>
points
=
ImmutableList
<
float
[]>
points
=
ImmutableList
.
of
(
ImmutableList
.
of
(
new
float
[]
{-
1
,
0
,
1
,
1
},
new
float
[]
{
1
,
0
,
1
,
1
},
new
float
[]
{
0
,
1
,
1
,
1
});
new
float
[]
{-
1
,
0
,
1
,
1
},
new
float
[]
{
1
,
0
,
1
,
1
},
new
float
[]
{
0
,
1
,
1
,
1
});
float
[]
scaleMatrix
=
new
float
[
16
];
float
[]
scaleMatrix
=
GlUtil
.
create4x4IdentityMatrix
();
Matrix
.
setIdentityM
(
scaleMatrix
,
/* smOffset= */
0
);
Matrix
.
scaleM
(
scaleMatrix
,
/* mOffset= */
0
,
/* x= */
2
,
/* y= */
3
,
/* z= */
4
);
Matrix
.
scaleM
(
scaleMatrix
,
/* mOffset= */
0
,
/* x= */
2
,
/* y= */
3
,
/* z= */
4
);
ImmutableList
<
float
[]>
actualTransformedPoints
=
ImmutableList
<
float
[]>
actualTransformedPoints
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment