8 #define ARGS(alist) alist 10 #define ARGS(alist) () 18 #define put_byte(A) (*put_b)((byte)(A)); Nbyte++ 20 typedef unsigned char byte;
63 long GIFencode(Width, Height, Ncol,
R,
G,
B, ScLine, get_scline, pb)
64 int Width, Height, Ncol;
69 int ncol, i,
x,
y, disp, Code,
K;
74 if (Width <= 0 || Width > 4096 || Height <= 0 || Height > 4096) {
76 "\nGIFencode: incorrect image size: %d x %d\n", Width, Height);
80 if (Ncol <= 0 || Ncol > 256) {
81 fprintf(stderr,
"\nGIFencode: wrong number of colors: %d\n", Ncol);
126 for (i=0; i<Ncol; i++) {
131 for (; i<ncol; i++) {
153 for (y=0; y<Height; y++) {
154 (*get_scline)(
y, Width, ScLine);
160 CodeK = ((long) K <<
BITS) + Code;
161 i = (K <<
SHIFT) ^ Code;
171 if (i == 0) disp = 1;
211 static unsigned long masks[] = { 0x0000,
212 0x0001, 0x0003, 0x0007, 0x000F,
213 0x001F, 0x003F, 0x007F, 0x00FF,
214 0x01FF, 0x03FF, 0x07FF, 0x0FFF,
215 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
233 cur_accum |= ((long)code << cur_bits);
237 while( cur_bits >= 8 ) {
238 char_out( (
unsigned int) (cur_accum & 0xFF) );
246 memset((
char *)
HashTab, -1,
sizeof(HashTab));
265 while( cur_bits > 0 ) {
266 char_out( (
unsigned int)(cur_accum & 0xff) );
284 accum[a_count++] =
c;
293 if (a_count == 0)
return;
long GIFencode(void *int, void *int, void *int, R, G, B, ScLine, void *get_scline, pb)
#define R(a, b, c, d, e, f, g, h, i)
static const uint32_t K[64]
static unsigned long cur_accum
static void char_out(int c)
static long HashTab[HSIZE]
typedef void((*Func_t)())
static void put_short(int word)
static unsigned long masks[]
static void output(int code)
static int CodeTab[HSIZE]