Use external timeline runtime images
This commit is contained in:
@@ -1541,7 +1541,7 @@ def _build_guide_data_from_timeline(
|
|||||||
img_segs = [
|
img_segs = [
|
||||||
s for s in tdata.get("segments", [])
|
s for s in tdata.get("segments", [])
|
||||||
if s.get("type", "image") in ("image", "video")
|
if s.get("type", "image") in ("image", "video")
|
||||||
and (s.get("imageFile") or s.get("imageB64"))
|
and (s.get("imageFile") or s.get("imageB64") or s.get("runtime_image") is not None)
|
||||||
and int(s.get("start", 0)) < start_frame + duration_frames
|
and int(s.get("start", 0)) < start_frame + duration_frames
|
||||||
and int(s.get("start", 0)) + int(s.get("length", 1)) > start_frame
|
and int(s.get("start", 0)) + int(s.get("length", 1)) > start_frame
|
||||||
]
|
]
|
||||||
@@ -1565,20 +1565,25 @@ def _build_guide_data_from_timeline(
|
|||||||
tensor = _load_video_tensor(seg_for_load, frame_rate_f, input_dir=input_dir)
|
tensor = _load_video_tensor(seg_for_load, frame_rate_f, input_dir=input_dir)
|
||||||
cache_key = None
|
cache_key = None
|
||||||
else:
|
else:
|
||||||
cache_key = (
|
if seg.get("runtime_image") is not None:
|
||||||
seg.get("imageFile") or "",
|
cache_key = None
|
||||||
seg.get("imageB64") or "",
|
cached_tensor = None
|
||||||
custom_width,
|
|
||||||
custom_height,
|
|
||||||
resize_method,
|
|
||||||
divisible_by,
|
|
||||||
img_compression,
|
|
||||||
)
|
|
||||||
cached_tensor = processed_still_cache.get(cache_key)
|
|
||||||
if cached_tensor is not None:
|
|
||||||
tensor = cached_tensor
|
|
||||||
else:
|
|
||||||
tensor = _load_image_tensor(seg, cache=image_cache, input_dir=input_dir)
|
tensor = _load_image_tensor(seg, cache=image_cache, input_dir=input_dir)
|
||||||
|
else:
|
||||||
|
cache_key = (
|
||||||
|
seg.get("imageFile") or "",
|
||||||
|
seg.get("imageB64") or "",
|
||||||
|
custom_width,
|
||||||
|
custom_height,
|
||||||
|
resize_method,
|
||||||
|
divisible_by,
|
||||||
|
img_compression,
|
||||||
|
)
|
||||||
|
cached_tensor = processed_still_cache.get(cache_key)
|
||||||
|
if cached_tensor is not None:
|
||||||
|
tensor = cached_tensor
|
||||||
|
else:
|
||||||
|
tensor = _load_image_tensor(seg, cache=image_cache, input_dir=input_dir)
|
||||||
|
|
||||||
if cache_key is None or cached_tensor is None:
|
if cache_key is None or cached_tensor is None:
|
||||||
src_h, src_w = tensor.shape[1], tensor.shape[2]
|
src_h, src_w = tensor.shape[1], tensor.shape[2]
|
||||||
|
|||||||
Reference in New Issue
Block a user