MCPcopy Index your code
hub / github.com/Lightricks/ComfyUI-LTXVideo / _extract_spatial_tile

Method _extract_spatial_tile

looping_sampler.py:254–308  ·  view source on GitHub ↗

Extract spatial tiles from all inputs for a given spatial region.

(
        self,
        latents,
        optional_guiding_latents,
        optional_negative_index_latents,
        optional_normalizing_latents,
        optional_keyframes,
        v_start,
        v_end,
        h_start,
        h_end,
        height_scale_factor,
        width_scale_factor,
    )

Source from the content-addressed store, hash-verified

252 return {"samples": tile_samples}
253
254 def _extract_spatial_tile(
255 self,
256 latents,
257 optional_guiding_latents,
258 optional_negative_index_latents,
259 optional_normalizing_latents,
260 optional_keyframes,
261 v_start,
262 v_end,
263 h_start,
264 h_end,
265 height_scale_factor,
266 width_scale_factor,
267 ):
268 """Extract spatial tiles from all inputs for a given spatial region."""
269 # Extract spatial tile from latents
270 tile_latents = self._extract_latent_spatial_tile(
271 latents, v_start, v_end, h_start, h_end
272 )
273
274 # Extract spatial tile from guiding latents if provided
275 tile_guiding_latents = self._extract_latent_spatial_tile(
276 optional_guiding_latents, v_start, v_end, h_start, h_end
277 )
278
279 # Extract spatial tile from negative index latents if provided
280 tile_negative_index_latents = self._extract_latent_spatial_tile(
281 optional_negative_index_latents, v_start, v_end, h_start, h_end
282 )
283
284 # Extract spatial tile from normalizing latents if provided
285 tile_normalizing_latents = self._extract_latent_spatial_tile(
286 optional_normalizing_latents, v_start, v_end, h_start, h_end
287 )
288
289 if optional_keyframes is not None:
290 # Scale coordinates for image
291 img_h_start = v_start * height_scale_factor
292 img_h_end = v_end * height_scale_factor
293 img_w_start = h_start * width_scale_factor
294 img_w_end = h_end * width_scale_factor
295
296 tile_keyframes = optional_keyframes[
297 :, img_h_start:img_h_end, img_w_start:img_w_end, :
298 ]
299 else:
300 tile_keyframes = None
301
302 return (
303 tile_latents,
304 tile_guiding_latents,
305 tile_negative_index_latents,
306 tile_keyframes,
307 tile_normalizing_latents,
308 )
309
310 def _process_temporal_chunks(
311 self,

Callers 1

sampleMethod · 0.95

Calls 1

Tested by

no test coverage detected