video-hdr: Rework for GstVideoMasteringDisplayInfo and GstVideoContentLightLevel struct

This commit modifies GstVideoMasteringDisplayInfo and GstVideoContentLightLevel
structs so that each value is to be more like hdr_metadata_infoframe struct
of linux drm header and DXGI_HDR_METADATA_HDR10 struct of Windows.
So each value is no more fraction but normalized one as per CTA 861.G spec.
Also the unit of each value will be consistent with H.264, H.265
specifications, hdr_metadata_infoframe struct for linux and
DXGI_HDR_METADATA_HDR10 struct for Windows.
This commit is contained in:
Seungha Yang 2020-03-10 20:36:16 +09:00 committed by GStreamer Merge Bot
parent 476eaf9425
commit 1dee0f05a7
3 changed files with 193 additions and 248 deletions

View file

@ -21,49 +21,41 @@
# include "config.h" # include "config.h"
#endif #endif
#include <string.h>
#include <stdio.h>
#include "video-hdr.h" #include "video-hdr.h"
#define N_ELEMENT_MASTERING_DISPLAY_INFO 20 #define N_ELEMENT_MASTERING_DISPLAY_INFO 10
#define MASTERING_FORMAT \ #define MASTERING_FORMAT \
"%d:%d:" \
"%d:%d:" \
"%d:%d:" \
"%d:%d:" \
"%d:%d:" \
"%d:%d:" \ "%d:%d:" \
"%d:%d:" \ "%d:%d:" \
"%d:%d:" \ "%d:%d:" \
"%d:%d:" \ "%d:%d:" \
"%d:%d" "%d:%d"
#define MASTERING_SCANF_ARGS(m) \
&(m)->Rx_n, &(m)->Rx_d, &(m)->Ry_n, &(m)->Ry_d, \
&(m)->Gx_n, &(m)->Gx_d, &(m)->Gy_n, &(m)->Gy_d, \
&(m)->Bx_n, &(m)->Bx_d, &(m)->By_n, &(m)->By_d, \
&(m)->Wx_n, &(m)->Wx_d, &(m)->Wy_n, &(m)->Wy_d, \
&(m)->max_luma_n, &(m)->max_luma_d, \
&(m)->min_luma_n, &(m)->min_luma_d
#define RX_ARGS(m) (m)->Rx_n, (m)->Rx_d
#define RY_ARGS(m) (m)->Ry_n, (m)->Ry_d
#define GX_ARGS(m) (m)->Gx_n, (m)->Gx_d
#define GY_ARGS(m) (m)->Gy_n, (m)->Gy_d
#define BX_ARGS(m) (m)->Bx_n, (m)->Bx_d
#define BY_ARGS(m) (m)->By_n, (m)->By_d
#define WX_ARGS(m) (m)->Wx_n, (m)->Wx_d
#define WY_ARGS(m) (m)->Wy_n, (m)->Wy_d
#define MAX_LUMA_ARGS(m) (m)->max_luma_n, (m)->max_luma_d
#define MIN_LUMA_ARGS(m) (m)->min_luma_n, (m)->min_luma_d
#define MASTERING_PRINTF_ARGS(m) \ #define MASTERING_PRINTF_ARGS(m) \
RX_ARGS(m), RY_ARGS(m), \ (m)->display_primaries[0].x, (m)->display_primaries[0].y, \
GX_ARGS(m), GY_ARGS(m), \ (m)->display_primaries[1].x, (m)->display_primaries[1].y, \
BX_ARGS(m), BY_ARGS(m), \ (m)->display_primaries[2].x, (m)->display_primaries[2].y, \
WX_ARGS(m), WY_ARGS(m), \ (m)->white_point.x, (m)->white_point.y, \
MAX_LUMA_ARGS(m), MIN_LUMA_ARGS(m) (m)->max_display_mastering_luminance, \
(m)->min_display_mastering_luminance
/* g_ascii_string_to_unsigned is available since 2.54. Get rid of this wrapper
* when we bump the version in 1.18 */
#if !GLIB_CHECK_VERSION(2,54,0)
#define g_ascii_string_to_unsigned vidoe_hdr_ascii_string_to_unsigned
static gboolean
vidoe_hdr_ascii_string_to_unsigned (const gchar * str, guint base, guint64 min,
guint64 max, guint64 * out_num, GError ** error)
{
gchar *endptr = NULL;
*out_num = g_ascii_strtoull (str, &endptr, base);
if (errno)
return FALSE;
if (endptr == str)
return FALSE;
return TRUE;
}
#endif
/** /**
* gst_video_mastering_display_info_init: * gst_video_mastering_display_info_init:
@ -81,49 +73,6 @@ gst_video_mastering_display_info_init (GstVideoMasteringDisplayInfo * minfo)
memset (minfo, 0, sizeof (GstVideoMasteringDisplayInfo)); memset (minfo, 0, sizeof (GstVideoMasteringDisplayInfo));
} }
#define DIVIDE_ARGS(val,gcd) \
{ \
minfo->G_PASTE(val,_n) /= gcd; \
minfo->G_PASTE(val,_d) /= gcd; \
}
static void
gst_video_mastering_display_info_normalize (GstVideoMasteringDisplayInfo *
minfo)
{
guint gcd;
gcd = gst_util_greatest_common_divisor (RX_ARGS (minfo));
DIVIDE_ARGS (Rx, gcd);
gcd = gst_util_greatest_common_divisor (RY_ARGS (minfo));
DIVIDE_ARGS (Ry, gcd);
gcd = gst_util_greatest_common_divisor (GX_ARGS (minfo));
DIVIDE_ARGS (Gx, gcd);
gcd = gst_util_greatest_common_divisor (GY_ARGS (minfo));
DIVIDE_ARGS (Gy, gcd);
gcd = gst_util_greatest_common_divisor (BX_ARGS (minfo));
DIVIDE_ARGS (Bx, gcd);
gcd = gst_util_greatest_common_divisor (BY_ARGS (minfo));
DIVIDE_ARGS (By, gcd);
gcd = gst_util_greatest_common_divisor (WX_ARGS (minfo));
DIVIDE_ARGS (Wx, gcd);
gcd = gst_util_greatest_common_divisor (WY_ARGS (minfo));
DIVIDE_ARGS (Wy, gcd);
gcd = gst_util_greatest_common_divisor (MAX_LUMA_ARGS (minfo));
DIVIDE_ARGS (max_luma, gcd);
gcd = gst_util_greatest_common_divisor (MIN_LUMA_ARGS (minfo));
DIVIDE_ARGS (min_luma, gcd);
}
/** /**
* gst_video_mastering_display_info_from_string: * gst_video_mastering_display_info_from_string:
* @minfo: (out): a #GstVideoMasteringDisplayInfo * @minfo: (out): a #GstVideoMasteringDisplayInfo
@ -136,23 +85,68 @@ gst_video_mastering_display_info_normalize (GstVideoMasteringDisplayInfo *
* Since: 1.18 * Since: 1.18
*/ */
gboolean gboolean
gst_video_mastering_display_info_from_string gst_video_mastering_display_info_from_string (GstVideoMasteringDisplayInfo *
(GstVideoMasteringDisplayInfo * minfo, const gchar * mastering) minfo, const gchar * mastering)
{ {
GstVideoMasteringDisplayInfo tmp; gboolean ret = FALSE;
gchar **split;
gint i;
gint idx = 0;
guint64 val;
g_return_val_if_fail (minfo != NULL, FALSE); g_return_val_if_fail (minfo != NULL, FALSE);
g_return_val_if_fail (mastering != NULL, FALSE); g_return_val_if_fail (mastering != NULL, FALSE);
if (sscanf (mastering, MASTERING_FORMAT, split = g_strsplit (mastering, ":", -1);
MASTERING_SCANF_ARGS (&tmp)) == N_ELEMENT_MASTERING_DISPLAY_INFO &&
gst_video_mastering_display_info_is_valid (&tmp)) { if (g_strv_length (split) != N_ELEMENT_MASTERING_DISPLAY_INFO)
gst_video_mastering_display_info_normalize (&tmp); goto out;
*minfo = tmp;
return TRUE; for (i = 0; i < G_N_ELEMENTS (minfo->display_primaries); i++) {
if (!g_ascii_string_to_unsigned (split[idx++],
10, 0, G_MAXUINT16, &val, NULL))
goto out;
minfo->display_primaries[i].x = (guint16) val;
if (!g_ascii_string_to_unsigned (split[idx++],
10, 0, G_MAXUINT16, &val, NULL))
goto out;
minfo->display_primaries[i].y = (guint16) val;
} }
return FALSE; if (!g_ascii_string_to_unsigned (split[idx++],
10, 0, G_MAXUINT16, &val, NULL))
goto out;
minfo->white_point.x = (guint16) val;
if (!g_ascii_string_to_unsigned (split[idx++],
10, 0, G_MAXUINT16, &val, NULL))
goto out;
minfo->white_point.y = (guint16) val;
if (!g_ascii_string_to_unsigned (split[idx++],
10, 0, G_MAXUINT32, &val, NULL))
goto out;
minfo->max_display_mastering_luminance = (guint32) val;
if (!g_ascii_string_to_unsigned (split[idx++],
10, 0, G_MAXUINT32, &val, NULL))
goto out;
minfo->min_display_mastering_luminance = (guint32) val;
ret = TRUE;
out:
g_strfreev (split);
if (!ret)
gst_video_mastering_display_info_init (minfo);
return ret;
} }
/** /**
@ -161,26 +155,17 @@ gboolean
* *
* Convert @minfo to its string representation * Convert @minfo to its string representation
* *
* Returns: (transfer full) (nullable): a string representation of @minfo * Returns: (transfer full): a string representation of @minfo
* or %NULL if @minfo has invalid chromaticity and/or luminance values
* *
* Since: 1.18 * Since: 1.18
*/ */
gchar * gchar *
gst_video_mastering_display_info_to_string (const gst_video_mastering_display_info_to_string (const GstVideoMasteringDisplayInfo *
GstVideoMasteringDisplayInfo * minfo) minfo)
{ {
GstVideoMasteringDisplayInfo copy;
g_return_val_if_fail (minfo != NULL, NULL); g_return_val_if_fail (minfo != NULL, NULL);
if (!gst_video_mastering_display_info_is_valid (minfo)) return g_strdup_printf (MASTERING_FORMAT, MASTERING_PRINTF_ARGS (minfo));
return NULL;
copy = *minfo;
gst_video_mastering_display_info_normalize (&copy);
return g_strdup_printf (MASTERING_FORMAT, MASTERING_PRINTF_ARGS (&copy));
} }
/** /**
@ -195,69 +180,26 @@ gst_video_mastering_display_info_to_string (const
* Since: 1.18 * Since: 1.18
*/ */
gboolean gboolean
gst_video_mastering_display_info_is_equal (const gst_video_mastering_display_info_is_equal (const GstVideoMasteringDisplayInfo *
GstVideoMasteringDisplayInfo * minfo, minfo, const GstVideoMasteringDisplayInfo * other)
const GstVideoMasteringDisplayInfo * other)
{ {
if (gst_util_fraction_compare (RX_ARGS (minfo), RX_ARGS (other)) || gint i;
gst_util_fraction_compare (RY_ARGS (minfo), RY_ARGS (other)) ||
gst_util_fraction_compare (GX_ARGS (minfo), GX_ARGS (other)) ||
gst_util_fraction_compare (GY_ARGS (minfo), GY_ARGS (other)) ||
gst_util_fraction_compare (BX_ARGS (minfo), BX_ARGS (other)) ||
gst_util_fraction_compare (BY_ARGS (minfo), BY_ARGS (other)) ||
gst_util_fraction_compare (WX_ARGS (minfo), WX_ARGS (other)) ||
gst_util_fraction_compare (WY_ARGS (minfo), WY_ARGS (other)) ||
gst_util_fraction_compare (MAX_LUMA_ARGS (minfo), MAX_LUMA_ARGS (other))
|| gst_util_fraction_compare (MIN_LUMA_ARGS (minfo),
MIN_LUMA_ARGS (other)))
return FALSE;
return TRUE; g_return_val_if_fail (minfo != NULL, FALSE);
} g_return_val_if_fail (other != NULL, FALSE);
/** for (i = 0; i < G_N_ELEMENTS (minfo->display_primaries); i++) {
* gst_video_mastering_display_info_is_valid: if (minfo->display_primaries[i].x != other->display_primaries[i].x ||
* @minfo: a #GstVideoMasteringDisplayInfo minfo->display_primaries[i].y != other->display_primaries[i].y)
* return FALSE;
* Checks the minimum validity of @mininfo (not theoretical validation). }
*
* Each x and y chromaticity coordinate should be in the range of [0, 1]
* min_luma should be less than max_luma.
*
* Returns: %TRUE if @minfo satisfies the condition.
*
* Since: 1.18
*/
gboolean
gst_video_mastering_display_info_is_valid (const GstVideoMasteringDisplayInfo *
minfo)
{
GstVideoMasteringDisplayInfo other;
gst_video_mastering_display_info_init (&other); if (minfo->white_point.x != other->white_point.x ||
minfo->white_point.y != other->white_point.y ||
if (!memcmp (minfo, &other, sizeof (GstVideoMasteringDisplayInfo))) minfo->max_display_mastering_luminance !=
return FALSE; other->max_display_mastering_luminance
|| minfo->min_display_mastering_luminance !=
/* should be valid fraction */ other->min_display_mastering_luminance)
if (!minfo->Rx_d || !minfo->Ry_d || !minfo->Gx_d || !minfo->Gy_d ||
!minfo->Bx_d || !minfo->By_d || !minfo->Wx_d || !minfo->Wy_d ||
!minfo->max_luma_d || !minfo->min_luma_d)
return FALSE;
/* should be less than one */
if (gst_util_fraction_compare (RX_ARGS (minfo), 1, 1) > 0 ||
gst_util_fraction_compare (RY_ARGS (minfo), 1, 1) > 0 ||
gst_util_fraction_compare (GX_ARGS (minfo), 1, 1) > 0 ||
gst_util_fraction_compare (GY_ARGS (minfo), 1, 1) > 0 ||
gst_util_fraction_compare (BX_ARGS (minfo), 1, 1) > 0 ||
gst_util_fraction_compare (BY_ARGS (minfo), 1, 1) > 0 ||
gst_util_fraction_compare (WX_ARGS (minfo), 1, 1) > 0 ||
gst_util_fraction_compare (WY_ARGS (minfo), 1, 1) > 0)
return FALSE;
if (gst_util_fraction_compare (MAX_LUMA_ARGS (minfo),
MIN_LUMA_ARGS (minfo)) <= 0)
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -353,25 +295,39 @@ gst_video_content_light_level_init (GstVideoContentLightLevel * linfo)
* Since: 1.18 * Since: 1.18
*/ */
gboolean gboolean
gst_video_content_light_level_from_string (GstVideoContentLightLevel * gst_video_content_light_level_from_string (GstVideoContentLightLevel * linfo,
linfo, const gchar * level) const gchar * level)
{ {
guint maxCLL_n, maxCLL_d; gboolean ret = FALSE;
guint maxFALL_n, maxFALL_d; gchar **split;
guint64 val;
g_return_val_if_fail (linfo != NULL, FALSE); g_return_val_if_fail (linfo != NULL, FALSE);
g_return_val_if_fail (level != NULL, FALSE); g_return_val_if_fail (level != NULL, FALSE);
if (sscanf (level, "%u:%u:%u:%u", &maxCLL_n, &maxCLL_d, &maxFALL_n, split = g_strsplit (level, ":", -1);
&maxFALL_d) == 4 && maxCLL_d != 0 && maxFALL_d != 0) {
linfo->maxCLL_n = maxCLL_n;
linfo->maxCLL_d = maxCLL_d;
linfo->maxFALL_n = maxFALL_n;
linfo->maxFALL_d = maxFALL_d;
return TRUE;
}
return FALSE; if (g_strv_length (split) != 2)
goto out;
if (!g_ascii_string_to_unsigned (split[0], 10, 0, G_MAXUINT16, &val, NULL))
goto out;
linfo->max_content_light_level = (guint16) val;
if (!g_ascii_string_to_unsigned (split[1], 10, 0, G_MAXUINT16, &val, NULL))
goto out;
linfo->max_frame_average_light_level = (guint16) val;
ret = TRUE;
out:
g_strfreev (split);
if (!ret)
gst_video_content_light_level_init (linfo);
return ret;
} }
/** /**
@ -390,12 +346,8 @@ gst_video_content_light_level_to_string (const GstVideoContentLightLevel *
{ {
g_return_val_if_fail (linfo != NULL, NULL); g_return_val_if_fail (linfo != NULL, NULL);
/* When maxCLL and/or maxFALL is zero, it means no upper bound is indicated. return g_strdup_printf ("%d:%d",
* But at least it should be valid fraction value */ linfo->max_content_light_level, linfo->max_frame_average_light_level);
g_return_val_if_fail (linfo->maxCLL_d != 0 && linfo->maxFALL_d != 0, NULL);
return g_strdup_printf ("%u:%u:%u:%u",
linfo->maxCLL_n, linfo->maxCLL_d, linfo->maxFALL_n, linfo->maxFALL_d);
} }
/** /**

View file

@ -25,53 +25,52 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef struct _GstVideoMasteringDisplayInfoCoordinates GstVideoMasteringDisplayInfoCoordinates;
typedef struct _GstVideoMasteringDisplayInfo GstVideoMasteringDisplayInfo; typedef struct _GstVideoMasteringDisplayInfo GstVideoMasteringDisplayInfo;
typedef struct _GstVideoContentLightLevel GstVideoContentLightLevel; typedef struct _GstVideoContentLightLevel GstVideoContentLightLevel;
/**
* GstVideoMasteringDisplayInfoCoordinates:
* @x: the x coordinate of CIE 1931 color space in unit of 0.00002.
* @x: the y coordinate of CIE 1931 color space in unit of 0.00002.
*
* Used to represent display_primaries and white_point of
* #GstVideoMasteringDisplayInfo struct. See #GstVideoMasteringDisplayInfo
*
* Since: 1.18
*/
struct _GstVideoMasteringDisplayInfoCoordinates
{
guint16 x;
guint16 y;
};
/** /**
* GstVideoMasteringDisplayInfo: * GstVideoMasteringDisplayInfo:
* @Rx_n: the numerator of normalized red x coordinate as defined CIE 1931 * @display_primaries: the xy coordinates of primaries in the CIE 1931 color space.
* @Rx_d: the denominator of normalized red x coordinate as defined CIE 1931 * the index 0 contains red, 1 is for green and 2 is for blue.
* @Ry_n: the numerator of normalized red y coordinate as defined CIE 1931 * each value is normalized to 50000 (meaning that in unit of 0.00002)
* @Ry_d: the denominator of normalized red y coordinate as defined CIE 1931 * @white_point: the xy coordinates of white point in the CIE 1931 color space.
* @Gx_n: the numerator of normalized green x coordinate as defined CIE 1931 * each value is normalized to 50000 (meaning that in unit of 0.00002)
* @Gx_d: the denominator of normalized green x coordinate as defined CIE 1931 * @max_display_mastering_luminance: the maximum value of display luminance
* @Gy_n: the numerator of normalized green y coordinate as defined CIE 1931 * in unit of 0.0001 candelas per square metre (cd/m^2 and nit)
* @Gy_d: the denominator of normalized green y coordinate as defined CIE 1931 * @min_display_mastering_luminance: the minimum value of display luminance
* @Bx_n: the numerator of normalized blue x coordinate as defined CIE 1931 * in unit of 0.0001 candelas per square metre (cd/m^2 and nit)
* @Bx_d: the denominator of normalized blue x coordinate as defined CIE 1931
* @By_n: the numerator of normalized blue y coordinate as defined CIE 1931
* @By_d: the denominator of normalized blue y coordinate as defined CIE 1931
* @Wx_n: the numerator of normalized white x coordinate as defined CIE 1931
* @Wx_d: the denominator of normalized white x coordinate as defined CIE 1931
* @Wy_n: the numerator of normalized white y coordinate as defined CIE 1931
* @Wy_d: the denominator of normalized white y coordinate as defined CIE 1931
* @max_luma_n: the numerator of maximum display luminance in candelas per square meter (cd/m^2 and nit)
* @max_luma_d: the denominator of maximum display luminance in candelas per square meter (cd/m^2 and nit)
* @min_luma_n: the numerator of minimum display luminance in candelas per square meter (cd/m^2 and nit)
* @min_luma_d: the denominator of minimum display luminance in candelas per square meter (cd/m^2 and nit)
* *
* Mastering display color volume information defined by SMPTE ST 2086 * Mastering display color volume information defined by SMPTE ST 2086
* (a.k.a static HDR metadata). * (a.k.a static HDR metadata).
* Each pair of *_d and *_n represents fraction value of red, green, blue, white
* and min/max luma.
*
* The decimal representation of each red, green, blue and white value should
* be in the range of [0, 1].
* *
* Since: 1.18 * Since: 1.18
*/ */
struct _GstVideoMasteringDisplayInfo struct _GstVideoMasteringDisplayInfo
{ {
guint Rx_n, Rx_d, Ry_n, Ry_d; GstVideoMasteringDisplayInfoCoordinates display_primaries[3];
guint Gx_n, Gx_d, Gy_n, Gy_d; GstVideoMasteringDisplayInfoCoordinates white_point;
guint Bx_n, Bx_d, By_n, By_d; guint32 max_display_mastering_luminance;
guint Wx_n, Wx_d, Wy_n, Wy_d; guint32 min_display_mastering_luminance;
guint max_luma_n, max_luma_d;
guint min_luma_n, min_luma_d;
/*< private >*/ /*< private >*/
guint _gst_reserved[GST_PADDING]; gpointer _gst_reserved[GST_PADDING];
}; };
GST_VIDEO_API GST_VIDEO_API
@ -88,9 +87,6 @@ GST_VIDEO_API
gboolean gst_video_mastering_display_info_is_equal (const GstVideoMasteringDisplayInfo * minfo, gboolean gst_video_mastering_display_info_is_equal (const GstVideoMasteringDisplayInfo * minfo,
const GstVideoMasteringDisplayInfo * other); const GstVideoMasteringDisplayInfo * other);
GST_VIDEO_API
gboolean gst_video_mastering_display_info_is_valid (const GstVideoMasteringDisplayInfo * minfo);
GST_VIDEO_API GST_VIDEO_API
gboolean gst_video_mastering_display_info_from_caps (GstVideoMasteringDisplayInfo * minfo, gboolean gst_video_mastering_display_info_from_caps (GstVideoMasteringDisplayInfo * minfo,
const GstCaps * caps); const GstCaps * caps);
@ -101,10 +97,10 @@ gboolean gst_video_mastering_display_info_add_to_caps (const GstVideoMastering
/** /**
* GstVideoContentLightLevel: * GstVideoContentLightLevel:
* @maxCLL_n: the numerator of Maximum Content Light Level (cd/m^2 and nit) * @max_content_light_level: the maximum content light level
* @maxCLL_d: the denominator of Maximum Content Light Level (cd/m^2 and nit) * (abbreviated to MaxCLL) in candelas per square meter (cd/m^2 and nit)
* @maxFALL_n: the numerator Maximum Frame-Average Light Level (cd/m^2 and nit) * @max_frame_average_light_level: the maximum frame average light level
* @maxFALL_d: the denominator Maximum Frame-Average Light Level (cd/m^2 and nit) * (abbreviated to MaxFLL) in candelas per square meter (cd/m^2 and nit)
* *
* Content light level information specified in CEA-861.3, Appendix A. * Content light level information specified in CEA-861.3, Appendix A.
* *
@ -112,11 +108,11 @@ gboolean gst_video_mastering_display_info_add_to_caps (const GstVideoMastering
*/ */
struct _GstVideoContentLightLevel struct _GstVideoContentLightLevel
{ {
guint maxCLL_n, maxCLL_d; guint16 max_content_light_level;
guint maxFALL_n, maxFALL_d; guint16 max_frame_average_light_level;
/*< private >*/ /*< private >*/
guint _gst_reserved[GST_PADDING]; gpointer _gst_reserved[GST_PADDING];
}; };
GST_VIDEO_API GST_VIDEO_API

View file

@ -3065,26 +3065,24 @@ GST_START_TEST (test_hdr)
GstStructure *s = NULL; GstStructure *s = NULL;
gchar *minfo_str; gchar *minfo_str;
gchar *level_str = NULL; gchar *level_str = NULL;
gint i;
guint val;
gst_video_mastering_display_info_init (&minfo); gst_video_mastering_display_info_init (&minfo);
gst_video_mastering_display_info_init (&other_minfo); gst_video_mastering_display_info_init (&other_minfo);
/* Test GstVideoMasteringDisplayInfo */ /* Test GstVideoMasteringDisplayInfo, initialize with random values
minfo.Rx_n = 1; * just for comparison */
minfo.Ry_n = 2; val = 1;
minfo.Gx_n = 3; for (i = 0; i < G_N_ELEMENTS (minfo.display_primaries); i++) {
minfo.Gy_n = 4; minfo.display_primaries[i].x = val++;
minfo.Bx_n = 5; minfo.display_primaries[i].y = val++;
minfo.By_n = 6; }
minfo.Wx_n = 7; minfo.white_point.x = val++;
minfo.Wy_n = 8; minfo.white_point.y = val++;
minfo.max_display_mastering_luminance = val++;
minfo.max_luma_n = 9990; minfo.min_display_mastering_luminance = val++;
minfo.min_luma_n = 10;
minfo.Rx_d = minfo.Ry_d = minfo.Gx_d = minfo.Gy_d = minfo.Bx_d =
minfo.By_d = minfo.Wx_d = minfo.Wy_d = minfo.max_luma_d =
minfo.min_luma_d = 10;
caps = gst_caps_new_empty_simple ("video/x-raw"); caps = gst_caps_new_empty_simple ("video/x-raw");
minfo_str = gst_video_mastering_display_info_to_string (&minfo); minfo_str = gst_video_mastering_display_info_to_string (&minfo);
@ -3126,10 +3124,9 @@ GST_START_TEST (test_hdr)
/* Test GstVideoContentLightLevel */ /* Test GstVideoContentLightLevel */
gst_video_content_light_level_init (&level); gst_video_content_light_level_init (&level);
gst_video_content_light_level_init (&other_level); gst_video_content_light_level_init (&other_level);
level.maxCLL_n = 1000;
level.maxCLL_d = 1; level.max_content_light_level = 1000;
level.maxFALL_n = 300; level.max_frame_average_light_level = 300;
level.maxFALL_d = 1;
caps = gst_caps_new_empty_simple ("video/x-raw"); caps = gst_caps_new_empty_simple ("video/x-raw");
level_str = gst_video_content_light_level_to_string (&level); level_str = gst_video_content_light_level_to_string (&level);
@ -3147,18 +3144,18 @@ GST_START_TEST (test_hdr)
level_str)); level_str));
g_free (level_str); g_free (level_str);
fail_unless_equals_int (level.maxCLL_n, other_level.maxCLL_n); fail_unless_equals_int (level.max_content_light_level,
fail_unless_equals_int (level.maxCLL_d, other_level.maxCLL_d); other_level.max_content_light_level);
fail_unless_equals_int (level.maxFALL_n, other_level.maxFALL_n); fail_unless_equals_int (level.max_frame_average_light_level,
fail_unless_equals_int (level.maxFALL_d, other_level.maxFALL_d); other_level.max_frame_average_light_level);
/* simplified version for caps use case */ /* simplified version for caps use case */
fail_unless (gst_video_content_light_level_from_caps (&level_from_caps, fail_unless (gst_video_content_light_level_from_caps (&level_from_caps,
caps)); caps));
fail_unless_equals_int (level.maxCLL_n, level_from_caps.maxCLL_n); fail_unless_equals_int (level.max_content_light_level,
fail_unless_equals_int (level.maxCLL_d, level_from_caps.maxCLL_d); level_from_caps.max_content_light_level);
fail_unless_equals_int (level.maxFALL_n, level_from_caps.maxFALL_n); fail_unless_equals_int (level.max_frame_average_light_level,
fail_unless_equals_int (level.maxFALL_d, level_from_caps.maxFALL_d); level_from_caps.max_frame_average_light_level);
/* check _add_to_caps () and manually created one */ /* check _add_to_caps () and manually created one */
other_caps = gst_caps_new_empty_simple ("video/x-raw"); other_caps = gst_caps_new_empty_simple ("video/x-raw");