[FFmpeg-devel] [PATCH] lavfi/hue: use lookup tables

Michael Niedermayer michaelni at gmx.at
Wed Aug 21 15:40:42 CEST 2013


On Tue, Aug 20, 2013 at 02:43:00AM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/vf_hue.c | 79 ++++++++++++++++++++++++++++++++--------------------
>  1 file changed, 49 insertions(+), 30 deletions(-)
> 
> diff --git a/libavfilter/vf_hue.c b/libavfilter/vf_hue.c
> index cc8ac78..e39d282 100644
> --- a/libavfilter/vf_hue.c
> +++ b/libavfilter/vf_hue.c
> @@ -73,6 +73,8 @@ typedef struct {
>      int32_t hue_sin;
>      int32_t hue_cos;
>      double   var_values[VAR_NB];
> +    uint8_t  lut_u[256][256];
> +    uint8_t  lut_v[256][256];
>  } HueContext;
>  
>  #define OFFSET(x) offsetof(HueContext, x)
> @@ -94,12 +96,43 @@ static inline void compute_sin_and_cos(HueContext *hue)
>      /*
>       * Scale the value to the norm of the resulting (U,V) vector, that is
>       * the saturation.
> -     * This will be useful in the process_chrominance function.
> +     * This will be useful in the apply_lut function.
>       */
>      hue->hue_sin = rint(sin(hue->hue) * (1 << 16) * hue->saturation);
>      hue->hue_cos = rint(cos(hue->hue) * (1 << 16) * hue->saturation);
>  }
>  
> +static inline void create_chrominance_lut(HueContext *s, const int32_t cos,
> +                                          const int32_t sin)
> +{

the variable names sin/cos might conflict with some sin() / cos()
macros on some platforms i suspect

otherwise it should be ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130821/bd5611d9/attachment.asc>


More information about the ffmpeg-devel mailing list