avcodec/ffv1: Simplify fold()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 26 Jan 2019 23:49:14 +0000 (00:49 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 31 Jan 2019 16:17:17 +0000 (17:17 +0100)
No speed difference, or slightly faster (the difference is too small so it may be noise
that this appears faster)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ffv1.h

index 653138b..7c29d01 100644 (file)
@@ -153,9 +153,7 @@ static av_always_inline int fold(int diff, int bits)
     if (bits == 8)
         diff = (int8_t)diff;
     else {
-        diff +=  1 << (bits  - 1);
-        diff  = av_mod_uintp2(diff, bits);
-        diff -=  1 << (bits  - 1);
+        diff = sign_extend(diff, bits);
     }
 
     return diff;