aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-04-24 00:26:49 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-04-24 00:26:49 +0000
commit3788e661f1e50558b92544c8e2d373aa553e9124 (patch)
treee7e52d96ad5b5749004957c05d02748ece039e5f
parenta39b76ea7d98c63b83584ff761977cf41b61b314 (diff)
downloadffmpeg-3788e661f1e50558b92544c8e2d373aa553e9124.tar.gz
Optimize sign handling in get_symbol().
Originally committed as revision 18672 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/ffv1.c6
-rw-r--r--libavcodec/snow.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 9eef531d59..62b12ede16 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -258,10 +258,8 @@ static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){
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;
}
}
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 5d9577bc03..995c1a2024 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -665,10 +665,8 @@ static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){
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;
}
}