| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#ifndef DOSBOX_DOSBOX_H |
| 20 |
#ifdef _MSC_VER |
| 21 |
#define INLINE __forceinline |
| 22 |
#else |
| 23 |
#define INLINE inline |
| 24 |
#endif |
| 25 |
#endif |
| 26 |
|
| 27 |
#define CODEC_4CC "ZMBV" |
| 28 |
|
| 29 |
typedef enum { |
| 30 |
ZMBV_FORMAT_NONE = 0x00, |
| 31 |
ZMBV_FORMAT_1BPP = 0x01, |
| 32 |
ZMBV_FORMAT_2BPP = 0x02, |
| 33 |
ZMBV_FORMAT_4BPP = 0x03, |
| 34 |
ZMBV_FORMAT_8BPP = 0x04, |
| 35 |
ZMBV_FORMAT_15BPP = 0x05, |
| 36 |
ZMBV_FORMAT_16BPP = 0x06, |
| 37 |
ZMBV_FORMAT_24BPP = 0x07, |
| 38 |
ZMBV_FORMAT_32BPP = 0x08 |
| 39 |
} zmbv_format_t; |
| 40 |
|
| 41 |
void Msg(const char fmt[], ...); |
| 42 |
class VideoCodec { |
| 43 |
private: |
| 44 |
struct FrameBlock { |
| 45 |
int start; |
| 46 |
int dx,dy; |
| 47 |
}; |
| 48 |
struct CodecVector { |
| 49 |
int x,y; |
| 50 |
int slot; |
| 51 |
}; |
| 52 |
struct KeyframeHeader { |
| 53 |
unsigned char high_version; |
| 54 |
unsigned char low_version; |
| 55 |
unsigned char compression; |
| 56 |
unsigned char format; |
| 57 |
unsigned char blockwidth,blockheight; |
| 58 |
}; |
| 59 |
|
| 60 |
struct { |
| 61 |
int linesDone; |
| 62 |
int writeSize; |
| 63 |
int writeDone; |
| 64 |
unsigned char *writeBuf; |
| 65 |
} compress; |
| 66 |
|
| 67 |
CodecVector VectorTable[512]; |
| 68 |
int VectorCount; |
| 69 |
|
| 70 |
unsigned char *oldframe, *newframe; |
| 71 |
unsigned char *buf1, *buf2, *work; |
| 72 |
int bufsize; |
| 73 |
|
| 74 |
int blockcount; |
| 75 |
FrameBlock * blocks; |
| 76 |
|
| 77 |
int workUsed, workPos; |
| 78 |
|
| 79 |
int palsize; |
| 80 |
char palette[256*4]; |
| 81 |
int height, width, pitch; |
| 82 |
zmbv_format_t format; |
| 83 |
int pixelsize; |
| 84 |
|
| 85 |
z_stream zstream; |
| 86 |
|
| 87 |
|
| 88 |
void FreeBuffers(void); |
| 89 |
void CreateVectorTable(void); |
| 90 |
bool SetupBuffers(zmbv_format_t format, int blockwidth, int blockheight); |
| 91 |
|
| 92 |
template<class P> |
| 93 |
void AddXorFrame(void); |
| 94 |
template<class P> |
| 95 |
void UnXorFrame(void); |
| 96 |
template<class P> |
| 97 |
INLINE int PossibleBlock(int vx,int vy,FrameBlock * block); |
| 98 |
template<class P> |
| 99 |
INLINE int CompareBlock(int vx,int vy,FrameBlock * block); |
| 100 |
template<class P> |
| 101 |
INLINE void AddXorBlock(int vx,int vy,FrameBlock * block); |
| 102 |
template<class P> |
| 103 |
INLINE void UnXorBlock(int vx,int vy,FrameBlock * block); |
| 104 |
template<class P> |
| 105 |
INLINE void CopyBlock(int vx, int vy,FrameBlock * block); |
| 106 |
public: |
| 107 |
VideoCodec(); |
| 108 |
bool SetupCompress( int _width, int _height); |
| 109 |
bool SetupDecompress( int _width, int _height); |
| 110 |
zmbv_format_t BPPFormat( int bpp ); |
| 111 |
int NeededSize( int _width, int _height, zmbv_format_t _format); |
| 112 |
|
| 113 |
void CompressLines(int lineCount, void *lineData[]); |
| 114 |
bool PrepareCompressFrame(int flags, zmbv_format_t _format, char * pal, void *writeBuf, int writeSize); |
| 115 |
int FinishCompressFrame( void ); |
| 116 |
bool DecompressFrame(void * framedata, int size); |
| 117 |
void Output_UpsideDown_24(void * output); |
| 118 |
}; |