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

Steve Lhomme robux4 at gmail.com
Tue Mar 7 08:31:31 CET 2017


On Mon, Mar 6, 2017 at 4:24 PM, Filip Roséen <filip at atch.se> wrote:
> 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, would it not
> make sense to introduce a common helper for both cases?

Yeah, it will make the things a little less readable though.

>  +                            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 floats are really
> desired, powf and .0f seems more suitable to declare such intent.

This is not C or C++ code, it's HLSL which doesn't have double nor powf().
https://msdn.microsoft.com/en-us/library/windows/desktop/bb509636(v=vs.85).aspx

>  +                            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;
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list