[Mesa-stable] [PATCH 1/3] gallium/vl: Fix brightness usage v2
Thomas Hellstrom
thellstrom at vmware.com
Tue Mar 8 06:25:48 UTC 2016
On 03/04/2016 12:52 PM, Thomas Hellstrom wrote:
> Multiplying the contrast- and brightness matrices it becomes obvious that
> brightness should be multiplied by contrast in the procamp matrix. Fix this.
>
> v2: Fixed a couple of typos, one of them affecting the results.
Actually, when looking at also the msdn document,
https://msdn.microsoft.com/en-us/library/windows/hardware/ff569191%28v=vs.85%29.aspx
it turns out that the brightness matrix described was incorrect whereas the
procamp matrix and the actual calculation was indeed correct.
So this patch will turn out to be a documentation change only. I'll
respin the other ones as well.
/Thomas
>
> Cc: "11.0 11.1 11.2" <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
> ---
> src/gallium/auxiliary/vl/vl_csc.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/src/gallium/auxiliary/vl/vl_csc.c b/src/gallium/auxiliary/vl/vl_csc.c
> index c8efe28..fc11f73 100644
> --- a/src/gallium/auxiliary/vl/vl_csc.c
> +++ b/src/gallium/auxiliary/vl/vl_csc.c
> @@ -77,10 +77,10 @@
> * [ 0, 0, 0, 1]
> *
> * procamp
> - * [ c, 0, 0, b]
> - * [ 0, c*s*cos(h), c*s*sin(h), 0]
> - * [ 0, -c*s*sin(h), c*s*cos(h), 0]
> - * [ 0, 0, 0, 1]
> + * [ c, 0, 0, cb]
> + * [ 0, c*s*cos(h), c*s*sin(h), 0]
> + * [ 0, -c*s*sin(h), c*s*cos(h), 0]
> + * [ 0, 0, 0, 1]
> *
> * bias
> * [ 1, 0, 0, ybias]
> @@ -89,10 +89,10 @@
> * [ 0, 0, 0, 1]
> *
> * csc
> - * [ c*cstd[ 0], c*cstd[ 1]*s*cos(h) - c*cstd[ 2]*s*sin(h), c*cstd[ 2]*s*cos(h) + c*cstd[ 1]*s*sin(h), cstd[ 3] + cstd[ 0]*(b + c*ybias) + cstd[ 1]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[ 2]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))]
> - * [ c*cstd[ 4], c*cstd[ 5]*s*cos(h) - c*cstd[ 6]*s*sin(h), c*cstd[ 6]*s*cos(h) + c*cstd[ 5]*s*sin(h), cstd[ 7] + cstd[ 4]*(b + c*ybias) + cstd[ 5]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[ 6]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))]
> - * [ c*cstd[ 8], c*cstd[ 9]*s*cos(h) - c*cstd[10]*s*sin(h), c*cstd[10]*s*cos(h) + c*cstd[ 9]*s*sin(h), cstd[11] + cstd[ 8]*(b + c*ybias) + cstd[ 9]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[10]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))]
> - * [ c*cstd[12], c*cstd[13]*s*cos(h) - c*cstd[14]*s*sin(h), c*cstd[14]*s*cos(h) + c*cstd[13]*s*sin(h), cstd[15] + cstd[12]*(b + c*ybias) + cstd[13]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[14]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))]
> + * [ c*cstd[ 0], c*cstd[ 1]*s*cos(h) - c*cstd[ 2]*s*sin(h), c*cstd[ 2]*s*cos(h) + c*cstd[ 1]*s*sin(h), cstd[ 3] + cstd[ 0]*c(b + ybias) + cstd[ 1]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[ 2]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))]
> + * [ c*cstd[ 4], c*cstd[ 5]*s*cos(h) - c*cstd[ 6]*s*sin(h), c*cstd[ 6]*s*cos(h) + c*cstd[ 5]*s*sin(h), cstd[ 7] + cstd[ 4]*c*(b + ybias) + cstd[ 5]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[ 6]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))]
> + * [ c*cstd[ 8], c*cstd[ 9]*s*cos(h) - c*cstd[10]*s*sin(h), c*cstd[10]*s*cos(h) + c*cstd[ 9]*s*sin(h), cstd[11] + cstd[ 8]*c*(b + ybias) + cstd[ 9]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[10]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))]
> + * [ c*cstd[12], c*cstd[13]*s*cos(h) - c*cstd[14]*s*sin(h), c*cstd[14]*s*cos(h) + c*cstd[13]*s*sin(h), cstd[15] + cstd[12]*c*(b + ybias) + cstd[13]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[14]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))]
> */
>
> /*
> @@ -210,21 +210,21 @@ void vl_csc_get_matrix(enum VL_CSC_COLOR_STANDARD cs,
> (*matrix)[0][0] = c * (*cstd)[0][0];
> (*matrix)[0][1] = c * (*cstd)[0][1] * s * cosf(h) - c * (*cstd)[0][2] * s * sinf(h);
> (*matrix)[0][2] = c * (*cstd)[0][2] * s * cosf(h) + c * (*cstd)[0][1] * s * sinf(h);
> - (*matrix)[0][3] = (*cstd)[0][3] + (*cstd)[0][0] * (b + c * ybias) +
> + (*matrix)[0][3] = (*cstd)[0][3] + (*cstd)[0][0] * c * (b + ybias) +
> (*cstd)[0][1] * (c * cbbias * s * cosf(h) + c * crbias * s * sinf(h)) +
> (*cstd)[0][2] * (c * crbias * s * cosf(h) - c * cbbias * s * sinf(h));
>
> (*matrix)[1][0] = c * (*cstd)[1][0];
> (*matrix)[1][1] = c * (*cstd)[1][1] * s * cosf(h) - c * (*cstd)[1][2] * s * sinf(h);
> (*matrix)[1][2] = c * (*cstd)[1][2] * s * cosf(h) + c * (*cstd)[1][1] * s * sinf(h);
> - (*matrix)[1][3] = (*cstd)[1][3] + (*cstd)[1][0] * (b + c * ybias) +
> + (*matrix)[1][3] = (*cstd)[1][3] + (*cstd)[1][0] * c * (b + ybias) +
> (*cstd)[1][1] * (c * cbbias * s * cosf(h) + c * crbias * s * sinf(h)) +
> (*cstd)[1][2] * (c * crbias * s * cosf(h) - c * cbbias * s * sinf(h));
>
> (*matrix)[2][0] = c * (*cstd)[2][0];
> (*matrix)[2][1] = c * (*cstd)[2][1] * s * cosf(h) - c * (*cstd)[2][2] * s * sinf(h);
> (*matrix)[2][2] = c * (*cstd)[2][2] * s * cosf(h) + c * (*cstd)[2][1] * s * sinf(h);
> - (*matrix)[2][3] = (*cstd)[2][3] + (*cstd)[2][0] * (b + c * ybias) +
> + (*matrix)[2][3] = (*cstd)[2][3] + (*cstd)[2][0] * c * (b + ybias) +
> (*cstd)[2][1] * (c * cbbias * s * cosf(h) + c * crbias * s * sinf(h)) +
> (*cstd)[2][2] * (c * crbias * s * cosf(h) - c * cbbias * s * sinf(h));
> }
More information about the mesa-stable
mailing list