Search in sources :

Example 86 with MutableFrameFormat

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

the class CropFilter method getOutputFormat.

@Override
public FrameFormat getOutputFormat(String portName, FrameFormat inputFormat) {
    // Make sure output size is set to unspecified, as we do not know what we will be resizing
    // to.
    MutableFrameFormat outputFormat = inputFormat.mutableCopy();
    outputFormat.setDimensions(FrameFormat.SIZE_UNSPECIFIED, FrameFormat.SIZE_UNSPECIFIED);
    return outputFormat;
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 87 with MutableFrameFormat

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

the class CropFilter method process.

@Override
public void process(FilterContext env) {
    // Get input frame
    Frame imageFrame = pullInput("image");
    Frame boxFrame = pullInput("box");
    createProgram(env, imageFrame.getFormat());
    // Get the box
    Quad box = (Quad) boxFrame.getObjectValue();
    // Create output format
    MutableFrameFormat outputFormat = imageFrame.getFormat().mutableCopy();
    outputFormat.setDimensions(mOutputWidth == -1 ? outputFormat.getWidth() : mOutputWidth, mOutputHeight == -1 ? outputFormat.getHeight() : mOutputHeight);
    // Create output frame
    Frame output = env.getFrameManager().newFrame(outputFormat);
    // Set the program parameters
    if (mProgram instanceof ShaderProgram) {
        ShaderProgram shaderProgram = (ShaderProgram) mProgram;
        shaderProgram.setSourceRegion(box);
    }
    mProgram.process(imageFrame, output);
    // Push output
    pushOutput("image", output);
    // Release pushed frame
    output.release();
}
Also used : Quad(android.filterfw.geometry.Quad) Frame(android.filterfw.core.Frame) ShaderProgram(android.filterfw.core.ShaderProgram) MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 88 with MutableFrameFormat

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

the class FrameFormat method mutableCopy.

public MutableFrameFormat mutableCopy() {
    MutableFrameFormat result = new MutableFrameFormat();
    result.setBaseType(getBaseType());
    result.setTarget(getTarget());
    result.setBytesPerSample(getBytesPerSample());
    result.setDimensions(getDimensions());
    result.setObjectClass(getObjectClass());
    result.mMetaData = mMetaData == null ? null : (KeyValueMap) mMetaData.clone();
    return result;
}
Also used : KeyValueMap(android.filterfw.core.KeyValueMap) MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 89 with MutableFrameFormat

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

the class ImageFormat method create.

public static MutableFrameFormat create(int width, int height, int colorspace, int bytesPerSample, int target) {
    MutableFrameFormat result = new MutableFrameFormat(FrameFormat.TYPE_BYTE, target);
    result.setDimensions(width, height);
    result.setBytesPerSample(bytesPerSample);
    result.setMetaValue(COLORSPACE_KEY, colorspace);
    if (target == FrameFormat.TARGET_SIMPLE) {
        result.setObjectClass(Bitmap.class);
    }
    return result;
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 90 with MutableFrameFormat

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

the class ObjectFormat method fromClass.

public static MutableFrameFormat fromClass(Class clazz, int count, int target) {
    // Create frame format
    MutableFrameFormat result = new MutableFrameFormat(FrameFormat.TYPE_OBJECT, target);
    result.setObjectClass(getBoxedClass(clazz));
    if (count != FrameFormat.SIZE_UNSPECIFIED) {
        result.setDimensions(count);
    }
    result.setBytesPerSample(bytesPerSampleForClass(clazz, target));
    return result;
}
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