[vlc-devel] [PATCH 2/4] direct3d11: handle output to a SMPTE ST 2084 display

Filip Roséen filip at atch.se
Mon Mar 6 16:24:28 CET 2017


Hi Steve,

On 2017-03-06 16:09, Steve Lhomme wrote:

> 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;\
> +                            \

Given that the above constants are also declared in [patch 1/4][1],
would it not make sense to introduce a common helper for both cases?

[1]: https://patches.videolan.org/patch/15825/

> +                            rgb = pow(rgb, m1);\
> +                            rgb = (c1 + c2 * rgb) / (1 + c3 * rgb);\
> +                            rgb = pow(rgb, m3);\

NITPICK: Is it by intention that `pow`, together with
*double-literals* are used, while the variables in question are
`float`? If `float`s are really desired, `powf` and `.0f` seems more
suitable to declare such intent.

> +                            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;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170306/0bf80a07/attachment.html>


More information about the vlc-devel mailing list