From edfdbb9dd749cde96c1e155a1e5e5e00856adcc1 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 24 Jul 2017 22:16:53 +0200 Subject: [PATCH] IMAGE: Use new BitStreamMemory class for indeo --- image/codecs/indeo/get_bits.h | 5 ++--- image/codecs/indeo4.cpp | 4 ++-- image/codecs/indeo5.cpp | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/image/codecs/indeo/get_bits.h b/image/codecs/indeo/get_bits.h index c2d593bfb5d..f972e68ae03 100644 --- a/image/codecs/indeo/get_bits.h +++ b/image/codecs/indeo/get_bits.h @@ -31,15 +31,14 @@ namespace Indeo { /** * Intel Indeo Bitstream reader */ -class GetBits : public Common::BitStream8LSB { +class GetBits : public Common::BitStreamMemory8LSB { public: /** * Constructor * @param stream Source stream to reader from * @param disposeAfterUse Whether to destroy stream in destructor */ - GetBits(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse - = DisposeAfterUse::YES) : Common::BitStream8LSB(stream, disposeAfterUse) {} + GetBits(const uint8 *ptr, uint32 size) : Common::BitStreamMemory8LSB(new Common::BitStreamMemoryStream(ptr, size), DisposeAfterUse::YES) {} /** * The number of bits left diff --git a/image/codecs/indeo4.cpp b/image/codecs/indeo4.cpp index 4658068b278..ead1d3a8147 100644 --- a/image/codecs/indeo4.cpp +++ b/image/codecs/indeo4.cpp @@ -56,7 +56,7 @@ bool Indeo4Decoder::isIndeo4(Common::SeekableReadStream &stream) { stream.seek(-16, SEEK_CUR); // 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; return isIndeo4; @@ -74,7 +74,7 @@ const Graphics::Surface *Indeo4Decoder::decodeFrame(Common::SeekableReadStream & _ctx._frameSize = stream.size(); // 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 int err = decodeIndeoFrame(); diff --git a/image/codecs/indeo5.cpp b/image/codecs/indeo5.cpp index 858c634704b..c4e98d4ac7b 100644 --- a/image/codecs/indeo5.cpp +++ b/image/codecs/indeo5.cpp @@ -67,7 +67,7 @@ bool Indeo5Decoder::isIndeo5(Common::SeekableReadStream &stream) { stream.seek(-16, SEEK_CUR); // 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; return isIndeo5; @@ -85,7 +85,7 @@ const Graphics::Surface *Indeo5Decoder::decodeFrame(Common::SeekableReadStream & _ctx._frameSize = stream.size(); // 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 int err = decodeIndeoFrame();