Search in sources :

Example 81 with Frame

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

the class FrameManager method duplicateFrameToTarget.

public Frame duplicateFrameToTarget(Frame frame, int newTarget) {
    MutableFrameFormat newFormat = frame.getFormat().mutableCopy();
    newFormat.setTarget(newTarget);
    Frame result = newFrame(newFormat);
    result.setDataFromFrame(frame);
    return result;
}
Also used : Frame(android.filterfw.core.Frame) MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 82 with Frame

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

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 83 with Frame

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

the class CachedFrameManager method newFrame.

@Override
public Frame newFrame(FrameFormat format) {
    Frame result = findAvailableFrame(format, Frame.NO_BINDING, 0);
    if (result == null) {
        result = super.newFrame(format);
    }
    result.setTimestamp(Frame.TIMESTAMP_NOT_SET);
    return result;
}
Also used : Frame(android.filterfw.core.Frame)

Example 84 with Frame

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

the class CachedFrameManager method newBoundFrame.

@Override
public Frame newBoundFrame(FrameFormat format, int bindingType, long bindingId) {
    Frame result = findAvailableFrame(format, bindingType, bindingId);
    if (result == null) {
        result = super.newBoundFrame(format, bindingType, bindingId);
    }
    result.setTimestamp(Frame.TIMESTAMP_NOT_SET);
    return result;
}
Also used : Frame(android.filterfw.core.Frame)

Example 85 with Frame

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

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)

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