diff mbox

[FFmpeg-devel,1/2] avcodec/ffv1: Simplify fold()

Message ID 20190127004414.12662-1-michael@niedermayer.cc
State Accepted
Commit 5d0139d5f0aa9fc16661891e40efdb2671ff1726
Headers show

Commit Message

Michael Niedermayer Jan. 27, 2019, 12:44 a.m. UTC
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 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Michael Niedermayer Jan. 31, 2019, 4:03 p.m. UTC | #1
On Sun, Jan 27, 2019 at 01:44:13AM +0100, Michael Niedermayer wrote:
> 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 | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

will apply patchset

[...]
diff mbox

Patch

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;