[FFmpeg-devel] [PATCH] Electronic Arts TGV decoder

Michael Niedermayer michaelni
Sun Jul 20 21:34:52 CEST 2008


On Sun, Jul 20, 2008 at 12:28:06PM +1000, pross at xvid.org wrote:
> On Sat, Jul 19, 2008 at 11:30:38AM +0200, Reimar D?ffinger wrote:
> > Hello,
> > >  /**
> > > - * \brief copy previously decoded bytes to current position
> > > - * \param back how many bytes back we start
> > > + * \brief deliberate overlapping memcpy implementation
> > > + * \param dst destination buffer; must be padded by 12 bytes
> > > + * \param back how many bytes back we start (the initial size of the overlapping window)
> > >   * \param cnt number of bytes to copy, must be >= 0
> > >   *
> > >   * cnt > back is valid, this will copy the bytes we just copied,
> > >   * thus creating a repeating pattern with a period length of back.
> > >   */
> > > -static inline void copy_backptr(LZOContext *c, int back, int cnt) {
> > > -    register const uint8_t *src = &c->out[-back];
> > > -    register uint8_t *dst = c->out;
> > > -    if (src < c->out_start || src > dst) {
> > > -        c->error |= LZO_INVALID_BACKPTR;
> > > -        return;
> > > -    }
> > > -    if (cnt > c->out_end - dst) {
> > > -        cnt = FFMAX(c->out_end - dst, 0);
> > > -        c->error |= LZO_OUTPUT_FULL;
> > > -    }
> > > +void av_memcpy_backptr(uint8_t *dst, int back, int cnt) {
> > > +    const uint8_t *src = dst-back;
> > >      if (back == 1) {
> > >          memset(dst, *src, cnt);
> > >          dst += cnt;
> > > @@ -157,10 +149,32 @@
> > >          }
> > >          dst += cnt;
> > >      }
> > > -    c->out = dst;
> > >  }
> > >  
> > >  /**
> > > + * \brief copy previously decoded bytes to current position
> > > + * \param back how many bytes back we start
> > > + * \param cnt number of bytes to copy, must be >= 0
> > > + *
> > > + * cnt > back is valid, this will copy the bytes we just copied,
> > > + * thus creating a repeating pattern with a period length of back.
> > > + */
> > > +static inline void copy_backptr(LZOContext *c, int back, int cnt) {
> > 
> > The diff should be smaller if you change the order of these two
> > functions.
> 
> Okay, but s/smaller/simpler/.
> 
> Updated patch enclosed, addressing your request, and Michael's final
> comments.

decoder looks ok

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080720/d2e5ebb4/attachment.pgp>



More information about the ffmpeg-devel mailing list