@@ -901,12 +901,11 @@ enum METHOD parseMethod(const char *s)
901
901
return UNKNOWN ;
902
902
}
903
903
904
- float RescaleMetric (int currentmethod , float value )
904
+ float MetricRescale (int currentmethod , float value )
905
905
{
906
- float k1 , k0 ;
907
-
906
+ float k1 ;
907
+
908
908
k1 = 1.0f ;
909
- k0 = 0.0f ;
910
909
switch (currentmethod )
911
910
{
912
911
case MSE :
@@ -918,8 +917,7 @@ float RescaleMetric(int currentmethod, float value)
918
917
value = sqrt (value );
919
918
value = sqrt (value );
920
919
value -= 1.0f ;
921
- k1 = 0.25f ;
922
- k0 = 0.0f ;
920
+ k1 = 0.29f ;
923
921
}
924
922
else
925
923
{
@@ -928,14 +926,13 @@ float RescaleMetric(int currentmethod, float value)
928
926
break ;
929
927
case PSNR :
930
928
value = sqrt (value );
931
- k1 = 0.87f ;
932
- k0 = -4.70f ;
929
+ value -= 5.0f ;
930
+ k1 = 0.557f ;
933
931
break ;
934
932
case COR :
935
933
value = MetricSigma (value );
936
934
value = MetricSigma (value );
937
935
k1 = 1.0f ;
938
- k0 = 0.0f ;
939
936
break ;
940
937
case MSEF :
941
938
if (value > 0.0f )
@@ -945,7 +942,6 @@ float RescaleMetric(int currentmethod, float value)
945
942
value = sqrt (value );
946
943
value -= 1.0f ;
947
944
k1 = 0.5f ;
948
- k0 = 0.0f ;
949
945
}
950
946
else
951
947
{
@@ -956,32 +952,26 @@ float RescaleMetric(int currentmethod, float value)
956
952
value = MetricSigma (value );
957
953
value = MetricSigma (value );
958
954
value = MetricSigma (value );
959
- k1 = 1.51f ;
960
- k0 = 0.0f ;
955
+ k1 = 1.57f ;
961
956
break ;
962
957
case MS_SSIM :
963
958
value = MetricSigma (value );
964
959
value = MetricSigma (value );
965
960
k1 = 1.59f ;
966
- k0 = 0.0f ;
967
961
break ;
968
962
case VIFP1 :
969
963
value = MetricSigma (value );
970
964
value = MetricSigma (value );
971
- k1 = 1.06f ;
972
- k0 = 0.0f ;
965
+ k1 = 1.10f ;
973
966
break ;
974
967
case SMALLFRY :
975
968
value *= 0.01f ;
976
969
value -= 0.8f ;
977
970
k1 = 3.0f ;
978
- k0 = 0.0f ;
979
971
break ;
980
972
case SHARPENBAD :
981
- value = sqrt (value );
982
973
value = MetricSigma (value );
983
- k1 = 1.0f ;
984
- k0 = 0.0f ;
974
+ k1 = 1.46f ;
985
975
break ;
986
976
case NHW :
987
977
if (value > 0.0f )
@@ -990,8 +980,7 @@ float RescaleMetric(int currentmethod, float value)
990
980
value = sqrt (value );
991
981
value = sqrt (value );
992
982
value -= 1.0f ;
993
- k1 = 0.333f ;
994
- k0 = 0.0f ;
983
+ k1 = 0.342f ;
995
984
}
996
985
else
997
986
{
@@ -1000,7 +989,6 @@ float RescaleMetric(int currentmethod, float value)
1000
989
break ;
1001
990
}
1002
991
value *= k1 ;
1003
- value += k0 ;
1004
992
1005
993
return value ;
1006
994
}
@@ -1120,30 +1108,30 @@ float MetricCalc(int method, unsigned char *image1, unsigned char *image2, int w
1120
1108
break ;
1121
1109
case SSIMFRY :
1122
1110
tmetric = iqa_ssim (image1 , image2 , width , height , width * components , 0 , 0 );
1123
- diff = RescaleMetric (SSIM , tmetric );
1111
+ diff = MetricRescale (SSIM , tmetric );
1124
1112
tmetric = metric_smallfry (image1 , image2 , width , height );
1125
- diff += RescaleMetric (SMALLFRY , tmetric );
1113
+ diff += MetricRescale (SMALLFRY , tmetric );
1126
1114
diff *= 0.5f ;
1127
1115
break ;
1128
1116
case SSIMSHBAD :
1129
1117
tmetric = iqa_ssim (image1 , image2 , width , height , width * components , 0 , 0 );
1130
- diff = RescaleMetric (SSIM , tmetric );
1118
+ diff = MetricRescale (SSIM , tmetric );
1131
1119
tmetric = metric_sharpenbad (image1 , image2 , width , height , 1 );
1132
- diff += RescaleMetric (SHARPENBAD , tmetric );
1120
+ diff += MetricRescale (SHARPENBAD , tmetric );
1133
1121
diff *= 0.5f ;
1134
1122
break ;
1135
1123
case SUMMET :
1136
1124
default :
1137
1125
tmetric = iqa_ssim (image1 , image2 , width , height , width * components , 0 , 0 );
1138
- tm [0 ] = RescaleMetric (SSIM , tmetric );
1126
+ tm [0 ] = MetricRescale (SSIM , tmetric );
1139
1127
tmetric = metric_smallfry (image1 , image2 , width , height );
1140
- tm [1 ] = RescaleMetric (SMALLFRY , tmetric );
1128
+ tm [1 ] = MetricRescale (SMALLFRY , tmetric );
1141
1129
tmetric = metric_sharpenbad (image1 , image2 , width , height , 1 );
1142
- tm [2 ] = RescaleMetric (SHARPENBAD , tmetric );
1130
+ tm [2 ] = MetricRescale (SHARPENBAD , tmetric );
1143
1131
tmetric = metric_nhw (image1 , image2 , width , height );
1144
- tm [3 ] = RescaleMetric (NHW , tmetric );
1132
+ tm [3 ] = MetricRescale (NHW , tmetric );
1145
1133
tmetric = iqa_vifp1 (image1 , image2 , width , height , width * components , 0 , 0 );
1146
- tm [4 ] = RescaleMetric (VIFP1 , tmetric );
1134
+ tm [4 ] = MetricRescale (VIFP1 , tmetric );
1147
1135
diff = waverage (tm , 5 );
1148
1136
break ;
1149
1137
}
@@ -1246,7 +1234,7 @@ int compareFromBuffer(int method, unsigned char *imageBuf1, long bufSize1, unsig
1246
1234
// Calculate and print comparison
1247
1235
diff = MetricCalc (method , image1 , image2 , width1 , height1 , components );
1248
1236
if (umscale )
1249
- diff = RescaleMetric (method , diff );
1237
+ diff = MetricRescale (method , diff );
1250
1238
if (printPrefix )
1251
1239
printf ("%s: " , MetricName (method ));
1252
1240
printf ("%f" , diff );
0 commit comments