Class MulticoreVideoBackend
java.lang.Object
org.episteme.core.media.video.backends.MulticoreVideoBackend
- All Implemented Interfaces:
VideoAlgorithmProvider, VideoBackend, AlgorithmProvider, Backend, ComputeBackend, CPUBackend
@AutoService({Backend.class,ComputeBackend.class,VideoBackend.class,VideoAlgorithmProvider.class,CPUBackend.class})
public class MulticoreVideoBackend
extends Object
implements VideoBackend, CPUBackend
Multicore CPU Video Backend using Java Parallel Streams for analysis.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates and returns the backend instance (or returns self if it is the backend).detectMotion(float[][] prev, float[][] curr, float threshold) Detects motion between two frames.detectTransitions(List<float[][]> frames, double threshold) Detects scene transitions in a list of frames.Returns the type of hardware accelerator used by this backend.Returns the friendly name of this backend instance.Returns a description of the backend.doublegetId()Returns the unique identifier for this backend (e.g., "javafx", "jmol", "cuda").intReturns the priority for auto-selection (higher = preferred).doublegetTime()getType()Returns the backend type category (e.g., "plotting", "molecular", "tensor", "math").<T> TGrabs the current frame as an image.booleanChecks if this backend is currently available (libraries loaded, etc.).voidLoads a video resource.voidpause()voidplay()voidshutdown()Called when the application is shutting down or the backend is being replaced.voidstop()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AlgorithmProvider
description, getMetadata, scoreMethods inherited from interface Backend
getAlgorithmProviders, getStatusMessage, isExplicitlyDisabledMethods inherited from interface CPUBackend
supportsComplexNumbers, supportsFloatingPoint, supportsParallelOpsMethods inherited from interface VideoAlgorithmProvider
getAlgorithmTypeMethods inherited from interface VideoBackend
createContext, getName
-
Constructor Details
-
MulticoreVideoBackend
public MulticoreVideoBackend()
-
-
Method Details
-
getType
Description copied from interface:BackendReturns the backend type category (e.g., "plotting", "molecular", "tensor", "math").- Specified by:
getTypein interfaceBackend- Specified by:
getTypein interfaceComputeBackend- Specified by:
getTypein interfaceCPUBackend- Specified by:
getTypein interfaceVideoBackend
-
getId
Description copied from interface:BackendReturns the unique identifier for this backend (e.g., "javafx", "jmol", "cuda").- Specified by:
getIdin interfaceBackend- Specified by:
getIdin interfaceComputeBackend- Specified by:
getIdin interfaceVideoBackend
-
getBackendName
Description copied from interface:VideoBackendReturns the friendly name of this backend instance.- Specified by:
getBackendNamein interfaceVideoBackend
-
getDescription
Description copied from interface:BackendReturns a description of the backend.- Specified by:
getDescriptionin interfaceBackend- Specified by:
getDescriptionin interfaceComputeBackend- Specified by:
getDescriptionin interfaceVideoBackend
-
isAvailable
public boolean isAvailable()Description copied from interface:BackendChecks if this backend is currently available (libraries loaded, etc.).Default implementation checks
Backend.isExplicitlyDisabled()and returns false if it is.- Specified by:
isAvailablein interfaceAlgorithmProvider- Specified by:
isAvailablein interfaceBackend- Specified by:
isAvailablein interfaceVideoBackend
-
getPriority
public int getPriority()Description copied from interface:BackendReturns the priority for auto-selection (higher = preferred). Used when multiple backends are available.- Specified by:
getPriorityin interfaceAlgorithmProvider- Specified by:
getPriorityin interfaceBackend- Specified by:
getPriorityin interfaceVideoBackend
-
createBackend
Description copied from interface:BackendCreates and returns the backend instance (or returns self if it is the backend).- Specified by:
createBackendin interfaceBackend- Specified by:
createBackendin interfaceComputeBackend- Specified by:
createBackendin interfaceVideoBackend- Returns:
- The backend implementation object
-
getAcceleratorType
Description copied from interface:ComputeBackendReturns the type of hardware accelerator used by this backend.- Specified by:
getAcceleratorTypein interfaceComputeBackend- Specified by:
getAcceleratorTypein interfaceCPUBackend- Specified by:
getAcceleratorTypein interfaceVideoBackend- Returns:
- the accelerator type
-
load
Description copied from interface:VideoBackendLoads a video resource.- Specified by:
loadin interfaceVideoBackend- Parameters:
path- File path or URL- Throws:
Exception
-
play
public void play()- Specified by:
playin interfaceVideoBackend
-
pause
public void pause()- Specified by:
pausein interfaceVideoBackend
-
stop
public void stop()- Specified by:
stopin interfaceVideoBackend
-
getTime
public double getTime()- Specified by:
getTimein interfaceVideoBackend
-
getDuration
public double getDuration()- Specified by:
getDurationin interfaceVideoBackend
-
grabFrame
public <T> T grabFrame()Description copied from interface:VideoBackendGrabs the current frame as an image.- Specified by:
grabFramein interfaceVideoBackend- Type Parameters:
T- the image type- Returns:
- the current frame
-
detectMotion
public SceneTransitionDetector.Transition detectMotion(float[][] prev, float[][] curr, float threshold) Description copied from interface:VideoAlgorithmProviderDetects motion between two frames.- Specified by:
detectMotionin interfaceVideoAlgorithmProvider- Parameters:
prev- Gray frame (float[][])curr- Gray frame (float[][])threshold- Sensitivity threshold- Returns:
- Motion result
-
detectTransitions
public List<SceneTransitionDetector.Transition> detectTransitions(List<float[][]> frames, double threshold) Description copied from interface:VideoAlgorithmProviderDetects scene transitions in a list of frames.- Specified by:
detectTransitionsin interfaceVideoAlgorithmProvider- Parameters:
frames- List of gray frames (float[][])threshold- Sensitivity threshold- Returns:
- List of transitions
-
shutdown
public void shutdown()Description copied from interface:BackendCalled when the application is shutting down or the backend is being replaced. Use this to release hardware resources, close file handles, or stop background threads.- Specified by:
shutdownin interfaceAlgorithmProvider- Specified by:
shutdownin interfaceBackend- Specified by:
shutdownin interfaceVideoBackend
-