#
#	Copyright 1993, Center for Computer Vision and Visualization,
#	University of Florida.  All rights reserved.
#

#
# $Log: nbh-ops.desc,v $
# Revision 1.3  1994/05/08  19:42:50  thoth
# Automatic neighborhood reductions require change in spec file.
#
# Revision 1.2  1994/04/15  13:19:55  thoth
# removed neighborhood_ prefix from reductions.
#
# Revision 1.1  1994/01/31  16:50:30  thoth
# Initial revision
#

#
# Things that frob Bit images
#

#"C#define NEED_SPARE
# Not really, one of the other reductions below defines the spare for us.
neighborhood int sum IA_Bit zero=0
#init:	RTYPE	a = ZERO;
accum:	if (IVAL) IRESULT++;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	if (IVAL) IRESULT++;
end
#"C#undef NEED_SPARE

neighborhood IA_Bit max IA_Bit zero=0
#init:	RTYPE	a = ZERO;
accum:	IRESULT |= IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	IRESULT |= IVAL;
end

neighborhood IA_Bit min IA_Bit zero=1
#init:	RTYPE	a = ZERO;
accum:	IRESULT &= IVAL
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	IRESULT &= IVAL;
end

#
# Things that frob unsigned char images
#
neighborhood int sum u_char zero=0
#init:	RTYPE	a = ZERO;
accum:	IRESULT += IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	IRESULT += IVAL;
end

neighborhood u_char max u_char zero=0
#init:	RTYPE	a = ZERO;
accum:	if (IVAL>IRESULT) IRESULT = IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	if (IVAL>IRESULT) IRESULT = IVAL;
end

neighborhood u_char min u_char zero=255
#init:	RTYPE	a = ZERO;
accum:	if (IVAL<IRESULT) IRESULT = IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	if (IVAL<IRESULT) IRESULT = IVAL;
end

#
# Things that frob int images
#
neighborhood int sum int zero=0
#init:	RTYPE	a = ZERO;
accum:	IRESULT += IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	IRESULT += IVAL;
end

neighborhood int product int zero=1
#init:	RTYPE	a = ZERO;
accum:	IRESULT *= IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	IRESULT *= IVAL;
end

neighborhood int max int zero=-MAXINT
#init:	RTYPE	a = ZERO;
accum:	if (IVAL>IRESULT) IRESULT = IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	if (IVAL>IRESULT) IRESULT = IVAL;
end

neighborhood int min int zero=MAXINT
#init:	RTYPE	a = ZERO;
accum:	if (IVAL<IRESULT) IRESULT = IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	if (IVAL<IRESULT) IRESULT = IVAL;
end

#
# Things that frob float images
#
neighborhood float sum float zero=0
#init:	RTYPE	a = ZERO;
accum:	IRESULT += IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	IRESULT += IVAL;
end

neighborhood float product float zero=1
#init:	RTYPE	a = ZERO;
accum:	IRESULT *= IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	IRESULT *= IVAL;
end

neighborhood float max float zero=-infinity()
#init:	RTYPE	a = ZERO;
accum:	if (IVAL>IRESULT) IRESULT = IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	if (IVAL>IRESULT) IRESULT = IVAL;
end

neighborhood float min float zero=infinity()
#init:	RTYPE	a = ZERO;
accum:	if (IVAL<IRESULT) IRESULT = IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	if (IVAL<IRESULT) IRESULT = IVAL;
end

#
# Things that frob complex images
#
neighborhood complex sum complex zero=0
#init:	RTYPE	a = ZERO;
accum:	IRESULT += IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	IRESULT += IVAL;
end

neighborhood complex product complex zero=1
#init:	RTYPE	a = ZERO;
accum:	IRESULT *= IVAL;
#final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	IRESULT *= IVAL;
end
