<!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>Hi Steve,</p>
<p>On 2017-03-06 16:09, Steve Lhomme wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> This is especially important for sub pictures that are not HDR but displayed on
 HDR display.
 ---
  modules/video_output/win32/direct3d11.c | 24 +++++++++++++++++++++++-
  1 file changed, 23 insertions(+), 1 deletion(-)

 diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
 index 806dcea932..31cc4e6242 100644
 --- a/modules/video_output/win32/direct3d11.c
 +++ b/modules/video_output/win32/direct3d11.c
 @@ -1643,8 +1643,30 @@ static HRESULT CompilePixelShader(vout_display_t *vd, const d3d_format_t *format
                              rgb = hable(32.0 * rgb) / HABLE_DIV;\
                              return rgb";
                      }
 -                    break;
                  }
 +                else
 +                    msg_Warn(vd, "don't know how to transfer from %d to sRGB", src_transfer);
 +                break;
 +
 +            case TRANSFER_FUNC_SMPTE_ST2084:
 +                if (src_transfer == TRANSFER_FUNC_LINEAR)
 +                {
 +                    /* Linear to ST2084 */
 +                    psz_src_transform =
 +                           "const float m1 = 2610.0 / (4096.0 * 4);\
 +                            const float m2 = (2523.0 / 4096.0) * 128.0;\
 +                            const float c1 = 3424.0 / 4096.0;\
 +                            const float c2 = (2413.0 / 4096.0) * 32.0;\
 +                            const float c3 = (2392.0 / 4096.0) * 32.0;\
 +                            \</code></pre>
</blockquote>
<p>Given that the above constants are also declared in <a href="https://patches.videolan.org/patch/15825/">patch 1/4</a>, would it not make sense to introduce a common helper for both cases?</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> +                            rgb = pow(rgb, m1);\
 +                            rgb = (c1 + c2 * rgb) / (1 + c3 * rgb);\
 +                            rgb = pow(rgb, m3);\</code></pre>
</blockquote>
<p>NITPICK: Is it by intention that <code>pow</code>, together with <em>double-literals</em> are used, while the variables in question are <code>float</code>? If <code>float</code>s are really desired, <code>powf</code> and <code>.0f</code> seems more suitable to declare such intent.</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> +                            return rgb";
 +                }
 +                else
 +                    msg_Warn(vd, "don't know how to transfer from %d to SMPTE ST 2084", src_transfer);
 +                break;
              default:
                  msg_Warn(vd, "don't know how to transfer from %d to %d", src_transfer, sys->display_transfer);
                  break;</code></pre>
</blockquote>
</body>
</html>