MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / next_frame

Method next_frame

lightx2v/shot_runner/utils.py:62–84  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

60 self.chunk_idx = 0
61
62 def next_frame(self):
63 cur_clip_len = self.first_clip_len if self.chunk_idx == 0 else self.clip_len
64
65 start_sample = self.pos_frame * self.audio_per_frame
66 if start_sample >= self.samples.shape[1]:
67 return None, 0
68
69 end_sample = start_sample + cur_clip_len * self.audio_per_frame
70 real_end = min(end_sample, self.samples.shape[1])
71
72 frame = self.samples[:, start_sample:real_end].float()
73
74 expected_samples = cur_clip_len * self.audio_per_frame
75 real_samples = frame.shape[1]
76 pad_len = expected_samples - real_samples
77
78 if pad_len > 0:
79 frame = F.pad(frame, (0, pad_len))
80
81 self.pos_frame += cur_clip_len
82 self.chunk_idx += 1
83
84 return frame, pad_len
85
86
87def array_to_video(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected