RgbAdjustment


@UnstableApi
public final class RgbAdjustment implements RgbMatrix


Scales the red, green, and blue color channels of a frame.

Summary

Nested types

public final class RgbAdjustment.Builder

A builder for RgbAdjustment instances.

Public methods

float[]
getMatrix(long presentationTimeUs, boolean useHdr)

Returns the 4x4 RGB transformation matrix to apply to the color values of each pixel in the frame with the given timestamp.

boolean
isNoOp(int inputWidth, int inputHeight)

Returns whether a GlEffect applies no change at every timestamp.

Inherited methods

From androidx.media3.common.Effect
long

Returns the expected duration of the output stream when the effect is applied given a input durationUs.

From androidx.media3.effect.GlEffect
abstract GlShaderProgram
toGlShaderProgram(Context context, boolean useHdr)

Returns a GlShaderProgram that applies the effect.

From androidx.media3.effect.RgbMatrix
BaseGlShaderProgram
toGlShaderProgram(Context context, boolean useHdr)

Returns a GlShaderProgram that applies the effect.

Public methods

getMatrix

public float[] getMatrix(long presentationTimeUs, boolean useHdr)

Returns the 4x4 RGB transformation matrix to apply to the color values of each pixel in the frame with the given timestamp.

Parameters
long presentationTimeUs

The timestamp of the frame to apply the matrix on.

boolean useHdr

If true, colors will be in linear RGB BT.2020. If false, colors will be in linear RGB BT.709. Must be consistent with useHdr in toGlShaderProgram.

Returns
float[]

The RgbMatrix to apply to the frame.

isNoOp

public boolean isNoOp(int inputWidth, int inputHeight)

Returns whether a GlEffect applies no change at every timestamp.

This can be used as a hint to skip this instance.

Parameters
int inputWidth

The input frame width, in pixels.

int inputHeight

The input frame height, in pixels.