diff options
author | Neil Birkbeck <neil.birkbeck@gmail.com> | 2016-04-21 12:00:05 -0700 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-06-01 16:32:08 +0200 |
commit | 785038c92cc7fc1da437576382083246ca598fce (patch) | |
tree | 464eb45e093a254d3dc3d8ac654bbdca3812b9a8 /libavutil | |
parent | 4c7d3e827c80627e4c77b01cc9478f4603a59b90 (diff) | |
download | ffmpeg-785038c92cc7fc1da437576382083246ca598fce.tar.gz |
lavu: Adding ARIB STD-B67 (hybrid log-gamma) enum value and transfer function.
Adding hybrid log-gamma (https://en.wikipedia.org/wiki/Hybrid_Log-Gamma)
based on the standardization in ARIB STD-B67:
http://www.arib.or.jp/english/html/overview/doc/2-STD-B67v1_0.pdf
The choice of enum value of 18 is consistent with HEVC:
http://phenix.it-sudparis.eu/jct/doc_end_user/current_document.php?id=10481
And also with latest proposal for color format in mkv:
https://mailarchive.ietf.org/arch/search/?email_list=cellar&gbt=1&q=Colour+Format+proposal
The implementation assumes a nominal input range of [0, 1], which is
consistent with HEVC.
Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/color_utils.c | 16 | ||||
-rw-r--r-- | libavutil/pixdesc.c | 1 | ||||
-rw-r--r-- | libavutil/pixfmt.h | 1 |
3 files changed, 18 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: diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index c630d840ce..413698051a 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2080,6 +2080,7 @@ static const char *color_transfer_names[AVCOL_TRC_NB] = { "bt470bg", "smpte170m", "smpte240m", "linear", "log100", "log316", "iec61966-2-4", "bt1361e", "iec61966-2-1", "bt2020-10", "bt2020-20", "smpte2084", "smpte428-1", + "arib-std-b67" }; static const char *color_space_names[AVCOL_SPC_NB] = { diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 41e910685f..bc0cf9e190 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -420,6 +420,7 @@ enum AVColorTransferCharacteristic { AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system AVCOL_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10, 12, 14 and 16 bit systems AVCOL_TRC_SMPTEST428_1 = 17, ///< SMPTE ST 428-1 + AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma" AVCOL_TRC_NB, ///< Not part of ABI }; |