use of android.filterfw.core.FrameFormat in project android_frameworks_base by ParanoidAndroid.
the class CrossProcessFilter method process.
@Override
public void process(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();
}
use of android.filterfw.core.FrameFormat in project android_frameworks_base by ParanoidAndroid.
the class ObjectSource method process.
@Override
public void process(FilterContext context) {
// If no frame has been created, create one now.
if (mFrame == null) {
if (mObject == null) {
throw new NullPointerException("ObjectSource producing frame with no object set!");
}
FrameFormat outputFormat = ObjectFormat.fromObject(mObject, FrameFormat.TARGET_SIMPLE);
mFrame = context.getFrameManager().newFrame(outputFormat);
mFrame.setObjectValue(mObject);
mFrame.setTimestamp(Frame.TIMESTAMP_UNKNOWN);
}
// Push output
pushOutput("frame", mFrame);
// Wait for free output
if (!mRepeatFrame) {
closeOutputPort("frame");
}
}
use of android.filterfw.core.FrameFormat in project android_frameworks_base by ParanoidAndroid.
the class AutoFixFilter method prepare.
@Override
protected void prepare(FilterContext context) {
int densityDim = 1024;
int histDim = 255 * 3 + 1;
long precision = (256l * 256l - 1l);
int[] densityTable = new int[densityDim];
for (int i = 0; i < densityDim; ++i) {
long temp = normal_cdf[i] * precision / histDim;
densityTable[i] = (int) temp;
}
FrameFormat densityFormat = ImageFormat.create(densityDim, 1, ImageFormat.COLORSPACE_RGBA, FrameFormat.TARGET_GPU);
mDensityFrame = context.getFrameManager().newFrame(densityFormat);
mDensityFrame.setInts(densityTable);
}
use of android.filterfw.core.FrameFormat in project android_frameworks_base by ParanoidAndroid.
the class AutoFixFilter method process.
@Override
public void process(FilterContext context) {
// Get input frame
Frame input = pullInput("image");
FrameFormat inputFormat = input.getFormat();
// Create program if not created already
if (mShaderProgram == null || inputFormat.getTarget() != mTarget) {
initProgram(context, inputFormat.getTarget());
initParameters();
}
// Check if the frame size has changed
if (inputFormat.getWidth() != mWidth || inputFormat.getHeight() != mHeight) {
mWidth = inputFormat.getWidth();
mHeight = inputFormat.getHeight();
createHistogramFrame(context, mWidth, mHeight, input.getInts());
}
// Create output frame
Frame output = context.getFrameManager().newFrame(inputFormat);
// Process
Frame[] inputs = { input, mHistFrame, mDensityFrame };
mShaderProgram.process(inputs, output);
// Push output
pushOutput("image", output);
// Release pushed frame
output.release();
}
use of android.filterfw.core.FrameFormat in project android_frameworks_base by ParanoidAndroid.
the class SepiaFilter method process.
@Override
public void process(FilterContext context) {
// Get input frame
Frame input = pullInput("image");
FrameFormat inputFormat = input.getFormat();
// Create output frame
Frame output = context.getFrameManager().newFrame(inputFormat);
// Create program if not created already
if (mProgram == null || inputFormat.getTarget() != mTarget) {
initProgram(context, inputFormat.getTarget());
initParameters();
}
// Process
mProgram.process(input, output);
// Push output
pushOutput("image", output);
// Release pushed frame
output.release();
}
Aggregations