[Ffmpeg-cvslog] r6784 - trunk/libavcodec/jpeg_ls.c

michael subversion
Tue Oct 24 10:52:51 CEST 2006


Author: michael
Date: Tue Oct 24 10:52:51 2006
New Revision: 6784

Modified:
   trunk/libavcodec/jpeg_ls.c

Log:
common subexpression elimination


Modified: trunk/libavcodec/jpeg_ls.c
==============================================================================
--- trunk/libavcodec/jpeg_ls.c	(original)
+++ trunk/libavcodec/jpeg_ls.c	Tue Oct 24 10:52:51 2006
@@ -248,10 +248,9 @@
     int k, ret, temp, map;
     int Q = 365 + RItype;
 
-    if(!RItype)
-        temp = state->A[Q];
-    else
-        temp = state->A[Q] + (state->N[Q] >> 1);
+    temp=  state->A[Q];
+    if(RItype)
+        temp += state->N[Q] >> 1;
 
     for(k = 0; (state->N[Q] << k) < temp; k++);
 
@@ -355,17 +354,6 @@
                 else
                     pred = Rb + err;
             }
-
-            if(state->near){
-                if(pred < -state->near)
-                    pred += state->range * state->twonear;
-                else if(pred > state->maxval + state->near)
-                    pred -= state->range * state->twonear;
-                pred = clip(pred, 0, state->maxval);
-            }
-
-            W(dst, x, pred);
-            x += stride;
         } else { /* regular mode */
             int context, sign;
 
@@ -389,17 +377,17 @@
 
             /* we have to do something more for near-lossless coding */
             pred += err;
-            if(state->near) {
-                if(pred < -state->near)
-                    pred += state->range * state->twonear;
-                else if(pred > state->maxval + state->near)
-                    pred -= state->range * state->twonear;
-                pred = clip(pred, 0, state->maxval);
-            }
-
-            W(dst, x, pred);
-            x += stride;
         }
+        if(state->near){
+            if(pred < -state->near)
+                pred += state->range * state->twonear;
+            else if(pred > state->maxval + state->near)
+                pred -= state->range * state->twonear;
+            pred = clip(pred, 0, state->maxval);
+        }
+
+        W(dst, x, pred);
+        x += stride;
     }
 }
 
@@ -677,7 +665,6 @@
 
             if(state->run_index[comp] > 0)
                 state->run_index[comp]--;
-            x += stride;
         } else { /* regular mode */
             int context;
 
@@ -708,8 +695,8 @@
             }
 
             ls_encode_regular(state, pb, context, err);
-            x += stride;
         }
+        x += stride;
     }
 }
 




More information about the ffmpeg-cvslog mailing list