aboutsummaryrefslogtreecommitdiff
path: root/image/codecs/indeo4.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-05 13:34:33 -0400
committerPaul Gilbert2016-09-10 10:07:53 -0400
commit73e79031865a71dd5ced18fe3269f79ceba6e08c (patch)
treefd0a7a29904346f95daf913a8efdb8a58eb3d296 /image/codecs/indeo4.cpp
parentd3d0819b00c0dddcb35d99561c2eeadf04791190 (diff)
downloadscummvm-rg350-73e79031865a71dd5ced18fe3269f79ceba6e08c.tar.gz
scummvm-rg350-73e79031865a71dd5ced18fe3269f79ceba6e08c.tar.bz2
scummvm-rg350-73e79031865a71dd5ced18fe3269f79ceba6e08c.zip
IMAGE: Beginning of Indeo 4 decoder, added GetBits class for reading bits
Diffstat (limited to 'image/codecs/indeo4.cpp')
-rw-r--r--image/codecs/indeo4.cpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/image/codecs/indeo4.cpp b/image/codecs/indeo4.cpp
new file mode 100644
index 0000000000..465e3adc49
--- /dev/null
+++ b/image/codecs/indeo4.cpp
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+
+/* Intel Indeo 4 decompressor, derived from ffmpeg.
+ *
+ * Original copyright note: * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg
+ * written, produced, and directed by Alan Smithee
+ */
+
+#include "common/system.h"
+#include "common/endian.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+
+#include "graphics/yuv_to_rgb.h"
+
+#include "image/codecs/indeo4.h"
+#include "image/codecs/indeo/get_bits.h"
+
+namespace Image {
+
+Indeo4Decoder::Indeo4Decoder(uint16 width, uint16 height) {
+ _pixelFormat = g_system->getScreenFormat();
+ _surface = new Graphics::ManagedSurface();
+ _surface->create(width, height, _pixelFormat);
+
+}
+
+Indeo4Decoder::~Indeo4Decoder() {
+ delete _surface;
+}
+
+bool Indeo4Decoder::isIndeo4(Common::SeekableReadStream &stream) {
+ // Less than 16 bytes? This can't be right
+ if (stream.size() < 16)
+ return false;
+
+ // Read in the start of the data
+ byte buffer[16];
+ stream.read(buffer, 16);
+ stream.seek(-16, SEEK_CUR);
+
+ // Validate the first 18-bit word has the correct identifier
+ Indeo::GetBits gb(buffer, 16 * 8);
+ bool isIndeo4 = gb.getBits(18) == 0x3FFF8;
+
+ return isIndeo4;
+}
+
+const Graphics::Surface *Indeo4Decoder::decodeFrame(Common::SeekableReadStream &stream) {
+ // Not Indeo 4? Fail
+ if (!isIndeo4(stream))
+ return 0;
+
+ // TODO
+ return nullptr;
+}
+
+} // End of namespace Image