Mercurial > libavcodec.hg
diff ffv1.c @ 1361:8479b875a989 libavcodec
golomb rice code cleanup / simplify (~0.5% compression gain and slightly faster)
jpegls style golomb rice coder
author | michaelni |
---|---|
date | Sun, 13 Jul 2003 11:06:45 +0000 |
parents | 047b1dff5976 |
children | 20a79b0e6d2a |
line wrap: on
line diff
--- a/ffv1.c Sat Jul 12 22:15:11 2003 +0000 +++ b/ffv1.c Sun Jul 13 11:06:45 2003 +0000 @@ -300,6 +300,9 @@ k++; i += i; } + + assert(k<=8); + #if 0 // JPEG LS if(k==0 && 2*state->drift <= - state->count) code= v ^ (-1); else code= v; @@ -310,7 +313,7 @@ code = -2*code-1; code^= (code>>31); //printf("v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code, state->bias, state->error_sum, state->drift, state->count, k); - set_ur_golomb(pb, code, k, 8, 8); + set_ur_golomb(pb, code, k, 12, 8); update_vlc_state(state, v); } @@ -324,10 +327,12 @@ k++; i += i; } - - v= get_ur_golomb(gb, k, 8, 8); + + assert(k<=8); + + v= get_ur_golomb(gb, k, 12, 8); //printf("v:%d bias:%d error:%d drift:%d count:%d k:%d", v, state->bias, state->error_sum, state->drift, state->count, k); - + v++; if(v&1) v= (v>>1); else v= -(v>>1);