Refactor internal "F-Log2" definitions code.
@@ -298,31 +298,10 @@ def log_encoding_FLog2(
array([ 95, 400, 570])
"""
- in_r = to_domain_1(in_r)
-
- if not in_reflection:
- in_r = in_r * 0.9
-
- cut1 = constants.cut1
- a = constants.a
- b = constants.b
- c = constants.c
- d = constants.d
- e = constants.e
- f = constants.f
-
- out_r = np.where(
- in_r < cut1,
- e * in_r + f,
- c * np.log10(a * in_r + b) + d,
+ return log_encoding_FLog(
+ in_r, bit_depth, out_normalised_code_value, in_reflection, constants
)
- out_r_cv = (
- out_r if out_normalised_code_value else legal_to_full(out_r, bit_depth)
- )
-
- return as_float(from_range_1(out_r_cv))
-
def log_decoding_FLog2(
out_r: ArrayLike,
@@ -378,27 +357,6 @@ def log_decoding_FLog2(
0.1799999...
"""
- out_r = to_domain_1(out_r)
-
- out_r = (
- out_r if in_normalised_code_value else full_to_legal(out_r, bit_depth)
+ return log_decoding_FLog(
+ out_r, bit_depth, in_normalised_code_value, out_reflection, constants
)
-
- cut2 = constants.cut2
- a = constants.a
- b = constants.b
- c = constants.c
- d = constants.d
- e = constants.e
- f = constants.f
-
- in_r = np.where(
- out_r < cut2,
- (out_r - f) / e,
- (10 ** ((out_r - d) / c)) / a - b / a,
- )
-
- if not out_reflection:
- in_r = in_r / 0.9
-
- return as_float(from_range_1(in_r))
