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

#
# $Log: neighborhood-ops.desc,v $
# Revision 1.1  1994/01/31  16:50:30  thoth
# Initial revision
#

#
# Things that frob Bit images
#
neighborhood int neighborhood_sum IA_Bit zero=0
init:	RTYPE	a = ZERO;
accum:	if (IVAL) a++;
final:	IRESULT = a;
forw_init:	IRESULT = ZERO;
forw_accumvar:	if (IVAL) IRESULT++;
end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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