Skip to content

Commit

Permalink
IMAGE: Move video codecs to image/
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hoops committed Feb 28, 2014
1 parent 740b6e8 commit b568ac7
Show file tree
Hide file tree
Showing 38 changed files with 201 additions and 196 deletions.
6 changes: 3 additions & 3 deletions video/codecs/cdtoons.cpp → image/codecs/cdtoons.cpp
Expand Up @@ -20,13 +20,13 @@
*
*/

#include "video/codecs/cdtoons.h"
#include "image/codecs/cdtoons.h"
#include "common/rect.h"
#include "common/stream.h"
#include "common/textconsole.h"
#include "common/array.h"

namespace Video {
namespace Image {

struct CDToonsAction {
uint16 blockId;
Expand Down Expand Up @@ -445,4 +445,4 @@ void CDToonsDecoder::setPalette(byte *data) {
_palette[0] = _palette[1] = _palette[2] = 0;
}

} // End of namespace Video
} // End of namespace Image
10 changes: 5 additions & 5 deletions video/codecs/cdtoons.h → image/codecs/cdtoons.h
Expand Up @@ -20,14 +20,14 @@
*
*/

#ifndef VIDEO_CODECS_CDTOONS_H
#define VIDEO_CODECS_CDTOONS_H
#ifndef IMAGE_CODECS_CDTOONS_H
#define IMAGE_CODECS_CDTOONS_H

#include "video/codecs/codec.h"
#include "image/codecs/codec.h"

#include "common/hashmap.h"

namespace Video {
namespace Image {

struct CDToonsBlock {
uint16 flags;
Expand Down Expand Up @@ -67,6 +67,6 @@ class CDToonsDecoder : public Codec {
void setPalette(byte *data);
};

} // End of namespace Video
} // End of namespace Image

#endif
6 changes: 3 additions & 3 deletions video/codecs/cinepak.cpp → image/codecs/cinepak.cpp
Expand Up @@ -20,7 +20,7 @@
*
*/

#include "video/codecs/cinepak.h"
#include "image/codecs/cinepak.h"

#include "common/debug.h"
#include "common/stream.h"
Expand All @@ -32,7 +32,7 @@

// Code here partially based off of ffmpeg ;)

namespace Video {
namespace Image {

#define PUT_PIXEL(offset, lum, u, v) \
if (_pixelFormat.bytesPerPixel != 1) { \
Expand Down Expand Up @@ -306,4 +306,4 @@ void CinepakDecoder::decodeVectors(Common::SeekableReadStream *stream, uint16 st
}
}

} // End of namespace Video
} // End of namespace Image
10 changes: 5 additions & 5 deletions video/codecs/cinepak.h → image/codecs/cinepak.h
Expand Up @@ -20,20 +20,20 @@
*
*/

#ifndef VIDEO_CODECS_CINEPAK_H
#define VIDEO_CODECS_CINEPAK_H
#ifndef IMAGE_CODECS_CINEPAK_H
#define IMAGE_CODECS_CINEPAK_H

#include "common/scummsys.h"
#include "common/rect.h"
#include "graphics/pixelformat.h"

#include "video/codecs/codec.h"
#include "image/codecs/codec.h"

namespace Common {
class SeekableReadStream;
}

namespace Video {
namespace Image {

struct CinepakCodebook {
// These are not in the normal YUV colorspace, but in the Cinepak YUV colorspace instead.
Expand Down Expand Up @@ -84,6 +84,6 @@ class CinepakDecoder : public Codec {
void decodeVectors(Common::SeekableReadStream *stream, uint16 strip, byte chunkID, uint32 chunkSize);
};

} // End of namespace Video
} // End of namespace Image

#endif
8 changes: 4 additions & 4 deletions video/codecs/codec.h → image/codecs/codec.h
Expand Up @@ -20,8 +20,8 @@
*
*/

#ifndef VIDEO_CODECS_CODEC_H
#define VIDEO_CODECS_CODEC_H
#ifndef IMAGE_CODECS_CODEC_H
#define IMAGE_CODECS_CODEC_H

#include "graphics/surface.h"
#include "graphics/pixelformat.h"
Expand All @@ -30,7 +30,7 @@ namespace Common {
class SeekableReadStream;
}

namespace Video {
namespace Image {

/**
* An abstract representation of a video codec used for decoding
Expand Down Expand Up @@ -77,6 +77,6 @@ class Codec {
virtual bool hasDirtyPalette() const { return false; }
};

} // End of namespace Video
} // End of namespace Image

#endif
6 changes: 3 additions & 3 deletions video/codecs/indeo3.cpp → image/codecs/indeo3.cpp
Expand Up @@ -36,9 +36,9 @@

#include "graphics/yuv_to_rgb.h"

#include "video/codecs/indeo3.h"
#include "image/codecs/indeo3.h"

namespace Video {
namespace Image {

Indeo3Decoder::Indeo3Decoder(uint16 width, uint16 height) : _ModPred(0), _corrector_type(0) {
_iv_frame[0].the_buf = 0;
Expand Down Expand Up @@ -3484,4 +3484,4 @@ const uint32 Indeo3Decoder::correctionhighorder[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
};

} // End of namespace Video
} // End of namespace Image
12 changes: 6 additions & 6 deletions video/codecs/indeo3.h → image/codecs/indeo3.h
Expand Up @@ -29,12 +29,12 @@
* written, produced, and directed by Alan Smithee
*/

#ifndef VIDEO_CODECS_INDEO3_H
#define VIDEO_CODECS_INDEO3_H
#ifndef IMAGE_CODECS_INDEO3_H
#define IMAGE_CODECS_INDEO3_H

#include "video/codecs/codec.h"
#include "image/codecs/codec.h"

namespace Video {
namespace Image {

/**
* Intel Indeo 3 decoder.
Expand Down Expand Up @@ -89,6 +89,6 @@ class Indeo3Decoder : public Codec {
const byte *buf2, int min_width_160);
};

} // End of namespace Video
} // End of namespace Image

#endif // VIDEO_CODECS_INDEO3_H
#endif
14 changes: 7 additions & 7 deletions video/codecs/jpeg.cpp → image/codecs/jpeg.cpp
Expand Up @@ -25,28 +25,28 @@
#include "graphics/surface.h"
#include "image/jpeg.h"

#include "video/codecs/jpeg.h"
#include "image/codecs/jpeg.h"

namespace Common {
class SeekableReadStream;
}

namespace Video {
namespace Image {

JPEGDecoder::JPEGDecoder() : Codec() {
JPEGCodec::JPEGCodec() : Codec() {
_pixelFormat = g_system->getScreenFormat();
_surface = NULL;
}

JPEGDecoder::~JPEGDecoder() {
JPEGCodec::~JPEGCodec() {
if (_surface) {
_surface->free();
delete _surface;
}
}

const Graphics::Surface *JPEGDecoder::decodeImage(Common::SeekableReadStream *stream) {
Image::JPEGDecoder jpeg;
const Graphics::Surface *JPEGCodec::decodeImage(Common::SeekableReadStream *stream) {
JPEGDecoder jpeg;

if (!jpeg.loadStream(*stream)) {
warning("Failed to decode JPEG frame");
Expand All @@ -63,4 +63,4 @@ const Graphics::Surface *JPEGDecoder::decodeImage(Common::SeekableReadStream *st
return _surface;
}

} // End of namespace Video
} // End of namespace Image
16 changes: 8 additions & 8 deletions video/codecs/jpeg.h → image/codecs/jpeg.h
Expand Up @@ -20,10 +20,10 @@
*
*/

#ifndef VIDEO_CODECS_JPEG_H
#define VIDEO_CODECS_JPEG_H
#ifndef IMAGE_CODECS_JPEG_H
#define IMAGE_CODECS_JPEG_H

#include "video/codecs/codec.h"
#include "image/codecs/codec.h"
#include "graphics/pixelformat.h"

namespace Common {
Expand All @@ -34,18 +34,18 @@ namespace Graphics {
struct Surface;
}

namespace Video {
namespace Image {

/**
* JPEG decoder.
*
* Used in video:
* - QuickTimeDecoder
*/
class JPEGDecoder : public Codec {
class JPEGCodec : public Codec {
public:
JPEGDecoder();
~JPEGDecoder();
JPEGCodec();
~JPEGCodec();

const Graphics::Surface *decodeImage(Common::SeekableReadStream *stream);
Graphics::PixelFormat getPixelFormat() const { return _pixelFormat; }
Expand All @@ -55,6 +55,6 @@ class JPEGDecoder : public Codec {
Graphics::Surface *_surface;
};

} // End of namespace Video
} // End of namespace Image

#endif
8 changes: 4 additions & 4 deletions video/codecs/mjpeg.cpp → image/codecs/mjpeg.cpp
Expand Up @@ -31,13 +31,13 @@
#include "graphics/surface.h"
#include "image/jpeg.h"

#include "video/codecs/mjpeg.h"
#include "image/codecs/mjpeg.h"

namespace Common {
class SeekableReadStream;
}

namespace Video {
namespace Image {

MJPEGDecoder::MJPEGDecoder() : Codec() {
_pixelFormat = g_system->getScreenFormat();
Expand Down Expand Up @@ -197,7 +197,7 @@ const Graphics::Surface *MJPEGDecoder::decodeImage(Common::SeekableReadStream *s
stream->read(data + dataOffset, stream->size() - inputSkip);

Common::MemoryReadStream convertedStream(data, outputSize, DisposeAfterUse::YES);
Image::JPEGDecoder jpeg;
JPEGDecoder jpeg;

if (!jpeg.loadStream(convertedStream)) {
warning("Failed to decode MJPEG frame");
Expand All @@ -214,4 +214,4 @@ const Graphics::Surface *MJPEGDecoder::decodeImage(Common::SeekableReadStream *s
return _surface;
}

} // End of namespace Video
} // End of namespace Image
10 changes: 5 additions & 5 deletions video/codecs/mjpeg.h → image/codecs/mjpeg.h
Expand Up @@ -20,10 +20,10 @@
*
*/

#ifndef VIDEO_CODECS_MJPEG_H
#define VIDEO_CODECS_MJPEG_H
#ifndef IMAGE_CODECS_MJPEG_H
#define IMAGE_CODECS_MJPEG_H

#include "video/codecs/codec.h"
#include "image/codecs/codec.h"
#include "graphics/pixelformat.h"

namespace Common {
Expand All @@ -34,7 +34,7 @@ namespace Graphics {
struct Surface;
}

namespace Video {
namespace Image {

/**
* Motion JPEG decoder.
Expand All @@ -55,6 +55,6 @@ class MJPEGDecoder : public Codec {
Graphics::Surface *_surface;
};

} // End of namespace Video
} // End of namespace Image

#endif
6 changes: 3 additions & 3 deletions video/codecs/mpeg.cpp → image/codecs/mpeg.cpp
Expand Up @@ -27,9 +27,9 @@
#include "graphics/surface.h"
#include "graphics/yuv_to_rgb.h"

#include "video/codecs/mpeg.h"
#include "image/codecs/mpeg.h"

namespace Video {
namespace Image {

MPEGDecoder::MPEGDecoder() : Codec() {
_pixelFormat = g_system->getScreenFormat();
Expand Down Expand Up @@ -104,4 +104,4 @@ bool MPEGDecoder::decodePacket(Common::SeekableReadStream *packet, uint32 &frame
return foundFrame;
}

} // End of namespace Video
} // End of namespace Image
12 changes: 6 additions & 6 deletions video/codecs/mpeg.h → image/codecs/mpeg.h
Expand Up @@ -22,10 +22,10 @@

#ifdef USE_MPEG2

#ifndef VIDEO_CODECS_MPEG_H
#define VIDEO_CODECS_MPEG_H
#ifndef IMAGE_CODECS_MPEG_H
#define IMAGE_CODECS_MPEG_H

#include "video/codecs/codec.h"
#include "image/codecs/codec.h"
#include "graphics/pixelformat.h"

#if defined(__PLAYSTATION2__)
Expand Down Expand Up @@ -62,7 +62,7 @@ namespace Graphics {
struct Surface;
}

namespace Video {
namespace Image {

// MPEG 1/2 video decoder

Expand Down Expand Up @@ -91,8 +91,8 @@ class MPEGDecoder : public Codec {
const mpeg2_info_t *_mpegInfo;
};

} // End of namespace Video
} // End of namespace Image

#endif // VIDEO_CODECS_MPEG_H
#endif // IMAGE_CODECS_MPEG_H

#endif // USE_MPEG2
6 changes: 3 additions & 3 deletions video/codecs/msrle.cpp → image/codecs/msrle.cpp
Expand Up @@ -22,11 +22,11 @@

// Based off ffmpeg's msrledec.c

#include "video/codecs/msrle.h"
#include "image/codecs/msrle.h"
#include "common/stream.h"
#include "common/textconsole.h"

namespace Video {
namespace Image {

MSRLEDecoder::MSRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) {
_surface = new Graphics::Surface();
Expand Down Expand Up @@ -129,4 +129,4 @@ void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) {
warning("MS RLE Codec: No end-of-picture code");
}

} // End of namespace Video
} // End of namespace Image

0 comments on commit b568ac7

Please sign in to comment.