SeparableConvolution


@UnstableApi
public abstract class SeparableConvolution implements GlEffect

Known direct subclasses
GaussianBlurWithFrameOverlaid

A SeparableConvolution to apply a Gaussian blur on image data.

GaussianBlur

A SeparableConvolution to apply a Gaussian blur on image data.


A GlEffect for performing separable convolutions.

A single 1D convolution function is applied horizontally on a first pass and vertically on a second pass.

Summary

Public constructors

Creates an instance with scaleWidth and scaleHeight set to 1.0f.

SeparableConvolution(float scaleWidth, float scaleHeight)

Creates an instance.

Public methods

abstract ConvolutionFunction1D
getConvolution(long presentationTimeUs)

Returns a 1D convolution function.

GlShaderProgram
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 constructors

SeparableConvolution

public SeparableConvolution()

Creates an instance with scaleWidth and scaleHeight set to 1.0f.

SeparableConvolution

public SeparableConvolution(float scaleWidth, float scaleHeight)

Creates an instance.

Parameters
float scaleWidth

The scaling factor used to determine the width of the output relative to the input.

float scaleHeight

The scaling factor used to determine the height of the output relative to the input.

Public methods

getConvolution

public abstract ConvolutionFunction1D getConvolution(long presentationTimeUs)

Returns a 1D convolution function.

Parameters
long presentationTimeUs

The presentation timestamp of the input frame, in microseconds.

toGlShaderProgram

public GlShaderProgram 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 .