mirror of
https://github.com/facefusion/facefusion.git
synced 2026-07-27 12:30:55 +02:00
Drop the frame copy in the video reader
read_video_reader_frame copied every decoded frame out of the pipe buffer. The frames are only read downstream (face detection, coordinate scaling), so the read-only numpy view over the pipe bytes is safe to return directly. Saves one full-frame (~25 MB at 4K) memcpy per decoded frame. AV1 ~21 -> ~22 fps, H.264 ~19 -> ~20 fps, output unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -84,7 +84,7 @@ def read_video_reader_frame(video_reader : VideoReader) -> Tuple[bool, Optional[
|
||||
|
||||
if len(frame_buffer) == frame_size:
|
||||
video_reader['position'] = video_reader.get('position') + 1
|
||||
return True, numpy.frombuffer(frame_buffer, numpy.uint8).reshape(video_reader.get('height'), video_reader.get('width'), 3).copy()
|
||||
return True, numpy.frombuffer(frame_buffer, numpy.uint8).reshape(video_reader.get('height'), video_reader.get('width'), 3)
|
||||
return False, None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user