求助程序功能一致性的验证方法
我有两个子程序:// code 1:
short con_sig_model( unsigned char **Fc, short i, short j,
short x_start, short y_start, short x_end, short y_end, unsigned short subband)
{
short h,v,d,hv,temp;
h=0; // h = 0,1,2
v=0; // v = 0,1,2
d=0; // d = 0,1,2,3,4
if(((j-1)>=x_start)&&Fc[i][j-1]) h++;
if(((j+1)<x_end)&&Fc[i][j+1]) h++;
if(((i-1)>=y_start)&&Fc[i-1][j]) v++;
if(((i+1)<y_end)&&Fc[i+1][j]) v++;
if(((i-1)>=y_start)&&((j-1)>=x_start)&&Fc[i-1][j-1]) d++;
if(((i-1)>=y_start)&&((j+1)<x_end)&&Fc[i-1][j+1]) d++;
if(((i+1)<y_end)&&((j-1)>=x_start)&&Fc[i+1][j-1]) d++;
if(((i+1)<y_end)&&((j+1)<x_end)&&Fc[i+1][j+1]) d++;
if(subband==3)
{
hv=v+h;
if(d>=3) return 8;
else if(d==2){
if(hv>=1) return 7;
else return 6;
}
else { // d = 1,0
if(hv>=2) return 2 + d*3;
return hv + d*3;
}
}
else // subband = 0,1,2
{
if(subband==1) { // subband = 1,2
temp=h; h=v; v=temp;
}
if(h==2) return 8;
else if(h==1){
if(v>=1) return 7;
else {
if(d>=1) return 6;
else return 5;
}
}
else { // (h==0)
if( v>0 ) return v+2;
else { // (v==0)
return (d>=2) ? 2: d;
}
}
}
}
// code 2:
short con_sig_model(
unsigned char **Fc,
short i,
short j,
short x_start,
short y_start,
short x_end,
short y_end,
unsigned short subband)
{ short h,v,d,hv,temp;
h=0;
v=0;
d=0;
if(((j-1)>=x_start)&&Fc[i][j-1]) h++;
if(((j+1)<x_end)&&Fc[i][j+1]) h++;
if(((i-1)>=y_start)&&Fc[i-1][j]) v++;
if(((i+1)<y_end)&&Fc[i+1][j]) v++;
if(((i-1)>=y_start)&&((j-1)>=x_start)&&Fc[i-1][j-1]) d++;
if(((i-1)>=y_start)&&((j+1)<x_end)&&Fc[i-1][j+1]) d++;
if(((i+1)<y_end)&&((j-1)>=x_start)&&Fc[i+1][j-1]) d++;
if(((i+1)<y_end)&&((j+1)<x_end)&&Fc[i+1][j+1]) d++;
if(subband==3){
hv=v+h;
if(d>=3) return 8;
if(d==2){
if(hv>=1) return 7;
else return 6;
}
if(d==1){
if(hv>=2) return 5;
if(hv==1) return 4;
if(!hv) return 3;
}
if(!d){
if(hv>=2) return 2;
if(hv==1) return 1;
if(!hv) return 0;
}
}
else{//0,2
if(subband==1){ //1
temp=h;
h=v;
v=temp;
}
if(h==2) return 8;
if(h==1){
if(v>=1) return 7;
else{
if(d>=1) return 6;
else return 5;
}
}
if(h==0){
if(v==2) return 4;
if(v==1) return 3;
if(v==0){
if(d>=2) return 2;
if(d==1) return 1;
if(d==0) return 0;
}
}
}
return 0;//avoid compiler warning!
}
我用什么方法来验证上述两个代码的功能是否一致呢 ??