Skip to content

Commit

Permalink
Use normal case to undisplay an object out of two and continue with p…
Browse files Browse the repository at this point in the history
…alette updates if possible.
  • Loading branch information
cubicibo committed May 20, 2023
1 parent 4754daf commit 8bdda1a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
8 changes: 7 additions & 1 deletion SUPer/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def optimise(self) -> None:

bdn = BDNXML(path.expanduser(self.bdn_file))

if self.kwargs.get('scale_fps', False):
if bdn.fps >= 50:
logger.critical("BDNXML is not subsampled, aborting!")
import sys
sys.exit(1)

clip_framerate = bdn.fps
if self.kwargs.pop('adjust_dropframe', False):
if isinstance(bdn.fps, float):
Expand Down Expand Up @@ -116,7 +122,7 @@ def ndf_shift(self, bdn: BDNXML, clip_framerate: float) -> None:
for epoch in self._epochs:
for ds in epoch:
for seg in ds:
seg.pts = seg.pts*adjustment_ratio - 3/90e3
seg.pts = seg.pts*adjustment_ratio - 5/90e3

def scale_pcsfps(self) -> bool:
from SUPer.utils import BDVideo
Expand Down
26 changes: 23 additions & 3 deletions SUPer/render2.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from .segments import DisplaySet, PCS, WDS, PDS, ODS, ENDS, WindowDefinition, CObject, Epoch
from .optim import Optimise, Preprocess
from .pgraphics import PGraphics, PGDecoder, PGObject, FadeEffect
from .palette import Palette
from .palette import Palette, PaletteEntry

_Region = TypeVar('Region')
logger = get_super_logger('SUPer')
Expand Down Expand Up @@ -748,7 +748,25 @@ def get_undisplay(self, i, pcs_id, wds_base):
if len(pals) == 1:
assert not has_two_objs
pals.append([])
for z, (p1, p2) in enumerate(zip_longest(pals[0][1:], pals[1][1:], fillvalue=Palette()), i+1):
for z, (p1, p2) in enumerate(zip_longest(pals[0][1:], pals[1][1:], fillvalue=None), i+1):
if p1 is None:
if len(cobjs) == 2:
cobjs = cobjs[1:2]
if not palup_compatibility_mode:
p1 = Palette({k: PaletteEntry(16, 128, 128, 0) for k in range(0, 128)})
else:
p1 = Palette()
else:
p1 = Palette()
if p2 is None:
if len(cobjs) == 2:
cobjs = cobjs[0:1]
if not palup_compatibility_mode:
p2 = Palette({k: PaletteEntry(16, 128, 128, 0) for k in range(128, 256)})
else:
p2 = Palette()
else:
p2 = Palette()
c_pts = get_pts(TC.tc2s(self.events[z].tc_in, self.bdn.fps))
pal |= (p1 | p2)
assert states[z] == PCS.CompositionState.NORMAL
Expand All @@ -767,6 +785,8 @@ def get_undisplay(self, i, pcs_id, wds_base):
displaysets.append(DisplaySet([pcs, pds, ENDS.from_scratch(pts=c_pts)]))
pal_vn += 1
pcs_id += 1
if len(cobjs) == 1:
has_two_objs = False
assert z+1 == k
i = k
if use_pbar:
Expand Down Expand Up @@ -799,7 +819,7 @@ def find_acqs(self, pgobjs_proc: dict[..., list[...]], windows):
for wid, wd in enumerate(windows):
if objs[wid] and not objs[wid].is_active(k):
objs[wid] = None
force_acq = True
#force_acq = True
if len(pgobjs_proc[wid]):
if not objs[wid] and pgobjs_proc[wid][0].is_active(k):
objs[wid] = pgobjs_proc[wid].pop(0)
Expand Down

0 comments on commit 8bdda1a

Please sign in to comment.