SeparableConvolution


@UnstableApi
abstract class SeparableConvolution : 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(scaleWidth: Float, scaleHeight: Float)

Creates an instance.

Public functions

abstract ConvolutionFunction1D!
getConvolution(presentationTimeUs: Long)

Returns a 1D convolution function.

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

SeparableConvolution

SeparableConvolution()

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

SeparableConvolution

SeparableConvolution(scaleWidth: Float, scaleHeight: Float)

Creates an instance.

Parameters
scaleWidth: Float

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

scaleHeight: Float

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

Public functions

getConvolution

abstract fun getConvolution(presentationTimeUs: Long): ConvolutionFunction1D!

Returns a 1D convolution function.

Parameters
presentationTimeUs: Long

The presentation timestamp of the input frame, in microseconds.

toGlShaderProgram

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

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 .