[FFmpeg-devel] [PATCH 2/2] libavcodec/zmbvenc: motion estimation improvements/bug fixes:

Tomas Härdin tjoppen at acc.umu.se
Tue Feb 19 22:28:33 EET 2019


sön 2019-02-10 klockan 17:04 +0100 skrev Tomas Härdin:
> lör 2019-02-09 klockan 13:10 +0000 skrev Matthew Fearnley:
> > - Clamp ME range to -64..63 (prevents corruption when me_range is too high)
> > - Allow MV's up to *and including* the positive range limit
> > - Allow out-of-edge ME by padding the prev buffer with a border of 0's
> > - Try previous MV before checking the rest (improves speed in some cases)
> > - More robust logic in code - ensure *mx,*my,*xored are updated together
> > ---
> >  libavcodec/zmbvenc.c | 64 +++++++++++++++++++++++++++++++-------------
> >  1 file changed, 46 insertions(+), 18 deletions(-)
> 
> Passes FATE
> 
> The only maybe suspicious thing is this part:
> 
> > -    c->pstride = FFALIGN(avctx->width, 16);
> > -    if (!(c->prev = av_malloc(c->pstride * avctx->height))) {
> > +
> > +    /* Allocate prev buffer - leave border around the outside for out of edge ME */
> > +    c->pstride = FFALIGN(avctx->width + c->lrange, 16);
> 
> Shouldn't this be with + lrange + urange? I guess it works out fine due
> to wraparound and lrange >= urange, but it makes me feel slightly
> uneasy
> 
> > +    prev_offset = FFALIGN(c->lrange + (c->pstride * c->lrange), 16);
> > +    prev_size = prev_offset + (c->pstride * (avctx->height + c->urange));
> 
> The way I'd do this is compute the size first, then the offset. But I
> guess this works out the same way. Maybe someone else wants to chime
> in?

Pushed patch 1 and a version of this that I only just now noticed I got
off-list. Attaching here for posterity.

We might want a test for me_range >= 64 as well.

/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libavcodec-zmbvenc-motion-estimation-improvements-bu.patch
Type: text/x-patch
Size: 6135 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190219/325ac3be/attachment.bin>


More information about the ffmpeg-devel mailing list