[vlc-devel] [PATCH 5/5] direct3d11: pass the Whitepoint shifts as a Matrix

Steve Lhomme robux4 at gmail.com
Tue Mar 7 14:41:41 CET 2017


On Tue, Mar 7, 2017 at 1:15 PM, Steinar H. Gunderson
<steinar+vlc at gunderson.no> wrote:
> On Tue, Mar 07, 2017 at 01:12:39PM +0100, Steve Lhomme wrote:
>>>> +#define CbCr_ACHROMACY 0.5f /* 128 on 8 bits and 512 on 10 bits, etc */
>>>> +        colorspace.WhitePoint[1*4 + 3] = -CbCr_ACHROMACY;
>>>> +        colorspace.WhitePoint[2*4 + 3] = -CbCr_ACHROMACY;
>>>
>>> Isn't 0.5f rather 127.5 on a GPU?
>> I suppose it depends if you use asbolute values or not. In D3D11 we
>> use xxx_UNORM for the swapchain meaning it's normalized between 0 and
>> 1 regardless of the original bit depth.
>
> If 0 => 0.0 and 255 => 1.0, then surely 127 => 127.0/255.0 =~ 0.498.

My comment says I'm using 128, not 127. IMO the middle between 0 and
255, in integer, is 128 not 127. But anyway the 128 value comes from
3.4 and 4.6 in BT.709. I picked the name "achromacy" from there. It
should be 128/255 though.

> (I had this problem in my own library; see
> https://git.sesse.net/?p=movit;a=blob;f=ycbcr.h;h=6f9f4c9d3ac6b25e880c2931e439c3549688694e;hb=af438a8d5331bb1435494eaf377256deac74f408#l7)

You have a point there that the middle is not 0.5 (or 128 or 127) in
limited range and it goes from 16 to 235 (220 values shifted by 16)
and 64 to 940 (877 values shifted by 64).

For the YCbCr conversion I used this formula with the 601/709/2020
coefficients: https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.601_conversion
It actually converts from limited range.

> /* Steinar */
> --
> Homepage: https://www.sesse.net/
> _______________________________________________
> 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