[FFmpeg-cvslog] avcodec/ffv1: Simplify fold()

Michael Niedermayer git at videolan.org
Thu Jan 31 18:18:28 EET 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Jan 27 00:49:14 2019 +0100| [5d0139d5f0aa9fc16661891e40efdb2671ff1726] | committer: Michael Niedermayer

avcodec/ffv1: Simplify fold()

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 at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d0139d5f0aa9fc16661891e40efdb2671ff1726
---

 libavcodec/ffv1.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index 653138b070..7c29d01f51 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -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;



More information about the ffmpeg-cvslog mailing list