MCPcopy Create free account
hub / github.com/Lightricks/ComfyUI-LTXVideo / compute_chunk_boundaries

Function compute_chunk_boundaries

tiled_vae_decode.py:214–246  ·  view source on GitHub ↗

Compute chunk boundaries for temporal tiling. Args: chunk_start: Starting frame index for the current chunk temporal_tile_length: Length of each temporal tile temporal_overlap: Number of frames to overlap between chunks total_latent_frames: Total number of latent

(
    chunk_start: int,
    temporal_tile_length: int,
    temporal_overlap: int,
    total_latent_frames: int,
)

Source from the content-addressed store, hash-verified

212
213
214def compute_chunk_boundaries(
215 chunk_start: int,
216 temporal_tile_length: int,
217 temporal_overlap: int,
218 total_latent_frames: int,
219):
220 """Compute chunk boundaries for temporal tiling.
221
222 Args:
223 chunk_start: Starting frame index for the current chunk
224 temporal_tile_length: Length of each temporal tile
225 temporal_overlap: Number of frames to overlap between chunks
226 total_latent_frames: Total number of latent frames
227
228 Returns:
229 Tuple of (overlap_start, chunk_end)
230 """
231 if chunk_start == 0:
232 # First chunk: no overlap needed
233 chunk_end = min(chunk_start + temporal_tile_length, total_latent_frames)
234 overlap_start = chunk_start
235 else:
236 # Subsequent chunks: include overlap from previous chunk
237 # -1 because we need one extra frame to overlap, which is decoded to a single frame
238 # never overlap with the first latent frame
239 overlap_start = max(1, chunk_start - temporal_overlap - 1)
240 extra_frames = chunk_start - overlap_start
241 chunk_end = min(
242 chunk_start + temporal_tile_length - extra_frames,
243 total_latent_frames,
244 )
245
246 return overlap_start, chunk_end
247
248
249def calculate_temporal_output_boundaries(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected