Skip to content

Commit

Permalink
Varnish "F-Log2" implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Dec 14, 2022
1 parent 5aa5777 commit 38c42d3
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 25 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,7 @@ Log Encoding / Decoding
'D-Log',
'ERIMM RGB',
'F-Log',
'F-Log2',
'Filmic Pro 6',
'L-Log',
'Log2',
Expand Down Expand Up @@ -1175,6 +1176,7 @@ CCTFs Encoding / Decoding
'DICOM GSDF',
'ERIMM RGB',
'F-Log',
'F-Log2',
'Filmic Pro 6',
'Gamma 2.2',
'Gamma 2.4',
Expand Down
4 changes: 4 additions & 0 deletions colour/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@
log_decoding_VLog,
log_encoding_FLog,
log_decoding_FLog,
log_encoding_FLog2,
log_decoding_FLog2,
log_encoding_LLog,
log_decoding_LLog,
log_encoding_NLog,
Expand Down Expand Up @@ -605,6 +607,8 @@
"log_decoding_VLog",
"log_encoding_FLog",
"log_decoding_FLog",
"log_encoding_FLog2",
"log_decoding_FLog2",
"log_encoding_LLog",
"log_decoding_LLog",
"log_encoding_NLog",
Expand Down
2 changes: 1 addition & 1 deletion colour/models/rgb/transfer_functions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
)
from .panalog import log_encoding_Panalog, log_decoding_Panalog
from .panasonic_v_log import log_encoding_VLog, log_decoding_VLog
from .fujifilm_flog import (
from .fujifilm_f_log import (
log_encoding_FLog,
log_decoding_FLog,
log_decoding_FLog2,
Expand Down
48 changes: 24 additions & 24 deletions colour/models/rgb/transfer_functions/fujifilm_f_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
References
----------
- :cite:`Fujifilm2022a` : Fujifilm. (2022). F-Log Data Sheet Ver.1.1 (pp.
1-4). https://dl.fujifilm-x.com/support/lut/F-Log_DataSheet_E_Ver.1.1.pdf
- :cite:`Fujifilm2022b` : Fujifilm. (2022). F-Log2 Data Sheet Ver.1.0 (pp.
1-4). https://dl.fujifilm-x.com/support/lut/F-Log2_DataSheet_E_Ver.1.0.pdf
- :cite:`Fujifilm2022` : Fujifilm. (2022). F-Log Data Sheet Ver.1.1 (pp.
14). https://dl.fujifilm-x.com/support/lut/F-Log_DataSheet_E_Ver.1.1.pdf
- :cite:`Fujifilm2022a` : Fujifilm. (2022). F-Log2 Data Sheet Ver.1.0 (pp.
14). https://dl.fujifilm-x.com/support/lut/F-Log2_DataSheet_E_Ver.1.0.pdf
"""

from __future__ import annotations
Expand All @@ -36,9 +36,9 @@
"CONSTANTS_FLOG",
"CONSTANTS_FLOG2",
"log_encoding_FLog",
"log_encoding_FLog2",
"log_decoding_FLog",
"log_decoding_FLog2"
"log_encoding_FLog2",
"log_decoding_FLog2",
]

CONSTANTS_FLOG: Structure = Structure(
Expand Down Expand Up @@ -112,14 +112,14 @@ def log_encoding_FLog(
References
----------
:cite:`Fujifilm2022a`
:cite:`Fujifilm2022`
Examples
--------
>>> log_encoding_FLog(0.18) # doctest: +ELLIPSIS
0.4593184...
The values of *2-2. F-Log Code Value* table in :cite:`Fujifilm2022a` are
The values of *2-2. F-Log Code Value* table in :cite:`Fujifilm2022` are
obtained as follows:
>>> x = np.array([0, 18, 90]) / 100
Expand Down Expand Up @@ -201,7 +201,7 @@ def log_decoding_FLog(
References
----------
:cite:`Fujifilm2022a`
:cite:`Fujifilm2022`
Examples
--------
Expand Down Expand Up @@ -236,12 +236,12 @@ def log_decoding_FLog(


def log_encoding_FLog2(
in_r: FloatingOrArrayLike,
bit_depth: Integer = 10,
out_normalised_code_value: Boolean = True,
in_reflection: Boolean = True,
in_r: ArrayLike,
bit_depth: int = 10,
out_normalised_code_value: bool = True,
in_reflection: bool = True,
constants: Structure = CONSTANTS_FLOG2,
) -> FloatingOrNDArray:
) -> NDArrayFloat:
"""
Define the *Fujifilm F-Log2* log encoding curve / opto-electronic transfer
function.
Expand Down Expand Up @@ -281,20 +281,20 @@ def log_encoding_FLog2(
References
----------
:cite:`Fujifilm2022b`
:cite:`Fujifilm2022a`
Examples
--------
>>> log_encoding_FLog2(0.18) # doctest: +ELLIPSIS
0.3910072...
The values of *2-2. F-Log2 Code Value* table in :cite:`Fujifilm2022b` are
The values of *2-2. F-Log2 Code Value* table in :cite:`Fujifilm2022a` are
obtained as follows:
>>> x = np.array([0, 18, 90]) / 100
>>> np.around(log_encoding_FLog2(x, 10, False) * 100, 1)
array([ 3.5, 38.4, 57.8])
>>> np.around(log_encoding_FLog2(x) * (2 ** 10 - 1)).astype(np.int)
>>> np.around(log_encoding_FLog2(x) * (2**10 - 1)).astype(np.int)
array([ 95, 400, 570])
"""

Expand Down Expand Up @@ -325,12 +325,12 @@ def log_encoding_FLog2(


def log_decoding_FLog2(
out_r: FloatingOrArrayLike,
bit_depth: Integer = 10,
in_normalised_code_value: Boolean = True,
out_reflection: Boolean = True,
out_r: ArrayLike,
bit_depth: int = 10,
in_normalised_code_value: bool = True,
out_reflection: bool = True,
constants: Structure = CONSTANTS_FLOG2,
) -> FloatingOrNDArray:
) -> NDArrayFloat:
"""
Define the *Fujifilm F-Log2* log decoding curve / electro-optical transfer
function.
Expand Down Expand Up @@ -370,12 +370,12 @@ def log_decoding_FLog2(
References
----------
:cite:`Fujifilm2022b`
:cite:`Fujifilm2022a`
Examples
--------
>>> log_decoding_FLog2(0.39100724189123004) # doctest: +ELLIPSIS
0.1800000...
0.1799999...
"""

out_r = to_domain_1(out_r)
Expand Down
2 changes: 2 additions & 0 deletions docs/colour.models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,8 @@ Log Encoding and Decoding
log_decoding_ERIMMRGB
log_encoding_FLog
log_decoding_FLog
log_encoding_FLog2
log_decoding_FLog2
log_encoding_LLog
log_decoding_LLog
log_encoding_Log2
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,7 @@ Log Encoding / Decoding
'D-Log',
'ERIMM RGB',
'F-Log',
'F-Log2',
'Filmic Pro 6',
'L-Log',
'Log2',
Expand Down Expand Up @@ -957,6 +958,7 @@ CCTFs Encoding / Decoding
'DICOM GSDF',
'ERIMM RGB',
'F-Log',
'F-Log2',
'Filmic Pro 6',
'Gamma 2.2',
'Gamma 2.4',
Expand Down

0 comments on commit 38c42d3

Please sign in to comment.