/*
 * gc_geometry_smart.h
 *
 */

#ifndef GC_GEOMETRY_SMART_H_
#define GC_GEOMETRY_SMART_H_


#define GC_GEOMETRY_VGA

#define GC_GEOMETRY_NAME "EVO"

#define GC_DISPLAY_ASPECT_RATIO(x_) ((x_)/4)*3

#define GC_DISPLAY_EXTENDED	720

namespace gc_cfg_k
{
enum rdr_display_geometry_k_
{
  K_XY_REFERENCE_DIMENSION=484,

  K_X_EXTRA_DIM=(640-484),
  K_Y_EXTRA_DIM=(512-484),

#ifndef GC_DISPLAY_EXTENDED
  K_XY_MAX_LOGICAL_DISPLAY_SIZE=484,

  K_XY_LOGICAL_DISPLAY_DIMENSION  = 484,

  K_XY_DEFAULT_DISPLAY_SIZE=484,
#else
  K_XY_MAX_LOGICAL_DISPLAY_SIZE=GC_DISPLAY_EXTENDED,

  K_XY_LOGICAL_DISPLAY_DIMENSION  = 484,

  K_XY_DEFAULT_DISPLAY_SIZE=484,
#endif

  K_X_MAX_PHYSICAL_DISPLAY_DIMENSION=K_XY_MAX_LOGICAL_DISPLAY_SIZE+K_X_EXTRA_DIM,
  K_Y_MAX_PHYSICAL_DISPLAY_DIMENSION=K_XY_MAX_LOGICAL_DISPLAY_SIZE+K_Y_EXTRA_DIM,


  K_X_MAX_PHYSICAL_DISPLAY_STRIDE=K_X_MAX_PHYSICAL_DISPLAY_DIMENSION,  //WARNING: shall be always rounded up to 4 bytes or multiples


  K_X_PHYSICAL_DISPLAY_DIMENSION = K_XY_LOGICAL_DISPLAY_DIMENSION+K_X_EXTRA_DIM,
  K_Y_PHYSICAL_DISPLAY_DIMENSION = K_XY_LOGICAL_DISPLAY_DIMENSION+K_Y_EXTRA_DIM, //real dimension is 484, extend for some debug info to be displayed only at higher resolutions GC_DISPLAY_ASPECT_RATIO(X_PHYSICAL_DISPLAY_DIMENSION),

  K_Y_PHYSICAL_DISPLAY_OUTPUT = K_XY_LOGICAL_DISPLAY_DIMENSION, //real dimension is 484, extend for some debug info to be displayed only at higher resolutions GC_DISPLAY_ASPECT_RATIO(X_PHYSICAL_DISPLAY_DIMENSION),

  K_X_LOGICAL_DISPLAY_OFFSET=(K_X_PHYSICAL_DISPLAY_DIMENSION-K_XY_LOGICAL_DISPLAY_DIMENSION)/2,
  K_Y_LOGICAL_DISPLAY_OFFSET=0, //(Y_PHYSICAL_DISPLAY_DIMENSION-XY_LOGICAL_DISPLAY_DIMENSION)/2,
};

enum rdr_display_geometry_k2_
{
  K_X_ABS_DIMENSION = K_XY_LOGICAL_DISPLAY_DIMENSION,
  K_Y_ABS_DIMENSION = K_XY_LOGICAL_DISPLAY_DIMENSION,

  K_X_ABS_CENTRE_DISPL=K_X_ABS_DIMENSION/2,
  K_Y_ABS_CENTRE_DISPL=K_Y_ABS_DIMENSION/2,

  K_X_MOVWIN_OFFSET=0,
  K_Y_MOVWIN_OFFSET=0,

  K_X_SCALE_OFFSET_TOP=1,
  K_X_SCALE_OFFSET_BOTTOM=2,
  K_Y_SCALE_OFFSET_TOP=1,
  K_Y_SCALE_OFFSET_BOTTOM=2,

  K_X_DIMENSION = (K_X_ABS_DIMENSION-K_X_MOVWIN_OFFSET*2),
  K_Y_DIMENSION = (K_Y_ABS_DIMENSION-K_Y_MOVWIN_OFFSET*2),

  K_X_CENTRE_DISPL=(K_X_DIMENSION/2)-1,
  K_Y_CENTRE_DISPL=(K_X_DIMENSION/2)-1,

  K_Y_ZERO_RANGE = (K_Y_DIMENSION-1)-K_Y_SCALE_OFFSET_BOTTOM,
  K_Y_FULL_RANGE = K_Y_SCALE_OFFSET_TOP,
  K_LEN_1D4_RNG  = ((K_Y_ZERO_RANGE-K_Y_FULL_RANGE)/4),

  K_X_ZERO_RNG_PPI=K_X_CENTRE_DISPL,
  K_Y_ZERO_RNG_PPI=K_Y_ZERO_RANGE,
  K_Y_FULL_RNG_PPI=K_Y_FULL_RANGE,

  K_LEN_1D4_RNG_PPI=((K_Y_ZERO_RNG_PPI-K_Y_FULL_RNG_PPI)/4),
  K_LEN_1D2_RNG_PPI=((K_Y_ZERO_RNG_PPI-K_Y_FULL_RNG_PPI)/2),
  K_LEN_3D4_RNG_PPI=(((K_Y_ZERO_RNG_PPI-K_Y_FULL_RNG_PPI)*3)/4),

  K_X_MIN_PIX_DISPL=0,
  K_X_MAX_PIX_DISPL=(K_X_DIMENSION-1),
  K_Y_MIN_PIX_DISPL=0,
  K_Y_MAX_PIX_DISPL=(K_Y_DIMENSION-1)
};

} /*namespace gc_cfg_k*/

namespace gc_cfg
{

typedef int pixel_num_t;

enum rdr_display_geometry_k_
{
	X_MAX_PHYSICAL_DISPLAY_DIMENSION=gc_cfg_k::K_X_MAX_PHYSICAL_DISPLAY_DIMENSION, //640, //872,
	Y_MAX_PHYSICAL_DISPLAY_DIMENSION=gc_cfg_k::K_X_MAX_PHYSICAL_DISPLAY_DIMENSION, //512, //720,

	X_MAX_PHYSICAL_DISPLAY_STRIDE=X_MAX_PHYSICAL_DISPLAY_DIMENSION,  //WARNING: shall be always rounded up to 4 bytes or multiples

    XY_MAX_LOGICAL_DISPLAY_SIZE=gc_cfg_k::K_XY_MAX_LOGICAL_DISPLAY_SIZE, //Y_MAX_PHYSICAL_DISPLAY_DIMENSION,

    XY_DEFAULT_DISPLAY_SIZE=gc_cfg_k::K_XY_DEFAULT_DISPLAY_SIZE
};

extern pixel_num_t XY_LOGICAL_DISPLAY_DIMENSION;//  = 484,
extern pixel_num_t X_PHYSICAL_DISPLAY_DIMENSION;// = 640,
extern pixel_num_t Y_PHYSICAL_DISPLAY_DIMENSION;// = 512, //real dimension is 484, extend for some debug info to be displayed only at higher resolutions GC_DISPLAY_ASPECT_RATIO(X_PHYSICAL_DISPLAY_DIMENSION),
extern pixel_num_t X_PHYSICAL_DISPLAY_STRIDE;// = 640,

extern pixel_num_t Y_PHYSICAL_DISPLAY_OUTPUT;// = 484, //real dimension is 484, extend for some debug info to be displayed only at higher resolutions GC_DISPLAY_ASPECT_RATIO(X_PHYSICAL_DISPLAY_DIMENSION),

extern pixel_num_t X_LOGICAL_DISPLAY_OFFSET;//=(X_PHYSICAL_DISPLAY_DIMENSION-XY_LOGICAL_DISPLAY_DIMENSION)/2,
extern pixel_num_t Y_LOGICAL_DISPLAY_OFFSET;//=0, //(Y_PHYSICAL_DISPLAY_DIMENSION-XY_LOGICAL_DISPLAY_DIMENSION)/2,

extern pixel_num_t X_ABS_DIMENSION;// = XY_LOGICAL_DISPLAY_DIMENSION,
extern pixel_num_t Y_ABS_DIMENSION;// = XY_LOGICAL_DISPLAY_DIMENSION,

extern pixel_num_t X_ABS_CENTRE_DISPL;//=X_ABS_DIMENSION/2,
extern pixel_num_t Y_ABS_CENTRE_DISPL;//=Y_ABS_DIMENSION/2,

extern pixel_num_t X_MOVWIN_OFFSET;//=0,
extern pixel_num_t Y_MOVWIN_OFFSET;//=0,

extern pixel_num_t X_SCALE_OFFSET_TOP;//=1,
extern pixel_num_t X_SCALE_OFFSET_BOTTOM;//=2,
extern pixel_num_t Y_SCALE_OFFSET_TOP;//=1,
extern pixel_num_t Y_SCALE_OFFSET_BOTTOM;//=2,

extern pixel_num_t X_DIMENSION;// = (X_ABS_DIMENSION-X_MOVWIN_OFFSET*2),
extern pixel_num_t Y_DIMENSION;// = (Y_ABS_DIMENSION-Y_MOVWIN_OFFSET*2),

extern pixel_num_t X_CENTRE_DISPL;//=(X_DIMENSION/2)-1,
extern pixel_num_t Y_CENTRE_DISPL;//=(X_DIMENSION/2)-1,

extern pixel_num_t Y_ZERO_RANGE;// = (Y_DIMENSION-1)-Y_SCALE_OFFSET_BOTTOM,
extern pixel_num_t Y_FULL_RANGE;// = Y_SCALE_OFFSET_TOP,
extern pixel_num_t LEN_1D4_RNG;//  = ((Y_ZERO_RANGE-Y_FULL_RANGE)/4),

extern pixel_num_t X_ZERO_RNG_PPI;//=X_CENTRE_DISPL,
extern pixel_num_t Y_ZERO_RNG_PPI;//=Y_ZERO_RANGE,
extern pixel_num_t Y_FULL_RNG_PPI;//=Y_FULL_RANGE,

extern pixel_num_t LEN_1D4_RNG_PPI;//=((Y_ZERO_RNG_PPI-Y_FULL_RNG_PPI)/4),
extern pixel_num_t LEN_1D2_RNG_PPI;//=((Y_ZERO_RNG_PPI-Y_FULL_RNG_PPI)/2),
extern pixel_num_t LEN_3D4_RNG_PPI;//=(((Y_ZERO_RNG_PPI-Y_FULL_RNG_PPI)*3)/4),

extern pixel_num_t X_MIN_PIX_DISPL;//=0,
extern pixel_num_t X_MAX_PIX_DISPL;//=(X_DIMENSION-1),
extern pixel_num_t Y_MIN_PIX_DISPL;//=0,
extern pixel_num_t Y_MAX_PIX_DISPL;//=(Y_DIMENSION-1)

}//namespace

#endif /* GC_GEOMETRY_SMART_H_ */
