Skip to content

Commit

Permalink
Update standard/wide gamut conversion
Browse files Browse the repository at this point in the history
Fix #127
  • Loading branch information
Setsugennoao committed Aug 1, 2024
1 parent f01d654 commit 1878fb2
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions vspreview/core/types/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,26 @@ def prepare_vs_output(self, clip: vs.VideoNode, pack_rgb: bool = True, fmt: vs.V
if self._stateset and assumed_props:
logging.warn(f'Video Node {self.index}: Had to assume these props which were unspecified or non-valid for preview <"{', '.join(assumed_props)}>')

standard_gamut = {'transfer': Transfer.BT709, 'primaries': self.main.settings.output_primaries_zimg}

if (
not self.main.display_profile
or self.main.display_profile.primaries() == QColorSpace.Primaries.SRgb
) and heuristics['primaries_in'] in (
Primaries.BT2020, Primaries.ST428, Primaries.ST431_2, Primaries.ST432_1
):
standard_gamut = {}

print(standard_gamut)

resizer_kwargs = KwargsT({
'format': fallback(fmt, PackingType.CURRENT.vs_format if pack_rgb else PackingType.CURRENT.vs_alpha_format),
'matrix_in': Matrix.BT709,
'transfer_in': Transfer.BT709,
'primaries_in': Primaries.BT709,
'range_in': ColorRange.LIMITED,
'chromaloc_in': ChromaLocation.LEFT
} | heuristics | {
'transfer': Transfer.BT709,
'primaries': self.main.settings.output_primaries_zimg
})
} | heuristics | standard_gamut)

if src.format.color_family == vs.RGB:
del resizer_kwargs['matrix_in']
Expand Down

0 comments on commit 1878fb2

Please sign in to comment.