Remove unused trash
This commit is contained in:
@@ -28,37 +28,10 @@ class Cv2BufferedCap:
|
||||
self.frame_width = int(self.cap.get(cv2.CAP_PROP_FRAME_WIDTH))
|
||||
self.frame_height = int(self.cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
||||
|
||||
# Frame cache
|
||||
self.frame_cache = {}
|
||||
self.cache_access_order = []
|
||||
self.MAX_CACHE_FRAMES = 3000
|
||||
|
||||
# Current position tracking
|
||||
self.current_frame = 0
|
||||
|
||||
def _manage_cache(self):
|
||||
"""Manage cache size using LRU eviction"""
|
||||
while len(self.frame_cache) > self.MAX_CACHE_FRAMES:
|
||||
oldest_frame = self.cache_access_order.pop(0)
|
||||
if oldest_frame in self.frame_cache:
|
||||
del self.frame_cache[oldest_frame]
|
||||
|
||||
def _add_to_cache(self, frame_number, frame):
|
||||
"""Add frame to cache"""
|
||||
self.frame_cache[frame_number] = frame.copy()
|
||||
if frame_number in self.cache_access_order:
|
||||
self.cache_access_order.remove(frame_number)
|
||||
self.cache_access_order.append(frame_number)
|
||||
self._manage_cache()
|
||||
|
||||
def _get_from_cache(self, frame_number):
|
||||
"""Get frame from cache and update LRU"""
|
||||
if frame_number in self.frame_cache:
|
||||
if frame_number in self.cache_access_order:
|
||||
self.cache_access_order.remove(frame_number)
|
||||
self.cache_access_order.append(frame_number)
|
||||
return self.frame_cache[frame_number].copy()
|
||||
return None
|
||||
|
||||
def get_frame(self, frame_number):
|
||||
"""Get frame at specific index - always accurate"""
|
||||
@@ -458,7 +431,7 @@ class ProjectView:
|
||||
|
||||
class VideoEditor:
|
||||
# Configuration constants
|
||||
BASE_FRAME_DELAY_MS = 1 # ~60 FPS
|
||||
TARGET_FPS = 80 # Target FPS for speed calculations
|
||||
SPEED_INCREMENT = 0.1
|
||||
MIN_PLAYBACK_SPEED = 0.05
|
||||
MAX_PLAYBACK_SPEED = 10.0
|
||||
@@ -991,9 +964,8 @@ class VideoEditor:
|
||||
return 1
|
||||
else:
|
||||
# Speed < 1: scale FPS based on speed
|
||||
# At 0.05 speed = 3 FPS, at 1.0 speed = 60 FPS
|
||||
# Formula: fps = 60 * speed, so delay = 1000 / fps
|
||||
target_fps = 80 * speed
|
||||
# Formula: fps = TARGET_FPS * speed, so delay = 1000 / fps
|
||||
target_fps = self.TARGET_FPS * speed
|
||||
delay_ms = int(1000 / target_fps)
|
||||
return max(1, delay_ms)
|
||||
|
||||
@@ -2056,7 +2028,7 @@ class VideoEditor:
|
||||
line_to_draw = ("prev_next", prev_result, next_result)
|
||||
|
||||
if line_to_draw:
|
||||
line_type, (frame1, pts1), (frame2, pts2) = line_to_draw
|
||||
line_type, (_, pts1), (_, pts2) = line_to_draw
|
||||
|
||||
# Draw lines between corresponding tracking points
|
||||
for i, (px1, py1) in enumerate(pts1):
|
||||
@@ -2208,7 +2180,7 @@ class VideoEditor:
|
||||
best_snap_point = None
|
||||
|
||||
# Check all tracking points from all frames for point snapping
|
||||
for frame_num, points in self.tracking_points.items():
|
||||
for _, points in self.tracking_points.items():
|
||||
for (px, py) in points:
|
||||
sxp, syp = self._map_rotated_to_screen(px, py)
|
||||
distance = ((sxp - x) ** 2 + (syp - y) ** 2) ** 0.5
|
||||
@@ -2234,7 +2206,7 @@ class VideoEditor:
|
||||
print(f"DEBUG: Checking prev->next line")
|
||||
|
||||
if line_to_check:
|
||||
line_type, (frame1, pts1), (frame2, pts2) = line_to_check
|
||||
line_type, (_, pts1), (_, pts2) = line_to_check
|
||||
|
||||
# Check each corresponding pair of points
|
||||
for j in range(min(len(pts1), len(pts2))):
|
||||
|
Reference in New Issue
Block a user