SingleColorLut


@UnstableApi
public final class SingleColorLut implements ColorLut


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

Summary

Public methods

static SingleColorLut

Creates a new instance.

static SingleColorLut
createFromCube(int[][][] lutCube)

Creates a new instance.

int
getLength(long presentationTimeUs)

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

int
getLutTextureId(long presentationTimeUs)

Must be called after toGlShaderProgram.

void

Releases the OpenGL texture of the LUT.

BaseGlShaderProgram
toGlShaderProgram(Context context, boolean useHdr)

Returns a GlShaderProgram that applies the effect.

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
boolean
isNoOp(int inputWidth, int inputHeight)

Returns whether a GlEffect applies no change at every timestamp.

Public methods

createFromBitmap

public static SingleColorLut createFromBitmap(Bitmap lut)

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

public static SingleColorLut createFromCube(int[][][] lutCube)

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

public int getLength(long presentationTimeUs)

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

getLutTextureId

public int getLutTextureId(long presentationTimeUs)

Must be called after toGlShaderProgram.

release

public void release()

Releases the OpenGL texture of the LUT.

toGlShaderProgram

public BaseGlShaderProgram toGlShaderProgram(Context context, boolean useHdr)

Returns a GlShaderProgram that applies the effect.

Parameters
Context context

A Context.

boolean useHdr

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 .