summaryrefslogtreecommitdiff
path: root/libavutil/color_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavutil/color_utils.c')
-rw-r--r--libavutil/color_utils.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavutil/color_utils.c b/libavutil/color_utils.c
index 63f2230980..eb8bc7b5fc 100644
--- a/libavutil/color_utils.c
+++ b/libavutil/color_utils.c
@@ -155,6 +155,18 @@ static double avpriv_trc_smpte_st428_1(double Lc)
: pow(48.0 * Lc / 52.37, 1.0 / 2.6);
}
+
+static double avpriv_trc_arib_std_b67(double Lc) {
+ // The function uses the definition from HEVC, which assumes that the peak
+ // white is input level = 1. (this is equivalent to scaling E = Lc * 12 and
+ // using the definition from the ARIB STD-B67 spec)
+ const double a = 0.17883277;
+ const double b = 0.28466892;
+ const double c = 0.55991073;
+ return (0.0 > Lc) ? 0.0 :
+ (Lc <= 1.0 / 12.0 ? sqrt(3.0 * Lc) : a * log(12.0 * Lc - b) + c);
+}
+
avpriv_trc_function avpriv_get_trc_function_from_trc(enum AVColorTransferCharacteristic trc)
{
avpriv_trc_function func = NULL;
@@ -209,6 +221,10 @@ avpriv_trc_function avpriv_get_trc_function_from_trc(enum AVColorTransferCharact
func = avpriv_trc_smpte_st428_1;
break;
+ case AVCOL_TRC_ARIB_STD_B67:
+ func = avpriv_trc_arib_std_b67;
+ break;
+
case AVCOL_TRC_RESERVED0:
case AVCOL_TRC_UNSPECIFIED:
case AVCOL_TRC_RESERVED: