changeset 4077:fc1235327725 libavcodec

simplify
author michael
date Tue, 24 Oct 2006 10:33:40 +0000
parents aeb514c163ad
children 6a10cc9adb8a
files jpeg_ls.c
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/jpeg_ls.c	Tue Oct 24 10:13:26 2006 +0000
+++ b/jpeg_ls.c	Tue Oct 24 10:33:40 2006 +0000
@@ -204,17 +204,13 @@
     downscale_state(state, Q);
 
     if(state->B[Q] <= -state->N[Q]) {
-        state->B[Q] += state->N[Q];
+        state->B[Q]= FFMAX(state->B[Q] + state->N[Q], 1-state->N[Q]);
         if(state->C[Q] > -128)
             state->C[Q]--;
-        if(state->B[Q] <= -state->N[Q])
-            state->B[Q] = -state->N[Q] + 1;
     }else if(state->B[Q] > 0){
-        state->B[Q] -= state->N[Q];
+        state->B[Q]= FFMIN(state->B[Q] - state->N[Q], 0);
         if(state->C[Q] < 127)
             state->C[Q]++;
-        if(state->B[Q] > 0)
-            state->B[Q] = 0;
     }
 
     return err;