Search in sources :

Example 36 with MutableFrameFormat

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

the class ToRGBFilter method getConvertedFormat.

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

Example 37 with MutableFrameFormat

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

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)

Example 38 with MutableFrameFormat

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

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)

Example 39 with MutableFrameFormat

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

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 40 with MutableFrameFormat

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

the class ResizeFilter method process.

@Override
public void process(FilterContext env) {
    // Get input frame
    Frame input = pullInput("image");
    createProgram(env, input.getFormat());
    // Create output frame
    MutableFrameFormat outputFormat = input.getFormat().mutableCopy();
    if (mKeepAspectRatio) {
        FrameFormat inputFormat = input.getFormat();
        mOHeight = mOWidth * inputFormat.getHeight() / inputFormat.getWidth();
    }
    outputFormat.setDimensions(mOWidth, mOHeight);
    Frame output = env.getFrameManager().newFrame(outputFormat);
    // Process
    if (mGenerateMipMap) {
        GLFrame mipmapped = (GLFrame) env.getFrameManager().newFrame(input.getFormat());
        mipmapped.setTextureParameter(GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR_MIPMAP_NEAREST);
        mipmapped.setDataFromFrame(input);
        mipmapped.generateMipMap();
        mProgram.process(mipmapped, output);
        mipmapped.release();
    } else {
        mProgram.process(input, output);
    }
    // Push output
    pushOutput("image", output);
    // Release pushed frame
    output.release();
}
Also used : FrameFormat(android.filterfw.core.FrameFormat) MutableFrameFormat(android.filterfw.core.MutableFrameFormat) Frame(android.filterfw.core.Frame) GLFrame(android.filterfw.core.GLFrame) GLFrame(android.filterfw.core.GLFrame) 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