Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def GetMatrix(clip, matrix=None, name='getmatrix'):
- if matrix is 2:
- matrix = None
- if matrix is not None:
- if isinstance(matrix, int):
- return matrix
- matrix = matrix.lower()
- if matrix == 'chromacl': # Chromaticity derived non-constant luminance system
- return 12
- if matrix == 'chromancl': # Chromaticity derived constant luminance system
- return 13
- if 'u' in matrix: # Unspecified
- return GetMatrix(clip, matrix=None)
- if 'y' in matrix: # YCgCo
- return 8
- #if 'o' in matrix: # opponent color space
- #return 100
- if 'r' in matrix: # RGB
- return 0
- if 'i' in matrix: # iCtCb
- return 14
- if 'f' in matrix: # fcc
- return 4
- if '24' in matrix: # smpte240m
- return 7
- if '4' in matrix: # bt470bg
- return 5
- if '6' in matrix or '1' in matrix: # 601/smpte170m
- return 6
- if '7' in matrix: # bt709
- return 1
- if 'n' in matrix or matrix in ('2', '2020'): # 2020/bt2020nc/2020ncl
- return 9
- #if '8' in matrix or '5' in matrix: # smpte2085
- #return 11
- if '2' in matrix: # 2020cl/bt2020c/bt2020c
- return 10
- raise ValueError(f'zzfunc.{name}: "matrix" string provided was outlandishly wrong')
- frame = clip.get_frame(0)
- _Matrix = frame.props.get('_Matrix', 0)
- if _Matrix is not 0:
- return _Matrix
- w, h = frame.width, frame.height
- if w <= 1024 and h <= 576:
- return 5
- if w <= 2048 and h <= 1536:
- return 1
- return 9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement