@@ -64,6 +64,8 @@ def is_processing_required(self, frame_num: int) -> bool:
64
64
65
65
True otherwise (i.e. the frame_img passed to process_frame is required
66
66
to be passed to process_frame for the given frame_num).
67
+
68
+ :meta private:
67
69
"""
68
70
metric_keys = self .get_metrics ()
69
71
return not metric_keys or not (
@@ -132,6 +134,8 @@ class SparseSceneDetector(SceneDetector):
132
134
as opposed to just a single cut.
133
135
134
136
An example of a SparseSceneDetector is the MotionDetector.
137
+
138
+ :meta private:
135
139
"""
136
140
137
141
def process_frame (
@@ -160,13 +164,22 @@ def post_process(self, frame_num: int) -> ty.List[ty.Tuple[int, int]]:
160
164
161
165
162
166
class FlashFilter :
167
+ """Filters fast-cuts to enforce minimum scene length."""
168
+
163
169
class Mode (Enum ):
170
+ """Which mode the filter should use for enforcing minimum scene length."""
171
+
164
172
MERGE = 0
165
173
"""Merge consecutive cuts shorter than filter length."""
166
174
SUPPRESS = 1
167
175
"""Suppress consecutive cuts until the filter length has passed."""
168
176
169
177
def __init__ (self , mode : Mode , length : int ):
178
+ """
179
+ Arguments:
180
+ mode: The mode to use when enforcing `length`.
181
+ length: Number of frames to use when filtering cuts.
182
+ """
170
183
self ._mode = mode
171
184
self ._filter_length = length # Number of frames to use for activating the filter.
172
185
self ._last_above = None # Last frame above threshold.
@@ -176,7 +189,6 @@ def __init__(self, mode: Mode, length: int):
176
189
177
190
@property
178
191
def max_behind (self ) -> int :
179
- """Maximum number of frames a filtered cut can be behind the current frame."""
180
192
return 0 if self ._mode == FlashFilter .Mode .SUPPRESS else self ._filter_length
181
193
182
194
def filter (self , frame_num : int , above_threshold : bool ) -> ty .List [int ]:
0 commit comments