# HG changeset patch # User michael # Date 1094845255 0 # Node ID 21947e176d4d2d5020b9ac00372c08f3926866ca # Parent 9b6eb06cc184e7697ad4df3ac6732dc5b496601f get/set_sr_golomb() cleanup diff -r 9b6eb06cc184 -r 21947e176d4d ffv1.c --- a/ffv1.c Fri Sep 10 18:54:02 2004 +0000 +++ b/ffv1.c Fri Sep 10 19:40:55 2004 +0000 @@ -325,7 +325,7 @@ #endif //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_sr_golomb_ffv1(pb, code, k, 12, bits); + set_sr_golomb(pb, code, k, 12, bits); update_vlc_state(state, v); } @@ -342,7 +342,7 @@ assert(k<=8); - v= get_sr_golomb_ffv1(gb, k, 12, bits); + v= get_sr_golomb(gb, k, 12, bits); //printf("v:%d bias:%d error:%d drift:%d count:%d k:%d", v, state->bias, state->error_sum, state->drift, state->count, k); #if 0 // JPEG LS diff -r 9b6eb06cc184 -r 21947e176d4d golomb.h --- a/golomb.h Fri Sep 10 18:54:02 2004 +0000 +++ b/golomb.h Fri Sep 10 19:40:55 2004 +0000 @@ -263,7 +263,7 @@ /** * read signed golomb rice code (ffv1). */ -static inline int get_sr_golomb_ffv1(GetBitContext *gb, int k, int limit, int esc_len){ +static inline int get_sr_golomb(GetBitContext *gb, int k, int limit, int esc_len){ int v= get_ur_golomb(gb, k, limit, esc_len); v++; @@ -272,8 +272,8 @@ // return (v>>1) ^ -(v&1); } + /** - * read signed golomb rice code (flac). */ static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len){ @@ -281,17 +281,6 @@ return (v>>1) ^ -(v&1); } -/** - * read signed golomb rice code (sonic). - */ -static inline int get_sr_golomb_sonic(GetBitContext *gb, int k, int limit, int esc_len){ - int v= get_ur_golomb(gb, k, limit, esc_len); - - v++; - if (v&1) return -(v>>1); - else return v>>1; -} - #ifdef TRACE static inline int get_ue(GetBitContext *s, char *file, char *func, int line){ @@ -432,7 +421,7 @@ /** * write signed golomb rice code (ffv1). */ -static inline void set_sr_golomb_ffv1(PutBitContext *pb, int i, int k, int limit, int esc_len){ +static inline void set_sr_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len){ int v; v = -2*i-1; @@ -452,15 +441,3 @@ set_ur_golomb_jpegls(pb, v, k, limit, esc_len); } - -/** - * write signed golomb rice code (sonic). - */ -static inline void set_sr_golomb_sonic(PutBitContext *pb, int i, int k, int limit, int esc_len){ - int v; - - v = 2*i-1; - if (v<0) v ^= -1; - - set_ur_golomb(pb, v, k, limit, esc_len); -}