Mercurial > libavcodec.hg
changeset 4072:db5d1a289b56 libavcodec
common subexpression elimination
author | michael |
---|---|
date | Tue, 24 Oct 2006 08:52:51 +0000 |
parents | 00ad06966bff |
children | ce2ce063481c |
files | jpeg_ls.c |
diffstat | 1 files changed, 14 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/jpeg_ls.c Tue Oct 24 08:33:44 2006 +0000 +++ b/jpeg_ls.c Tue Oct 24 08:52:51 2006 +0000 @@ -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); - } + } + 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; - } + 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; } }