<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<p>As far as I can tell (I have not applied nor built the relevant batch-patch), this patch needs to be after <a href="https://mailman.videolan.org/pipermail/vlc-devel/2017-March/112638.html">[PATCH 05/28] avcommon: add a conversion from AVRational to vlc_rational_t</a> in order to not break compilation when bisecting.</p>
<p>On 2017-03-31 18:14, Steve Lhomme wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> That's the way they are in the standard and how libavcodec handles them.
 ---
  include/vlc_es.h                        |  8 ++++----
  modules/codec/avcodec/video.c           | 22 +++++++++++-----------
  modules/packetizer/hevc.c               | 16 ++++++++++++----
  modules/video_output/win32/direct3d11.c | 22 +++++++++++-----------
  4 files changed, 38 insertions(+), 30 deletions(-)

 diff --git a/include/vlc_es.h b/include/vlc_es.h
 index 9b5afb792e..462531a4a9 100644
 --- a/include/vlc_es.h
 +++ b/include/vlc_es.h
 @@ -347,10 +347,10 @@ struct video_format_t
      } pose;
      struct {
          /* similar to SMPTE ST 2086 mastering display color volume */
 -        uint16_t primaries[3*2]; /* G,B,R / x,y */
 -        uint16_t white_point[2]; /* x,y */
 -        uint32_t max_luminance;
 -        uint32_t min_luminance;
 +        vlc_rational_t primaries[3*2]; /* G,B,R / x,y */
 +        vlc_rational_t white_point[2]; /* x,y */
 +        vlc_rational_t max_luminance;
 +        vlc_rational_t min_luminance;
      } mastering;
      struct {
          /* similar to CTA-861.3 content light level */
 diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
 index 6d2cb5d8a6..f9b982bc33 100644
 --- a/modules/codec/avcodec/video.c
 +++ b/modules/codec/avcodec/video.c
 @@ -308,7 +308,7 @@ static int lavc_UpdateVideoFormat(decoder_t *dec, AVCodecContext *ctx,
      dec->fmt_out.video.orientation = dec->fmt_in.video.orientation;
      dec->fmt_out.video.projection_mode = dec->fmt_in.video.projection_mode;
      dec->fmt_out.video.pose = dec->fmt_in.video.pose;
 -    if ( dec->fmt_in.video.mastering.max_luminance )
 +    if ( dec->fmt_in.video.mastering.max_luminance.den )
          dec->fmt_out.video.mastering = dec->fmt_in.video.mastering;
      dec->fmt_out.video.ligthing = dec->fmt_in.video.ligthing;
      return decoder_UpdateVideoFormat(dec);
 @@ -1045,8 +1045,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
                      (const AVMasteringDisplayMetadata *) metadata->data;
              if ( hdr_meta->has_luminance )
              {
 -                p_pic->format.mastering.max_luminance = hdr_meta->max_luminance.num;
 -                p_pic->format.mastering.min_luminance = hdr_meta->min_luminance.num;
 +                p_pic->format.mastering.max_luminance = FromAVRational(hdr_meta->max_luminance);
 +                p_pic->format.mastering.min_luminance = FromAVRational(hdr_meta->min_luminance);
              }
              if ( hdr_meta->has_primaries )
              {
 @@ -1056,14 +1056,14 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
  #define LAV_RED    0
  #define LAV_GREEN  1
  #define LAV_BLUE   2
 -                p_pic->format.mastering.primaries[ST2086_RED*2   + 0] = hdr_meta->display_primaries[LAV_RED][0].num;
 -                p_pic->format.mastering.primaries[ST2086_RED*2   + 1] = hdr_meta->display_primaries[LAV_RED][1].num;
 -                p_pic->format.mastering.primaries[ST2086_GREEN*2 + 0] = hdr_meta->display_primaries[LAV_GREEN][0].num;
 -                p_pic->format.mastering.primaries[ST2086_GREEN*2 + 1] = hdr_meta->display_primaries[LAV_GREEN][1].num;
 -                p_pic->format.mastering.primaries[ST2086_BLUE*2  + 0] = hdr_meta->display_primaries[LAV_BLUE][0].num;
 -                p_pic->format.mastering.primaries[ST2086_BLUE*2  + 1] = hdr_meta->display_primaries[LAV_BLUE][1].num;
 -                p_pic->format.mastering.white_point[0] = hdr_meta->white_point[0].num;
 -                p_pic->format.mastering.white_point[1] = hdr_meta->white_point[1].num;
 +                p_pic->format.mastering.primaries[ST2086_RED*2   + 0] = FromAVRational(hdr_meta->display_primaries[LAV_RED][0]);
 +                p_pic->format.mastering.primaries[ST2086_RED*2   + 1] = FromAVRational(hdr_meta->display_primaries[LAV_RED][1]);
 +                p_pic->format.mastering.primaries[ST2086_GREEN*2 + 0] = FromAVRational(hdr_meta->display_primaries[LAV_GREEN][0]);
 +                p_pic->format.mastering.primaries[ST2086_GREEN*2 + 1] = FromAVRational(hdr_meta->display_primaries[LAV_GREEN][1]);
 +                p_pic->format.mastering.primaries[ST2086_BLUE*2  + 0] = FromAVRational(hdr_meta->display_primaries[LAV_BLUE][0]);
 +                p_pic->format.mastering.primaries[ST2086_BLUE*2  + 1] = FromAVRational(hdr_meta->display_primaries[LAV_BLUE][1]);
 +                p_pic->format.mastering.white_point[0] = FromAVRational(hdr_meta->white_point[0]);
 +                p_pic->format.mastering.white_point[1] = FromAVRational(hdr_meta->white_point[1]);
              }
          }
  #endif
 diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
 index 90ee198e90..21ed17451d 100644
 --- a/modules/packetizer/hevc.c
 +++ b/modules/packetizer/hevc.c
 @@ -764,11 +764,19 @@ static bool ParseSEICallback( const hxxx_sei_data_t *p_sei_data, void *cbdata )
          {
              video_format_t *p_fmt = &p_dec->fmt_out.video;
              for (size_t i=0; i<ARRAY_SIZE(p_sei_data->colour_volume.primaries); ++i)
 -                p_fmt->mastering.primaries[i] = p_sei_data->colour_volume.primaries[i];
 +            {
 +                p_fmt->mastering.primaries[i].num = p_sei_data->colour_volume.primaries[i];
 +                p_fmt->mastering.primaries[i].den = 50000;
 +            }
              for (size_t i=0; i<ARRAY_SIZE(p_sei_data->colour_volume.white_point); ++i)
 -                p_fmt->mastering.white_point[i] = p_sei_data->colour_volume.white_point[i];
 -            p_fmt->mastering.max_luminance = p_sei_data->colour_volume.max_luminance;
 -            p_fmt->mastering.min_luminance = p_sei_data->colour_volume.min_luminance;
 +            {
 +                p_fmt->mastering.white_point[i].num = p_sei_data->colour_volume.white_point[i];
 +                p_fmt->mastering.white_point[i].den = 50000;
 +            }
 +            p_fmt->mastering.max_luminance.num = p_sei_data->colour_volume.max_luminance;
 +            p_fmt->mastering.max_luminance.den = 10000;
 +            p_fmt->mastering.min_luminance.num = p_sei_data->colour_volume.min_luminance;
 +            p_fmt->mastering.min_luminance.den = 10000;
          } break;
          case HXXX_SEI_CONTENT_LIGHT_LEVEL:
          {
 diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
 index 7e285de560..91f03d4a9f 100644
 --- a/modules/video_output/win32/direct3d11.c
 +++ b/modules/video_output/win32/direct3d11.c
 @@ -1304,19 +1304,19 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
      }
  #endif

 -    if (sys->dxgiswapChain4 && picture->format.mastering.max_luminance)
 +    if (sys->dxgiswapChain4 && picture->format.mastering.max_luminance.den)
      {
          DXGI_HDR_METADATA_HDR10 hdr10 = {0};
 -        hdr10.GreenPrimary[0] = picture->format.mastering.primaries[0];
 -        hdr10.GreenPrimary[1] = picture->format.mastering.primaries[1];
 -        hdr10.BluePrimary[0]  = picture->format.mastering.primaries[2];
 -        hdr10.BluePrimary[1]  = picture->format.mastering.primaries[3];
 -        hdr10.RedPrimary[0]   = picture->format.mastering.primaries[4];
 -        hdr10.RedPrimary[1]   = picture->format.mastering.primaries[5];
 -        hdr10.WhitePoint[0] = picture->format.mastering.white_point[0];
 -        hdr10.WhitePoint[1] = picture->format.mastering.white_point[1];
 -        hdr10.MinMasteringLuminance = picture->format.mastering.min_luminance;
 -        hdr10.MaxMasteringLuminance = picture->format.mastering.max_luminance;
 +        hdr10.GreenPrimary[0] = picture->format.mastering.primaries[0].num;
 +        hdr10.GreenPrimary[1] = picture->format.mastering.primaries[1].num;
 +        hdr10.BluePrimary[0]  = picture->format.mastering.primaries[2].num;
 +        hdr10.BluePrimary[1]  = picture->format.mastering.primaries[3].num;
 +        hdr10.RedPrimary[0]   = picture->format.mastering.primaries[4].num;
 +        hdr10.RedPrimary[1]   = picture->format.mastering.primaries[5].num;
 +        hdr10.WhitePoint[0] = picture->format.mastering.white_point[0].num;
 +        hdr10.WhitePoint[1] = picture->format.mastering.white_point[1].num;
 +        hdr10.MinMasteringLuminance = picture->format.mastering.min_luminance.num;
 +        hdr10.MaxMasteringLuminance = picture->format.mastering.max_luminance.num;
          hdr10.MaxContentLightLevel = picture->format.ligthing.MaxCLL;
          hdr10.MaxFrameAverageLightLevel = picture->format.ligthing.MaxFALL;
          IDXGISwapChain4_SetHDRMetaData(sys->dxgiswapChain4, DXGI_HDR_METADATA_TYPE_HDR10, sizeof(hdr10), &hdr10);
 -- 
 2.11.1

 _______________________________________________
 vlc-devel mailing list
 To unsubscribe or modify your subscription options:
 https://mailman.videolan.org/listinfo/vlc-devel</code></pre>
</blockquote>
</body>
</html>