aboutsummaryrefslogtreecommitdiff
path: root/image/codecs/indeo/get_bits.h
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-10 20:35:02 -0400
committerPaul Gilbert2016-09-10 20:35:02 -0400
commit23b1dbbb0e9c10035a1df98bffa9d6eaa5a6d338 (patch)
treefb2b3194e646bce8e7f6f966424fc217b586c502 /image/codecs/indeo/get_bits.h
parent9c6a55a2a660d2c59e9c0e22402e4d16e08ef987 (diff)
downloadscummvm-rg350-23b1dbbb0e9c10035a1df98bffa9d6eaa5a6d338.tar.gz
scummvm-rg350-23b1dbbb0e9c10035a1df98bffa9d6eaa5a6d338.tar.bz2
scummvm-rg350-23b1dbbb0e9c10035a1df98bffa9d6eaa5a6d338.zip
IMAGE: Refactored Indeo GetBits class to derive from Common::BitStream
Diffstat (limited to 'image/codecs/indeo/get_bits.h')
-rw-r--r--image/codecs/indeo/get_bits.h129
1 files changed, 9 insertions, 120 deletions
diff --git a/image/codecs/indeo/get_bits.h b/image/codecs/indeo/get_bits.h
index 986bfc8a99..359d8fcab0 100644
--- a/image/codecs/indeo/get_bits.h
+++ b/image/codecs/indeo/get_bits.h
@@ -20,152 +20,41 @@
*
*/
-#include "common/scummsys.h"
-
-/* Indeo 4 & 5 bitstream reader
- *
- * Original copyright note:
- * Copyright (c) 2004 Michael Niedermayer
- */
-
#ifndef IMAGE_CODECS_INDEO_GET_BITS_H
#define IMAGE_CODECS_INDEO_GET_BITS_H
-#include "common/scummsys.h"
-#include "common/stream.h"
-#include "common/types.h"
+#include "common/bitstream.h"
namespace Image {
namespace Indeo {
-#define AV_INPUT_BUFFER_PADDING_SIZE 32
-
/**
* Intel Indeo Bitstream reader
*/
-class GetBits {
-private:
- const byte *_buffer;
- uint _index;
- uint _sizeInBits;
- uint _sizeInBitsPlus8;
+class GetBits : public Common::BitStream8LSB {
public:
/**
* Constructor
- * @param buffer Bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes
- * larger than the actual read bits because some optimized bitstream
- * readers read 32 or 64 bit at once and could read over the end
- * @param bit_size the size of the buffer in bits
- * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
+ * @param stream Source stream to reader from
+ * @param disposeAfterUse Whether to destroy stream in destructor
*/
- GetBits(const byte *buffer, size_t totalBits);
-
- /**
- * Copy constructor
- */
- GetBits(const GetBits &src);
-
- /**
- * Returns the number of bits read
- */
- uint getBitsCount() const { return _index; }
+ GetBits(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse
+ = DisposeAfterUse::YES) : Common::BitStream8LSB(stream, disposeAfterUse) {}
/**
* The number of bits left
*/
- int getBitsLeft() const { return _sizeInBits - _index; }
-
- void skipBitsLong(uint n) { _index += n; }
-
- /**
- * Read MPEG-1 dc-style VLC (sign bit + mantissa with no MSB).
- * if MSB not set it is negative
- * @param n length in bits
- */
- int getXbits(int n);
-
- /**
- * Returns the next n bits, and does sign extension
- */
- int getSbits(int n);
-
- /**
- * Read 1-25 bits.
- */
- uint getBits(int n);
-
- /**
- * Read 0-25 bits.
- */
- int getBitsZ(int n);
-
- uint getBitsLE(int n);
-
- /**
- * Show 1-25 bits.
- * Returns the data without updating the index
- */
- uint showBits(int n);
-
- /**
- * Skips a specified number of bits
- */
- void skipBits(int n);
-
- /**
- * Returns the next bit
- */
- uint getBits1();
-
- /**
- * Shows the next following bit
- */
- uint showBits1();
-
- /**
- * Skips the next bit
- */
- void skipBits1();
-
- /**
- * Read 0-32 bits.
- */
- uint getBitsLong(int n);
-
- /**
- * Read 0-64 bits.
- */
- uint64 getBits64(int n);
-
- /**
- * Read 0-32 bits as a signed integer.
- */
- int getSbitsLong(int n);
-
- /**
- * Show 0-32 bits.
- */
- uint showBitsLong(int n);
-
- int checkMarker(void *logctx, const char *msg);
+ int getBitsLeft() const { return size() - pos(); }
/**
* Parse a VLC code.
* @param bits is the number of bits which will be read at once, must be
- * identical to nb_bits in init_vlc()
- * @param max_depth is the number of times bits bits must be read to completely
+ * identical to nbBits in init_vlc()
+ * @param maxDepth is the number of times bits bits must be read to completely
* read the longest vlc code
* = (max_vlc_length + bits - 1) / bits
*/
int getVLC2(int16 (*table)[2], int bits, int maxDepth);
-
- int decode012();
-
- int decode210();
-
- int skip1stop8dataBits();
-
- const byte *alignGetBits();
};
} // End of namespace Indeo