[FFmpeg-cvslog] avfilter/vf_noise: fix high resolution support

Michael Niedermayer michaelni at gmx.at
Fri Oct 17 01:23:25 CEST 2014


On Thu, Oct 16, 2014 at 03:06:48PM +0200, Robert Krüger wrote:
> On Thu, Oct 16, 2014 at 2:40 PM, Michael Niedermayer <git at videolan.org> wrote:
> > ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 16 13:23:39 2014 +0200| [411be72dcbc99b339a7b3fbd1011b54a9185add3] | committer: Michael Niedermayer
> >
> > avfilter/vf_noise: fix high resolution support
> >
> > Fixes Ticket4017
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> >
> >> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=411be72dcbc99b339a7b3fbd1011b54a9185add3
> > ---
> >
> >  libavfilter/vf_noise.c |   22 +++++++++++++---------
> >  1 file changed, 13 insertions(+), 9 deletions(-)
> >
> > diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
> > index 1028a3c..051ccc2 100644
> > --- a/libavfilter/vf_noise.c
> > +++ b/libavfilter/vf_noise.c
> > @@ -348,16 +348,20 @@ static void noise(uint8_t *dst, const uint8_t *src,
> >
> >      for (y = start; y < end; y++) {
> >          const int ix = y & (MAX_RES - 1);
> > -        if (flags & NOISE_TEMPORAL)
> > -            shift = av_lfg_get(lfg) & (MAX_SHIFT - 1);
> > -        else
> > -            shift = n->rand_shift[ix];
> > +        int x;
> > +        for (x=0; x < width; x+= MAX_RES) {
> > +            int w = FFMIN(width - x, MAX_RES);
> > +            if (flags & NOISE_TEMPORAL)
> > +                shift = av_lfg_get(lfg) & (MAX_SHIFT - 1);
> > +            else
> > +                shift = n->rand_shift[ix];
> >
> > -        if (flags & NOISE_AVERAGED) {
> > -            n->line_noise_avg(dst, src, width, (const int8_t**)p->prev_shift[ix]);
> > -            p->prev_shift[ix][shift & 3] = noise + shift;
> > -        } else {
> > -            n->line_noise(dst, src, noise, width, shift);
> > +            if (flags & NOISE_AVERAGED) {
> > +                n->line_noise_avg(dst + x, src + x, w, (const int8_t**)p->prev_shift[ix]);
> > +                p->prev_shift[ix][shift & 3] = noise + shift;
> > +            } else {
> > +                n->line_noise(dst + x, src + x, noise, w, shift);
> > +            }
> >          }
> >          dst += dst_linesize;
> >          src += src_linesize;
> >
> 
> I can confirm the fix solves the issue for me. Since I am not fluent
> enough in this part of the API, I am not able to understand which
> pixel formats are supported by vf_noise by just looking at the
> query_formats function. Could someone shed some light on this?

the filter supports 8bit based formats, it supports 16bit formats
by treating them like 8bit, which works out more or less.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20141017/8a8bfc97/attachment.asc>


More information about the ffmpeg-cvslog mailing list