[Mesa-dev] [PATCH 1/4] state_trackers/vdpau: Implement VdpGenerateCSCMatrix

Christian König deathsimple at vodafone.de
Mon Nov 7 08:05:59 PST 2011


Hi Maarten,

On 06.11.2011 10:41, Maarten Lankhorst wrote:
> Hey Christian,
>
> On 10/31/2011 11:00 AM, Christian König wrote:
>> On 31.10.2011 10:23, Maarten Lankhorst wrote:
>>> With the smpte240 profile, which was missing.
>>>
>>> Signed-off-by: Maarten Lankhorst<m.b.lankhorst at gmail.com>
>>> ---
>>>    src/gallium/auxiliary/vl/vl_csc.c        |   19 +++++++++++++++++++
>>>    src/gallium/auxiliary/vl/vl_csc.h        |    3 ++-
>>>    src/gallium/state_trackers/vdpau/mixer.c |   20 +++++++++++++++++++-
>>>    3 files changed, 40 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/gallium/auxiliary/vl/vl_csc.c b/src/gallium/auxiliary/vl/vl_csc.c
>>> index 21da95f..56e6621 100644
>>> --- a/src/gallium/auxiliary/vl/vl_csc.c
>>> +++ b/src/gallium/auxiliary/vl/vl_csc.c
>>> @@ -147,6 +147,22 @@ static const float bt_709_full[16] =
>>>       0.0f,    0.0f,    0.0f,   1.0f
>>>    };
>>>
>>> +static const float smpte240m[16] =
>>> +{
>>> +   1.0f,  0.0f,    1.582f, 0.0f,
>>> +   1.0f, -0.228f, -0.478f, 0.0f,
>>> +   1.0f,  1.833f,  0.0f,   0.0f,
>>> +   0.0f,  0.0f,    0.0f,   1.0f
>>> +};
>>> +
>>> +static const float smpte240m_full[16] =
>>> +{
>>> +   1.164f,  0.0f,    1.794f, 0.0f,
>>> +   1.164f, -0.258f, -0.543f, 0.0f,
>>> +   1.164f,  2.079f,  0.0f,   0.0f,
>>> +   0.0f,    0.0f,    0.0f,   1.0f
>>> +};
>>> +
>> I haven't checked if the matrix are correct and precise enough, but otherwise looks good to me.
> For completeness, what I'm getting on nouveau:
>
> {{1.164000, 0.000000, 1.794000, -0.973553},
>   {1.164000, -0.258000, -0.543000, 0.329035},
>   {1.164000, 2.079000, 0.000000, -1.116612}}
>
> And nvidia:
>
> {{1.164400, 0.000000, 1.793900, -0.973528},
>   {1.164400, -0.257800, -0.542500, 0.328659},
>   {1.164400, 2.078700, 0.000000, -1.116486}}
>
> I'm not sure if it matters though, all the matrixes in vl_csc seem to have slightly
> less accuracy than nvidia's, but is the difference really relevant when the effective
> range is only 240 (CbCr) or less (Y)?
Maybe, I'm not an expert in numeric so I really don't know. For the iDCT 
Matrix i even had to store it as hex values to get the desired 
precision. But with iDCT you have a 8x8 matrix multiplication compared 
to an 4x3 vector multiplication in this case.

I think the precision is enough, but I'm not 100% sure either. Somebody 
with a good mathematical background should to sit down and think it through.

For now I think it's ok to commit the patch (if not already done) and 
keep this in mind if we ever find a noticeable difference in display 
quality.

Christian.


More information about the mesa-dev mailing list