]> granicus.if.org Git - openjpeg/commitdiff
Correct lossless issue on linux x86
authormayeut <mayeut@users.noreply.github.com>
Wed, 9 Sep 2015 22:39:23 +0000 (00:39 +0200)
committermayeut <mayeut@users.noreply.github.com>
Wed, 9 Sep 2015 22:39:23 +0000 (00:39 +0200)
Update uclouvain/openjpeg#571

src/lib/openjp2/tcd.c
tests/compare_images.c
tests/nonregression/CMakeLists.txt

index 8f1c941026af291dc51fcee49cf982cc84ece19c..df9272ff1fce827e6335f5a467bcf8d7be28b2f6 100644 (file)
@@ -268,7 +268,7 @@ void opj_tcd_makelayer( opj_tcd_t *tcd,
                                                                         n = passno + 1;
                                                                 continue;
                                                         }
-                                                        if (dd / dr >= thresh)
+                                                        if (dd / dr > thresh)
                                                                 n = passno + 1;
                                                 }
 
@@ -565,7 +565,7 @@ OPJ_BOOL opj_tcd_rateallocate(  opj_tcd_t *tcd,
                         opj_t2_destroy(t2);
                 } else {
                         success = OPJ_TRUE;
-                        goodthresh = min;
+                        goodthresh = min - DBL_MAX; /* do not rely on float equality for lossless transform */
                 }
 
                 if (!success) {
index cb1b1301147bc6a0c13703b950c430644947e0fd..fa15d13e6b05c1eb7b22fcec82e5cee0c2ed7572 100644 (file)
@@ -85,7 +85,7 @@ static void compare_images_help_display(void)
   fprintf(stdout,"\n");
   fprintf(stdout,"  -b \t REQUIRED \t filename to the reference/baseline PGX/TIF/PNM image \n");
   fprintf(stdout,"  -t \t REQUIRED \t filename to the test PGX/TIF/PNM image\n");
-  fprintf(stdout,"  -n \t REQUIRED \t number of component of the image (used to generate correct filename)\n");
+  fprintf(stdout,"  -n \t REQUIRED \t number of component of the image (used to generate correct filename, not used when both input files are TIF)\n");
   fprintf(stdout,"  -m \t OPTIONAL \t list of MSE tolerances, separated by : (size must correspond to the number of component) of \n");
   fprintf(stdout,"  -p \t OPTIONAL \t list of PEAK tolerances, separated by : (size must correspond to the number of component) \n");
   fprintf(stdout,"  -s \t OPTIONAL \t 1 or 2 filename separator to take into account PGX/PNM image with different components, "
index 2527f8cb5907bb3845ceda44d99ae8db93729144..5ce37c81575d845827521b7e9a11a60560cd924d 100644 (file)
@@ -353,6 +353,26 @@ foreach(OPJ_TEST_CMD_LINE ${OPJ_TEST_CMD_LINE_LIST})
                 )              
             endif()
           endif(JPYLYZER_EXECUTABLE)
+          
+          # If lossless compression (simple test is 4 arguments), decompress & compare
+          list(LENGTH CMD_ARG_LIST_2 ARG_COUNT)
+          if (ARG_COUNT EQUAL 4)
+            # can we compare with the input image ?
+            if (${INPUT_FILENAME_NAME} MATCHES "\\.tif$")
+              add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-decode
+                COMMAND opj_decompress -i ${OUTPUT_FILENAME} -o ${OUTPUT_FILENAME}.lossless.tif
+                )
+              set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-decode PROPERTIES 
+                DEPENDS NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode
+                )
+              add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-compare
+                COMMAND compare_images -b ${INPUT_FILENAME} -t ${OUTPUT_FILENAME}.lossless.tif -n 1 -d
+                )
+              set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-compare PROPERTIES 
+                DEPENDS NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-decode
+                )      
+            endif()
+          endif()
       endif()
 
     # DECODER TEST SUITE