[FFmpeg-cvslog] lavc/golobm: Add set_ue_golomb_long to support up to 2^32 -2.

Jun Zhao git at videolan.org
Sat Jun 24 23:18:44 EEST 2017


ffmpeg | branch: master | Jun Zhao <jun.zhao at intel.com> | Wed Jun 14 10:35:20 2017 +0800| [e61abe2d73297e0b6dc1e179b717afc00c32af98] | committer: Michael Niedermayer

lavc/golobm: Add set_ue_golomb_long to support up to 2^32 -2.

add set_ue_golomb_long to support up to 2^32-2.

Reviewed-by: Mark Thompson <sw at jkqxz.net>
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Jun Zhao <jun.zhao at intel.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e61abe2d73297e0b6dc1e179b717afc00c32af98
---

 libavcodec/golomb.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 1e834f9327..efb1eff8aa 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -474,6 +474,21 @@ static inline void set_ue_golomb(PutBitContext *pb, int i)
 }
 
 /**
+ * write unsigned exp golomb code. 2^32-2 at most.
+ */
+static inline void set_ue_golomb_long(PutBitContext *pb, uint32_t i)
+{
+    av_assert2(i <= (UINT32_MAX - 1));
+
+    if (i < 256)
+        put_bits(pb, ff_ue_golomb_len[i], i + 1);
+    else {
+        int e = av_log2(i + 1);
+        put_bits64(pb, 2 * e + 1, i + 1);
+    }
+}
+
+/**
  * write truncated unsigned exp golomb code.
  */
 static inline void set_te_golomb(PutBitContext *pb, int i, int range)



More information about the ffmpeg-cvslog mailing list