]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vc1dsp.c
avcodec: postpone removal of deprecated codec caps
[ffmpeg] / libavcodec / vc1dsp.c
index 9239a4a1f5bf47f0ba2d555592238b5aac16dc0a..c25a6f3adf8c657c64b7c869951d0c85fd7a2231 100644 (file)
@@ -95,10 +95,10 @@ static void vc1_v_s_overlap_c(int16_t *top, int16_t *bottom)
         d1 = a - d;
         d2 = a - d + b - c;
 
-        top[48]   = ((a << 3) - d1 + rnd1) >> 3;
-        top[56]   = ((b << 3) - d2 + rnd2) >> 3;
-        bottom[0] = ((c << 3) + d2 + rnd1) >> 3;
-        bottom[8] = ((d << 3) + d1 + rnd2) >> 3;
+        top[48]   = ((a * 8) - d1 + rnd1) >> 3;
+        top[56]   = ((b * 8) - d2 + rnd2) >> 3;
+        bottom[0] = ((c * 8) + d2 + rnd1) >> 3;
+        bottom[8] = ((d * 8) + d1 + rnd2) >> 3;
 
         bottom++;
         top++;
@@ -107,12 +107,13 @@ static void vc1_v_s_overlap_c(int16_t *top, int16_t *bottom)
     }
 }
 
-static void vc1_h_s_overlap_c(int16_t *left, int16_t *right)
+static void vc1_h_s_overlap_c(int16_t *left, int16_t *right, int left_stride, int right_stride, int flags)
 {
     int i;
     int a, b, c, d;
     int d1, d2;
-    int rnd1 = 4, rnd2 = 3;
+    int rnd1 = flags & 2 ? 3 : 4;
+    int rnd2 = 7 - rnd1;
     for (i = 0; i < 8; i++) {
         a  = left[6];
         b  = left[7];
@@ -121,15 +122,17 @@ static void vc1_h_s_overlap_c(int16_t *left, int16_t *right)
         d1 = a - d;
         d2 = a - d + b - c;
 
-        left[6]  = ((a << 3) - d1 + rnd1) >> 3;
-        left[7]  = ((b << 3) - d2 + rnd2) >> 3;
-        right[0] = ((c << 3) + d2 + rnd1) >> 3;
-        right[1] = ((d << 3) + d1 + rnd2) >> 3;
+        left[6]  = ((a * 8) - d1 + rnd1) >> 3;
+        left[7]  = ((b * 8) - d2 + rnd2) >> 3;
+        right[0] = ((c * 8) + d2 + rnd1) >> 3;
+        right[1] = ((d * 8) + d1 + rnd2) >> 3;
 
-        right += 8;
-        left  += 8;
-        rnd2   = 7 - rnd2;
-        rnd1   = 7 - rnd1;
+        right += right_stride;
+        left  += left_stride;
+        if (flags & 1) {
+            rnd2   = 7 - rnd2;
+            rnd1   = 7 - rnd1;
+        }
     }
 }