[FFmpeg-devel] vf_colorspace: Add support for smpte248 color primaries

Submitted by Vittorio Giovara on June 7, 2017, 9:50 p.m.

Details

Message ID 20170607215021.10425-1-vittorio.giovara@gmail.com
State New
Headers show

Commit Message

Vittorio Giovara June 7, 2017, 9:50 p.m.
---
I don't have a sample for this, but I used the values found in mpv
(and I find the source very reliable about this).
Vittorio

 libavfilter/vf_colorspace.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Ronald S. Bultje June 7, 2017, 11:26 p.m.
Hi,

On Wed, Jun 7, 2017 at 5:50 PM, Vittorio Giovara <vittorio.giovara@gmail.com
> wrote:

> +    ENUM("smpte248",     AVCOL_PRI_SMPTE428,   "prm"),


428 or 248?

Ronald
Kieran O Leary June 7, 2017, 11:36 p.m.
Hi,

Should the vf colorspace documentation be updated with this new addition?

Best,

Kieran
Vittorio Giovara June 8, 2017, 2:24 a.m.
On Wed, Jun 7, 2017 at 7:36 PM, Kieran O Leary <kieran.o.leary@gmail.com> wrote:
> Hi,
>
> Should the vf colorspace documentation be updated with this new addition?

Oh right, I forgot sorry.
Do you want to do the honors since I forgot also about gbr?

Patch hide | download patch | download mbox

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 0b1bc81f99..91fa4461f5 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -57,6 +57,7 @@  enum Whitepoint {
     WP_D65,
     WP_C,
     WP_DCI,
+    WP_E,
     WP_NB,
 };
 
@@ -281,6 +282,7 @@  static const struct WhitepointCoefficients whitepoint_coefficients[WP_NB] = {
     [WP_D65] = { 0.3127, 0.3290 },
     [WP_C]   = { 0.3100, 0.3160 },
     [WP_DCI] = { 0.3140, 0.3510 },
+    [WP_E]   = { 1/3.0f, 1/3.0f },
 };
 
 static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB] = {
@@ -289,6 +291,7 @@  static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB] = {
     [AVCOL_PRI_BT470BG]   = { WP_D65, 0.640, 0.330, 0.290, 0.600, 0.150, 0.060,},
     [AVCOL_PRI_SMPTE170M] = { WP_D65, 0.630, 0.340, 0.310, 0.595, 0.155, 0.070 },
     [AVCOL_PRI_SMPTE240M] = { WP_D65, 0.630, 0.340, 0.310, 0.595, 0.155, 0.070 },
+    [AVCOL_PRI_SMPTE428]  = { WP_E,   0.735, 0.265, 0.274, 0.718, 0.167, 0.009 },
     [AVCOL_PRI_SMPTE431]  = { WP_DCI, 0.680, 0.320, 0.265, 0.690, 0.150, 0.060 },
     [AVCOL_PRI_SMPTE432]  = { WP_D65, 0.680, 0.320, 0.265, 0.690, 0.150, 0.060 },
     [AVCOL_PRI_FILM]      = { WP_C,   0.681, 0.319, 0.243, 0.692, 0.145, 0.049 },
@@ -1104,6 +1107,7 @@  static const AVOption colorspace_options[] = {
     ENUM("bt470bg",      AVCOL_PRI_BT470BG,    "prm"),
     ENUM("smpte170m",    AVCOL_PRI_SMPTE170M,  "prm"),
     ENUM("smpte240m",    AVCOL_PRI_SMPTE240M,  "prm"),
+    ENUM("smpte248",     AVCOL_PRI_SMPTE428,   "prm"),
     ENUM("film",         AVCOL_PRI_FILM,       "prm"),
     ENUM("smpte431",     AVCOL_PRI_SMPTE431,   "prm"),
     ENUM("smpte432",     AVCOL_PRI_SMPTE432,   "prm"),
@@ -1119,6 +1123,7 @@  static const AVOption colorspace_options[] = {
     ENUM("gamma28",      AVCOL_TRC_GAMMA28,      "trc"),
     ENUM("smpte170m",    AVCOL_TRC_SMPTE170M,    "trc"),
     ENUM("smpte240m",    AVCOL_TRC_SMPTE240M,    "trc"),
+    ENUM("smpte428",     AVCOL_TRC_SMPTE428,     "trc"),
     ENUM("srgb",         AVCOL_TRC_IEC61966_2_1, "trc"),
     ENUM("iec61966-2-1", AVCOL_TRC_IEC61966_2_1, "trc"),
     ENUM("xvycc",        AVCOL_TRC_IEC61966_2_4, "trc"),