SingleColorLut


@UnstableApi
class SingleColorLut : ColorLut


Transforms the colors of a frame by applying the same color lookup table to each frame.

Summary

Public functions

java-static SingleColorLut!

Creates a new instance.

java-static SingleColorLut!

Creates a new instance.

Int
getLength(presentationTimeUs: Long)

Returns the length N of the 3D N x N x N LUT cube with the given timestamp.

Int
getLutTextureId(presentationTimeUs: Long)

Must be called after toGlShaderProgram.

Unit

Releases the OpenGL texture of the LUT.

BaseGlShaderProgram!
toGlShaderProgram(context: Context!, useHdr: Boolean)

Returns a GlShaderProgram that applies the effect.

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
Boolean
isNoOp(inputWidth: Int, inputHeight: Int)

Returns whether a GlEffect applies no change at every timestamp.

Public functions

createFromBitmap

java-static fun createFromBitmap(lut: Bitmap!): SingleColorLut!

Creates a new instance.

LUT needs to be a Bitmap of a flattened HALD image of width N and height N^2. Each element must be an integer representing a color using the ARGB_8888 format.

createFromCube

java-static fun createFromCube(lutCube: Array<Array<IntArray!>!>!): SingleColorLut!

Creates a new instance.

lutCube needs to be a N x N x N cube and each element is an integer representing a color using the ARGB_8888 format.

getLength

fun getLength(presentationTimeUs: Long): Int

Returns the length N of the 3D N x N x N LUT cube with the given timestamp.

getLutTextureId

fun getLutTextureId(presentationTimeUs: Long): Int

Must be called after toGlShaderProgram.

release

fun release(): Unit

Releases the OpenGL texture of the LUT.

toGlShaderProgram

fun toGlShaderProgram(context: Context!, useHdr: Boolean): BaseGlShaderProgram!

Returns a GlShaderProgram that applies the effect.

Parameters
context: Context!

A Context.

useHdr: Boolean

Whether input textures come from an HDR source. If true, colors will be in linear RGB BT.2020. If false, colors will be in linear RGB BT.709.

Throws
androidx.media3.common.VideoFrameProcessingException

If an error occurs while creating the .