use of androidx.media.filterfw.OutputPort in project platform_frameworks_base by android.
the class StatsFilter method onProcess.
/**
* @see androidx.media.filterfw.Filter#onProcess()
*/
@Override
protected void onProcess() {
FrameBuffer2D inputFrame = getConnectedInputPort("buffer").pullFrame().asFrameImage2D();
ByteBuffer pixelBuffer = inputFrame.lockBytes(Frame.MODE_READ);
calcMeanAndStd(pixelBuffer, inputFrame.getWidth(), inputFrame.getHeight(), mCropRect);
inputFrame.unlock();
OutputPort outPort = getConnectedOutputPort("mean");
FrameValue outFrame = outPort.fetchAvailableFrame(null).asFrameValue();
outFrame.setValue(mStats[MEAN_INDEX]);
outPort.pushFrame(outFrame);
OutputPort outPortStdev = getConnectedOutputPort("stdev");
FrameValue outFrameStdev = outPortStdev.fetchAvailableFrame(null).asFrameValue();
outFrameStdev.setValue(mStats[STDEV_INDEX]);
outPortStdev.pushFrame(outFrameStdev);
}
use of androidx.media.filterfw.OutputPort in project platform_frameworks_base by android.
the class ToStringFilter method onProcess.
@Override
protected void onProcess() {
FrameValue objectFrame = getConnectedInputPort("object").pullFrame().asFrameValue();
String outStr = objectFrame.getValue().toString();
OutputPort outPort = getConnectedOutputPort("string");
FrameValue stringFrame = outPort.fetchAvailableFrame(null).asFrameValue();
stringFrame.setValue(outStr);
outPort.pushFrame(stringFrame);
}
use of androidx.media.filterfw.OutputPort in project platform_frameworks_base by android.
the class NewChromaHistogramFilter method onProcess.
@Override
protected void onProcess() {
FrameBuffer2D imageFrame = getConnectedInputPort("image").pullFrame().asFrameImage2D();
OutputPort outPort = getConnectedOutputPort("histogram");
mValueBins = mHueBins;
int[] outDims = new int[] { mHueBins, mSaturationBins + 1 };
FrameBuffer2D histogramFrame = outPort.fetchAvailableFrame(outDims).asFrameBuffer2D();
ByteBuffer imageBuffer = imageFrame.lockBytes(Frame.MODE_READ);
ByteBuffer histogramBuffer = histogramFrame.lockBytes(Frame.MODE_READ);
histogramBuffer.order(ByteOrder.nativeOrder());
FloatBuffer floatHistogram = histogramBuffer.asFloatBuffer();
// Run native method
extractChromaHistogram(imageBuffer, floatHistogram, mHueBins, mSaturationBins, mValueBins, mSaturationThreshold, mValueThreshold);
imageFrame.unlock();
histogramFrame.unlock();
outPort.pushFrame(histogramFrame);
}
use of androidx.media.filterfw.OutputPort in project platform_frameworks_base by android.
the class RotateFilter method onProcess.
@Override
protected void onProcess() {
OutputPort outPort = getConnectedOutputPort("image");
FrameImage2D inputImage = getConnectedInputPort("image").pullFrame().asFrameImage2D();
int[] inDims = inputImage.getDimensions();
FrameImage2D outputImage = outPort.fetchAvailableFrame(inDims).asFrameImage2D();
mShader.setSourceQuad(mSourceRect);
Quad targetQuad = mSourceRect.rotated((float) (mRotateAngle / 180 * Math.PI));
mShader.setTargetQuad(targetQuad);
mShader.process(inputImage, outputImage);
outPort.pushFrame(outputImage);
}
use of androidx.media.filterfw.OutputPort in project platform_frameworks_base by android.
the class MotionSensor method onProcess.
@Override
protected void onProcess() {
OutputPort outPort = getConnectedOutputPort("values");
FrameValues outFrame = outPort.fetchAvailableFrame(null).asFrameValues();
synchronized (mValues) {
outFrame.setValues(mValues);
}
outFrame.setTimestamp(System.currentTimeMillis() * 1000000L);
outPort.pushFrame(outFrame);
}
Aggregations