Skip to content

Commit

Permalink
Implement support for "ARRI Wide Gamut 4" and "ARRI LogC4"
Browse files Browse the repository at this point in the history
Closes #992.
  • Loading branch information
KelSolaar committed Nov 7, 2022
1 parent a593876 commit d0152dc
Show file tree
Hide file tree
Showing 10 changed files with 411 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,7 @@ RGB Colourspaces
'ACEScg',
'ACESproxy',
'ARRI Wide Gamut 3',
'ARRI Wide Gamut 4',
'Adobe RGB (1998)',
'Adobe Wide Gamut RGB',
'Apple RGB',
Expand Down Expand Up @@ -1127,6 +1128,7 @@ Log Encoding / Decoding
'ACEScct',
'ACESproxy',
'ARRI LogC3',
'ARRI LogC4',
'Canon Log',
'Canon Log 2',
'Canon Log 3',
Expand Down Expand Up @@ -1162,6 +1164,7 @@ CCTFs Encoding / Decoding
'ACEScct',
'ACESproxy',
'ARRI LogC3',
'ARRI LogC4',
'ARIB STD-B67',
'Canon Log',
'Canon Log 2',
Expand Down
6 changes: 6 additions & 0 deletions colour/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@
oetf_inverse_ARIBSTDB67,
log_encoding_ARRILogC3,
log_decoding_ARRILogC3,
log_encoding_ARRILogC4,
log_decoding_ARRILogC4,
oetf_BlackmagicFilmGeneration5,
oetf_inverse_BlackmagicFilmGeneration5,
log_encoding_CanonLog,
Expand Down Expand Up @@ -271,6 +273,7 @@
RGB_COLOURSPACE_ADOBE_RGB1998,
RGB_COLOURSPACE_ADOBE_WIDE_GAMUT_RGB,
RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3,
RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4,
RGB_COLOURSPACE_APPLE_RGB,
RGB_COLOURSPACE_BEST_RGB,
RGB_COLOURSPACE_BETA_RGB,
Expand Down Expand Up @@ -526,6 +529,8 @@
"oetf_inverse_ARIBSTDB67",
"log_encoding_ARRILogC3",
"log_decoding_ARRILogC3",
"log_encoding_ARRILogC4",
"log_decoding_ARRILogC4",
"oetf_BlackmagicFilmGeneration5",
"oetf_inverse_BlackmagicFilmGeneration5",
"log_encoding_CanonLog",
Expand Down Expand Up @@ -669,6 +674,7 @@
"RGB_COLOURSPACE_ADOBE_RGB1998",
"RGB_COLOURSPACE_ADOBE_WIDE_GAMUT_RGB",
"RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3",
"RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4",
"RGB_COLOURSPACE_APPLE_RGB",
"RGB_COLOURSPACE_BEST_RGB",
"RGB_COLOURSPACE_BETA_RGB",
Expand Down
6 changes: 6 additions & 0 deletions colour/models/rgb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
oetf_inverse_ARIBSTDB67,
log_encoding_ARRILogC3,
log_decoding_ARRILogC3,
log_encoding_ARRILogC4,
log_decoding_ARRILogC4,
oetf_BlackmagicFilmGeneration5,
oetf_inverse_BlackmagicFilmGeneration5,
log_encoding_CanonLog,
Expand Down Expand Up @@ -166,6 +168,7 @@
RGB_COLOURSPACE_ADOBE_RGB1998,
RGB_COLOURSPACE_ADOBE_WIDE_GAMUT_RGB,
RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3,
RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4,
RGB_COLOURSPACE_APPLE_RGB,
RGB_COLOURSPACE_BEST_RGB,
RGB_COLOURSPACE_BETA_RGB,
Expand Down Expand Up @@ -288,6 +291,8 @@
"oetf_inverse_ARIBSTDB67",
"log_encoding_ARRILogC3",
"log_decoding_ARRILogC3",
"log_encoding_ARRILogC4",
"log_decoding_ARRILogC4",
"oetf_BlackmagicFilmGeneration5",
"oetf_inverse_BlackmagicFilmGeneration5",
"log_encoding_CanonLog",
Expand Down Expand Up @@ -431,6 +436,7 @@
"RGB_COLOURSPACE_ADOBE_RGB1998",
"RGB_COLOURSPACE_ADOBE_WIDE_GAMUT_RGB",
"RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3",
"RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4",
"RGB_COLOURSPACE_APPLE_RGB",
"RGB_COLOURSPACE_BEST_RGB",
"RGB_COLOURSPACE_BETA_RGB",
Expand Down
6 changes: 5 additions & 1 deletion colour/models/rgb/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
from .adobe_rgb_1998 import RGB_COLOURSPACE_ADOBE_RGB1998
from .adobe_wide_gamut_rgb import RGB_COLOURSPACE_ADOBE_WIDE_GAMUT_RGB
from .apple_rgb import RGB_COLOURSPACE_APPLE_RGB
from .arri import RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3
from .arri import (
RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3,
RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4,
)
from .best_rgb import RGB_COLOURSPACE_BEST_RGB
from .beta_rgb import RGB_COLOURSPACE_BETA_RGB
from .blackmagic_design import RGB_COLOURSPACE_BLACKMAGIC_WIDE_GAMUT
Expand Down Expand Up @@ -113,6 +116,7 @@
"RGB_COLOURSPACE_ADOBE_RGB1998",
"RGB_COLOURSPACE_ADOBE_WIDE_GAMUT_RGB",
"RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3",
"RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4",
"RGB_COLOURSPACE_APPLE_RGB",
"RGB_COLOURSPACE_BEST_RGB",
"RGB_COLOURSPACE_BETA_RGB",
Expand Down
62 changes: 62 additions & 0 deletions colour/models/rgb/datasets/arri.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
Defines the *ARRI* colourspaces:
- :attr:`colour.models.RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3`.
- :attr:`colour.models.RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4`.
References
----------
- :cite:`ARRI2012a` : ARRI. (2012). ALEXA - Log C Curve - Usage in VFX.
https://drive.google.com/open?id=1t73fAG_QpV7hJxoQPYZDWvOojYkYDgvn
- :cite:`Cooper2022` : Cooper, S., & Brendel, H. (2022). ARRI LogC4
Logarithmic Color Space SPECIFICATION. Retrieved October 24, 2022, from
https://www.arri.com/resource/blob/278790/bea879ac0d041a925bed27a096ab3ec2/\
2022-05-arri-logc4-specification-data.pdf
"""

from __future__ import annotations
Expand All @@ -22,6 +27,8 @@
RGB_Colourspace,
log_encoding_ARRILogC3,
log_decoding_ARRILogC3,
log_encoding_ARRILogC4,
log_decoding_ARRILogC4,
)

__author__ = "Colour Developers"
Expand All @@ -38,6 +45,12 @@
"MATRIX_ARRI_WIDE_GAMUT_3_TO_XYZ",
"MATRIX_XYZ_TO_ARRI_WIDE_GAMUT_3",
"RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3",
"PRIMARIES_ARRI_WIDE_GAMUT_4",
"WHITEPOINT_NAME_ARRI_WIDE_GAMUT_4",
"CCS_WHITEPOINT_ARRI_WIDE_GAMUT_4",
"MATRIX_ARRI_WIDE_GAMUT_4_TO_XYZ",
"MATRIX_XYZ_TO_ARRI_WIDE_GAMUT_4",
"RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4",
]

PRIMARIES_ARRI_WIDE_GAMUT_3: NDArray = np.array(
Expand Down Expand Up @@ -92,3 +105,52 @@
----------
:cite:`ARRI2012a`
"""

PRIMARIES_ARRI_WIDE_GAMUT_4: NDArray = np.array(
[
[0.7347, 0.2653],
[0.1424, 0.8576],
[0.0991, -0.0308],
]
)
"""*ARRI Wide Gamut 4* colourspace primaries."""

WHITEPOINT_NAME_ARRI_WIDE_GAMUT_4: str = "D65"
"""*ARRI Wide Gamut 4* colourspace whitepoint name."""

CCS_WHITEPOINT_ARRI_WIDE_GAMUT_4: NDArray = CCS_ILLUMINANTS[
"CIE 1931 2 Degree Standard Observer"
][WHITEPOINT_NAME_ARRI_WIDE_GAMUT_4]
"""*ARRI Wide Gamut 4* colourspace whitepoint chromaticity coordinates."""

MATRIX_ARRI_WIDE_GAMUT_4_TO_XYZ: NDArray = np.array(
[
[0.7048583204, 0.1297602952, 0.1158373115],
[0.2545241764, 0.7814777327, -0.0360019091],
[0.0000000000, 0.0000000000, 1.0890577508],
]
)
"""*ARRI Wide Gamut 4* colourspace to *CIE XYZ* tristimulus values matrix."""

MATRIX_XYZ_TO_ARRI_WIDE_GAMUT_4: NDArray = np.linalg.inv(
MATRIX_ARRI_WIDE_GAMUT_4_TO_XYZ
)
"""*CIE XYZ* tristimulus values to *ARRI Wide Gamut 4* colourspace matrix."""

RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4: RGB_Colourspace = RGB_Colourspace(
"ARRI Wide Gamut 4",
PRIMARIES_ARRI_WIDE_GAMUT_4,
CCS_WHITEPOINT_ARRI_WIDE_GAMUT_4,
WHITEPOINT_NAME_ARRI_WIDE_GAMUT_4,
MATRIX_ARRI_WIDE_GAMUT_4_TO_XYZ,
MATRIX_XYZ_TO_ARRI_WIDE_GAMUT_4,
log_encoding_ARRILogC4,
log_decoding_ARRILogC4,
)
RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4.__doc__ = """
*ARRI Wide Gamut 4* colourspace.
References
----------
:cite:`Cooper2022`
"""
17 changes: 16 additions & 1 deletion colour/models/rgb/transfer_functions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
log_decoding_ACEScct,
)
from .arib_std_b67 import oetf_ARIBSTDB67, oetf_inverse_ARIBSTDB67
from .arri import log_encoding_ARRILogC3, log_decoding_ARRILogC3
from .arri import (
log_encoding_ARRILogC3,
log_decoding_ARRILogC3,
log_encoding_ARRILogC4,
log_decoding_ARRILogC4,
)
from .blackmagic_design import (
oetf_BlackmagicFilmGeneration5,
oetf_inverse_BlackmagicFilmGeneration5,
Expand Down Expand Up @@ -160,6 +165,8 @@
__all__ += [
"log_encoding_ARRILogC3",
"log_decoding_ARRILogC3",
"log_encoding_ARRILogC4",
"log_decoding_ARRILogC4",
]
__all__ += [
"oetf_BlackmagicFilmGeneration5",
Expand Down Expand Up @@ -344,6 +351,7 @@
"ACEScct": log_encoding_ACEScct,
"ACESproxy": log_encoding_ACESproxy,
"ARRI LogC3": log_encoding_ARRILogC3,
"ARRI LogC4": log_encoding_ARRILogC4,
"Canon Log 2": log_encoding_CanonLog2,
"Canon Log 3": log_encoding_CanonLog3,
"Canon Log": log_encoding_CanonLog,
Expand Down Expand Up @@ -383,6 +391,7 @@ def log_encoding(
"ACEScct",
"ACESproxy",
"ARRI LogC3",
"ARRI LogC4",
"Canon Log 2",
"Canon Log 3",
"Canon Log",
Expand Down Expand Up @@ -430,6 +439,7 @@ def log_encoding(
:func:`colour.models.log_encoding_ACEScct`,
:func:`colour.models.log_encoding_ACESproxy`,
:func:`colour.models.log_encoding_ARRILogC3`,
:func:`colour.models.log_encoding_ARRILogC4`,
:func:`colour.models.log_encoding_CanonLog2`,
:func:`colour.models.log_encoding_CanonLog3`,
:func:`colour.models.log_encoding_CanonLog`,
Expand Down Expand Up @@ -491,6 +501,7 @@ def log_encoding(
"ACEScct": log_decoding_ACEScct,
"ACESproxy": log_decoding_ACESproxy,
"ARRI LogC3": log_decoding_ARRILogC3,
"ARRI LogC4": log_decoding_ARRILogC4,
"Canon Log 2": log_decoding_CanonLog2,
"Canon Log 3": log_decoding_CanonLog3,
"Canon Log": log_decoding_CanonLog,
Expand Down Expand Up @@ -530,6 +541,7 @@ def log_decoding(
"ACEScct",
"ACESproxy",
"ARRI LogC3",
"ARRI LogC4",
"Canon Log 2",
"Canon Log 3",
"Canon Log",
Expand Down Expand Up @@ -577,6 +589,7 @@ def log_decoding(
:func:`colour.models.log_decoding_ACEScct`,
:func:`colour.models.log_decoding_ACESproxy`,
:func:`colour.models.log_decoding_ARRILogC3`,
:func:`colour.models.log_decoding_ARRILogC4`,
:func:`colour.models.log_decoding_CanonLog2`,
:func:`colour.models.log_decoding_CanonLog3`,
:func:`colour.models.log_decoding_CanonLog`,
Expand Down Expand Up @@ -1044,6 +1057,7 @@ def cctf_encoding(
"ACEScct",
"ACESproxy",
"ARRI LogC3",
"ARRI LogC4",
"ARIB STD-B67",
"Blackmagic Film Generation 5",
"Canon Log 2",
Expand Down Expand Up @@ -1199,6 +1213,7 @@ def cctf_decoding(
"ACEScct",
"ACESproxy",
"ARRI LogC3",
"ARRI LogC4",
"ARIB STD-B67",
"Blackmagic Film Generation 5",
"Canon Log 2",
Expand Down
Loading

0 comments on commit d0152dc

Please sign in to comment.