Methods Summary |
---|
public void | fieldPortValueUpdated(java.lang.String name, android.filterfw.core.FilterContext context)
if (mProgram != null) {
updateParameters();
}
|
public android.filterfw.core.FrameFormat | getOutputFormat(java.lang.String portName, android.filterfw.core.FrameFormat inputFormat)
return inputFormat;
|
public void | initProgram(android.filterfw.core.FilterContext context, int target)
switch (target) {
case FrameFormat.TARGET_GPU:
ShaderProgram shaderProgram = ShaderProgram.createIdentity(context);
shaderProgram.setMaximumTileSize(mTileSize);
mProgram = shaderProgram;
break;
default:
throw new RuntimeException("Filter Sharpen does not support frames of " +
"target " + target + "!");
}
mTarget = target;
updateParameters();
|
public void | process(android.filterfw.core.FilterContext context)
// Get input frame
Frame input = pullInput("image");
FrameFormat inputFormat = input.getFormat();
// Create program if not created already
if (mProgram == null || inputFormat.getTarget() != mTarget) {
initProgram(context, inputFormat.getTarget());
}
// Create output frame
Frame output = context.getFrameManager().newFrame(inputFormat);
// Process
mProgram.process(input, output);
// Push output
pushOutput("image", output);
// Release pushed frame
output.release();
|
public void | setupPorts()
addMaskedInputPort("image", ImageFormat.create(ImageFormat.COLORSPACE_RGBA));
addOutputBasedOnInput("image", "image");
|
private void | updateParameters()
float x_origin = (mHorizontal) ? 1.0f : 0.0f;
float y_origin = (mVertical) ? 1.0f : 0.0f;
float width = (mHorizontal) ? -1.0f : 1.0f;
float height = (mVertical) ? -1.0f : 1.0f;
((ShaderProgram) mProgram).setSourceRect(x_origin, y_origin, width, height);
|