LanczosResample


@UnstableApi
public final class LanczosResample implements GlEffect


A GlEffect that applies a Lanczos-windowed sinc function when resampling an image. See Filters for Common Resampling Tasks, Ken Turkowski.

The filter rescales images in both dimensions with the same scaling factor.

Summary

Public methods

static LanczosResample
scaleToFit(@IntRange(from = 1) int width, @IntRange(from = 1) int height)

Creates an instance.

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 methods

scaleToFit

public static LanczosResample scaleToFit(@IntRange(from = 1) int width, @IntRange(from = 1) int height)

Creates an instance.

Parameters
@IntRange(from = 1) int width

The width inside which the output contents will fit.

@IntRange(from = 1) int height

The height inside which the output contents will fit.

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 .