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 |
|
|---|---|
boolean |
isNoOp(int inputWidth, int inputHeight)Returns whether a applies no change at every timestamp. |
static LanczosResample |
scaleToFit(@IntRange(from = 1) int width, @IntRange(from = 1) int height)Creates an instance. |
static LanczosResample |
scaleToFitWithFlexibleOrientation(Creates an instance. |
GlShaderProgram |
toGlShaderProgram(Context context, boolean useHdr)Returns a |
Inherited methods |
||
|---|---|---|
|
Public methods
isNoOp
public boolean isNoOp(int inputWidth, int inputHeight)
Returns whether a applies no change at every timestamp.
This can be used as a hint to skip this instance.
For scaling factors near 1, this effect applies no change because the Lanczos algorithm won't bring a big improvement over bilinear or nearest sampling using the GPU texture units.
scaleToFit
public static LanczosResample scaleToFit(@IntRange(from = 1) int width, @IntRange(from = 1) int height)
Creates an instance.
scaleToFitWithFlexibleOrientation
public static LanczosResample scaleToFitWithFlexibleOrientation(
@IntRange(from = 1) int firstDimension,
@IntRange(from = 1) int secondDimension
)
Creates an instance.
The output resolution will be either firstDimension x secondDimension or secondDimension x firstDimension. The longer of firstDimension or secondDimension will have the same orientation as the longer side of the Size passed in to configure.
toGlShaderProgram
public GlShaderProgram toGlShaderProgram(Context context, boolean useHdr)
Returns a GlShaderProgram that applies the effect.
| Parameters | |
|---|---|
Context context |
A |
boolean useHdr |
Whether input textures come from an HDR source. If |
| Throws | |
|---|---|
androidx.media3.common.VideoFrameProcessingException |
If an error occurs while creating the |