fix scaling 1
This commit is contained in:
@@ -1025,17 +1025,31 @@ class VideoProcessor:
|
|||||||
|
|
||||||
print(f"\nProcessing chunk {chunk_idx}: frames {start_frame}-{end_frame}")
|
print(f"\nProcessing chunk {chunk_idx}: frames {start_frame}-{end_frame}")
|
||||||
|
|
||||||
# Read chunk frames at dual resolution
|
# Choose processing approach based on scale factor
|
||||||
print(f"🔄 Reading frames at dual resolution (scale_factor={self.config.processing.scale_factor})")
|
if self.config.processing.scale_factor == 1.0:
|
||||||
frame_data = self.read_video_frames_dual_resolution(
|
# No scaling needed - use original single-resolution approach
|
||||||
self.config.input.video_path,
|
print(f"🔄 Reading frames at original resolution (no scaling)")
|
||||||
start_frame=start_frame,
|
frames = self.read_video_frames(
|
||||||
num_frames=frames_to_read,
|
self.config.input.video_path,
|
||||||
scale_factor=self.config.processing.scale_factor
|
start_frame=start_frame,
|
||||||
)
|
num_frames=frames_to_read,
|
||||||
|
scale_factor=1.0
|
||||||
|
)
|
||||||
|
|
||||||
# Process chunk with dual-resolution approach
|
# Process chunk normally (single resolution)
|
||||||
matted_frames = self.process_chunk_dual_resolution(frame_data, chunk_idx)
|
matted_frames = self.process_chunk(frames, chunk_idx)
|
||||||
|
else:
|
||||||
|
# Scaling required - use dual-resolution approach
|
||||||
|
print(f"🔄 Reading frames at dual resolution (scale_factor={self.config.processing.scale_factor})")
|
||||||
|
frame_data = self.read_video_frames_dual_resolution(
|
||||||
|
self.config.input.video_path,
|
||||||
|
start_frame=start_frame,
|
||||||
|
num_frames=frames_to_read,
|
||||||
|
scale_factor=self.config.processing.scale_factor
|
||||||
|
)
|
||||||
|
|
||||||
|
# Process chunk with dual-resolution approach
|
||||||
|
matted_frames = self.process_chunk_dual_resolution(frame_data, chunk_idx)
|
||||||
|
|
||||||
# Save chunk to disk immediately to free memory
|
# Save chunk to disk immediately to free memory
|
||||||
chunk_path = temp_chunk_dir / f"chunk_{chunk_idx:04d}.npz"
|
chunk_path = temp_chunk_dir / f"chunk_{chunk_idx:04d}.npz"
|
||||||
@@ -1050,7 +1064,10 @@ class VideoProcessor:
|
|||||||
|
|
||||||
# Free the frames from memory immediately
|
# Free the frames from memory immediately
|
||||||
del matted_frames
|
del matted_frames
|
||||||
del frame_data
|
if self.config.processing.scale_factor == 1.0:
|
||||||
|
del frames
|
||||||
|
else:
|
||||||
|
del frame_data
|
||||||
|
|
||||||
# Update statistics
|
# Update statistics
|
||||||
self.processing_stats['chunks_processed'] += 1
|
self.processing_stats['chunks_processed'] += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user