[FFmpeg-devel] [PATCH] lavfi/noise: support slice threading
Paul B Mahol
onemda at gmail.com
Tue May 28 12:52:19 CEST 2013
On 5/28/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> 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
I would prefer if somebody tested and compared speed of both versions. I can't.
>
> [...]
> --
> 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
>
More information about the ffmpeg-devel
mailing list