Browse code

avfilter/vf_minterpolate: do not right shift negative numbers

It was source of crashes. Use division instead.

Original patch by author. Log message by comitter.

Davinder Singh authored on 2016/08/30 00:04:54
Showing 1 changed files
... ...
@@ -936,8 +936,8 @@ static void set_frame_data(MIContext *mi_ctx, int alpha, AVFrame *avf_out)
936 936
                 for (i = 0; i < pixel->nb; i++) {
937 937
                     Frame *frame = &mi_ctx->frames[pixel->refs[i]];
938 938
                     if (chroma) {
939
-                        x_mv = (x >> mi_ctx->chroma_h_shift) + (pixel->mvs[i][0] >> mi_ctx->chroma_h_shift);
940
-                        y_mv = (y >> mi_ctx->chroma_v_shift) + (pixel->mvs[i][1] >> mi_ctx->chroma_v_shift);
939
+                        x_mv = (x >> mi_ctx->chroma_h_shift) + (pixel->mvs[i][0] / (1 << mi_ctx->chroma_h_shift));
940
+                        y_mv = (y >> mi_ctx->chroma_v_shift) + (pixel->mvs[i][1] / (1 << mi_ctx->chroma_v_shift));
941 941
                     } else {
942 942
                         x_mv = x + pixel->mvs[i][0];
943 943
                         y_mv = y + pixel->mvs[i][1];