aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/snow.c
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2004-09-17 23:51:36 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-09-17 23:51:36 +0000
commit7c2425d239ceac0075700df252ec561327832414 (patch)
tree0e2580c019dbab0b99ba3d589ac3eeef444e6bbd /libavcodec/snow.c
parentd925c516e4d86a9f19f719080f2942d5fe095e2a (diff)
downloadffmpeg-7c2425d239ceac0075700df252ec561327832414.tar.gz
simplify getsymbol patch by (Loren Merritt <lorenm at u dot washington dot edu>)
Originally committed as revision 3476 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/snow.c')
-rw-r--r--libavcodec/snow.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 3ae8b89750..62a7a131d2 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -507,27 +507,18 @@ static inline int get_symbol(CABACContext *c, uint8_t *state, int is_signed){
if(get_cabac(c, state+0))
return 0;
else{
- int i, e, a, el;
- //FIXME try to merge loops with FFMIN() maybe they are equally fast and they are surly cuter
- for(e=0; e<10; e++){
- if(get_cabac(c, state + 1 + e)==0) // 1..10
- break;
- }
- el= e;
-
- if(e==10){
- while(get_cabac(c, state + 1 + 9)) //10
- e++;
+ int i, e, a;
+ e= 0;
+ while(get_cabac(c, state+1 + FFMIN(e,9))){ //1..10
+ e++;
}
+
a= 1;
- for(i=e-1; i>=el; i--){
- a += a + get_cabac(c, state+22+9); //31
- }
- for(; i>=0; i--){
- a += a + get_cabac(c, state+22+i); //22..31
+ for(i=e-1; i>=0; i--){
+ a += a + get_cabac(c, state+22 + FFMIN(i,9)); //22..31
}
- if(is_signed && get_cabac(c, state+11 + el)) //11..21
+ if(is_signed && get_cabac(c, state+11 + FFMIN(e,10))) //11..21
return -a;
else
return a;