2004-03-21 21:20:25 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2002-2006 The ScummVM project
|
2004-03-21 21:20:25 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-03-21 21:20:25 +00:00
|
|
|
*
|
2006-02-11 10:10:44 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2004-03-21 21:20:25 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GRAPHICS_ANIMATION_H
|
|
|
|
#define GRAPHICS_ANIMATION_H
|
|
|
|
|
2004-03-22 01:28:45 +00:00
|
|
|
#include "common/scummsys.h"
|
2006-06-28 14:06:54 +00:00
|
|
|
|
2004-03-21 21:20:25 +00:00
|
|
|
// Uncomment this if you are using libmpeg2 0.3.1.
|
|
|
|
// #define USE_MPEG2_0_3_1
|
|
|
|
|
2004-10-17 17:57:33 +00:00
|
|
|
#ifdef USE_MPEG2
|
2004-03-21 21:20:25 +00:00
|
|
|
|
2006-03-04 15:26:26 +00:00
|
|
|
#if !defined(_MSC_VER)
|
2006-03-06 19:44:15 +00:00
|
|
|
#ifndef PALMOS_MODE
|
|
|
|
# include <inttypes.h>
|
|
|
|
#else
|
|
|
|
# include <stdint.h>
|
|
|
|
#endif
|
2006-03-04 15:26:26 +00:00
|
|
|
#endif
|
|
|
|
|
2004-03-21 21:20:25 +00:00
|
|
|
extern "C" {
|
|
|
|
#include <mpeg2dec/mpeg2.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USE_MPEG2_0_3_1
|
|
|
|
typedef int mpeg2_state_t;
|
|
|
|
typedef sequence_t mpeg2_sequence_t;
|
|
|
|
#define STATE_BUFFER -1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2004-03-22 01:28:45 +00:00
|
|
|
#ifdef BACKEND_8BIT
|
|
|
|
#define SQR(x) ((x) * (x))
|
|
|
|
#define SHIFT 3
|
|
|
|
#else
|
|
|
|
#define SHIFT 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define BITDEPTH (1 << (8 - SHIFT))
|
|
|
|
#define ROUNDADD (1 << (SHIFT - 1))
|
|
|
|
|
|
|
|
#define BUFFER_SIZE 4096
|
|
|
|
|
2005-05-10 22:56:25 +00:00
|
|
|
namespace Common {
|
|
|
|
class File;
|
|
|
|
}
|
|
|
|
|
2006-08-26 12:29:00 +00:00
|
|
|
class OSystem;
|
|
|
|
|
2004-03-22 01:28:45 +00:00
|
|
|
namespace Graphics {
|
|
|
|
|
|
|
|
class BaseAnimationState {
|
|
|
|
protected:
|
2005-03-11 15:30:28 +00:00
|
|
|
const int _movieWidth;
|
|
|
|
const int _movieHeight;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-05-18 13:18:02 +00:00
|
|
|
int _frameWidth;
|
|
|
|
int _frameHeight;
|
|
|
|
|
2006-05-17 23:52:45 +00:00
|
|
|
#ifndef BACKEND_8BIT
|
|
|
|
int _movieScale;
|
|
|
|
#endif
|
|
|
|
|
2004-03-22 01:28:45 +00:00
|
|
|
OSystem *_sys;
|
|
|
|
|
2005-03-11 15:30:28 +00:00
|
|
|
uint _frameNum;
|
2004-03-22 01:28:45 +00:00
|
|
|
|
|
|
|
#ifdef USE_MPEG2
|
2005-03-11 15:30:28 +00:00
|
|
|
mpeg2dec_t *_mpegDecoder;
|
|
|
|
const mpeg2_info_t *_mpegInfo;
|
2004-03-22 01:28:45 +00:00
|
|
|
#endif
|
|
|
|
|
2005-05-10 22:56:25 +00:00
|
|
|
Common::File *_mpegFile;
|
2004-03-21 21:20:25 +00:00
|
|
|
|
2004-03-22 01:28:45 +00:00
|
|
|
#ifdef BACKEND_8BIT
|
2005-03-11 15:30:28 +00:00
|
|
|
int _palNum;
|
|
|
|
int _maxPalNum;
|
2004-03-22 01:28:45 +00:00
|
|
|
|
2005-03-11 15:30:28 +00:00
|
|
|
byte _yuvLookup[2][(BITDEPTH+1) * (BITDEPTH+1) * (BITDEPTH+1)];
|
|
|
|
byte *_lut;
|
|
|
|
byte *_lut2;
|
|
|
|
int _lutCalcNum;
|
2004-03-22 01:28:45 +00:00
|
|
|
|
2005-03-11 15:30:28 +00:00
|
|
|
int _curPal;
|
|
|
|
int _cr;
|
|
|
|
int _pos;
|
2004-03-22 01:28:45 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
uint cnt;
|
|
|
|
uint end;
|
|
|
|
byte pal[4 * 256];
|
2005-03-11 15:30:28 +00:00
|
|
|
} _palettes[50];
|
2004-03-22 01:28:45 +00:00
|
|
|
#else
|
2005-03-11 15:30:28 +00:00
|
|
|
OverlayColor *_overlay;
|
|
|
|
int _bitFormat;
|
|
|
|
int16 *_colorTab;
|
2005-04-26 11:05:06 +00:00
|
|
|
OverlayColor *_rgbToPix;
|
2004-03-22 01:28:45 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
public:
|
2006-08-26 12:29:00 +00:00
|
|
|
BaseAnimationState(OSystem *sys, int width, int height);
|
2004-03-22 01:28:45 +00:00
|
|
|
virtual ~BaseAnimationState();
|
|
|
|
|
2006-08-26 12:29:00 +00:00
|
|
|
bool init(const char *name);
|
2004-03-23 00:10:18 +00:00
|
|
|
bool decodeFrame();
|
2006-05-18 13:58:33 +00:00
|
|
|
void handleScreenChanged();
|
2006-05-18 13:18:02 +00:00
|
|
|
void updateScreen();
|
2005-03-06 14:12:40 +00:00
|
|
|
|
2004-03-24 07:29:59 +00:00
|
|
|
#ifndef BACKEND_8BIT
|
2005-03-06 14:12:40 +00:00
|
|
|
void buildLookup();
|
2004-03-24 07:29:59 +00:00
|
|
|
#endif
|
2004-03-23 00:10:18 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
int getFrameWidth() { return _frameWidth; }
|
|
|
|
int getFrameHeight() { return _frameHeight; }
|
|
|
|
|
2004-03-22 01:28:45 +00:00
|
|
|
protected:
|
2004-03-22 01:40:24 +00:00
|
|
|
bool checkPaletteSwitch();
|
2004-03-23 00:10:18 +00:00
|
|
|
virtual void drawYUV(int width, int height, byte *const *dat) = 0;
|
|
|
|
|
2004-03-22 01:28:45 +00:00
|
|
|
#ifdef BACKEND_8BIT
|
|
|
|
void buildLookup(int p, int lines);
|
|
|
|
virtual void setPalette(byte *pal) = 0;
|
|
|
|
#else
|
2005-03-06 14:12:40 +00:00
|
|
|
void plotYUV(int width, int height, byte *const *dat);
|
2006-05-17 23:52:45 +00:00
|
|
|
void plotYUV1x(int width, int height, byte *const *dat);
|
|
|
|
void plotYUV2x(int width, int height, byte *const *dat);
|
|
|
|
void plotYUV3x(int width, int height, byte *const *dat);
|
2004-03-22 01:28:45 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Graphics
|
|
|
|
|
|
|
|
#endif
|