[FFmpeg-cvslog] ttadec: use branchless unsigned-to-signed unfolding

Justin Ruggles git at videolan.org
Sat Feb 18 02:34:01 CET 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Thu Feb 16 21:51:03 2012 -0500| [f2a4559c77ebce36b575e75fad102d2e9f02bb5a] | committer: Justin Ruggles

ttadec: use branchless unsigned-to-signed unfolding

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

 libavcodec/tta.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index db9c1b2..6f4d161 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -396,8 +396,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
         }
 
         // extract coded value
-#define UNFOLD(x) (((x)&1) ? (++(x)>>1) : (-(x)>>1))
-        *p = UNFOLD(value);
+        *p = 1 + ((value >> 1) ^ ((value & 1) - 1));
 
         // run hybrid filter
         ttafilter_process(filter, p);



More information about the ffmpeg-cvslog mailing list