IMAGE: Use new BitStreamMemory class for indeo

This commit is contained in:
Willem Jan Palenstijn 2017-07-24 22:16:53 +02:00
parent 0c8f95603f
commit edfdbb9dd7
3 changed files with 6 additions and 7 deletions

View File

@ -31,15 +31,14 @@ namespace Indeo {
/** /**
* Intel Indeo Bitstream reader * Intel Indeo Bitstream reader
*/ */
class GetBits : public Common::BitStream8LSB { class GetBits : public Common::BitStreamMemory8LSB {
public: public:
/** /**
* Constructor * Constructor
* @param stream Source stream to reader from * @param stream Source stream to reader from
* @param disposeAfterUse Whether to destroy stream in destructor * @param disposeAfterUse Whether to destroy stream in destructor
*/ */
GetBits(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse GetBits(const uint8 *ptr, uint32 size) : Common::BitStreamMemory8LSB(new Common::BitStreamMemoryStream(ptr, size), DisposeAfterUse::YES) {}
= DisposeAfterUse::YES) : Common::BitStream8LSB(stream, disposeAfterUse) {}
/** /**
* The number of bits left * The number of bits left

View File

@ -56,7 +56,7 @@ bool Indeo4Decoder::isIndeo4(Common::SeekableReadStream &stream) {
stream.seek(-16, SEEK_CUR); stream.seek(-16, SEEK_CUR);
// Validate the first 18-bit word has the correct identifier // Validate the first 18-bit word has the correct identifier
Indeo::GetBits gb(new Common::MemoryReadStream(buffer, 16 * 8), DisposeAfterUse::YES); Indeo::GetBits gb(buffer, 16 * 8);
bool isIndeo4 = gb.getBits(18) == 0x3FFF8; bool isIndeo4 = gb.getBits(18) == 0x3FFF8;
return isIndeo4; return isIndeo4;
@ -74,7 +74,7 @@ const Graphics::Surface *Indeo4Decoder::decodeFrame(Common::SeekableReadStream &
_ctx._frameSize = stream.size(); _ctx._frameSize = stream.size();
// Set up the GetBits instance for reading the data // Set up the GetBits instance for reading the data
_ctx._gb = new GetBits(new Common::MemoryReadStream(_ctx._frameData, _ctx._frameSize)); _ctx._gb = new GetBits(_ctx._frameData, _ctx._frameSize);
// Decode the frame // Decode the frame
int err = decodeIndeoFrame(); int err = decodeIndeoFrame();

View File

@ -67,7 +67,7 @@ bool Indeo5Decoder::isIndeo5(Common::SeekableReadStream &stream) {
stream.seek(-16, SEEK_CUR); stream.seek(-16, SEEK_CUR);
// Validate the first 5-bit word has the correct identifier // Validate the first 5-bit word has the correct identifier
Indeo::GetBits gb(new Common::MemoryReadStream(buffer, 16 * 8)); Indeo::GetBits gb(buffer, 16 * 8);
bool isIndeo5 = gb.getBits(5) == 0x1F; bool isIndeo5 = gb.getBits(5) == 0x1F;
return isIndeo5; return isIndeo5;
@ -85,7 +85,7 @@ const Graphics::Surface *Indeo5Decoder::decodeFrame(Common::SeekableReadStream &
_ctx._frameSize = stream.size(); _ctx._frameSize = stream.size();
// Set up the GetBits instance for reading the data // Set up the GetBits instance for reading the data
_ctx._gb = new GetBits(new Common::MemoryReadStream(_ctx._frameData, _ctx._frameSize)); _ctx._gb = new GetBits(_ctx._frameData, _ctx._frameSize);
// Decode the frame // Decode the frame
int err = decodeIndeoFrame(); int err = decodeIndeoFrame();