#ifndef PICTUREKEY_H 
#define PICTUREKEY_H 

/*********************************************************************
----------------------------------------------------------------------

	picture key
	
----------------------------------------------------------------------
*********************************************************************/

#include <exec/types.h>
#include <guigfx/guigfx.h>

#define	KEYWIDTH	6
#define	KEYHEIGHT	4
#define	KEYDEPTH	5

#define YKEY		0
#define UKEY		(KEYWIDTH * KEYHEIGHT * KEYDEPTH)
#define VKEY		(UKEY + (KEYWIDTH * KEYHEIGHT * KEYDEPTH))
#define	NUMKEYBITS	(VKEY + (KEYWIDTH * KEYHEIGHT * KEYDEPTH))



#define BITSPERCHAR		6
#define NUMCHARS 		((NUMKEYBITS + BITSPERCHAR - 1) / BITSPERCHAR)
#define BITARRAYSIZE 	(NUMCHARS * BITSPERCHAR)



typedef struct
{
	int ykey[KEYWIDTH*KEYHEIGHT];
	int ukey[KEYWIDTH*KEYHEIGHT];
	int vkey[KEYWIDTH*KEYHEIGHT];

} PICTUREKEY;



extern PICTUREKEY *CalcPictureKey(PICTURE *pic);
extern PICTUREKEY *CalcPictureKeySegment(PICTURE *pic, int sx, int sy, int w, int h);
extern char *KeyToString(PICTUREKEY *key);
extern PICTUREKEY *StringToKey(char *keystring);
extern double CompareKeys(PICTUREKEY *key1, PICTUREKEY *key2);
extern double CompareKeysX(PICTUREKEY *key1, PICTUREKEY *key2);
extern double CompareKeysY(PICTUREKEY *key1, PICTUREKEY *key2);
extern double CompareKeysXY(PICTUREKEY *key1, PICTUREKEY *key2);



#define OR_NORMAL	0
#define OR_FLIPX	1
#define OR_FLIPY	2

#endif
