Skip to content

Commit

Permalink
Assume BT.709 for untagged UHD video (Jaded-Encoding-Thaumaturgy#147)
Browse files Browse the repository at this point in the history
* Assume BT.709 for UHD video

* Also remove transfer assumption

---------

Co-authored-by: emotion3459 <[email protected]>
  • Loading branch information
shssoichiro and emotion3459 authored Oct 6, 2024
1 parent fd5890c commit 9c89692
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions vstools/enums/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,7 @@ def from_res(cls, frame: vs.VideoNode | vs.VideoFrame) -> Matrix:

return Matrix.SMPTE170M

if width <= 2048 and height <= 1556:
return Matrix.BT709

return Matrix.BT2020NCL
return Matrix.BT709

@classmethod
def from_video(
Expand Down Expand Up @@ -462,15 +459,6 @@ def from_res(cls, frame: vs.VideoNode | vs.VideoFrame) -> Transfer:
if width <= 1024 and height <= 576:
return Transfer.BT601

if width <= 2048 and height <= 1556:
return Transfer.BT709

if fmt.bits_per_sample == 10:
return Transfer.BT2020_10

if fmt.bits_per_sample == 12:
return Transfer.BT2020_12

return Transfer.BT709

@classmethod
Expand Down Expand Up @@ -829,10 +817,7 @@ def from_res(cls, frame: vs.VideoNode | vs.VideoFrame) -> Primaries:

return Primaries.SMPTE170M

if width <= 2048 and height <= 1556:
return Primaries.BT709

return Primaries.BT2020
return Primaries.BT709

@classmethod
def from_video(
Expand Down

0 comments on commit 9c89692

Please sign in to comment.