changeset 9546:54ddf2b7d4bd libavcodec

Optimize sign handling in get_symbol().
author michael
date Fri, 24 Apr 2009 00:26:49 +0000
parents 59073f92f0e2
children df1827eb3aaa
files ffv1.c snow.c
diffstat 2 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ffv1.c	Thu Apr 23 23:14:26 2009 +0000
+++ b/ffv1.c	Fri Apr 24 00:26:49 2009 +0000
@@ -258,10 +258,8 @@
             a += a + get_rac(c, state+22 + i); //22..31
         }
 
-        if(is_signed && get_rac(c, state+11 + e)) //11..21
-            return -a;
-        else
-            return a;
+        e= -(is_signed && get_rac(c, state+11 + e)); //11..21
+        return (a^e)-e;
     }
 }
 
--- a/snow.c	Thu Apr 23 23:14:26 2009 +0000
+++ b/snow.c	Fri Apr 24 00:26:49 2009 +0000
@@ -665,10 +665,8 @@
             a += a + get_rac(c, state+22 + FFMIN(i,9)); //22..31
         }
 
-        if(is_signed && get_rac(c, state+11 + FFMIN(e,10))) //11..21
-            return -a;
-        else
-            return a;
+        e= -(is_signed && get_rac(c, state+11 + FFMIN(e,10))); //11..21
+        return (a^e)-e;
     }
 }