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}")
|
||||
|
||||
# Read chunk frames at dual resolution
|
||||
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)
|
||||
# Choose processing approach based on scale factor
|
||||
if self.config.processing.scale_factor == 1.0:
|
||||
# No scaling needed - use original single-resolution approach
|
||||
print(f"🔄 Reading frames at original resolution (no scaling)")
|
||||
frames = self.read_video_frames(
|
||||
self.config.input.video_path,
|
||||
start_frame=start_frame,
|
||||
num_frames=frames_to_read,
|
||||
scale_factor=1.0
|
||||
)
|
||||
|
||||
# Process chunk normally (single resolution)
|
||||
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
|
||||
chunk_path = temp_chunk_dir / f"chunk_{chunk_idx:04d}.npz"
|
||||
@@ -1050,7 +1064,10 @@ class VideoProcessor:
|
||||
|
||||
# Free the frames from memory immediately
|
||||
del matted_frames
|
||||
del frame_data
|
||||
if self.config.processing.scale_factor == 1.0:
|
||||
del frames
|
||||
else:
|
||||
del frame_data
|
||||
|
||||
# Update statistics
|
||||
self.processing_stats['chunks_processed'] += 1
|
||||
|
||||
Reference in New Issue
Block a user