GaussianBlurWithFrameOverlaid


@UnstableApi
public final class GaussianBlurWithFrameOverlaid extends SeparableConvolution


A SeparableConvolution to apply a Gaussian blur on image data.

The width of the blur is specified in pixels and applied symmetrically.

Summary

Public constructors

GaussianBlurWithFrameOverlaid(
    float sigma,
    float scaleSharpX,
    float scaleSharpY
)

Creates an instance with numStandardDeviations set to 2.0f.

GaussianBlurWithFrameOverlaid(
    @FloatRange(from = 0.0, fromInclusive = false) float sigma,
    @FloatRange(from = 0.0, fromInclusive = false) float numStandardDeviations,
    float scaleSharpX,
    float scaleSharpY
)

Creates an instance.

Public methods

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

GaussianBlurWithFrameOverlaid

public GaussianBlurWithFrameOverlaid(
    float sigma,
    float scaleSharpX,
    float scaleSharpY
)

Creates an instance with numStandardDeviations set to 2.0f.

Parameters
float sigma

The half-width of 1 standard deviation, in pixels.

float scaleSharpX

The scaling factor used to determine the size of the sharp image in the output frame relative to the whole output frame in the horizontal direction.

float scaleSharpY

The scaling factor used to determine the size of the sharp image in the output frame relative to the whole output frame in the vertical direction.

GaussianBlurWithFrameOverlaid

public GaussianBlurWithFrameOverlaid(
    @FloatRange(from = 0.0, fromInclusive = false) float sigma,
    @FloatRange(from = 0.0, fromInclusive = false) float numStandardDeviations,
    float scaleSharpX,
    float scaleSharpY
)

Creates an instance.

Parameters
@FloatRange(from = 0.0, fromInclusive = false) float sigma

The half-width of 1 standard deviation, in pixels.

@FloatRange(from = 0.0, fromInclusive = false) float numStandardDeviations

The size of function domain, measured in the number of standard deviations.

float scaleSharpX

The scaling factor used to determine the size of the sharp image in the output frame relative to the whole output frame in the horizontal direction.

float scaleSharpY

The scaling factor used to determine the size of the sharp image in the output frame relative to the whole output frame in the vertical direction.

Public methods

getConvolution

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