Search in sources :

Example 91 with MutableFrameFormat

use of android.filterfw.core.MutableFrameFormat in project android_frameworks_base by AOSPA.

the class ToPackedGrayFilter method process.

@Override
public void process(FilterContext context) {
    Frame input = pullInput("image");
    FrameFormat inputFormat = input.getFormat();
    FrameFormat outputFormat = convertInputFormat(inputFormat);
    int ow = outputFormat.getWidth();
    int oh = outputFormat.getHeight();
    checkOutputDimensions(ow, oh);
    mProgram.setHostValue("pix_stride", 1.0f / ow);
    // Do the RGBA to luminance conversion.
    MutableFrameFormat tempFrameFormat = inputFormat.mutableCopy();
    tempFrameFormat.setDimensions(ow / 4, oh);
    Frame temp = context.getFrameManager().newFrame(tempFrameFormat);
    mProgram.process(input, temp);
    // Read frame from GPU to CPU.
    Frame output = context.getFrameManager().newFrame(outputFormat);
    output.setDataFromFrame(temp);
    temp.release();
    // Push output and yield ownership.
    pushOutput("image", output);
    output.release();
}
Also used : FrameFormat(android.filterfw.core.FrameFormat) MutableFrameFormat(android.filterfw.core.MutableFrameFormat) Frame(android.filterfw.core.Frame) MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 92 with MutableFrameFormat

use of android.filterfw.core.MutableFrameFormat in project android_frameworks_base by AOSPA.

the class ImageStitcher method calcOutputFormatForInput.

private FrameFormat calcOutputFormatForInput(FrameFormat format) {
    MutableFrameFormat outputFormat = format.mutableCopy();
    mInputWidth = format.getWidth();
    mInputHeight = format.getHeight();
    mSliceWidth = mInputWidth - 2 * mPadSize;
    mSliceHeight = mInputHeight - 2 * mPadSize;
    mImageWidth = mSliceWidth * mXSlices;
    mImageHeight = mSliceHeight * mYSlices;
    outputFormat.setDimensions(mImageWidth, mImageHeight);
    return outputFormat;
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 93 with MutableFrameFormat

use of android.filterfw.core.MutableFrameFormat in project android_frameworks_base by AOSPA.

the class ToRGBAFilter method getConvertedFormat.

public FrameFormat getConvertedFormat(FrameFormat format) {
    MutableFrameFormat result = format.mutableCopy();
    result.setMetaValue(ImageFormat.COLORSPACE_KEY, ImageFormat.COLORSPACE_RGBA);
    result.setBytesPerSample(4);
    return result;
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 94 with MutableFrameFormat

use of android.filterfw.core.MutableFrameFormat in project android_frameworks_base by AOSPA.

the class ToRGBAFilter method setupPorts.

@Override
public void setupPorts() {
    MutableFrameFormat mask = new MutableFrameFormat(FrameFormat.TYPE_BYTE, FrameFormat.TARGET_NATIVE);
    mask.setDimensionCount(2);
    addMaskedInputPort("image", mask);
    addOutputBasedOnInput("image", "image");
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 95 with MutableFrameFormat

use of android.filterfw.core.MutableFrameFormat in project android_frameworks_base by ResurrectionRemix.

the class RetargetFilter method getOutputFormat.

@Override
public FrameFormat getOutputFormat(String portName, FrameFormat inputFormat) {
    MutableFrameFormat retargeted = inputFormat.mutableCopy();
    retargeted.setTarget(mTarget);
    return retargeted;
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Aggregations

MutableFrameFormat (android.filterfw.core.MutableFrameFormat)126 Frame (android.filterfw.core.Frame)36 FrameFormat (android.filterfw.core.FrameFormat)24 ShaderProgram (android.filterfw.core.ShaderProgram)12 Point (android.filterfw.geometry.Point)12 Quad (android.filterfw.geometry.Quad)12 GLFrame (android.filterfw.core.GLFrame)6 KeyValueMap (android.filterfw.core.KeyValueMap)6 MediaRecorder (android.media.MediaRecorder)6 IOException (java.io.IOException)6 NativeFrame (android.filterfw.core.NativeFrame)2