@UnstableApi
class Brightness : RgbMatrix


Modifies brightness of an input frame.

Summary

Public constructors

Brightness(brightness: @FloatRange(from = "-1", to = 1) Float)

Modifies brightness by adding a constant value to red, green, and blue values.

Public functions

FloatArray<Float>!
getMatrix(presentationTimeUs: Long, useHdr: Boolean)

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

Boolean
isNoOp(inputWidth: Int, inputHeight: Int)

Returns whether a GlEffect applies no change at every timestamp.

Inherited functions

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!, useHdr: Boolean)

Returns a GlShaderProgram that applies the effect.

From androidx.media3.effect.RgbMatrix
BaseGlShaderProgram!
toGlShaderProgram(context: Context!, useHdr: Boolean)

Returns a GlShaderProgram that applies the effect.

Public constructors

Brightness

Brightness(brightness: @FloatRange(from = "-1", to = 1) Float)

Modifies brightness by adding a constant value to red, green, and blue values.

Parameters
brightness: @FloatRange(from = "-1", to = 1) Float

The constant value to add to red, green, and blue values. Should be greater than or equal to -1f, and less than or equal to 1f. 0 means to leave brightness unchanged.

Public functions

getMatrix

fun getMatrix(presentationTimeUs: Long, useHdr: Boolean): FloatArray<Float>!

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

Parameters
presentationTimeUs: Long

The timestamp of the frame to apply the matrix on.

useHdr: Boolean

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
FloatArray<Float>!

The RgbMatrix to apply to the frame.

isNoOp

fun isNoOp(inputWidth: Int, inputHeight: Int): Boolean

Returns whether a GlEffect applies no change at every timestamp.

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

Parameters
inputWidth: Int

The input frame width, in pixels.

inputHeight: Int

The input frame height, in pixels.