[FFmpeg-devel] [PATCH] avfilter/vf_nnedi: Simplify away some trivial mem*()

Michael Niedermayer michael at niedermayer.cc
Thu Feb 11 02:21:30 CET 2016


On Wed, Feb 10, 2016 at 10:10:22PM -0300, James Almer wrote:
> On 2/10/2016 9:30 PM, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavfilter/vf_nnedi.c |   10 +++-------
> >  1 file changed, 3 insertions(+), 7 deletions(-)
> > 
> > diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c
> > index 9a98ec2..d265fea 100644
> > --- a/libavfilter/vf_nnedi.c
> > +++ b/libavfilter/vf_nnedi.c
> > @@ -362,7 +362,7 @@ static int32_t process_line0(const uint8_t *tempu, int width, uint8_t *dstp8, co
> >              tmp /= 32;
> >              dstp[x] = FFMAX(FFMIN(tmp, maximum), minimum);
> >          } else {
> > -            memset(dstp + x, 255, sizeof(uint8_t));
> > +            dstp[x] = 255;
> >              count++;
> >          }
> >      }
> > @@ -612,14 +612,10 @@ static void evalfunc_1(NNEDIContext *s, FrameData *frame_data)
> >  
> >          for (y = ystart; y < ystop; y += 2) {
> >              for (x = 32; x < width - 32; x++) {
> > -                uint32_t pixel = 0;
> > -                uint32_t all_ones = 0;
> > +                uint32_t pixel = dstp[x];
> >                  float mstd[4];
> >  
> > -                memcpy(&pixel, dstp + x, sizeof(uint8_t));
> > -                memset(&all_ones, 255, sizeof(uint8_t));
> > -
> > -                if (pixel != all_ones)
> 
> lol
> 
> > +                if (pixel != 255)
> 
> Just make it "if (dstp[x] != 255)". No point using a local variable.

changed
applied
thx

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

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160211/3d48617b/attachment.sig>


More information about the ffmpeg-devel mailing list