[FFmpeg-devel] [PATCH] lavfi: remove noise libmpcodecs wrapper

Paul B Mahol onemda at gmail.com
Sat Apr 6 19:16:40 CEST 2013


On 4/6/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sat, Apr 06, 2013 at 04:24:15PM +0000, Paul B Mahol wrote:
>> On 4/6/13, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Fri, Apr 05, 2013 at 11:50:01PM +0000, Paul B Mahol wrote:
>> >> Native filter have been implemented.
>> >>
>> >> Even with inline assembly manually enabled, this filter
>> >> is significanly slower than native one.
>> >>
>> >> Optimization to native filter can be added at any time
>> >> and there is no reason to keep mp filter just because
>> >> it have inline assembly that gets never enabled.
>> >
>> > noise=all_strength=30
>> > 22863845 decicycles in noise, 32 runs, 0 skips
>> > the filter shows artifacts (quality is IMHO not acceptable)
>>
>>
>> What artifacts?
>
> bright pink pixels
> looking at the code i see RAND_MAX in it
>
>
>>
>> You did not provide full command line (so i can make sure you tested
>> same pixel format).
>
> ffplay -i  matrixbench_mpeg2.mpg -vf noise=all_strength=30
>
>
>>
>> The only difference is not using random().
>>
>> >
>> > mp=noise=30:30
>> > 15285560 decicycles in mpnoise, 32 runs, 0 skips
>> >
>> > forcing MMX2
>> > mp=noise=30:30
>> > 2790510 decicycles in mpnoise, 32 runs, 0 skips
>> >
>> > PS: why does the native filter not handle shorthand notation ?
>>
>> What kind of shorthand notation? The one mp=noise use can not
>> be done with it.
>
> noise=123
> should do something, currently it fails

Yes, but it supports also 123tq:23p

>
>
>>
>> >
>> > tested using:
>> >
>> > diff --git a/libavfilter/libmpcodecs/vf_noise.c
>> > b/libavfilter/libmpcodecs/vf_noise.c
>> > index 3b946e9..606ea66 100644
>> > --- a/libavfilter/libmpcodecs/vf_noise.c
>> > +++ b/libavfilter/libmpcodecs/vf_noise.c
>> > @@ -351,11 +351,11 @@ static int put_image(struct vf_instance *vf,
>> > mp_image_t *mpi, double pts){
>> >          }
>> >  //else printf("dr\n");
>> >          dmpi= vf->dmpi;
>> > -
>> > +START_TIMER
>> >          noise(dmpi->planes[0], mpi->planes[0], dmpi->stride[0],
>> > mpi->stride[0], mpi->w, mpi->h, &vf->priv->lumaParam);
>> >          noise(dmpi->planes[1], mpi->planes[1], dmpi->stride[1],
>> > mpi->stride[1], mpi->w/2, mpi->h/2, &vf->priv->chromaParam);
>> >          noise(dmpi->planes[2], mpi->planes[2], dmpi->stride[2],
>> > mpi->stride[2], mpi->w/2, mpi->h/2, &vf->priv->chromaParam);
>> > -
>> > +STOP_TIMER("mpnoise")
>> >          ff_vf_clone_mpi_attributes(dmpi, mpi);
>> >
>> >  #if HAVE_MMX
>> > diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
>> > index 8db5329..8782b4a 100644
>> > --- a/libavfilter/vf_noise.c
>> > +++ b/libavfilter/vf_noise.c
>> > @@ -309,11 +309,11 @@ static int filter_frame(AVFilterLink *inlink,
>> > AVFrame
>> > *inpicref)
>> >          }
>> >          av_frame_copy_props(out, inpicref);
>> >      }
>> > -
>> > +START_TIMER
>> >      for (i = 0; i < n->nb_planes; i++)
>> >          noise(out->data[i], inpicref->data[i], out->linesize[i],
>> >                inpicref->linesize[i], n->linesize[i], n->height[i], n,
>> > i);
>> > -
>> > +STOP_TIMER("noise")
>> >      ret = ff_filter_frame(outlink, out);
>> >      if (inpicref != out)
>> >          av_frame_free(&inpicref);
>> >
>> > [...]
>>
>> I feared of such kind of "benchmark".
>>
>> I tested with "time".
>
> both tests make sense, and if in either case mp is faster then theres
> something we can improve
> time based benchmarks include alot of interface code that easily
> could add a full picture copy ...
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Awnsering whenever a program halts or runs forever is
> On a turing machine, in general impossible (turings halting problem).
> On any real computer, always possible as a real computer has a finite
> number
> of states N, and will either halt in less than N cycles or never halt.
>


More information about the ffmpeg-devel mailing list