Skip to content

video-hdr: Rework for GstVideoMasteringDisplayInfo and GstVideoContentLightLevel struct

Seungha Yang requested to merge seungha.yang/gst-plugins-base:hdr-rework into master

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.

cc: @slomo @ndufresne @dabrain34

Following MRs must be merged at once with this MR.

FYI

Proposed GstVideoMasteringDisplayInfo and GstVideoContentLightLevel struct

struct _GstVideoMasteringDisplayInfoCoordinates
{
  guint16 x;
  guint16 y;
};

struct _GstVideoMasteringDisplayInfo
{
  GstVideoMasteringDisplayInfoCoordinates display_primaries[3];
  GstVideoMasteringDisplayInfoCoordinates white_point;
  guint32 max_display_mastering_luminance;
  guint32 min_display_mastering_luminance;

  /*< private >*/
  gpointer _gst_reserved[GST_PADDING];
};

struct _GstVideoContentLightLevel
{
  guint16 max_content_light_level;
  guint16 max_frame_average_light_level;

  /*< private >*/
  gpointer _gst_reserved[GST_PADDING];
};

DXGI_HDR_METADATA_HDR10 struct in dxgi1_5.h

typedef struct DXGI_HDR_METADATA_HDR10
    {
    UINT16 RedPrimary[ 2 ];
    UINT16 GreenPrimary[ 2 ];
    UINT16 BluePrimary[ 2 ];
    UINT16 WhitePoint[ 2 ];
    UINT MaxMasteringLuminance;
    UINT MinMasteringLuminance;
    UINT16 MaxContentLightLevel;
    UINT16 MaxFrameAverageLightLevel;
    } 	DXGI_HDR_METADATA_HDR10;

hdr_metadata_infoframe struct in drm_mode.h

struct hdr_metadata_infoframe {
	__u8 eotf;
	__u8 metadata_type;
	struct {
		__u16 x, y;
		} display_primaries[3];
	struct {
		__u16 x, y;
		} white_point;
	__u16 max_display_mastering_luminance;
	__u16 min_display_mastering_luminance;
	__u16 max_cll;
	__u16 max_fall;
};

AVMasteringDisplayMetadata and AVContentLightMetadata of ffmpeg

typedef struct AVMasteringDisplayMetadata {
    /**
     * CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
     */
    AVRational display_primaries[3][2];

    /**
     * CIE 1931 xy chromaticity coords of white point.
     */
    AVRational white_point[2];

    /**
     * Min luminance of mastering display (cd/m^2).
     */
    AVRational min_luminance;

    /**
     * Max luminance of mastering display (cd/m^2).
     */
    AVRational max_luminance;

    /**
     * Flag indicating whether the display primaries (and white point) are set.
     */
    int has_primaries;

    /**
     * Flag indicating whether the luminance (min_ and max_) have been set.
     */
    int has_luminance;

} AVMasteringDisplayMetadata;


typedef struct AVContentLightMetadata {
    /**
     * Max content light level (cd/m^2).
     */
    unsigned MaxCLL;

    /**
     * Max average light level per frame (cd/m^2).
     */
    unsigned MaxFALL;
} AVContentLightMetadata;
Edited by Seungha Yang

Merge request reports