Search in sources :

Example 51 with Frame

use of android.filterfw.core.Frame in project android_frameworks_base by ParanoidAndroid.

the class CachedFrameManager method findAvailableFrame.

private Frame findAvailableFrame(FrameFormat format, int bindingType, long bindingId) {
    // Look for a frame that is compatible with the requested format
    synchronized (mAvailableFrames) {
        for (Map.Entry<Integer, Frame> entry : mAvailableFrames.entrySet()) {
            Frame frame = entry.getValue();
            // Check that format is compatible
            if (frame.getFormat().isReplaceableBy(format)) {
                // Check that binding is compatible (if frame is bound)
                if ((bindingType == frame.getBindingType()) && (bindingType == Frame.NO_BINDING || bindingId == frame.getBindingId())) {
                    // We found one! Take it out of the set of available frames and attach the
                    // requested format to it.
                    super.retainFrame(frame);
                    mAvailableFrames.remove(entry.getKey());
                    frame.onFrameFetch();
                    frame.reset(format);
                    mStorageSize -= format.getSize();
                    return frame;
                }
            }
        }
    }
    return null;
}
Also used : Frame(android.filterfw.core.Frame) TreeMap(java.util.TreeMap) Map(java.util.Map) SortedMap(java.util.SortedMap)

Example 52 with Frame

use of android.filterfw.core.Frame in project android_frameworks_base by ParanoidAndroid.

the class CachedFrameManager method dropOldestFrame.

private void dropOldestFrame() {
    int oldest = mAvailableFrames.firstKey();
    Frame frame = mAvailableFrames.get(oldest);
    mStorageSize -= frame.getFormat().getSize();
    frame.releaseNativeAllocation();
    mAvailableFrames.remove(oldest);
}
Also used : Frame(android.filterfw.core.Frame)

Example 53 with Frame

use of android.filterfw.core.Frame in project android_frameworks_base by ParanoidAndroid.

the class FilterContext method tearDown.

public synchronized void tearDown() {
    // Release stored frames
    for (Frame frame : mStoredFrames.values()) {
        frame.release();
    }
    mStoredFrames.clear();
    // Release graphs
    for (FilterGraph graph : mGraphs) {
        graph.tearDown(this);
    }
    mGraphs.clear();
    // Release frame manager
    if (mFrameManager != null) {
        mFrameManager.tearDown();
        mFrameManager = null;
    }
    // Release GL context
    if (mGLEnvironment != null) {
        mGLEnvironment.tearDown();
        mGLEnvironment = null;
    }
}
Also used : Frame(android.filterfw.core.Frame)

Example 54 with Frame

use of android.filterfw.core.Frame in project android_frameworks_base by ParanoidAndroid.

the class StringSource method process.

@Override
public void process(FilterContext env) {
    Frame output = env.getFrameManager().newFrame(mOutputFormat);
    output.setObjectValue(mString);
    output.setTimestamp(Frame.TIMESTAMP_UNKNOWN);
    pushOutput("string", output);
    closeOutputPort("string");
}
Also used : Frame(android.filterfw.core.Frame)

Example 55 with Frame

use of android.filterfw.core.Frame in project android_frameworks_base by ParanoidAndroid.

the class ToUpperCase method process.

@Override
public void process(FilterContext env) {
    Frame input = pullInput("mixedcase");
    String inputString = (String) input.getObjectValue();
    Frame output = env.getFrameManager().newFrame(mOutputFormat);
    output.setObjectValue(inputString.toUpperCase());
    pushOutput("uppercase", output);
}
Also used : Frame(android.filterfw.core.Frame)

Aggregations

Frame (android.filterfw.core.Frame)414 FrameFormat (android.filterfw.core.FrameFormat)198 GLFrame (android.filterfw.core.GLFrame)73 MutableFrameFormat (android.filterfw.core.MutableFrameFormat)47 NativeFrame (android.filterfw.core.NativeFrame)38 Quad (android.filterfw.geometry.Quad)24 GLEnvironment (android.filterfw.core.GLEnvironment)18 ShaderProgram (android.filterfw.core.ShaderProgram)18 ByteBuffer (java.nio.ByteBuffer)18 Point (android.filterfw.geometry.Point)12 IOException (java.io.IOException)12 FrameManager (android.filterfw.core.FrameManager)6 Bitmap (android.graphics.Bitmap)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 Map (java.util.Map)6 SortedMap (java.util.SortedMap)6 TreeMap (java.util.TreeMap)6 CachedFrameManager (android.filterfw.core.CachedFrameManager)1