Skip to content

Commit 09f2b64

Browse files
committed
[docs] Add missing docs for FlashFilter
1 parent 9760c0a commit 09f2b64

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

scenedetect/scene_detector.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def is_processing_required(self, frame_num: int) -> bool:
6464
6565
True otherwise (i.e. the frame_img passed to process_frame is required
6666
to be passed to process_frame for the given frame_num).
67+
68+
:meta private:
6769
"""
6870
metric_keys = self.get_metrics()
6971
return not metric_keys or not (
@@ -132,6 +134,8 @@ class SparseSceneDetector(SceneDetector):
132134
as opposed to just a single cut.
133135
134136
An example of a SparseSceneDetector is the MotionDetector.
137+
138+
:meta private:
135139
"""
136140

137141
def process_frame(
@@ -160,13 +164,22 @@ def post_process(self, frame_num: int) -> ty.List[ty.Tuple[int, int]]:
160164

161165

162166
class FlashFilter:
167+
"""Filters fast-cuts to enforce minimum scene length."""
168+
163169
class Mode(Enum):
170+
"""Which mode the filter should use for enforcing minimum scene length."""
171+
164172
MERGE = 0
165173
"""Merge consecutive cuts shorter than filter length."""
166174
SUPPRESS = 1
167175
"""Suppress consecutive cuts until the filter length has passed."""
168176

169177
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+
"""
170183
self._mode = mode
171184
self._filter_length = length # Number of frames to use for activating the filter.
172185
self._last_above = None # Last frame above threshold.
@@ -176,7 +189,6 @@ def __init__(self, mode: Mode, length: int):
176189

177190
@property
178191
def max_behind(self) -> int:
179-
"""Maximum number of frames a filtered cut can be behind the current frame."""
180192
return 0 if self._mode == FlashFilter.Mode.SUPPRESS else self._filter_length
181193

182194
def filter(self, frame_num: int, above_threshold: bool) -> ty.List[int]:

scenedetect/scene_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def get_scenes_from_cuts(
191191
was processed (used to generate last scene's end time).
192192
start_frame: The start frame or FrameTimecode of the cut list. Used to generate the first
193193
scene's start time.
194-
base_timecode: [DEPRECATED] DO NOT USE. For backwards compatibility only.
194+
base_timecode: [DEPRECATED] DO NOT USE. For backwards compatibility only.
195195
Returns:
196196
List of tuples in the form (start_time, end_time), where both start_time and
197197
end_time are FrameTimecode objects representing the exact time/frame where each

0 commit comments

Comments
 (0)