aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ffv1.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-07-13 11:06:45 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-07-13 11:06:45 +0000
commitd9e6a6c629c073e3432e76a320245ce3616b4f3f (patch)
treeb0857112369a3d5e112f12c5fcfe427108df720d /libavcodec/ffv1.c
parent25bd2349ed9f0ac8fce4d8233acb27c52f520d45 (diff)
downloadffmpeg-d9e6a6c629c073e3432e76a320245ce3616b4f3f.tar.gz
golomb rice code cleanup / simplify (~0.5% compression gain and slightly faster)
jpegls style golomb rice coder Originally committed as revision 2040 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ffv1.c')
-rw-r--r--libavcodec/ffv1.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index a2c4dffaa1..a9bdf0c3ef 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -300,6 +300,9 @@ static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int
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 @@ static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int
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 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state){
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);