[Ffmpeg-devel] [PATCH] simple internal lzo decoder
    Reimar Döffinger 
    Reimar.Doeffinger
       
    Sat Jan 14 21:18:06 CET 2006
    
    
  
Hi,
On Sat, Jan 14, 2006 at 06:07:04PM +0100, Michael Niedermayer wrote:
> On Sat, Jan 14, 2006 at 04:21:44PM +0100, Reimar D?ffinger wrote:
> [...]
> > -    do {
> > -        *c->out++ = c->out[-back];
> > -    } while (--cnt);
> > +    if (back == 1)
> > +        memset(c->out, c->out[-1], cnt);
> > +    else {
> > +        int blocklen = (cnt > back) ? back : cnt;
> > +        uint8_t *start = &c->out[-back];
> > +        while (cnt > blocklen) {
> > +           memcpy(c->out, start, blocklen);
> > +           c->out += blocklen;
> > +           cnt -= blocklen;
> > +           blocklen <<= 1;
> > +        }
> > +        memcpy(c->out, start, cnt);
> > +    }
> > +    c->out += cnt;
> 
> is that faster then memmove()?
This is not what memmove does, memmove will actually do "the opposite"
by specifically starting to write at the end (as to not overwrite the to
be copied part).
Greetings,
Reimar D?ffinger
    
    
More information about the ffmpeg-devel
mailing list