]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mobiclip.c
avformat/http: Remove deprecated "user-agent" option
[ffmpeg] / libavcodec / mobiclip.c
index 94368c20e84b5cf82802b4362b129c3633476596..bf47a5bc416c6d45147d331077862e73f0bfd6b7 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * MobiClip Video decoder
+ * Copyright (c) 2015-2016 Florian Nouwt
  * Copyright (c) 2017 Adib Surani
  * Copyright (c) 2020 Paul B Mahol
  *
@@ -544,7 +545,7 @@ static uint8_t half(int a, int b)
 
 static uint8_t half3(int a, int b, int c)
 {
-    return ((a + b + b + c) * 2 / 4 + 1) / 2;;
+    return ((a + b + b + c) * 2 / 4 + 1) / 2;
 }
 
 static uint8_t pick_above(BlockXY bxy)
@@ -848,7 +849,7 @@ static int predict_intra(AVCodecContext *avctx, AVFrame *frame, int ax, int ay,
             uint8_t *left = frame->data[plane] + ay * frame->linesize[plane] + FFMAX(ax - 1, 0);
             int bottommost = frame->data[plane][(ay + size - 1) * frame->linesize[plane] + FFMAX(ax - 1, 0)];
             int rightmost = frame->data[plane][FFMAX(ay - 1, 0) * frame->linesize[plane] + ax + size - 1];
-            int avg = (bottommost + rightmost + 1) / 2 + 2 * get_se_golomb(gb);
+            int avg = (bottommost + rightmost + 1) / 2 + 2 * av_clip(get_se_golomb(gb), -(1<<16), 1<<16);
             int r6 = adjust(avg - bottommost, size);
             int r9 = adjust(avg - rightmost, size);
             int shift = adjust(size, size) == 8 ? 3 : 2;
@@ -1091,8 +1092,8 @@ static int predict_motion(AVCodecContext *avctx,
             sidx += 6;
 
         if (index > 0) {
-            mv.x = mv.x + get_se_golomb(gb);
-            mv.y = mv.y + get_se_golomb(gb);
+            mv.x = mv.x + (unsigned)get_se_golomb(gb);
+            mv.y = mv.y + (unsigned)get_se_golomb(gb);
         }
         if (mv.x >= INT_MAX || mv.y >= INT_MAX)
             return AVERROR_INVALIDDATA;