changeset 8449:d6faaf27eacf libavcodec

Add get_ue_golomb_31()
author michael
date Tue, 23 Dec 2008 21:05:47 +0000
parents 2f25133ab807
children 95dab8ec4cd7
files golomb.h
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/golomb.h	Tue Dec 23 19:12:50 2008 +0000
+++ b/golomb.h	Tue Dec 23 21:05:47 2008 +0000
@@ -74,6 +74,23 @@
     }
 }
 
+ /**
+ * read unsigned exp golomb code, constraint to a max of 31
+ */
+static inline int get_ue_golomb_31(GetBitContext *gb){
+    unsigned int buf;
+
+    OPEN_READER(re, gb);
+    UPDATE_CACHE(re, gb);
+    buf=GET_CACHE(re, gb);
+
+    buf >>= 32 - 9;
+    LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
+    CLOSE_READER(re, gb);
+
+    return ff_ue_golomb_vlc_code[buf];
+}
+
 static inline int svq3_get_ue_golomb(GetBitContext *gb){
     uint32_t buf;