[FFmpeg-cvslog] bitstream: add get_bits_longlong() to support more than 32bits

Michael Niedermayer git at videolan.org
Sun Sep 30 15:26:13 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Sep 30 02:39:55 2012 +0200| [f51c4bfe3f34c8ff33a2b9d93e42745119c396a3] | committer: Michael Niedermayer

bitstream: add get_bits_longlong() to support more than 32bits

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/get_bits.h |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 0aabca2..05ac8f7 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -316,6 +316,24 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n)
 }
 
 /**
+ * Read 0-64 bits.
+ */
+static inline uint64_t get_bits_longlong(GetBitContext *s, int n)
+{
+    if (n <= 32)
+        return get_bits_long(s, n);
+    else {
+#ifdef BITSTREAM_READER_LE
+        uint64_t ret = get_bits_long(s, 32);
+        return ret | (((uint64_t)get_bits_long(s, n-32)) << 32);
+#else
+        uint64_t ret = ((uint64_t)get_bits_long(s, 32)) << (n-32);
+        return ret | get_bits_long(s, n-32);
+#endif
+    }
+}
+
+/**
  * Read 0-32 bits as a signed integer.
  */
 static inline int get_sbits_long(GetBitContext *s, int n)



More information about the ffmpeg-cvslog mailing list