@@ -901,12 +901,11 @@ enum METHOD parseMethod(const char *s)
901901 return UNKNOWN ;
902902}
903903
904- float RescaleMetric (int currentmethod , float value )
904+ float MetricRescale (int currentmethod , float value )
905905{
906- float k1 , k0 ;
907-
906+ float k1 ;
907+
908908 k1 = 1.0f ;
909- k0 = 0.0f ;
910909 switch (currentmethod )
911910 {
912911 case MSE :
@@ -918,8 +917,7 @@ float RescaleMetric(int currentmethod, float value)
918917 value = sqrt (value );
919918 value = sqrt (value );
920919 value -= 1.0f ;
921- k1 = 0.25f ;
922- k0 = 0.0f ;
920+ k1 = 0.29f ;
923921 }
924922 else
925923 {
@@ -928,14 +926,13 @@ float RescaleMetric(int currentmethod, float value)
928926 break ;
929927 case PSNR :
930928 value = sqrt (value );
931- k1 = 0.87f ;
932- k0 = -4.70f ;
929+ value -= 5.0f ;
930+ k1 = 0.557f ;
933931 break ;
934932 case COR :
935933 value = MetricSigma (value );
936934 value = MetricSigma (value );
937935 k1 = 1.0f ;
938- k0 = 0.0f ;
939936 break ;
940937 case MSEF :
941938 if (value > 0.0f )
@@ -945,7 +942,6 @@ float RescaleMetric(int currentmethod, float value)
945942 value = sqrt (value );
946943 value -= 1.0f ;
947944 k1 = 0.5f ;
948- k0 = 0.0f ;
949945 }
950946 else
951947 {
@@ -956,32 +952,26 @@ float RescaleMetric(int currentmethod, float value)
956952 value = MetricSigma (value );
957953 value = MetricSigma (value );
958954 value = MetricSigma (value );
959- k1 = 1.51f ;
960- k0 = 0.0f ;
955+ k1 = 1.57f ;
961956 break ;
962957 case MS_SSIM :
963958 value = MetricSigma (value );
964959 value = MetricSigma (value );
965960 k1 = 1.59f ;
966- k0 = 0.0f ;
967961 break ;
968962 case VIFP1 :
969963 value = MetricSigma (value );
970964 value = MetricSigma (value );
971- k1 = 1.06f ;
972- k0 = 0.0f ;
965+ k1 = 1.10f ;
973966 break ;
974967 case SMALLFRY :
975968 value *= 0.01f ;
976969 value -= 0.8f ;
977970 k1 = 3.0f ;
978- k0 = 0.0f ;
979971 break ;
980972 case SHARPENBAD :
981- value = sqrt (value );
982973 value = MetricSigma (value );
983- k1 = 1.0f ;
984- k0 = 0.0f ;
974+ k1 = 1.46f ;
985975 break ;
986976 case NHW :
987977 if (value > 0.0f )
@@ -990,8 +980,7 @@ float RescaleMetric(int currentmethod, float value)
990980 value = sqrt (value );
991981 value = sqrt (value );
992982 value -= 1.0f ;
993- k1 = 0.333f ;
994- k0 = 0.0f ;
983+ k1 = 0.342f ;
995984 }
996985 else
997986 {
@@ -1000,7 +989,6 @@ float RescaleMetric(int currentmethod, float value)
1000989 break ;
1001990 }
1002991 value *= k1 ;
1003- value += k0 ;
1004992
1005993 return value ;
1006994}
@@ -1120,30 +1108,30 @@ float MetricCalc(int method, unsigned char *image1, unsigned char *image2, int w
11201108 break ;
11211109 case SSIMFRY :
11221110 tmetric = iqa_ssim (image1 , image2 , width , height , width * components , 0 , 0 );
1123- diff = RescaleMetric (SSIM , tmetric );
1111+ diff = MetricRescale (SSIM , tmetric );
11241112 tmetric = metric_smallfry (image1 , image2 , width , height );
1125- diff += RescaleMetric (SMALLFRY , tmetric );
1113+ diff += MetricRescale (SMALLFRY , tmetric );
11261114 diff *= 0.5f ;
11271115 break ;
11281116 case SSIMSHBAD :
11291117 tmetric = iqa_ssim (image1 , image2 , width , height , width * components , 0 , 0 );
1130- diff = RescaleMetric (SSIM , tmetric );
1118+ diff = MetricRescale (SSIM , tmetric );
11311119 tmetric = metric_sharpenbad (image1 , image2 , width , height , 1 );
1132- diff += RescaleMetric (SHARPENBAD , tmetric );
1120+ diff += MetricRescale (SHARPENBAD , tmetric );
11331121 diff *= 0.5f ;
11341122 break ;
11351123 case SUMMET :
11361124 default :
11371125 tmetric = iqa_ssim (image1 , image2 , width , height , width * components , 0 , 0 );
1138- tm [0 ] = RescaleMetric (SSIM , tmetric );
1126+ tm [0 ] = MetricRescale (SSIM , tmetric );
11391127 tmetric = metric_smallfry (image1 , image2 , width , height );
1140- tm [1 ] = RescaleMetric (SMALLFRY , tmetric );
1128+ tm [1 ] = MetricRescale (SMALLFRY , tmetric );
11411129 tmetric = metric_sharpenbad (image1 , image2 , width , height , 1 );
1142- tm [2 ] = RescaleMetric (SHARPENBAD , tmetric );
1130+ tm [2 ] = MetricRescale (SHARPENBAD , tmetric );
11431131 tmetric = metric_nhw (image1 , image2 , width , height );
1144- tm [3 ] = RescaleMetric (NHW , tmetric );
1132+ tm [3 ] = MetricRescale (NHW , tmetric );
11451133 tmetric = iqa_vifp1 (image1 , image2 , width , height , width * components , 0 , 0 );
1146- tm [4 ] = RescaleMetric (VIFP1 , tmetric );
1134+ tm [4 ] = MetricRescale (VIFP1 , tmetric );
11471135 diff = waverage (tm , 5 );
11481136 break ;
11491137 }
@@ -1246,7 +1234,7 @@ int compareFromBuffer(int method, unsigned char *imageBuf1, long bufSize1, unsig
12461234 // Calculate and print comparison
12471235 diff = MetricCalc (method , image1 , image2 , width1 , height1 , components );
12481236 if (umscale )
1249- diff = RescaleMetric (method , diff );
1237+ diff = MetricRescale (method , diff );
12501238 if (printPrefix )
12511239 printf ("%s: " , MetricName (method ));
12521240 printf ("%f" , diff );
0 commit comments