-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgdv.h
168 lines (148 loc) · 4.15 KB
/
gdv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//
// GDV.H
//
// Structures/types/defines for compresser and player
//
// Versions 3 and 4 (8 and 15 bit colour)
//
// Audio/Video data types
#define NO_SOUND 0
#define A_STANDARD_SOUND (1<<0)
#define A_STEREO (1<<1)
#define A_16_BIT (1<<2)
#define A_COMPRESSED (1<<3)
#define NO_VIDEO 0
#define V_256_VIDEO (1<<0)
#define V_32K_VIDEO (1<<1)
// Sound and video parameters
#define SOUNDSIZE (sample_rate/fps)
#define FRAMESIZE (videosize+SOUNDSIZE)
// Filenames
#define CONFIG_FILE "config.ini" // } Unless overridden by env. var.
#define SOS_PATH ".\\" // } settings
#define file_type "gdv"
#define VERSION "4.0"
// Frame types within animation file
#define FRM_PALETTE 0 // New palette only (used for fades)
#define FRM_JOINER 1 // Blank screen
#define FRM_DELTA1 2 // Complete frame differences from last frame
#define FRM_HOLD 3 // Hold frame; Do nothing.
#define FRM_PALETTE_DELTA1 4 // New palette and frame data (in that order)
// Token types within packed data
#define TKN_PIXEL 0 // 16 bit colour value (No match possible)
#define TKN_STRING 1 // 16 bit string (position and length)
#define TKN_SAME8 2 // 8 bit 'no change' length
#define TKN_END 3 // Token signifying end of frame or block
// Standard VGA screen stats
#define VGA_256 0x13
#define VGA_256_WIDTH 320
#define VGA_256_HEIGHT 200
#define VGA_256_BANKS 1
// Super VGA mode 101h stats
#define SVGA_256 0x101
#define SVGA_256_WIDTH 640
#define SVGA_256_HEIGHT 480
#define SVGA_256_BANKS 5
// Super VGA mode 110h stats
#define SVGA_32K 0x110
#define SVGA_32K_WIDTH 640
#define SVGA_32K_HEIGHT 480
#define SVGA_32K_BANKS 10
#ifdef VGA_SCREEN
#undef VGA_SCREEN
#define VGA_SCREEN (unsigned short *)0xa0000
#endif
// Compression stuff
#define DICT_BITS 12
#define BUFF_BITS 4
#define DICT_SIZE (1<<DICT_BITS)
#define BUFF_SIZE (1<<BUFF_BITS)
#define TOTAL_SIZE (DICT_SIZE+BUFF_SIZE)
// Magic numbers for headers
#define FRM_MAGIC 0x1305
#define GDV_MAGIC 0x29111994
// gl_shutdown error codes
#define GL_READ_ERROR 1<<0
#define GL_MAGIC_ERROR 1<<1
#define GL_FRAME_ERROR 1<<2
#define GL_TOKEN_ERROR 1<<3
#define GL_STOPPED 1<<4
// Main header for animation file [24 bytes]
struct gdv_header
{
unsigned long magic; // Magic number for GDV files
unsigned short dimensions; // Image dimension code
unsigned short no_frames; // Total number of frames
unsigned short fps; // Frames per second
unsigned short audio_type; // Type of audio data
unsigned short sample_rate; // Sound sample rate
unsigned short video_type; // Type of video data
unsigned short video_size; // (Max.) Size of video/frame
unsigned char version; // Version number
unsigned char lossyness; // Quality
unsigned char reserved[4]; // For later... UNUSED
};
// Header for each frame of the animation [8 bytes]
struct frame_header
{
unsigned short magic; // Magic frame number
unsigned short frame_size; // Size of DATA in bytes
unsigned char type; // Type of frame
unsigned char reserved[3]; // For later UNUSED
};
#define GAMMA_CORRECT 1.4
#define DIMENSIONS 32
#define MAX_256 16
#ifdef CGDV
#ifndef GLOBAL
unsigned short widths[DIMENSIONS]=
{
320,
640,
320,
320,
320,
320,
160,
160,
160,
280,
320,
320,
0,0,0,0,
640,
640,
640,
640,
640,
320,
0,0,0,0,0,0,0,0,0,0
};
unsigned short heights[DIMENSIONS]=
{
200,
200,
167,
180,
400,
170,
85,
83,
90,
128,
240,
201,
0,0,0,0,
400,
200,
180,
167,
170,
240,
0,0,0,0,0,0,0,0,0,0
};
#else
extern unsigned short widths[],heights[];
#endif
#endif