Skip to content

Commit

Permalink
cli/gui: Apply PES constraints with --withsup. Cast flags to bool.
Browse files Browse the repository at this point in the history
Add missing tick due to rounding with --tslong.
  • Loading branch information
cubicibo committed Sep 18, 2023
1 parent 875fa09 commit 4405aa6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
3 changes: 1 addition & 2 deletions SUPer/render2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,7 @@ def set_pts_dts_sc(cls, ds: DisplaySet, buffer: PGObjectBuffer, wds: WDS, node:
decode_duration = max(decode_duration, t_decoding) + copy_dur

#Prevent PTS(WDS) = PTS(PCS)
if decode_duration == sum(map(lambda w: np.ceil(PGDecoder.FREQ*w[0]*w[1]/PGDecoder.RC), windows.values())):
decode_duration += 1
decode_duration = max(decode_duration, sum(map(lambda w: np.ceil(PGDecoder.FREQ*w[0]*w[1]/PGDecoder.RC), windows.values())) + 1)

mask = ((1 << 32) - 1)
dts = int(ds.pcs.tpts - decode_duration) & mask
Expand Down
8 changes: 4 additions & 4 deletions supercli.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ def check_ext(fp: Union[Path, str]) -> None:
logger.warning("Unknown BT ITU target, using bt709.")
args.bt = 709

if (args.nodts or args.aheadoftime) and ext == 'pes':
if (args.nodts or args.aheadoftime) and (ext == 'pes' or args.withsup):
exit_msg("PES output without DTS or with ahead-of-time decoding is not allowed, aborting.")
if ext == 'pes' and not args.palette:
logger.warning("PES output: generating with full palette flag.")
if (ext == 'pes' or args.withsup) and not args.palette:
logger.warning("PES output requested, adding --palette to command.")
args.palette = True

print("\n @@@@@@@ &@@@ @@@@ @@@@@@@\n"\
Expand All @@ -109,7 +109,7 @@ def check_ext(fp: Union[Path, str]) -> None:
" @@@BP€ @@@\n"\
" @@@ @@@\n"\
" @@YY@@ @@@\n")

if args.qmode == 3:
config_file = Path('config.ini')
exepath = None
Expand Down
21 changes: 11 additions & 10 deletions supergui.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

from SUPer import BDNRender, get_super_logger
from SUPer.optim import Quantizer
from SUPer.__metadata__ import __version__ as SUPVERS
from SUPer.__metadata__ import __version__ as SUPVERS, __author__

### CONSTS
SUPER_STRING = "Make it SUPer!"
Expand All @@ -42,16 +42,16 @@ def get_kwargs() -> dict[str, int]:
return {
'quality_factor': int(compression_txt.value)/100,
'refresh_rate': int(refresh_txt.value)/100,
'scale_fps': scale_fps.value,
'scale_fps': bool(scale_fps.value),
'quantize_lib': Quantizer.get_option_id(quantcombo.value),
'bt_colorspace': colorspace.value,
'enforce_dts': set_dts.value,
'enforce_dts': bool(set_dts.value),
'no_overlap': True, #scenarist_checks.value,
'full_palette': scenarist_fullpal.value,
'output_all_formats': all_formats.value,
'normal_case_ok': normal_case_ok.value,
'full_palette': bool(scenarist_fullpal.value),
'output_all_formats': bool(all_formats.value),
'normal_case_ok': bool(normal_case_ok.value),
'libs_path': lib_paths,
'ts_long': soft_dts.value
'ts_long': bool(soft_dts.value),
}

def wrapper_mp() -> None:
Expand Down Expand Up @@ -117,7 +117,8 @@ def hide_chkbox() -> None:
set_dts.enabled = scenarist_fullpal.enabled = False
#scenarist_checks.enabled = False
elif not supout.value.lower().endswith('pes'):
set_dts.enabled = scenarist_fullpal.enabled = True
set_dts.enabled = True
scenarist_fullpal.enabled = True
#scenarist_checks.enabled = True

def get_bdnxml() -> None:
Expand Down Expand Up @@ -210,7 +211,7 @@ def get_value_key(config, key: str):
mp.freeze_support()

logger = get_super_logger('SUPui')
logger.info(f"SUPer v{SUPVERS}")
logger.info(f"SUPer v{SUPVERS}, (c) {__author__}")

lib_paths = init_extra_libs()
opts_quant = Quantizer.get_options()
Expand Down Expand Up @@ -266,7 +267,7 @@ def get_value_key(config, key: str):
"to update the given object in a tighter time window than in an acquisition (both objects refreshed).")

set_dts = CheckBox(app, text="Enforce strict compliancy (see tooltip)", grid=[0,pos_v:=pos_v+1,2,1], align='left')
set_dts.value = 1
set_dts.value = True
Hovertip(set_dts.tk, "PG streams include a decoding timestamp. This timestamp is required by old decoders\n"\
"else the on-screen behaviour is erratic. This is forcefully ticked for PES+MUI output.\n"\
"It must be ticked to ensure compatibility and strict compliancy to Blu-ray specifications.")
Expand Down

0 comments on commit 4405aa6

Please sign in to comment.