]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_minterpolate: do not right shift negative numbers
authorDavinder Singh <ds.mudhar@gmail.com>
Mon, 29 Aug 2016 15:04:54 +0000 (17:04 +0200)
committerPaul B Mahol <onemda@gmail.com>
Mon, 29 Aug 2016 15:32:47 +0000 (17:32 +0200)
It was source of crashes. Use division instead.

Original patch by author. Log message by comitter.

libavfilter/vf_minterpolate.c

index 5b41cd8f4614d7a3bd44dcf273086793e74936ff..76a546f7d29fc8208736870153c54a29786e8fc5 100644 (file)
@@ -936,8 +936,8 @@ static void set_frame_data(MIContext *mi_ctx, int alpha, AVFrame *avf_out)
                 for (i = 0; i < pixel->nb; i++) {
                     Frame *frame = &mi_ctx->frames[pixel->refs[i]];
                     if (chroma) {
-                        x_mv = (x >> mi_ctx->chroma_h_shift) + (pixel->mvs[i][0] >> mi_ctx->chroma_h_shift);
-                        y_mv = (y >> mi_ctx->chroma_v_shift) + (pixel->mvs[i][1] >> mi_ctx->chroma_v_shift);
+                        x_mv = (x >> mi_ctx->chroma_h_shift) + (pixel->mvs[i][0] / (1 << mi_ctx->chroma_h_shift));
+                        y_mv = (y >> mi_ctx->chroma_v_shift) + (pixel->mvs[i][1] / (1 << mi_ctx->chroma_v_shift));
                     } else {
                         x_mv = x + pixel->mvs[i][0];
                         y_mv = y + pixel->mvs[i][1];