RenderedImage source = args.getRenderedSource(0);
// map the input kernel + gain factor to an equivalent
// convolution kernel and then do a normal convolve.
KernelJAI unRotatedKernel =
ImageUtil.getUnsharpMaskEquivalentKernel(
(KernelJAI)args.getObjectParameter(0),
args.getFloatParameter(1));
KernelJAI kJAI = unRotatedKernel.getRotatedKernel();
int kWidth = kJAI.getWidth();
int kHeight = kJAI.getHeight();
/* mediaLib does not handle kernels with either dimension < 2. */
if (kWidth < 2 || kHeight < 2) {
return null;
}
if (kJAI.isSeparable() && kWidth >= 3 && kWidth <= 7 && kWidth == kHeight) {
return new MlibSeparableConvolveOpImage(source,
extender, hints, layout,
kJAI);
} else if ((kWidth == 3 && kHeight == 3) ||
(kWidth == 5 && kHeight == 5)) {