#include <stdio.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>

#ifdef SH_MEM
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
#endif

#if 0
/* X11/xmd.h correctly defines INT32, etc */
#ifndef XMD_H
typedef int INT32;
typedef short INT16;
typedef char INT8;
#endif
typedef unsigned int UINT32;
typedef unsigned short UINT16;
typedef unsigned char UINT8;
#endif 

extern Display *display;
extern int depth;

#define GRAY_DITHER        0
#define FULL_COLOR_DITHER  1
#define ORDERED_DITHER     2
#define DEPTH16            3
#define MONO_DITHER        4

/* dither */

extern int LUM_RANGE;
extern int CR_RANGE;
extern int CB_RANGE;

extern unsigned char pixel[256];
extern int *lum_values;
extern int *cr_values;
extern int *cb_values;

#define NUM_COLORS 256
