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
5c78444b
authored
Sep 09, 2022
by
leonwind
Committed by
Marc Baechinger
Sep 30, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Rename MatrixTransformationProcessor to MatrixTextureProcessor.
PiperOrigin-RevId: 473283967
parent
d188babd
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
119 additions
and
142 deletions
libraries/effect/src/androidTest/java/androidx/media3/effect/MatrixTransformationProcessorPixelTest.java → libraries/effect/src/androidTest/java/androidx/media3/effect/MatrixTextureProcessorPixelTest.java
libraries/effect/src/androidTest/java/androidx/media3/effect/RgbAdjustmentPixelTest.java
libraries/effect/src/androidTest/java/androidx/media3/effect/RgbFilterPixelTest.java
libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTransformationProcessorWrapper.java → libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixTextureProcessorWrapper.java
libraries/effect/src/main/java/androidx/media3/effect/GlEffectsFrameProcessor.java
libraries/effect/src/main/java/androidx/media3/effect/GlMatrixTransformation.java
libraries/effect/src/main/java/androidx/media3/effect/MatrixTransformationProcessor.java → libraries/effect/src/main/java/androidx/media3/effect/MatrixTextureProcessor.java
libraries/effect/src/main/java/androidx/media3/effect/RgbFilter.java
libraries/effect/src/main/java/androidx/media3/effect/RgbMatrix.java
libraries/effect/src/test/java/androidx/media3/effect/ScaleToFitTransformationTest.java
libraries/effect/src/androidTest/java/androidx/media3/effect/MatrixT
ransformation
ProcessorPixelTest.java
→
libraries/effect/src/androidTest/java/androidx/media3/effect/MatrixT
exture
ProcessorPixelTest.java
View file @
5c78444b
...
@@ -36,7 +36,7 @@ import org.junit.Test;
...
@@ -36,7 +36,7 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
/**
/**
* Pixel test for texture processing via {@link MatrixT
ransformation
Processor}.
* Pixel test for texture processing via {@link MatrixT
exture
Processor}.
*
*
* <p>Expected images are taken from an emulator, so tests on different emulators or physical
* <p>Expected images are taken from an emulator, so tests on different emulators or physical
* devices may fail. To test on other devices, please increase the {@link
* devices may fail. To test on other devices, please increase the {@link
...
@@ -44,7 +44,7 @@ import org.junit.runner.RunWith;
...
@@ -44,7 +44,7 @@ import org.junit.runner.RunWith;
* as recommended in {@link GlEffectsFrameProcessorPixelTest}.
* as recommended in {@link GlEffectsFrameProcessorPixelTest}.
*/
*/
@RunWith
(
AndroidJUnit4
.
class
)
@RunWith
(
AndroidJUnit4
.
class
)
public
final
class
MatrixT
ransformation
ProcessorPixelTest
{
public
final
class
MatrixT
exture
ProcessorPixelTest
{
public
static
final
String
ORIGINAL_PNG_ASSET_PATH
=
public
static
final
String
ORIGINAL_PNG_ASSET_PATH
=
"media/bitmap/sample_mp4_first_frame/original.png"
;
"media/bitmap/sample_mp4_first_frame/original.png"
;
public
static
final
String
TRANSLATE_RIGHT_PNG_ASSET_PATH
=
public
static
final
String
TRANSLATE_RIGHT_PNG_ASSET_PATH
=
...
@@ -58,7 +58,7 @@ public final class MatrixTransformationProcessorPixelTest {
...
@@ -58,7 +58,7 @@ public final class MatrixTransformationProcessorPixelTest {
private
@MonotonicNonNull
EGLDisplay
eglDisplay
;
private
@MonotonicNonNull
EGLDisplay
eglDisplay
;
private
@MonotonicNonNull
EGLContext
eglContext
;
private
@MonotonicNonNull
EGLContext
eglContext
;
private
@MonotonicNonNull
SingleFrameGlTextureProcessor
matrixT
ransformationFram
eProcessor
;
private
@MonotonicNonNull
SingleFrameGlTextureProcessor
matrixT
extur
eProcessor
;
private
int
inputTexId
;
private
int
inputTexId
;
private
int
outputTexId
;
private
int
outputTexId
;
private
int
width
;
private
int
width
;
...
@@ -82,8 +82,8 @@ public final class MatrixTransformationProcessorPixelTest {
...
@@ -82,8 +82,8 @@ public final class MatrixTransformationProcessorPixelTest {
@After
@After
public
void
release
()
throws
GlUtil
.
GlException
,
FrameProcessingException
{
public
void
release
()
throws
GlUtil
.
GlException
,
FrameProcessingException
{
if
(
matrixT
ransformationFram
eProcessor
!=
null
)
{
if
(
matrixT
extur
eProcessor
!=
null
)
{
matrixT
ransformationFram
eProcessor
.
release
();
matrixT
extur
eProcessor
.
release
();
}
}
if
(
eglContext
!=
null
&&
eglDisplay
!=
null
)
{
if
(
eglContext
!=
null
&&
eglDisplay
!=
null
)
{
GlUtil
.
destroyEglContext
(
eglDisplay
,
eglContext
);
GlUtil
.
destroyEglContext
(
eglDisplay
,
eglContext
);
...
@@ -95,12 +95,12 @@ public final class MatrixTransformationProcessorPixelTest {
...
@@ -95,12 +95,12 @@ public final class MatrixTransformationProcessorPixelTest {
String
testId
=
"drawFrame_noEdits"
;
String
testId
=
"drawFrame_noEdits"
;
Matrix
identityMatrix
=
new
Matrix
();
Matrix
identityMatrix
=
new
Matrix
();
MatrixTransformation
noEditsTransformation
=
(
long
presentationTimeUs
)
->
identityMatrix
;
MatrixTransformation
noEditsTransformation
=
(
long
presentationTimeUs
)
->
identityMatrix
;
matrixT
ransformationFram
eProcessor
=
matrixT
extur
eProcessor
=
noEditsTransformation
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
noEditsTransformation
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
matrixT
ransformationFram
eProcessor
.
configure
(
width
,
height
);
matrixT
extur
eProcessor
.
configure
(
width
,
height
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ORIGINAL_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ORIGINAL_PNG_ASSET_PATH
);
matrixT
ransformationFram
eProcessor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
extur
eProcessor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
width
,
height
);
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
width
,
height
);
...
@@ -120,12 +120,12 @@ public final class MatrixTransformationProcessorPixelTest {
...
@@ -120,12 +120,12 @@ public final class MatrixTransformationProcessorPixelTest {
translateRightMatrix
.
postTranslate
(
/* dx= */
1
,
/* dy= */
0
);
translateRightMatrix
.
postTranslate
(
/* dx= */
1
,
/* dy= */
0
);
MatrixTransformation
translateRightTransformation
=
MatrixTransformation
translateRightTransformation
=
(
long
presentationTimeUs
)
->
translateRightMatrix
;
(
long
presentationTimeUs
)
->
translateRightMatrix
;
matrixT
ransformationFram
eProcessor
=
matrixT
extur
eProcessor
=
translateRightTransformation
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
translateRightTransformation
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
matrixT
ransformationFram
eProcessor
.
configure
(
width
,
height
);
matrixT
extur
eProcessor
.
configure
(
width
,
height
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
TRANSLATE_RIGHT_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
TRANSLATE_RIGHT_PNG_ASSET_PATH
);
matrixT
ransformationFram
eProcessor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
extur
eProcessor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
width
,
height
);
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
width
,
height
);
...
@@ -144,12 +144,12 @@ public final class MatrixTransformationProcessorPixelTest {
...
@@ -144,12 +144,12 @@ public final class MatrixTransformationProcessorPixelTest {
Matrix
scaleNarrowMatrix
=
new
Matrix
();
Matrix
scaleNarrowMatrix
=
new
Matrix
();
scaleNarrowMatrix
.
postScale
(.
5
f
,
1.2f
);
scaleNarrowMatrix
.
postScale
(.
5
f
,
1.2f
);
MatrixTransformation
scaleNarrowTransformation
=
(
long
presentationTimeUs
)
->
scaleNarrowMatrix
;
MatrixTransformation
scaleNarrowTransformation
=
(
long
presentationTimeUs
)
->
scaleNarrowMatrix
;
matrixT
ransformationFram
eProcessor
=
matrixT
extur
eProcessor
=
scaleNarrowTransformation
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
scaleNarrowTransformation
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
matrixT
ransformationFram
eProcessor
.
configure
(
width
,
height
);
matrixT
extur
eProcessor
.
configure
(
width
,
height
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
SCALE_NARROW_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
SCALE_NARROW_PNG_ASSET_PATH
);
matrixT
ransformationFram
eProcessor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
extur
eProcessor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
width
,
height
);
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
width
,
height
);
...
@@ -168,12 +168,12 @@ public final class MatrixTransformationProcessorPixelTest {
...
@@ -168,12 +168,12 @@ public final class MatrixTransformationProcessorPixelTest {
Matrix
rotate90Matrix
=
new
Matrix
();
Matrix
rotate90Matrix
=
new
Matrix
();
rotate90Matrix
.
postRotate
(
/* degrees= */
90
);
rotate90Matrix
.
postRotate
(
/* degrees= */
90
);
MatrixTransformation
rotate90Transformation
=
(
long
presentationTimeUs
)
->
rotate90Matrix
;
MatrixTransformation
rotate90Transformation
=
(
long
presentationTimeUs
)
->
rotate90Matrix
;
matrixT
ransformationFram
eProcessor
=
matrixT
extur
eProcessor
=
rotate90Transformation
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
rotate90Transformation
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
matrixT
ransformationFram
eProcessor
.
configure
(
width
,
height
);
matrixT
extur
eProcessor
.
configure
(
width
,
height
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ROTATE_90_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ROTATE_90_PNG_ASSET_PATH
);
matrixT
ransformationFram
eProcessor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
extur
eProcessor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
width
,
height
);
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
width
,
height
);
...
...
libraries/effect/src/androidTest/java/androidx/media3/effect/RgbAdjustmentPixelTest.java
View file @
5c78444b
...
@@ -62,7 +62,7 @@ public final class RgbAdjustmentPixelTest {
...
@@ -62,7 +62,7 @@ public final class RgbAdjustmentPixelTest {
private
@MonotonicNonNull
EGLDisplay
eglDisplay
;
private
@MonotonicNonNull
EGLDisplay
eglDisplay
;
private
@MonotonicNonNull
EGLContext
eglContext
;
private
@MonotonicNonNull
EGLContext
eglContext
;
private
@MonotonicNonNull
SingleFrameGlTextureProcessor
matrixT
ransformation
Processor
;
private
@MonotonicNonNull
SingleFrameGlTextureProcessor
matrixT
exture
Processor
;
private
@MonotonicNonNull
EGLSurface
placeholderEglSurface
;
private
@MonotonicNonNull
EGLSurface
placeholderEglSurface
;
private
int
inputTexId
;
private
int
inputTexId
;
private
int
outputTexId
;
private
int
outputTexId
;
...
@@ -94,8 +94,8 @@ public final class RgbAdjustmentPixelTest {
...
@@ -94,8 +94,8 @@ public final class RgbAdjustmentPixelTest {
@After
@After
public
void
release
()
throws
GlUtil
.
GlException
,
FrameProcessingException
{
public
void
release
()
throws
GlUtil
.
GlException
,
FrameProcessingException
{
if
(
matrixT
ransformation
Processor
!=
null
)
{
if
(
matrixT
exture
Processor
!=
null
)
{
matrixT
ransformation
Processor
.
release
();
matrixT
exture
Processor
.
release
();
}
}
GlUtil
.
destroyEglContext
(
eglDisplay
,
eglContext
);
GlUtil
.
destroyEglContext
(
eglDisplay
,
eglContext
);
}
}
...
@@ -104,13 +104,11 @@ public final class RgbAdjustmentPixelTest {
...
@@ -104,13 +104,11 @@ public final class RgbAdjustmentPixelTest {
public
void
drawFrame_identityMatrix_leavesFrameUnchanged
()
throws
Exception
{
public
void
drawFrame_identityMatrix_leavesFrameUnchanged
()
throws
Exception
{
String
testId
=
"drawFrame_identityMatrix"
;
String
testId
=
"drawFrame_identityMatrix"
;
RgbMatrix
identityMatrix
=
new
RgbAdjustment
.
Builder
().
build
();
RgbMatrix
identityMatrix
=
new
RgbAdjustment
.
Builder
().
build
();
matrixTransformationProcessor
=
matrixTextureProcessor
=
identityMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
identityMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ORIGINAL_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ORIGINAL_PNG_ASSET_PATH
);
matrixT
ransformation
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
exture
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
first
,
outputSize
.
second
);
outputSize
.
first
,
outputSize
.
second
);
...
@@ -128,15 +126,13 @@ public final class RgbAdjustmentPixelTest {
...
@@ -128,15 +126,13 @@ public final class RgbAdjustmentPixelTest {
String
testId
=
"drawFrame_removeColors"
;
String
testId
=
"drawFrame_removeColors"
;
RgbMatrix
removeColorMatrix
=
RgbMatrix
removeColorMatrix
=
new
RgbAdjustment
.
Builder
().
setRedScale
(
0
).
setGreenScale
(
0
).
setBlueScale
(
0
).
build
();
new
RgbAdjustment
.
Builder
().
setRedScale
(
0
).
setGreenScale
(
0
).
setBlueScale
(
0
).
build
();
matrixTransformationProcessor
=
matrixTextureProcessor
=
removeColorMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
removeColorMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
Bitmap
expectedBitmap
=
Bitmap
expectedBitmap
=
BitmapTestUtil
.
createArgb8888BitmapWithSolidColor
(
BitmapTestUtil
.
createArgb8888BitmapWithSolidColor
(
outputSize
.
first
,
outputSize
.
second
,
Color
.
BLACK
);
outputSize
.
first
,
outputSize
.
second
,
Color
.
BLACK
);
matrixT
ransformation
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
exture
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
first
,
outputSize
.
second
);
outputSize
.
first
,
outputSize
.
second
);
...
@@ -153,13 +149,11 @@ public final class RgbAdjustmentPixelTest {
...
@@ -153,13 +149,11 @@ public final class RgbAdjustmentPixelTest {
public
void
drawFrame_redOnlyFilter_removeBlueAndGreenValues
()
throws
Exception
{
public
void
drawFrame_redOnlyFilter_removeBlueAndGreenValues
()
throws
Exception
{
String
testId
=
"drawFrame_redOnlyFilter"
;
String
testId
=
"drawFrame_redOnlyFilter"
;
RgbMatrix
redOnlyMatrix
=
new
RgbAdjustment
.
Builder
().
setBlueScale
(
0
).
setGreenScale
(
0
).
build
();
RgbMatrix
redOnlyMatrix
=
new
RgbAdjustment
.
Builder
().
setBlueScale
(
0
).
setGreenScale
(
0
).
build
();
matrixTransformationProcessor
=
matrixTextureProcessor
=
redOnlyMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
redOnlyMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ONLY_RED_CHANNEL_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ONLY_RED_CHANNEL_PNG_ASSET_PATH
);
matrixT
ransformation
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
exture
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
first
,
outputSize
.
second
);
outputSize
.
first
,
outputSize
.
second
);
...
@@ -176,13 +170,11 @@ public final class RgbAdjustmentPixelTest {
...
@@ -176,13 +170,11 @@ public final class RgbAdjustmentPixelTest {
public
void
drawFrame_increaseRedChannel_producesBrighterAndRedderFrame
()
throws
Exception
{
public
void
drawFrame_increaseRedChannel_producesBrighterAndRedderFrame
()
throws
Exception
{
String
testId
=
"drawFrame_increaseRedChannel"
;
String
testId
=
"drawFrame_increaseRedChannel"
;
RgbMatrix
increaseRedMatrix
=
new
RgbAdjustment
.
Builder
().
setRedScale
(
5
).
build
();
RgbMatrix
increaseRedMatrix
=
new
RgbAdjustment
.
Builder
().
setRedScale
(
5
).
build
();
matrixTransformationProcessor
=
matrixTextureProcessor
=
increaseRedMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
increaseRedMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
INCREASE_RED_CHANNEL_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
INCREASE_RED_CHANNEL_PNG_ASSET_PATH
);
matrixT
ransformation
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
exture
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
first
,
outputSize
.
second
);
outputSize
.
first
,
outputSize
.
second
);
...
@@ -200,13 +192,12 @@ public final class RgbAdjustmentPixelTest {
...
@@ -200,13 +192,12 @@ public final class RgbAdjustmentPixelTest {
String
testId
=
"drawFrame_increaseBrightness"
;
String
testId
=
"drawFrame_increaseBrightness"
;
RgbMatrix
increaseBrightnessMatrix
=
RgbMatrix
increaseBrightnessMatrix
=
new
RgbAdjustment
.
Builder
().
setRedScale
(
5
).
setGreenScale
(
5
).
setBlueScale
(
5
).
build
();
new
RgbAdjustment
.
Builder
().
setRedScale
(
5
).
setGreenScale
(
5
).
setBlueScale
(
5
).
build
();
matrixT
ransformation
Processor
=
matrixT
exture
Processor
=
increaseBrightnessMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
increaseBrightnessMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
Pair
<
Integer
,
Integer
>
outputSize
=
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
INCREASE_BRIGHTNESS_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
INCREASE_BRIGHTNESS_PNG_ASSET_PATH
);
matrixT
ransformation
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
exture
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
first
,
outputSize
.
second
);
outputSize
.
first
,
outputSize
.
second
);
...
@@ -225,19 +216,18 @@ public final class RgbAdjustmentPixelTest {
...
@@ -225,19 +216,18 @@ public final class RgbAdjustmentPixelTest {
RgbMatrix
noRed
=
new
RgbAdjustment
.
Builder
().
setRedScale
(
0
).
build
();
RgbMatrix
noRed
=
new
RgbAdjustment
.
Builder
().
setRedScale
(
0
).
build
();
RgbMatrix
noGreen
=
new
RgbAdjustment
.
Builder
().
setGreenScale
(
0
).
build
();
RgbMatrix
noGreen
=
new
RgbAdjustment
.
Builder
().
setGreenScale
(
0
).
build
();
RgbMatrix
noBlue
=
new
RgbAdjustment
.
Builder
().
setBlueScale
(
0
).
build
();
RgbMatrix
noBlue
=
new
RgbAdjustment
.
Builder
().
setBlueScale
(
0
).
build
();
matrixT
ransformation
Processor
=
matrixT
exture
Processor
=
MatrixT
ransformation
Processor
.
create
(
MatrixT
exture
Processor
.
create
(
context
,
context
,
/* matrixTransformations= */
ImmutableList
.
of
(),
/* matrixTransformations= */
ImmutableList
.
of
(),
/* rgbMatrices= */
ImmutableList
.
of
(
noRed
,
noGreen
,
noBlue
),
/* rgbMatrices= */
ImmutableList
.
of
(
noRed
,
noGreen
,
noBlue
),
/* useHdr= */
false
);
/* useHdr= */
false
);
Pair
<
Integer
,
Integer
>
outputSize
=
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
Bitmap
expectedBitmap
=
Bitmap
expectedBitmap
=
BitmapTestUtil
.
createArgb8888BitmapWithSolidColor
(
BitmapTestUtil
.
createArgb8888BitmapWithSolidColor
(
outputSize
.
first
,
outputSize
.
second
,
Color
.
BLACK
);
outputSize
.
first
,
outputSize
.
second
,
Color
.
BLACK
);
matrixT
ransformation
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
exture
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
first
,
outputSize
.
second
);
outputSize
.
first
,
outputSize
.
second
);
...
@@ -255,17 +245,16 @@ public final class RgbAdjustmentPixelTest {
...
@@ -255,17 +245,16 @@ public final class RgbAdjustmentPixelTest {
String
testId
=
"drawFrame_removeBlueAndGreenValuesInAChain"
;
String
testId
=
"drawFrame_removeBlueAndGreenValuesInAChain"
;
RgbMatrix
noGreen
=
new
RgbAdjustment
.
Builder
().
setGreenScale
(
0
).
build
();
RgbMatrix
noGreen
=
new
RgbAdjustment
.
Builder
().
setGreenScale
(
0
).
build
();
RgbMatrix
noBlue
=
new
RgbAdjustment
.
Builder
().
setBlueScale
(
0
).
build
();
RgbMatrix
noBlue
=
new
RgbAdjustment
.
Builder
().
setBlueScale
(
0
).
build
();
matrixT
ransformation
Processor
=
matrixT
exture
Processor
=
MatrixT
ransformation
Processor
.
create
(
MatrixT
exture
Processor
.
create
(
context
,
context
,
/* matrixTransformations= */
ImmutableList
.
of
(),
/* matrixTransformations= */
ImmutableList
.
of
(),
/* rgbMatrices= */
ImmutableList
.
of
(
noGreen
,
noBlue
),
/* rgbMatrices= */
ImmutableList
.
of
(
noGreen
,
noBlue
),
/* useHdr= */
false
);
/* useHdr= */
false
);
Pair
<
Integer
,
Integer
>
outputSize
=
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ONLY_RED_CHANNEL_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ONLY_RED_CHANNEL_PNG_ASSET_PATH
);
matrixT
ransformation
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
exture
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
first
,
outputSize
.
second
);
outputSize
.
first
,
outputSize
.
second
);
...
@@ -285,17 +274,16 @@ public final class RgbAdjustmentPixelTest {
...
@@ -285,17 +274,16 @@ public final class RgbAdjustmentPixelTest {
RgbMatrix
scaleRedMatrix
=
new
RgbAdjustment
.
Builder
().
setRedScale
(
redScale
).
build
();
RgbMatrix
scaleRedMatrix
=
new
RgbAdjustment
.
Builder
().
setRedScale
(
redScale
).
build
();
RgbMatrix
scaleRedByInverseMatrix
=
RgbMatrix
scaleRedByInverseMatrix
=
new
RgbAdjustment
.
Builder
().
setRedScale
(
1
/
redScale
).
build
();
new
RgbAdjustment
.
Builder
().
setRedScale
(
1
/
redScale
).
build
();
matrixT
ransformation
Processor
=
matrixT
exture
Processor
=
MatrixT
ransformation
Processor
.
create
(
MatrixT
exture
Processor
.
create
(
context
,
context
,
/* matrixTransformations= */
ImmutableList
.
of
(),
/* matrixTransformations= */
ImmutableList
.
of
(),
/* rgbMatrices= */
ImmutableList
.
of
(
scaleRedMatrix
,
scaleRedByInverseMatrix
),
/* rgbMatrices= */
ImmutableList
.
of
(
scaleRedMatrix
,
scaleRedByInverseMatrix
),
/* useHdr= */
false
);
/* useHdr= */
false
);
Pair
<
Integer
,
Integer
>
outputSize
=
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ORIGINAL_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
ORIGINAL_PNG_ASSET_PATH
);
matrixT
ransformation
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
exture
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
first
,
outputSize
.
second
);
outputSize
.
first
,
outputSize
.
second
);
...
...
libraries/effect/src/androidTest/java/androidx/media3/effect/RgbFilterPixelTest.java
View file @
5c78444b
...
@@ -58,7 +58,7 @@ public final class RgbFilterPixelTest {
...
@@ -58,7 +58,7 @@ public final class RgbFilterPixelTest {
private
@MonotonicNonNull
EGLDisplay
eglDisplay
;
private
@MonotonicNonNull
EGLDisplay
eglDisplay
;
private
@MonotonicNonNull
EGLContext
eglContext
;
private
@MonotonicNonNull
EGLContext
eglContext
;
private
@MonotonicNonNull
SingleFrameGlTextureProcessor
matrixT
ransformation
Processor
;
private
@MonotonicNonNull
SingleFrameGlTextureProcessor
matrixT
exture
Processor
;
private
@MonotonicNonNull
EGLSurface
placeholderEglSurface
;
private
@MonotonicNonNull
EGLSurface
placeholderEglSurface
;
private
int
inputTexId
;
private
int
inputTexId
;
private
int
outputTexId
;
private
int
outputTexId
;
...
@@ -90,8 +90,8 @@ public final class RgbFilterPixelTest {
...
@@ -90,8 +90,8 @@ public final class RgbFilterPixelTest {
@After
@After
public
void
release
()
throws
GlUtil
.
GlException
,
FrameProcessingException
{
public
void
release
()
throws
GlUtil
.
GlException
,
FrameProcessingException
{
if
(
matrixT
ransformation
Processor
!=
null
)
{
if
(
matrixT
exture
Processor
!=
null
)
{
matrixT
ransformation
Processor
.
release
();
matrixT
exture
Processor
.
release
();
}
}
GlUtil
.
destroyEglContext
(
eglDisplay
,
eglContext
);
GlUtil
.
destroyEglContext
(
eglDisplay
,
eglContext
);
}
}
...
@@ -100,13 +100,11 @@ public final class RgbFilterPixelTest {
...
@@ -100,13 +100,11 @@ public final class RgbFilterPixelTest {
public
void
drawFrame_grayscale_producesGrayscaleImage
()
throws
Exception
{
public
void
drawFrame_grayscale_producesGrayscaleImage
()
throws
Exception
{
String
testId
=
"drawFrame_grayscale"
;
String
testId
=
"drawFrame_grayscale"
;
RgbMatrix
grayscaleMatrix
=
RgbFilter
.
createGrayscaleFilter
();
RgbMatrix
grayscaleMatrix
=
RgbFilter
.
createGrayscaleFilter
();
matrixTransformationProcessor
=
matrixTextureProcessor
=
grayscaleMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
grayscaleMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
GRAYSCALE_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
GRAYSCALE_PNG_ASSET_PATH
);
matrixT
ransformation
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
exture
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
first
,
outputSize
.
second
);
outputSize
.
first
,
outputSize
.
second
);
...
@@ -123,13 +121,11 @@ public final class RgbFilterPixelTest {
...
@@ -123,13 +121,11 @@ public final class RgbFilterPixelTest {
public
void
drawFrame_inverted_producesInvertedFrame
()
throws
Exception
{
public
void
drawFrame_inverted_producesInvertedFrame
()
throws
Exception
{
String
testId
=
"drawFrame_inverted"
;
String
testId
=
"drawFrame_inverted"
;
RgbMatrix
invertedMatrix
=
RgbFilter
.
createInvertedFilter
();
RgbMatrix
invertedMatrix
=
RgbFilter
.
createInvertedFilter
();
matrixTransformationProcessor
=
matrixTextureProcessor
=
invertedMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
invertedMatrix
.
toGlTextureProcessor
(
context
,
/* useHdr= */
false
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
INVERT_PNG_ASSET_PATH
);
Bitmap
expectedBitmap
=
BitmapTestUtil
.
readBitmap
(
INVERT_PNG_ASSET_PATH
);
matrixT
ransformation
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
matrixT
exture
Processor
.
drawFrame
(
inputTexId
,
/* presentationTimeUs= */
0
);
Bitmap
actualBitmap
=
Bitmap
actualBitmap
=
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
BitmapTestUtil
.
createArgb8888BitmapFromCurrentGlFramebuffer
(
outputSize
.
first
,
outputSize
.
second
);
outputSize
.
first
,
outputSize
.
second
);
...
...
libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixT
ransformation
ProcessorWrapper.java
→
libraries/effect/src/main/java/androidx/media3/effect/FinalMatrixT
exture
ProcessorWrapper.java
View file @
5c78444b
...
@@ -52,15 +52,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -52,15 +52,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* Wrapper around a {@link GlTextureProcessor} that writes to the provided output surface and
* Wrapper around a {@link GlTextureProcessor} that writes to the provided output surface and
* optional debug surface view.
* optional debug surface view.
*
*
* <p>The wrapped {@link GlTextureProcessor} applies the {@link GlMatrixTransformation}
instances
* <p>The wrapped {@link GlTextureProcessor} applies the {@link GlMatrixTransformation}
and {@link
*
passed to the constructor, followed by any transformations needed to convert the frames to the
*
RgbMatrix} instances passed to the constructor, followed by any transformations needed to convert
* dimensions specified by the provided {@link SurfaceInfo}.
*
the frames to the
dimensions specified by the provided {@link SurfaceInfo}.
*
*
* <p>This wrapper is used for the final {@link GlTextureProcessor} instance in the chain of {@link
* <p>This wrapper is used for the final {@link GlTextureProcessor} instance in the chain of {@link
* GlTextureProcessor} instances used by {@link FrameProcessor}.
* GlTextureProcessor} instances used by {@link FrameProcessor}.
*/
*/
/* package */
final
class
FinalMatrixTransformationProcessorWrapper
/* package */
final
class
FinalMatrixTextureProcessorWrapper
implements
ExternalTextureProcessor
{
implements
ExternalTextureProcessor
{
private
static
final
String
TAG
=
"FinalProcessorWrapper"
;
private
static
final
String
TAG
=
"FinalProcessorWrapper"
;
...
@@ -80,7 +79,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -80,7 +79,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private
int
inputWidth
;
private
int
inputWidth
;
private
int
inputHeight
;
private
int
inputHeight
;
@Nullable
private
MatrixT
ransformationProcessor
matrixTransformation
Processor
;
@Nullable
private
MatrixT
extureProcessor
matrixTexture
Processor
;
@Nullable
private
SurfaceViewWrapper
debugSurfaceViewWrapper
;
@Nullable
private
SurfaceViewWrapper
debugSurfaceViewWrapper
;
private
InputListener
inputListener
;
private
InputListener
inputListener
;
private
@MonotonicNonNull
Pair
<
Integer
,
Integer
>
outputSizeBeforeSurfaceTransformation
;
private
@MonotonicNonNull
Pair
<
Integer
,
Integer
>
outputSizeBeforeSurfaceTransformation
;
...
@@ -96,7 +95,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -96,7 +95,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Nullable
@Nullable
private
EGLSurface
outputEglSurface
;
private
EGLSurface
outputEglSurface
;
public
FinalMatrixT
ransformation
ProcessorWrapper
(
public
FinalMatrixT
exture
ProcessorWrapper
(
Context
context
,
Context
context
,
EGLDisplay
eglDisplay
,
EGLDisplay
eglDisplay
,
EGLContext
eglContext
,
EGLContext
eglContext
,
...
@@ -192,8 +191,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -192,8 +191,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Override
@Override
@WorkerThread
@WorkerThread
public
void
release
()
throws
FrameProcessingException
{
public
void
release
()
throws
FrameProcessingException
{
if
(
matrixT
ransformation
Processor
!=
null
)
{
if
(
matrixT
exture
Processor
!=
null
)
{
matrixT
ransformation
Processor
.
release
();
matrixT
exture
Processor
.
release
();
}
}
}
}
...
@@ -206,8 +205,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -206,8 +205,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/* destPost= */
0
,
/* destPost= */
0
,
/* length= */
textureTransformMatrix
.
length
);
/* length= */
textureTransformMatrix
.
length
);
if
(
matrixT
ransformation
Processor
!=
null
)
{
if
(
matrixT
exture
Processor
!=
null
)
{
matrixT
ransformation
Processor
.
setTextureTransformMatrix
(
textureTransformMatrix
);
matrixT
exture
Processor
.
setTextureTransformMatrix
(
textureTransformMatrix
);
}
}
}
}
...
@@ -271,8 +270,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -271,8 +270,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
EGLSurface
outputEglSurface
=
this
.
outputEglSurface
;
EGLSurface
outputEglSurface
=
this
.
outputEglSurface
;
SurfaceInfo
outputSurfaceInfo
=
this
.
outputSurfaceInfo
;
SurfaceInfo
outputSurfaceInfo
=
this
.
outputSurfaceInfo
;
MatrixTransformationProcessor
matrixTransformationProcessor
=
MatrixTextureProcessor
matrixTextureProcessor
=
this
.
matrixTextureProcessor
;
this
.
matrixTransformationProcessor
;
GlUtil
.
focusEglSurface
(
GlUtil
.
focusEglSurface
(
eglDisplay
,
eglDisplay
,
...
@@ -281,7 +279,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -281,7 +279,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
outputSurfaceInfo
.
width
,
outputSurfaceInfo
.
width
,
outputSurfaceInfo
.
height
);
outputSurfaceInfo
.
height
);
GlUtil
.
clearOutputFrame
();
GlUtil
.
clearOutputFrame
();
matrixT
ransformation
Processor
.
drawFrame
(
inputTexture
.
texId
,
presentationTimeUs
);
matrixT
exture
Processor
.
drawFrame
(
inputTexture
.
texId
,
presentationTimeUs
);
if
(
dropLateFrame
&&
System
.
nanoTime
()
>
releaseTimeNs
)
{
if
(
dropLateFrame
&&
System
.
nanoTime
()
>
releaseTimeNs
)
{
return
;
return
;
...
@@ -291,7 +289,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -291,7 +289,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
}
@EnsuresNonNullIf
(
@EnsuresNonNullIf
(
expression
=
{
"outputSurfaceInfo"
,
"outputEglSurface"
,
"matrixT
ransformation
Processor"
},
expression
=
{
"outputSurfaceInfo"
,
"outputEglSurface"
,
"matrixT
exture
Processor"
},
result
=
true
)
result
=
true
)
private
synchronized
boolean
ensureConfigured
(
int
inputWidth
,
int
inputHeight
)
private
synchronized
boolean
ensureConfigured
(
int
inputWidth
,
int
inputHeight
)
throws
FrameProcessingException
,
GlUtil
.
GlException
{
throws
FrameProcessingException
,
GlUtil
.
GlException
{
...
@@ -313,9 +311,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -313,9 +311,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
}
if
(
outputSurfaceInfo
==
null
)
{
if
(
outputSurfaceInfo
==
null
)
{
if
(
matrixT
ransformation
Processor
!=
null
)
{
if
(
matrixT
exture
Processor
!=
null
)
{
matrixT
ransformation
Processor
.
release
();
matrixT
exture
Processor
.
release
();
matrixT
ransformation
Processor
=
null
;
matrixT
exture
Processor
=
null
;
}
}
outputEglSurface
=
null
;
outputEglSurface
=
null
;
return
false
;
return
false
;
...
@@ -342,14 +340,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -342,14 +340,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
this
.
debugSurfaceView
=
debugSurfaceView
;
this
.
debugSurfaceView
=
debugSurfaceView
;
}
}
if
(
matrixT
ransformation
Processor
!=
null
&&
outputSizeOrRotationChanged
)
{
if
(
matrixT
exture
Processor
!=
null
&&
outputSizeOrRotationChanged
)
{
matrixT
ransformation
Processor
.
release
();
matrixT
exture
Processor
.
release
();
matrixT
ransformation
Processor
=
null
;
matrixT
exture
Processor
=
null
;
outputSizeOrRotationChanged
=
false
;
outputSizeOrRotationChanged
=
false
;
}
}
if
(
matrixTransformationProcessor
==
null
)
{
if
(
matrixTextureProcessor
==
null
)
{
matrixTransformationProcessor
=
matrixTextureProcessor
=
createMatrixTextureProcessorForOutputSurface
(
outputSurfaceInfo
);
createMatrixTransformationProcessorForOutputSurface
(
outputSurfaceInfo
);
}
}
this
.
outputSurfaceInfo
=
outputSurfaceInfo
;
this
.
outputSurfaceInfo
=
outputSurfaceInfo
;
...
@@ -357,7 +354,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -357,7 +354,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
return
true
;
return
true
;
}
}
private
MatrixT
ransformationProcessor
createMatrixTransformation
ProcessorForOutputSurface
(
private
MatrixT
extureProcessor
createMatrixTexture
ProcessorForOutputSurface
(
SurfaceInfo
outputSurfaceInfo
)
throws
FrameProcessingException
{
SurfaceInfo
outputSurfaceInfo
)
throws
FrameProcessingException
{
ImmutableList
.
Builder
<
GlMatrixTransformation
>
matrixTransformationListBuilder
=
ImmutableList
.
Builder
<
GlMatrixTransformation
>
matrixTransformationListBuilder
=
new
ImmutableList
.
Builder
<
GlMatrixTransformation
>().
addAll
(
matrixTransformations
);
new
ImmutableList
.
Builder
<
GlMatrixTransformation
>().
addAll
(
matrixTransformations
);
...
@@ -371,39 +368,37 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -371,39 +368,37 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
Presentation
.
createForWidthAndHeight
(
Presentation
.
createForWidthAndHeight
(
outputSurfaceInfo
.
width
,
outputSurfaceInfo
.
height
,
Presentation
.
LAYOUT_SCALE_TO_FIT
));
outputSurfaceInfo
.
width
,
outputSurfaceInfo
.
height
,
Presentation
.
LAYOUT_SCALE_TO_FIT
));
MatrixT
ransformationProcessor
matrixTransformation
Processor
;
MatrixT
extureProcessor
matrixTexture
Processor
;
ImmutableList
<
GlMatrixTransformation
>
expandedMatrixTransformations
=
ImmutableList
<
GlMatrixTransformation
>
expandedMatrixTransformations
=
matrixTransformationListBuilder
.
build
();
matrixTransformationListBuilder
.
build
();
if
(
sampleFromExternalTexture
)
{
if
(
sampleFromExternalTexture
)
{
matrixT
ransformation
Processor
=
matrixT
exture
Processor
=
MatrixT
ransformation
Processor
.
createWithExternalSamplerApplyingEotfThenOetf
(
MatrixT
exture
Processor
.
createWithExternalSamplerApplyingEotfThenOetf
(
context
,
expandedMatrixTransformations
,
rgbMatrices
,
colorInfo
);
context
,
expandedMatrixTransformations
,
rgbMatrices
,
colorInfo
);
}
else
{
}
else
{
matrixT
ransformation
Processor
=
matrixT
exture
Processor
=
MatrixT
ransformation
Processor
.
createApplyingOetf
(
MatrixT
exture
Processor
.
createApplyingOetf
(
context
,
expandedMatrixTransformations
,
rgbMatrices
,
colorInfo
);
context
,
expandedMatrixTransformations
,
rgbMatrices
,
colorInfo
);
}
}
matrixTransformationProcessor
.
setTextureTransformMatrix
(
textureTransformMatrix
);
matrixTextureProcessor
.
setTextureTransformMatrix
(
textureTransformMatrix
);
Pair
<
Integer
,
Integer
>
outputSize
=
Pair
<
Integer
,
Integer
>
outputSize
=
matrixTextureProcessor
.
configure
(
inputWidth
,
inputHeight
);
matrixTransformationProcessor
.
configure
(
inputWidth
,
inputHeight
);
checkState
(
outputSize
.
first
==
outputSurfaceInfo
.
width
);
checkState
(
outputSize
.
first
==
outputSurfaceInfo
.
width
);
checkState
(
outputSize
.
second
==
outputSurfaceInfo
.
height
);
checkState
(
outputSize
.
second
==
outputSurfaceInfo
.
height
);
return
matrixT
ransformation
Processor
;
return
matrixT
exture
Processor
;
}
}
private
void
maybeRenderFrameToDebugSurface
(
TextureInfo
inputTexture
,
long
presentationTimeUs
)
{
private
void
maybeRenderFrameToDebugSurface
(
TextureInfo
inputTexture
,
long
presentationTimeUs
)
{
if
(
debugSurfaceViewWrapper
==
null
||
matrixTransformation
Processor
==
null
)
{
if
(
debugSurfaceViewWrapper
==
null
||
this
.
matrixTexture
Processor
==
null
)
{
return
;
return
;
}
}
MatrixTransformationProcessor
matrixTransformationProcessor
=
MatrixTextureProcessor
matrixTextureProcessor
=
this
.
matrixTextureProcessor
;
this
.
matrixTransformationProcessor
;
try
{
try
{
debugSurfaceViewWrapper
.
maybeRenderToSurfaceView
(
debugSurfaceViewWrapper
.
maybeRenderToSurfaceView
(
()
->
{
()
->
{
GlUtil
.
clearOutputFrame
();
GlUtil
.
clearOutputFrame
();
matrixT
ransformation
Processor
.
drawFrame
(
inputTexture
.
texId
,
presentationTimeUs
);
matrixT
exture
Processor
.
drawFrame
(
inputTexture
.
texId
,
presentationTimeUs
);
});
});
}
catch
(
FrameProcessingException
|
GlUtil
.
GlException
e
)
{
}
catch
(
FrameProcessingException
|
GlUtil
.
GlException
e
)
{
Log
.
d
(
TAG
,
"Error rendering to debug preview"
,
e
);
Log
.
d
(
TAG
,
"Error rendering to debug preview"
,
e
);
...
...
libraries/effect/src/main/java/androidx/media3/effect/GlEffectsFrameProcessor.java
View file @
5c78444b
...
@@ -159,15 +159,15 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
...
@@ -159,15 +159,15 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
}
}
/**
/**
* Combines consecutive {@link GlMatrixTransformation}
instances into a single {@link
* Combines consecutive {@link GlMatrixTransformation}
and {@link RgbMatrix} instances into a
*
MatrixTransformationProcessor} and converts all other {@link GlEffect} instances to separate
*
single {@link MatrixTextureProcessor} and converts all other {@link GlEffect} instances to
* {@link GlTextureProcessor} instances.
*
separate
{@link GlTextureProcessor} instances.
*
*
* <p>All {@link Effect} instances must be {@link GlEffect} instances.
* <p>All {@link Effect} instances must be {@link GlEffect} instances.
*
*
* @return A non-empty list of {@link GlTextureProcessor} instances to apply in the given order.
* @return A non-empty list of {@link GlTextureProcessor} instances to apply in the given order.
* The first is an {@link ExternalTextureProcessor} and the last is a {@link
* The first is an {@link ExternalTextureProcessor} and the last is a {@link
* FinalMatrixT
ransformation
ProcessorWrapper}.
* FinalMatrixT
exture
ProcessorWrapper}.
*/
*/
// TODO(b/239757183): Squash GlMatrixTransformation and RgbMatrix together.
// TODO(b/239757183): Squash GlMatrixTransformation and RgbMatrix together.
private
static
ImmutableList
<
GlTextureProcessor
>
getGlTextureProcessorsForGlEffects
(
private
static
ImmutableList
<
GlTextureProcessor
>
getGlTextureProcessorsForGlEffects
(
...
@@ -206,17 +206,17 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
...
@@ -206,17 +206,17 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
matrixTransformationListBuilder
.
build
();
matrixTransformationListBuilder
.
build
();
ImmutableList
<
RgbMatrix
>
rgbMatrices
=
rgbMatrixListBuilder
.
build
();
ImmutableList
<
RgbMatrix
>
rgbMatrices
=
rgbMatrixListBuilder
.
build
();
if
(!
matrixTransformations
.
isEmpty
()
||
!
rgbMatrices
.
isEmpty
()
||
sampleFromExternalTexture
)
{
if
(!
matrixTransformations
.
isEmpty
()
||
!
rgbMatrices
.
isEmpty
()
||
sampleFromExternalTexture
)
{
MatrixT
ransformationProcessor
matrixTransformation
Processor
;
MatrixT
extureProcessor
matrixTexture
Processor
;
if
(
sampleFromExternalTexture
)
{
if
(
sampleFromExternalTexture
)
{
matrixT
ransformation
Processor
=
matrixT
exture
Processor
=
MatrixT
ransformation
Processor
.
createWithExternalSamplerApplyingEotf
(
MatrixT
exture
Processor
.
createWithExternalSamplerApplyingEotf
(
context
,
matrixTransformations
,
rgbMatrices
,
colorInfo
);
context
,
matrixTransformations
,
rgbMatrices
,
colorInfo
);
}
else
{
}
else
{
matrixT
ransformation
Processor
=
matrixT
exture
Processor
=
MatrixT
ransformation
Processor
.
create
(
MatrixT
exture
Processor
.
create
(
context
,
matrixTransformations
,
rgbMatrices
,
ColorInfo
.
isTransferHdr
(
colorInfo
));
context
,
matrixTransformations
,
rgbMatrices
,
ColorInfo
.
isTransferHdr
(
colorInfo
));
}
}
textureProcessorListBuilder
.
add
(
matrixT
ransformation
Processor
);
textureProcessorListBuilder
.
add
(
matrixT
exture
Processor
);
matrixTransformationListBuilder
=
new
ImmutableList
.
Builder
<>();
matrixTransformationListBuilder
=
new
ImmutableList
.
Builder
<>();
rgbMatrixListBuilder
=
new
ImmutableList
.
Builder
<>();
rgbMatrixListBuilder
=
new
ImmutableList
.
Builder
<>();
sampleFromExternalTexture
=
false
;
sampleFromExternalTexture
=
false
;
...
@@ -226,7 +226,7 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
...
@@ -226,7 +226,7 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
}
}
textureProcessorListBuilder
.
add
(
textureProcessorListBuilder
.
add
(
new
FinalMatrixT
ransformation
ProcessorWrapper
(
new
FinalMatrixT
exture
ProcessorWrapper
(
context
,
context
,
eglDisplay
,
eglDisplay
,
eglContext
,
eglContext
,
...
@@ -271,7 +271,7 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
...
@@ -271,7 +271,7 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
private
final
ExternalTextureManager
inputExternalTextureManager
;
private
final
ExternalTextureManager
inputExternalTextureManager
;
private
final
Surface
inputSurface
;
private
final
Surface
inputSurface
;
private
final
boolean
releaseFramesAutomatically
;
private
final
boolean
releaseFramesAutomatically
;
private
final
FinalMatrixT
ransformation
ProcessorWrapper
finalTextureProcessorWrapper
;
private
final
FinalMatrixT
exture
ProcessorWrapper
finalTextureProcessorWrapper
;
private
final
ImmutableList
<
GlTextureProcessor
>
allTextureProcessors
;
private
final
ImmutableList
<
GlTextureProcessor
>
allTextureProcessors
;
private
@MonotonicNonNull
FrameInfo
nextInputFrameInfo
;
private
@MonotonicNonNull
FrameInfo
nextInputFrameInfo
;
...
@@ -297,15 +297,14 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
...
@@ -297,15 +297,14 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
checkState
(!
textureProcessors
.
isEmpty
());
checkState
(!
textureProcessors
.
isEmpty
());
checkState
(
textureProcessors
.
get
(
0
)
instanceof
ExternalTextureProcessor
);
checkState
(
textureProcessors
.
get
(
0
)
instanceof
ExternalTextureProcessor
);
checkState
(
getLast
(
textureProcessors
)
instanceof
FinalMatrixT
ransformation
ProcessorWrapper
);
checkState
(
getLast
(
textureProcessors
)
instanceof
FinalMatrixT
exture
ProcessorWrapper
);
ExternalTextureProcessor
inputExternalTextureProcessor
=
ExternalTextureProcessor
inputExternalTextureProcessor
=
(
ExternalTextureProcessor
)
textureProcessors
.
get
(
0
);
(
ExternalTextureProcessor
)
textureProcessors
.
get
(
0
);
inputExternalTextureManager
=
inputExternalTextureManager
=
new
ExternalTextureManager
(
inputExternalTextureProcessor
,
frameProcessingTaskExecutor
);
new
ExternalTextureManager
(
inputExternalTextureProcessor
,
frameProcessingTaskExecutor
);
inputExternalTextureProcessor
.
setInputListener
(
inputExternalTextureManager
);
inputExternalTextureProcessor
.
setInputListener
(
inputExternalTextureManager
);
inputSurface
=
new
Surface
(
inputExternalTextureManager
.
getSurfaceTexture
());
inputSurface
=
new
Surface
(
inputExternalTextureManager
.
getSurfaceTexture
());
finalTextureProcessorWrapper
=
finalTextureProcessorWrapper
=
(
FinalMatrixTextureProcessorWrapper
)
getLast
(
textureProcessors
);
(
FinalMatrixTransformationProcessorWrapper
)
getLast
(
textureProcessors
);
allTextureProcessors
=
textureProcessors
;
allTextureProcessors
=
textureProcessors
;
previousStreamOffsetUs
=
C
.
TIME_UNSET
;
previousStreamOffsetUs
=
C
.
TIME_UNSET
;
}
}
...
...
libraries/effect/src/main/java/androidx/media3/effect/GlMatrixTransformation.java
View file @
5c78444b
...
@@ -55,7 +55,7 @@ public interface GlMatrixTransformation extends GlEffect {
...
@@ -55,7 +55,7 @@ public interface GlMatrixTransformation extends GlEffect {
@Override
@Override
default
SingleFrameGlTextureProcessor
toGlTextureProcessor
(
Context
context
,
boolean
useHdr
)
default
SingleFrameGlTextureProcessor
toGlTextureProcessor
(
Context
context
,
boolean
useHdr
)
throws
FrameProcessingException
{
throws
FrameProcessingException
{
return
MatrixT
ransformation
Processor
.
create
(
return
MatrixT
exture
Processor
.
create
(
context
,
context
,
/* matrixTransformations= */
ImmutableList
.
of
(
this
),
/* matrixTransformations= */
ImmutableList
.
of
(
this
),
/* rgbMatrices= */
ImmutableList
.
of
(),
/* rgbMatrices= */
ImmutableList
.
of
(),
...
...
libraries/effect/src/main/java/androidx/media3/effect/MatrixT
ransformation
Processor.java
→
libraries/effect/src/main/java/androidx/media3/effect/MatrixT
exture
Processor.java
View file @
5c78444b
...
@@ -50,10 +50,9 @@ import java.util.List;
...
@@ -50,10 +50,9 @@ import java.util.List;
*
*
* <p>Can copy frames from an external texture and apply color transformations for HDR if needed.
* <p>Can copy frames from an external texture and apply color transformations for HDR if needed.
*/
*/
// TODO(b/239757183): Rename Matrix to a more generic name.
@UnstableApi
@UnstableApi
@SuppressWarnings
(
"FunctionalInterfaceClash"
)
// b/228192298
@SuppressWarnings
(
"FunctionalInterfaceClash"
)
// b/228192298
/* package */
final
class
MatrixT
ransformation
Processor
extends
SingleFrameGlTextureProcessor
/* package */
final
class
MatrixT
exture
Processor
extends
SingleFrameGlTextureProcessor
implements
ExternalTextureProcessor
{
implements
ExternalTextureProcessor
{
private
static
final
String
VERTEX_SHADER_TRANSFORMATION_PATH
=
private
static
final
String
VERTEX_SHADER_TRANSFORMATION_PATH
=
...
@@ -142,7 +141,7 @@ import java.util.List;
...
@@ -142,7 +141,7 @@ import java.util.List;
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* operation fails or is unsupported.
* operation fails or is unsupported.
*/
*/
public
static
MatrixT
ransformation
Processor
create
(
public
static
MatrixT
exture
Processor
create
(
Context
context
,
Context
context
,
List
<
GlMatrixTransformation
>
matrixTransformations
,
List
<
GlMatrixTransformation
>
matrixTransformations
,
List
<
RgbMatrix
>
rgbMatrices
,
List
<
RgbMatrix
>
rgbMatrices
,
...
@@ -153,7 +152,7 @@ import java.util.List;
...
@@ -153,7 +152,7 @@ import java.util.List;
context
,
VERTEX_SHADER_TRANSFORMATION_PATH
,
FRAGMENT_SHADER_TRANSFORMATION_PATH
);
context
,
VERTEX_SHADER_TRANSFORMATION_PATH
,
FRAGMENT_SHADER_TRANSFORMATION_PATH
);
// No transfer functions needed, because input and output are both optical colors.
// No transfer functions needed, because input and output are both optical colors.
return
new
MatrixT
ransformation
Processor
(
return
new
MatrixT
exture
Processor
(
glProgram
,
glProgram
,
ImmutableList
.
copyOf
(
matrixTransformations
),
ImmutableList
.
copyOf
(
matrixTransformations
),
ImmutableList
.
copyOf
(
rgbMatrices
),
ImmutableList
.
copyOf
(
rgbMatrices
),
...
@@ -183,7 +182,7 @@ import java.util.List;
...
@@ -183,7 +182,7 @@ import java.util.List;
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* operation fails or is unsupported.
* operation fails or is unsupported.
*/
*/
public
static
MatrixT
ransformation
Processor
createWithExternalSamplerApplyingEotf
(
public
static
MatrixT
exture
Processor
createWithExternalSamplerApplyingEotf
(
Context
context
,
Context
context
,
List
<
GlMatrixTransformation
>
matrixTransformations
,
List
<
GlMatrixTransformation
>
matrixTransformations
,
List
<
RgbMatrix
>
rgbMatrices
,
List
<
RgbMatrix
>
rgbMatrices
,
...
@@ -217,7 +216,7 @@ import java.util.List;
...
@@ -217,7 +216,7 @@ import java.util.List;
glProgram
.
setIntUniform
(
"uEotfColorTransfer"
,
colorTransfer
);
glProgram
.
setIntUniform
(
"uEotfColorTransfer"
,
colorTransfer
);
}
}
return
new
MatrixT
ransformation
Processor
(
return
new
MatrixT
exture
Processor
(
glProgram
,
glProgram
,
ImmutableList
.
copyOf
(
matrixTransformations
),
ImmutableList
.
copyOf
(
matrixTransformations
),
ImmutableList
.
copyOf
(
rgbMatrices
),
ImmutableList
.
copyOf
(
rgbMatrices
),
...
@@ -243,7 +242,7 @@ import java.util.List;
...
@@ -243,7 +242,7 @@ import java.util.List;
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* operation fails or is unsupported.
* operation fails or is unsupported.
*/
*/
public
static
MatrixT
ransformation
Processor
createApplyingOetf
(
public
static
MatrixT
exture
Processor
createApplyingOetf
(
Context
context
,
Context
context
,
List
<
GlMatrixTransformation
>
matrixTransformations
,
List
<
GlMatrixTransformation
>
matrixTransformations
,
List
<
RgbMatrix
>
rgbMatrices
,
List
<
RgbMatrix
>
rgbMatrices
,
...
@@ -264,7 +263,7 @@ import java.util.List;
...
@@ -264,7 +263,7 @@ import java.util.List;
glProgram
.
setIntUniform
(
"uOetfColorTransfer"
,
colorTransfer
);
glProgram
.
setIntUniform
(
"uOetfColorTransfer"
,
colorTransfer
);
}
}
return
new
MatrixT
ransformation
Processor
(
return
new
MatrixT
exture
Processor
(
glProgram
,
glProgram
,
ImmutableList
.
copyOf
(
matrixTransformations
),
ImmutableList
.
copyOf
(
matrixTransformations
),
ImmutableList
.
copyOf
(
rgbMatrices
),
ImmutableList
.
copyOf
(
rgbMatrices
),
...
@@ -290,7 +289,7 @@ import java.util.List;
...
@@ -290,7 +289,7 @@ import java.util.List;
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* @throws FrameProcessingException If a problem occurs while reading shader files or an OpenGL
* operation fails or is unsupported.
* operation fails or is unsupported.
*/
*/
public
static
MatrixT
ransformation
Processor
createWithExternalSamplerApplyingEotfThenOetf
(
public
static
MatrixT
exture
Processor
createWithExternalSamplerApplyingEotfThenOetf
(
Context
context
,
Context
context
,
List
<
GlMatrixTransformation
>
matrixTransformations
,
List
<
GlMatrixTransformation
>
matrixTransformations
,
List
<
RgbMatrix
>
rgbMatrices
,
List
<
RgbMatrix
>
rgbMatrices
,
...
@@ -322,7 +321,7 @@ import java.util.List;
...
@@ -322,7 +321,7 @@ import java.util.List;
glProgram
.
setIntUniform
(
"uEotfColorTransfer"
,
Format
.
NO_VALUE
);
glProgram
.
setIntUniform
(
"uEotfColorTransfer"
,
Format
.
NO_VALUE
);
}
}
return
new
MatrixT
ransformation
Processor
(
return
new
MatrixT
exture
Processor
(
glProgram
,
glProgram
,
ImmutableList
.
copyOf
(
matrixTransformations
),
ImmutableList
.
copyOf
(
matrixTransformations
),
ImmutableList
.
copyOf
(
rgbMatrices
),
ImmutableList
.
copyOf
(
rgbMatrices
),
...
@@ -340,7 +339,7 @@ import java.util.List;
...
@@ -340,7 +339,7 @@ import java.util.List;
* @param useHdr Whether to process the input as an HDR signal. Using HDR requires the {@code
* @param useHdr Whether to process the input as an HDR signal. Using HDR requires the {@code
* EXT_YUV_target} OpenGL extension.
* EXT_YUV_target} OpenGL extension.
*/
*/
private
MatrixT
ransformation
Processor
(
private
MatrixT
exture
Processor
(
GlProgram
glProgram
,
GlProgram
glProgram
,
ImmutableList
<
GlMatrixTransformation
>
matrixTransformations
,
ImmutableList
<
GlMatrixTransformation
>
matrixTransformations
,
ImmutableList
<
RgbMatrix
>
rgbMatrices
,
ImmutableList
<
RgbMatrix
>
rgbMatrices
,
...
...
libraries/effect/src/main/java/androidx/media3/effect/RgbFilter.java
View file @
5c78444b
...
@@ -91,7 +91,7 @@ public class RgbFilter implements RgbMatrix {
...
@@ -91,7 +91,7 @@ public class RgbFilter implements RgbMatrix {
}
}
@Override
@Override
public
MatrixT
ransformation
Processor
toGlTextureProcessor
(
Context
context
,
boolean
useHdr
)
public
MatrixT
exture
Processor
toGlTextureProcessor
(
Context
context
,
boolean
useHdr
)
throws
FrameProcessingException
{
throws
FrameProcessingException
{
checkForConsistentHdrSetting
(
useHdr
);
checkForConsistentHdrSetting
(
useHdr
);
return
RgbMatrix
.
super
.
toGlTextureProcessor
(
context
,
useHdr
);
return
RgbMatrix
.
super
.
toGlTextureProcessor
(
context
,
useHdr
);
...
...
libraries/effect/src/main/java/androidx/media3/effect/RgbMatrix.java
View file @
5c78444b
...
@@ -40,9 +40,9 @@ public interface RgbMatrix extends GlEffect {
...
@@ -40,9 +40,9 @@ public interface RgbMatrix extends GlEffect {
float
[]
getMatrix
(
long
presentationTimeUs
,
boolean
useHdr
);
float
[]
getMatrix
(
long
presentationTimeUs
,
boolean
useHdr
);
@Override
@Override
default
MatrixT
ransformation
Processor
toGlTextureProcessor
(
Context
context
,
boolean
useHdr
)
default
MatrixT
exture
Processor
toGlTextureProcessor
(
Context
context
,
boolean
useHdr
)
throws
FrameProcessingException
{
throws
FrameProcessingException
{
return
MatrixT
ransformation
Processor
.
create
(
return
MatrixT
exture
Processor
.
create
(
context
,
context
,
/* matrixTransformations= */
ImmutableList
.
of
(),
/* matrixTransformations= */
ImmutableList
.
of
(),
/* rgbMatrices= */
ImmutableList
.
of
(
this
),
/* rgbMatrices= */
ImmutableList
.
of
(
this
),
...
...
libraries/effect/src/test/java/androidx/media3/effect/ScaleToFitTransformationTest.java
View file @
5c78444b
...
@@ -25,8 +25,8 @@ import org.junit.runner.RunWith;
...
@@ -25,8 +25,8 @@ import org.junit.runner.RunWith;
/**
/**
* Unit tests for {@link ScaleToFitTransformation}.
* Unit tests for {@link ScaleToFitTransformation}.
*
*
* <p>See {@code MatrixT
ransformation
PixelTest} for pixel tests testing {@link
* <p>See {@code MatrixT
extureProcessor
PixelTest} for pixel tests testing {@link
* MatrixT
ransformation
Processor} given a transformation matrix.
* MatrixT
exture
Processor} given a transformation matrix.
*/
*/
@RunWith
(
AndroidJUnit4
.
class
)
@RunWith
(
AndroidJUnit4
.
class
)
public
final
class
ScaleToFitTransformationTest
{
public
final
class
ScaleToFitTransformationTest
{
...
...
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