#ifndef _DIRGRAD_H_
#define _DIRGRAD_H_
/**
 *  \file dirgrad.h
 *  \brief a header file for dirgrad.h
 *
 *
 *  \ingroup corefiles
 *  \date Jun 3, 2009
 *  \author Alexander Pimenov
 */
#ifdef __cplusplus
	extern "C" {
#endif

#include <stdint.h>

#define GET_MAGNITUDE(X) ((X) & 0x7F)
#define GET_DIRECTION(X) ((X >> 7) & 0x1F)

#define PACK_DIRGRAD(DIR, GRAD) ((((DIR) & 0x1F) << 7) | ((GRAD) & 0x7F))

/**
 * \brief A direction & gradient buffer
 * */
typedef struct DirGradBuffer_TAG {
	int h;              /**< Height of the buffer */
	int w;              /**< Width of the buffer */
	uint16_t *data;
} DirGradBuffer;

#ifdef __cplusplus
	} // 	extern "C"
#endif
#endif
