// Get input frame
Frame input = pullInput("image");
createProgram(env, input.getFormat());
// Create output frame
MutableFrameFormat outputFormat = input.getFormat().mutableCopy();
if (mKeepAspectRatio) {
FrameFormat inputFormat = input.getFormat();
mOHeight = mOWidth * inputFormat.getHeight() / inputFormat.getWidth();
}
outputFormat.setDimensions(mOWidth, mOHeight);
Frame output = env.getFrameManager().newFrame(outputFormat);
// Process
if (mGenerateMipMap) {
GLFrame mipmapped = (GLFrame)env.getFrameManager().newFrame(input.getFormat());
mipmapped.setTextureParameter(GLES20.GL_TEXTURE_MIN_FILTER,
GLES20.GL_LINEAR_MIPMAP_NEAREST);
mipmapped.setDataFromFrame(input);
mipmapped.generateMipMap();
mProgram.process(mipmapped, output);
mipmapped.release();
} else {
mProgram.process(input, output);
}
// Push output
pushOutput("image", output);
// Release pushed frame
output.release();