Browse code

jpegls: cosmetics: Drop some unnecessary parentheses

Diego Biurrun authored on 2013/05/16 02:55:09
Showing 3 changed files
... ...
@@ -31,7 +31,7 @@ void ff_jpegls_init_state(JLSState *state){
31 31
     int i;
32 32
 
33 33
     state->twonear = state->near * 2 + 1;
34
-    state->range = ((state->maxval + state->twonear - 1) / state->twonear) + 1;
34
+    state->range   = (state->maxval + state->twonear - 1) / state->twonear + 1;
35 35
 
36 36
     // QBPP = ceil(log2(RANGE))
37 37
     for(state->qbpp = 0; (1 << state->qbpp) < state->range; state->qbpp++);
... ...
@@ -39,10 +39,10 @@ void ff_jpegls_init_state(JLSState *state){
39 39
     if(state->bpp < 8)
40 40
         state->limit = 16 + 2 * state->bpp - state->qbpp;
41 41
     else
42
-        state->limit = (4 * state->bpp) - state->qbpp;
42
+        state->limit = 4 * state->bpp - state->qbpp;
43 43
 
44 44
     for(i = 0; i < 367; i++) {
45
-        state->A[i] = FFMAX((state->range + 32) >> 6, 2);
45
+        state->A[i] = FFMAX(state->range + 32 >> 6, 2);
46 46
         state->N[i] = 1;
47 47
     }
48 48
 
... ...
@@ -65,7 +65,7 @@ void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all){
65 65
     if(s->maxval==0 || reset_all) s->maxval= (1 << s->bpp) - 1;
66 66
 
67 67
     if(s->maxval >=128){
68
-        factor= (FFMIN(s->maxval, 4095) + 128)>>8;
68
+        factor = FFMIN(s->maxval, 4095) + 128 >> 8;
69 69
 
70 70
         if(s->T1==0     || reset_all)
71 71
             s->T1= iso_clip(factor*(basic_t1-2) + 2 + 3*s->near, s->near+1, s->maxval);
... ...
@@ -98,7 +98,7 @@ static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
98 98
 
99 99
     /* decode mapped error */
100 100
     if(ret & 1)
101
-        ret = -((ret + 1) >> 1);
101
+        ret = -(ret + 1 >> 1);
102 102
     else
103 103
         ret >>= 1;
104 104
 
... ...
@@ -136,7 +136,7 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RI
136 136
     ret += RItype + map;
137 137
 
138 138
     if(ret & 1){
139
-        ret = map - ((ret + 1) >> 1);
139
+        ret = map - (ret + 1 >> 1);
140 140
         state->B[Q]++;
141 141
     } else {
142 142
         ret = ret >> 1;
... ...
@@ -186,7 +186,7 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *
186 186
                     x += stride;
187 187
                 }
188 188
                 /* if EOL reached, we stop decoding */
189
-                if(r != (1 << ff_log2_run[state->run_index[comp]]))
189
+                if (r != 1 << ff_log2_run[state->run_index[comp]])
190 190
                     return;
191 191
                 if(state->run_index[comp] < 31)
192 192
                     state->run_index[comp]++;
... ...
@@ -48,7 +48,7 @@ static inline void ls_encode_regular(JLSState *state, PutBitContext *pb, int Q,
48 48
 
49 49
     if(err < 0)
50 50
         err += state->range;
51
-    if(err >= ((state->range + 1) >> 1)) {
51
+    if (err >= (state->range + 1 >> 1)) {
52 52
         err -= state->range;
53 53
         val = 2 * FFABS(err) - 1 - map;
54 54
     } else
... ...
@@ -144,7 +144,7 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, void *last
144 144
             if(x >= w)
145 145
                 return;
146 146
             Rb = R(last, x);
147
-            RItype = (FFABS(Ra - Rb) <= state->near);
147
+            RItype = FFABS(Ra - Rb) <= state->near;
148 148
             pred = RItype ? Ra : Rb;
149 149
             err = R(cur, x) - pred;
150 150
 
... ...
@@ -165,7 +165,7 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, void *last
165 165
             }
166 166
             if(err < 0)
167 167
                 err += state->range;
168
-            if(err >= ((state->range + 1) >> 1))
168
+            if (err >= state->range + 1 >> 1)
169 169
                 err -= state->range;
170 170
 
171 171
             ls_encode_runterm(state, pb, RItype, err, ff_log2_run[state->run_index[comp]]);