[vlc-devel] [PATCH 2/2] XYZ to RGB filter conversion

Rémi Denis-Courmont remi at remlab.net
Thu Feb 14 15:54:25 CET 2013


On Thu, 14 Feb 2013 15:27:34 +0100, Nicolas BERTRAND
<nicoinattendu at gmail.com> wrote:
> +struct filter_sys_t
> +{
> +    int xyzgamma[4096];
> +    int rgbgamma[4096];

Why is all this data regenerated for each filter instance? I

> +    int matrix[3][3];

This matrix should probably be a static const.

> +   double v_xyzgamma ;
> +   double v_rgbgamma ;

These values could probably be symbolic constants. Also do you really need
double precision?

> +};

>
+/*****************************************************************************
> + * InitFilter
> +
>
*****************************************************************************
> + * This function initializes XYZ-->RGB filter (LUTs and matrix)
> +
>
*****************************************************************************/
> +static void InitFilter( filter_sys_t *p_sys)
> +{
> +    int i;
> +    p_sys->v_xyzgamma = XYZGAMMA;
> +    p_sys->v_rgbgamma = RGBGAMMA;
> +
> +    for (i = 0; i < 4096; i++)
> +        {
> +        p_sys->xyzgamma[i] =
> (int)(pow(i/4095.0,p_sys->v_xyzgamma)*4095.0+0.5);
> +        p_sys->rgbgamma[i] =
> (int)(pow(i/4095.0,p_sys->v_rgbgamma)*4095.0+0.5);
> +        }

Same question... If not, you should use powf() and the f constant postfix.

-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list