Search in sources :

Example 91 with OutputPort

use of androidx.media.filterfw.OutputPort in project android_frameworks_base by crdroidandroid.

the class AvgBrightnessFilter method onProcess.

@Override
protected void onProcess() {
    FrameImage2D inputImage = getConnectedInputPort("image").pullFrame().asFrameImage2D();
    float brightness;
    ByteBuffer inputBuffer = inputImage.lockBytes(Frame.MODE_READ);
    brightness = brightnessOperator(inputImage.getWidth(), inputImage.getHeight(), inputBuffer);
    inputImage.unlock();
    if (mLogVerbose)
        Log.v(TAG, "contrastRatio: " + brightness);
    OutputPort brightnessPort = getConnectedOutputPort("brightnessRating");
    FrameValue brightnessOutFrame = brightnessPort.fetchAvailableFrame(null).asFrameValue();
    brightnessOutFrame.setValue(brightness);
    brightnessPort.pushFrame(brightnessOutFrame);
}
Also used : OutputPort(androidx.media.filterfw.OutputPort) FrameImage2D(androidx.media.filterfw.FrameImage2D) ByteBuffer(java.nio.ByteBuffer) FrameValue(androidx.media.filterfw.FrameValue)

Example 92 with OutputPort

use of androidx.media.filterfw.OutputPort in project android_frameworks_base by crdroidandroid.

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);
}
Also used : OutputPort(androidx.media.filterfw.OutputPort) FrameValue(androidx.media.filterfw.FrameValue)

Aggregations

OutputPort (androidx.media.filterfw.OutputPort)92 FrameValue (androidx.media.filterfw.FrameValue)60 FrameImage2D (androidx.media.filterfw.FrameImage2D)48 ByteBuffer (java.nio.ByteBuffer)36 FrameBuffer2D (androidx.media.filterfw.FrameBuffer2D)20 FrameValues (androidx.media.filterfw.FrameValues)12 Bitmap (android.graphics.Bitmap)8 Quad (androidx.media.filterfw.geometry.Quad)8 FloatBuffer (java.nio.FloatBuffer)8 Canvas (android.graphics.Canvas)4 Matrix (android.graphics.Matrix)4 Paint (android.graphics.Paint)4 Face (android.hardware.Camera.Face)4 RenderTarget (androidx.media.filterfw.RenderTarget)4