[FFmpeg-devel] [PATCH] lavfi/noise: support slice threading

Michael Niedermayer michaelni at gmx.at
Tue May 28 12:30:53 CEST 2013


On Sun, May 26, 2013 at 05:43:07PM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> 
> Alternative version.
> 
> ---
>  libavfilter/vf_noise.c | 85 +++++++++++++++++++++++++++++---------------------
>  1 file changed, 49 insertions(+), 36 deletions(-)
> 
> diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
> index 12aca24..7ae6c53 100644
> --- a/libavfilter/vf_noise.c
> +++ b/libavfilter/vf_noise.c
> @@ -47,7 +47,6 @@
>  typedef struct {
>      int strength;
>      unsigned flags;
> -    int shiftptr;
>      AVLFG lfg;
>      int seed;
>      int8_t *noise;
> @@ -67,6 +66,10 @@ typedef struct {
>      void (*line_noise_avg)(uint8_t *dst, const uint8_t *src, int len, int8_t **shift);
>  } NoiseContext;
>  
> +typedef struct ThreadData {
> +    AVFrame *in, *out;
> +} ThreadData;
> +
>  #define OFFSET(x) offsetof(NoiseContext, x)
>  #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
>  
> @@ -161,7 +164,6 @@ static int init_noise(NoiseContext *n, int comp)
>      }
>  
>      fp->noise = noise;
> -    fp->shiftptr = 0;
>      return 0;
>  }
>  
> @@ -328,48 +330,60 @@ static inline void line_noise_avg_mmx(uint8_t *dst, const uint8_t *src,
>  #endif
>  }
>  
> -static void noise(uint8_t *dst, const uint8_t *src,
> -                  int dst_linesize, int src_linesize,
> -                  int width, int height, NoiseContext *n, int comp)
> +static int noise(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)

isnt it simpler to leave noise() as it is and add a function that
calls noise() nb_planes times ?

otherwise patch should be ok

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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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/20130528/62b15a5b/attachment.asc>


More information about the ffmpeg-devel mailing list