[FFmpeg-devel] [PATCH 2/2] libavcodec/zmbvenc: motion estimation improvements/bug fixes:
Tomas Härdin
tjoppen at acc.umu.se
Sun Feb 10 18:04:30 EET 2019
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?
/Tomas
More information about the ffmpeg-devel
mailing list