+ short cpt, ic, jc ;
+ short histogram[256] ; // 8 bit image
+ // zeroing histogram data
+ for (ic =0; ic<256; ic++) histogram[ ic ]=0 ;
+ // histogram filling
+ for(ic=i-r; ic<=i+r; ic++ )
+ for(jc=j-r; jc<=j+r; jc++)
+ histogram[ tex2D(tex_img_ins, jc, ic) ]++ ;
+ // histogram parsing
+ cpt = 0 ;
+ for(ic=0; ic<256; ic++)