[trunk] WIP: backport rev 967-969 about test suite enhancement and rename of opj_configh.cmake.in from opj-1.5 to trunk

This commit is contained in:
Mickael Savinaud 2011-10-07 14:20:15 +00:00
parent 68967aef72
commit e4b728ccb9
7 changed files with 416 additions and 213 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed ! : changed
+ : added + : added
October 07, 2011
+ [mickael] WIP: backport rev 967-969 from opj-1.5 to trunk about test suite enhancement and rename of opj_configh.cmake.in
October 06, 2011 October 06, 2011
* [mickael] WIP: fix build errors with windows configuration induced by rev 960 * [mickael] WIP: fix build errors with windows configuration induced by rev 960
+ [mickael] WIP: Enhance html documentation generation with cmake, add a mainpage to this documentation and bump version to 1.99.0 into the main CMakeLists (as rev951) + [mickael] WIP: Enhance html documentation generation with cmake, add a mainpage to this documentation and bump version to 1.99.0 into the main CMakeLists (as rev951)

View File

@ -220,7 +220,7 @@ ENDIF (BUILD_CODEC OR BUILD_MJ2 OR BUILD_JPIP)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# opj_config.h generation (2/2) # opj_config.h generation (2/2)
CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_configh.cmake.in" CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_config.h.cmake.in"
"${OPENJPEG_BINARY_DIR}/opj_config.h" "${OPENJPEG_BINARY_DIR}/opj_config.h"
@ONLY @ONLY
) )

View File

@ -416,6 +416,55 @@ FOREACH(numFileC1P1 RANGE 1 7)
ENDFOREACH(numFileC1P1) ENDFOREACH(numFileC1P1)
#--------------------------------------------------------------------------
# Tests about JP2 file
# try to decode
# compare to ref file
# non regression comparison
# Tolerances given by Table G.1
FOREACH(numFileJP2 RANGE 1 9)
# Build filenames
SET( filenameInput "file${numFileJP2}.jp2" )
SET( filenameRef jp2_${numFileJP2}.tif )
# Get corresponding tests parameters
list(GET JP2_PEAK_list ${numFileJP2} PEAK_limit)
ADD_TEST(ETS-JP2-${filenameInput}-decode
${EXECUTABLE_OUTPUT_PATH}/j2k_to_image
-i ${INPUT_CONF}/${filenameInput}
-o ${TEMP}/${filenameInput}.tif
)
#
# FIXME: Need to implement a compare tif images function
#
# ADD_TEST(ETS-JP2-${filenameInput}-compare2ref
# ${EXECUTABLE_OUTPUT_PATH}/compareTIFimages
# -b ${BASELINE_CONF}/${filenameRef_tif}
# -t ${TEMP}/${filenameInput}.pgx
# -p 4
# )
#
# SET_TESTS_PROPERTIES(ETS-JP2-${filenameInput}-compare2ref
# PROPERTIES DEPENDS
# ETS-JP2-${filenameInput}-decode)
#
# ADD_TEST(NR-JP2-${filenameInput}-compare2base
# ${EXECUTABLE_OUTPUT_PATH}/compareTIFimages
# -b ${BASELINE_NR}/opj_${filenameRef}
# -t ${TEMP}/${filenameInput}.tif
# -d
# )
#
# SET_TESTS_PROPERTIES(NR-JP2-${filenameInput}-compare2base
# PROPERTIES DEPENDS
# ETS-JP2-${filenameInput}-decode)
ENDFOREACH(numFileJP2)
#--------------------------------------------------------------------------# #--------------------------------------------------------------------------#
#--------------------------------------------------------------------------# #--------------------------------------------------------------------------#
#--------------------------------------------------------------------------# #--------------------------------------------------------------------------#
@ -452,7 +501,7 @@ FOREACH(numFileP0 RANGE 1 16)
PROPERTIES DEPENDS PROPERTIES DEPENDS
NR-${filenameInput}-dump) NR-${filenameInput}-dump)
ENDFOREACH(numFileP0 RANGE 1 16) ENDFOREACH(numFileP0)
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Tests about dump of profile 1 file # Tests about dump of profile 1 file
@ -481,4 +530,33 @@ FOREACH(numFileP1 RANGE 1 7)
PROPERTIES DEPENDS PROPERTIES DEPENDS
NR-${filenameInput}-dump) NR-${filenameInput}-dump)
ENDFOREACH(numFileP1 RANGE 1 7) ENDFOREACH(numFileP1)
#--------------------------------------------------------------------------
# Tests about dump of JP2 file
# try to dump image and codestream informations into a file
# non regression comparison this file to the baseline
FOREACH(numFileJP2 RANGE 1 9)
# Build filenames
SET( filenameInput "file${numFileJP2}.jp2" )
get_filename_component(filenameInputSub ${filenameInput} NAME_WE)
ADD_TEST(NR-${filenameInput}-dump
${EXECUTABLE_OUTPUT_PATH}/j2k_dump
-i ${INPUT_CONF}/${filenameInput}
-o ${TEMP}/${filenameInput}.txt
)
ADD_TEST(NR-${filenameInput}-compare_dump2base
${EXECUTABLE_OUTPUT_PATH}/compare_dump_files
-b ${BASELINE_NR}/opj_${filenameInputSub}.txt
-t ${TEMP}/${filenameInput}.txt
)
SET_TESTS_PROPERTIES(NR-${filenameInput}-compare_dump2base
PROPERTIES DEPENDS
NR-${filenameInput}-dump)
ENDFOREACH(numFileJP2)

View File

@ -6,52 +6,258 @@ SET(TEMP ${CMAKE_CURRENT_BINARY_DIR}/Temporary)
SET(BASELINE_NR ${OPJ_DATA_ROOT}/baseline/nonregression) SET(BASELINE_NR ${OPJ_DATA_ROOT}/baseline/nonregression)
SET(INPUT_NR ${OPJ_DATA_ROOT}/input/nonregression) SET(INPUT_NR ${OPJ_DATA_ROOT}/input/nonregression)
FILE(GLOB_RECURSE OPJ_DATA_NR_LIST SET(INPUT_NR_PATH ${INPUT_NR})
"${INPUT_NR}/*.j2k" SET(TEMP_PATH ${TEMP})
"${INPUT_NR}/*.j2c"
"${INPUT_NR}/*.jp2"
)
# Define a list of file which should be gracefully rejected: # FIXME: should be corectly manage with a find kakadu
SET(BLACKLIST_JPEG200 IF (NOT WIN32)
illegalcolortransform.j2k CONFIGURE_FILE("opj_ref_decode_cmd.sh.in"
) "${CMAKE_CURRENT_BINARY_DIR}/opj_ref_decode_cmd.sh"
@ONLY)
ENDIF (NOT WIN32)
STRING(COMPARE EQUAL ${REF_DECODER_BIN_PATH} "NOTFOUND" REF_DECODER_NOTFOUND)
IF (REF_DECODER_NOTFOUND)
MESSAGE(STATUS "REF_DECODER_BIN_PATH not found, if you want all the encoding tests suite please provide a regular path")
ENDIF (REF_DECODER_NOTFOUND)
FOREACH(filepath ${OPJ_DATA_NR_LIST}) #########################################################################
GET_FILENAME_COMPONENT(filename ${filepath} NAME) # GENERATION OF THE TEST SUITE
GET_FILENAME_COMPONENT(filenameSub ${filename} NAME_WE) # Read one and more input file(s) (located in ${OPJ_DATA_ROOT}/input/nonregression)
STRING(REGEX MATCH ${filename} bad_jpeg2000 ${BLACKLIST_JPEG200}) # to know which files processed and with which options.
ADD_TEST(NR-${filename}-dump # Configure the test suite file:
${EXECUTABLE_OUTPUT_PATH}/j2k_dump CONFIGURE_FILE("test_suite.ctest.in"
-i ${filepath} "${CMAKE_CURRENT_BINARY_DIR}/test_suite.ctest"
-o ${TEMP}/${filename}.txt @ONLY)
)
ADD_TEST(NR-${filename}-decode
${EXECUTABLE_OUTPUT_PATH}/j2k_to_image
-i ${filepath}
-o ${TEMP}/${filename}.pgx
)
IF(bad_jpeg2000) # Read the file into a list
SET_TESTS_PROPERTIES(NR-${filename}-dump FILE(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/test_suite.ctest OPJ_TEST_CMD_LINE_LIST)
PROPERTIES WILL_FAIL TRUE)
SET_TESTS_PROPERTIES(NR-${filename}-decode
PROPERTIES WILL_FAIL TRUE)
ELSE(bad_jpeg2000)
# Only run this test when previous succeeds
ADD_TEST(NR-${filename}-compare_dump2base
${EXECUTABLE_OUTPUT_PATH}/compare_dump_files
-b ${BASELINE_NR}/opj_${filenameSub}.txt
-t ${TEMP}/${filename}.txt
)
SET_TESTS_PROPERTIES(NR-${filename}-compare_dump2base # Try to find and configure and read another test suite file
PROPERTIES DEPENDS FILE(GLOB TEST_SUITE_FILES *.ctest.in)
NR-${filename}-dump) IF (TEST_SUITE_FILES)
FOREACH(TEST_SUITE_FILE ${TEST_SUITE_FILES})
# Avoid to process the official test suite
SET(FILE_ALREADY_READ 0)
STRING(REGEX MATCH "test_suite.ctest.in$" FILE_ALREADY_READ ${TEST_SUITE_FILE})
IF(NOT FILE_ALREADY_READ)
# Configure the additional test suite file:
GET_FILENAME_COMPONENT(TEST_SUITE_FILE_SUB ${TEST_SUITE_FILE} NAME_WE)
CONFIGURE_FILE("${TEST_SUITE_FILE}"
"${CMAKE_CURRENT_BINARY_DIR}/${TEST_SUITE_FILE_SUB}.ctest"
@ONLY)
# Read the additional file into a list
FILE(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/${TEST_SUITE_FILE_SUB}.ctest OPJ_TEST_CMD_LINE_LIST_TEMP)
# Append the list of command
SET(OPJ_TEST_CMD_LINE_LIST ${OPJ_TEST_CMD_LINE_LIST} ${OPJ_TEST_CMD_LINE_LIST_TEMP})
ENDIF(NOT FILE_ALREADY_READ)
ENDIF(bad_jpeg2000) ENDFOREACH(TEST_SUITE_FILE)
ELSE(TEST_SUITE_FILES)
MESSAGE(FATAL_ERROR "One test suite should be available (test_suite.ctest.in) !!!")
ENDIF(TEST_SUITE_FILES)
# Parse the command line found in the file(s)
SET(IT_TEST_ENC 0)
SET(IT_TEST_DEC 0)
FOREACH(OPJ_TEST_CMD_LINE ${OPJ_TEST_CMD_LINE_LIST})
SET(IGNORE_LINE_FOUND 0)
# Replace space by ; to generate a list
STRING(REPLACE " " ";" CMD_ARG_LIST ${OPJ_TEST_CMD_LINE})
# Check if the first argument begin by the comment sign
LIST(GET CMD_ARG_LIST 0 EXE_NAME)
STRING(REGEX MATCH "^#" IGNORE_LINE_FOUND ${EXE_NAME})
IF(IGNORE_LINE_FOUND)
#MESSAGE( STATUS "Current line is ignored: ${OPJ_TEST_CMD_LINE}")
ELSE(IGNORE_LINE_FOUND)
# Check if the first argument begin by the failed sign
SET(FAILED_TEST_FOUND 0)
STRING(REGEX MATCH "^!" FAILED_TEST_FOUND ${EXE_NAME})
IF (FAILED_TEST_FOUND)
# Manage the different cases with the failed sign to remove the first argument which must be image_to_j2k
SET(FAILED_TEST_FOUND_1 0)
STRING(REGEX MATCH "^!image_to_j2k$|^!j2k_to_image$" FAILED_TEST_FOUND_1 ${EXE_NAME})
IF (FAILED_TEST_FOUND_1)
LIST(REMOVE_AT CMD_ARG_LIST 0)
ELSE (FAILED_TEST_FOUND_1)
SET(FAILED_TEST_FOUND_2 0)
LIST(GET CMD_ARG_LIST 1 EXE_NAME)
STRING(REGEX MATCH "^image_to_j2k$|^j2k_to_image$" FAILED_TEST_FOUND_2 ${EXE_NAME})
IF (FAILED_TEST_FOUND_2)
LIST(REMOVE_AT CMD_ARG_LIST 0)
LIST(REMOVE_AT CMD_ARG_LIST 0)
ELSE (FAILED_TEST_FOUND_2)
MESSAGE( FATAL_ERROR "${EXE_NAME} is not the right executable name to encode file (try to use image_to_j2k or j2k_to_image)")
ENDIF (FAILED_TEST_FOUND_2)
ENDIF (FAILED_TEST_FOUND_1)
ELSE (FAILED_TEST_FOUND)
# Check if the first argument is equal to image_to_j2k
STRING(REGEX MATCH "^image_to_j2k$|^j2k_to_image$" EXE_NAME_FOUND ${EXE_NAME})
IF(EXE_NAME_FOUND)
STRING(REGEX MATCH "image_to_j2k" ENC_TEST_FOUND ${EXE_NAME})
ELSE(EXE_NAME_FOUND)
MESSAGE( FATAL_ERROR "${EXE_NAME} is not the right executable name to encode file (try to use image_to_j2k)")
ENDIF(EXE_NAME_FOUND)
LIST(REMOVE_AT CMD_ARG_LIST 0)
ENDIF (FAILED_TEST_FOUND)
# Parse the argument list to find the input filename and output filename
SET(CMD_ARG_LIST_2 "")
SET(ARG_POS 0)
SET(INPUT_ARG_POS 0)
SET(OUTPUT_ARG_POS 0)
FOREACH(CMD_ARG_ELT ${CMD_ARG_LIST})
math(EXPR ARG_POS "${ARG_POS}+1" )
STRING(COMPARE EQUAL ${CMD_ARG_ELT} "-i" INPUT_ARG_FOUND)
IF(INPUT_ARG_FOUND)
SET(INPUT_ARG_POS ${ARG_POS})
SET(INPUT_ARG_FOUND 0)
ENDIF(INPUT_ARG_FOUND)
STRING(COMPARE EQUAL ${CMD_ARG_ELT} "-o" OUTPUT_ARG_FOUND)
IF(OUTPUT_ARG_FOUND)
SET(OUTPUT_ARG_POS ${ARG_POS})
SET(OUTPUT_ARG_FOUND 0)
ENDIF(OUTPUT_ARG_FOUND)
LIST (APPEND CMD_ARG_LIST_2 ${CMD_ARG_ELT})
ENDFOREACH(CMD_ARG_ELT)
LIST(GET CMD_ARG_LIST_2 ${INPUT_ARG_POS} INPUT_FILENAME)
GET_FILENAME_COMPONENT(INPUT_FILENAME_NAME ${INPUT_FILENAME} NAME)
GET_FILENAME_COMPONENT(INPUT_FILENAME_NAME_WE ${INPUT_FILENAME_NAME} NAME_WE)
LIST(GET CMD_ARG_LIST_2 ${OUTPUT_ARG_POS} OUTPUT_FILENAME)
GET_FILENAME_COMPONENT(OUTPUT_FILENAME_NAME_WE ${OUTPUT_FILENAME} NAME_WE)
#-----
# Now we can add the test suite corresponding to a line command in the file
#-----
# ENCODER TEST SUITE
IF(ENC_TEST_FOUND)
math(EXPR IT_TEST_ENC "${IT_TEST_ENC}+1" )
# Encode an image into the jpeg2000 format
ADD_TEST(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode
${EXECUTABLE_OUTPUT_PATH}/image_to_j2k
${CMD_ARG_LIST_2}
)
IF(FAILED_TEST_FOUND)
SET_TESTS_PROPERTIES(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode PROPERTIES WILL_FAIL TRUE)
ELSE(FAILED_TEST_FOUND)
# Dump the encoding file
ADD_TEST(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-dump
${EXECUTABLE_OUTPUT_PATH}/j2k_dump
-i ${OUTPUT_FILENAME}
-o ${OUTPUT_FILENAME}-ENC-${IT_TEST_ENC}.txt
)
SET_TESTS_PROPERTIES(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-dump
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode)
# Compare the dump file with the baseline
ADD_TEST(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dump2base
${EXECUTABLE_OUTPUT_PATH}/compare_dump_files
-b ${BASELINE_NR}/opj_${OUTPUT_FILENAME_NAME_WE}-ENC-${IT_TEST_ENC}.txt
-t ${OUTPUT_FILENAME}-ENC-${IT_TEST_ENC}.txt
)
SET_TESTS_PROPERTIES(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dump2base
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-dump)
# Decode the encoding file with kakadu expand command
IF (NOT REF_DECODER_NOTFOUND)
IF (NOT WIN32)
# Need a bash script to export the path of the kakadu library into PATH
ADD_TEST( NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref
bash ${CMAKE_CURRENT_BINARY_DIR}/opj_ref_decode_cmd.sh
-i ${OUTPUT_FILENAME}
-o ${OUTPUT_FILENAME}.raw
)
ELSE (NOT WIN32)
ADD_TEST(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref
${REF_DECODER_BIN_PATH}/kdu_expand
-i ${OUTPUT_FILENAME}
-o ${OUTPUT_FILENAME}.raw
)
ENDIF (NOT WIN32)
SET_TESTS_PROPERTIES(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode)
# Compare the decoding file with baseline generated from the kdu_expand and baseline.j2k
ADD_TEST(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dec-ref-out2base
${EXECUTABLE_OUTPUT_PATH}/compareRAWimages
-b ${BASELINE_NR}/opj_${OUTPUT_FILENAME_NAME_WE}-ENC-${IT_TEST_ENC}.raw
-t ${OUTPUT_FILENAME}.raw
)
SET_TESTS_PROPERTIES(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dec-ref-out2base
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref)
ENDIF(NOT REF_DECODER_NOTFOUND)
ENDIF(FAILED_TEST_FOUND)
# DECODER TEST SUITE
ELSE(ENC_TEST_FOUND)
math(EXPR IT_TEST_DEC "${IT_TEST_DEC}+1" )
# Decode the input image
ADD_TEST(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode
${EXECUTABLE_OUTPUT_PATH}/j2k_to_image
${CMD_ARG_LIST_2}
)
IF(FAILED_TEST_FOUND)
SET_TESTS_PROPERTIES(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode PROPERTIES WILL_FAIL TRUE)
ELSE(FAILED_TEST_FOUND)
# FIXME: add a compare2base function base on raw which
# can output png diff files if necesary
# ADD_TEST(NR-${filename}-compare2base # ADD_TEST(NR-${filename}-compare2base
# ${EXECUTABLE_OUTPUT_PATH}/comparePGXimages # ${EXECUTABLE_OUTPUT_PATH}/comparePGXimages
# -b ${BASELINE_NR}/opj_${filenameRef} # -b ${BASELINE_NR}/opj_${filenameRef}
@ -63,165 +269,32 @@ FOREACH(filepath ${OPJ_DATA_NR_LIST})
# #
# SET_TESTS_PROPERTIES(NR-${filename}-compare2base # SET_TESTS_PROPERTIES(NR-${filename}-compare2base
# PROPERTIES DEPENDS # PROPERTIES DEPENDS
# NR-${filename}-decode) # NR-${filename}-decode)
# Dump the input image
ADD_TEST(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-dump
${EXECUTABLE_OUTPUT_PATH}/j2k_dump
-i ${INPUT_FILENAME}
-o ${TEMP}/${INPUT_FILENAME_NAME}.txt
)
# Compare the dump output with the baseline
ADD_TEST(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-compare_dump2base
${EXECUTABLE_OUTPUT_PATH}/compare_dump_files
-b ${BASELINE_NR}/opj_${INPUT_FILENAME_NAME_WE}.txt
-t ${TEMP}/${INPUT_FILENAME_NAME}.txt
)
SET_TESTS_PROPERTIES(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-compare_dump2base
PROPERTIES DEPENDS
NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-dump)
ENDFOREACH(filepath)
ENDIF(FAILED_TEST_FOUND)
# TEST ENCODER SUITE
# Read a input file to know which files processed and with which options. ENDIF(ENC_TEST_FOUND)
IF (NOT WIN32)
CONFIGURE_FILE("opj_ref_decode_cmd.sh.in"
"${CMAKE_CURRENT_BINARY_DIR}/opj_ref_decode_cmd.sh"
@ONLY)
ENDIF (NOT WIN32)
string(COMPARE EQUAL ${REF_DECODER_BIN_PATH} "NOTFOUND" REF_DECODER_NOTFOUND) ENDIF(IGNORE_LINE_FOUND)
IF (REF_DECODER_NOTFOUND)
MESSAGE(STATUS "REF_DECODER_BIN_PATH not found, if you want all the encoding tests suite please provide a regular path")
ENDIF (REF_DECODER_NOTFOUND)
# Read the file into a list
FILE(STRINGS encoder_test_suite.txt OPJ_TEST_ENC_CMD_LINE_LIST)
SET(it_test 0)
FOREACH(OPJ_TEST_ENC_CMD_LINE ${OPJ_TEST_ENC_CMD_LINE_LIST})
math(EXPR it_test "${it_test}+1" )
#message(STATUS ${OPJ_TEST_ENC_CMD_LINE})
string(REPLACE " " ";" CMD_ARG_LIST ${OPJ_TEST_ENC_CMD_LINE})
#message(STATUS "list = ${CMD_ARG_LIST}")
list(GET CMD_ARG_LIST 0 EXE_NAME)
string(COMPARE EQUAL ${EXE_NAME} "image_to_j2k" EXE_NAME_FOUND)
IF(EXE_NAME_FOUND)
list(REMOVE_AT CMD_ARG_LIST 0)
ELSE(EXE_NAME_FOUND)
string(COMPARE EQUAL ${EXE_NAME} "#" IGNORE_LINE_FOUND)
IF(IGNORE_LINE_FOUND)
message( STATUS "Current line is ignored: ${OPJ_TEST_ENC_CMD_LINE}")
ELSE(IGNORE_LINE_FOUND)
message( FATAL_ERROR "${EXE_ARG} is not the right executable name to encode file (try to use image_to_j2k)")
ENDIF(IGNORE_LINE_FOUND)
ENDIF(EXE_NAME_FOUND)
IF(NOT IGNORE_LINE_FOUND)
SET(CMD_ARG_LIST_2 "")
SET(ARG_POS 0)
SET(INPUT_ARG_POS 0)
SET(OUTPUT_ARG_POS 0)
FOREACH(CMD_ARG_ELT ${CMD_ARG_LIST})
math(EXPR ARG_POS "${ARG_POS}+1" )
# Will work only with cmake version > 2.8.4
#message(STATUS "${CMD_ARG_ELT}")
#string(FIND "${CMD_ARG_ELT}" "-i input/" INPUT_ARG_FOUND)
#message(STATUS "pos = ${INPUT_ARG_FOUND}")
#IF(INPUT_ARG_FOUND)
# string(SUBSTRING ${CMD_ARG_ELT} INPUT_ARG_FOUND -1 filename_input)
# message(STATUS "filename = ${filename_input}")
#ELSE(INPUT_ARG_FOUND)
# message( FATAL_ERROR "Not found a input image into the list of arguments")
#ENDIF(INPUT_ARG_FOUND)
string(COMPARE EQUAL ${CMD_ARG_ELT} "-i" INPUT_ARG_FOUND)
IF(INPUT_ARG_FOUND)
SET(INPUT_ARG_POS ${ARG_POS})
SET(INPUT_ARG_FOUND 0)
ENDIF(INPUT_ARG_FOUND)
string(COMPARE EQUAL ${CMD_ARG_ELT} "-o" OUTPUT_ARG_FOUND)
IF(OUTPUT_ARG_FOUND)
SET(OUTPUT_ARG_POS ${ARG_POS})
SET(OUTPUT_ARG_FOUND 0)
ENDIF(OUTPUT_ARG_FOUND)
string(REPLACE "input/" "${INPUT_NR}/" CMD_ARG_ELT ${CMD_ARG_ELT})
string(REPLACE "temp/" "${TEMP}/" CMD_ARG_ELT ${CMD_ARG_ELT})
list (APPEND CMD_ARG_LIST_2 ${CMD_ARG_ELT})
ENDFOREACH(CMD_ARG_ELT)
list(GET CMD_ARG_LIST_2 ${INPUT_ARG_POS} INPUT_FILENAME)
get_filename_component(INPUT_FILENAME_NAME ${INPUT_FILENAME} NAME)
list(GET CMD_ARG_LIST_2 ${OUTPUT_ARG_POS} OUTPUT_FILENAME)
get_filename_component(OUTPUT_FILENAME_NAME_WE ${OUTPUT_FILENAME} NAME_WE)
# Encode an image into the jpeg2000 format
ADD_TEST(NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-encode
${EXECUTABLE_OUTPUT_PATH}/${EXE_NAME}
${CMD_ARG_LIST_2}
)
# Dump the encoding file
ADD_TEST(NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-dump
${EXECUTABLE_OUTPUT_PATH}/j2k_dump
-i ${OUTPUT_FILENAME}
-o ${OUTPUT_FILENAME}-ENC-${it_test}.txt
)
SET_TESTS_PROPERTIES(NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-dump
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-encode)
# Compare the dump file with the baseline
ADD_TEST(NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-compare_dump2base
${EXECUTABLE_OUTPUT_PATH}/compare_dump_files
-b ${BASELINE_NR}/opj_${OUTPUT_FILENAME_NAME_WE}-ENC-${it_test}.txt
-t ${OUTPUT_FILENAME}-ENC-${it_test}.txt
)
SET_TESTS_PROPERTIES(NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-compare_dump2base
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-dump)
# Decode the encoding file with kakadu expand command
IF (NOT REF_DECODER_NOTFOUND)
IF (NOT WIN32)
# Need a bash script to export the path of the kakadu library into PATH
ADD_TEST( NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-decode-ref
bash ${CMAKE_CURRENT_BINARY_DIR}/opj_ref_decode_cmd.sh
-i ${OUTPUT_FILENAME}
-o ${OUTPUT_FILENAME}.raw
)
ELSE (NOT WIN32)
ADD_TEST(NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-decode-ref
${REF_DECODER_BIN_PATH}/kdu_expand
-i ${OUTPUT_FILENAME}
-o ${OUTPUT_FILENAME}.raw
)
ENDIF (NOT WIN32)
SET_TESTS_PROPERTIES(NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-decode-ref
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-encode)
# Compare the decoding file with baseline generated from the kdu_expand and baseline.j2k
ADD_TEST(NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-compare_dec-ref-out2base
${EXECUTABLE_OUTPUT_PATH}/compareRAWimages
#-b ${BASELINE_NR}/opj_${OUTPUT_FILENAME_NAME_WE}-ENC-${it_test}.raw
-b ${BASELINE_NR}/opj_${OUTPUT_FILENAME_NAME_WE}-ENC-${it_test}.raw
-t ${OUTPUT_FILENAME}.raw
)
SET_TESTS_PROPERTIES(NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-compare_dec-ref-out2base
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-decode-ref)
ENDIF (NOT REF_DECODER_NOTFOUND)
ENDIF(NOT IGNORE_LINE_FOUND)
ENDFOREACH(OPJ_TEST_ENC_CMD_LINE)
ENDFOREACH(OPJ_TEST_CMD_LINE)

View File

@ -1,14 +0,0 @@
image_to_j2k -i input/Bretagne1.ppm -o temp/Bretagne1_0.j2k -r 200,50,10
image_to_j2k -i input/Bretagne1.ppm -o temp/Bretagne1_1.j2k -q 30,35,40 -n 2
image_to_j2k -i input/Bretagne1.ppm -o temp/Bretagne1_2.j2k -q 30,35,40 -b 16,16 -c [64,64]
image_to_j2k -i input/Bretagne2.ppm -o temp/Bretagne2_0.j2k -c [128,128],[128,128],[128,128] -r 100,20,2 -t 640,480 -b 32,32
image_to_j2k -i input/Bretagne2.ppm -o temp/Bretagne2_1.j2k -t 127,127 -p PCRL
image_to_j2k -i input/Bretagne2.ppm -o temp/Bretagne2_2.j2k -s 2,2 -SOP
image_to_j2k -i input/Bretagne2.ppm -o temp/Bretagne2_3.j2k -EPH -M 38
image_to_j2k -i input/Bretagne2.ppm -o temp/Bretagne2_4.j2k -d 150,300 -r 800
image_to_j2k -i input/Cevennes1.bmp -o temp/Cevennes1.j2k -r 10
image_to_j2k -i input/Cevennes2.ppm -o temp/Cevennes2.jp2 -r 50
image_to_j2k -i input/Rome.bmp -o temp/Rome.jp2 -q 30,35,50 -p LRCP -n 3
# image_to_j2k -i input/X_4_2K_24_185_CBR_WB_000.tif -o temp/X_4_2K_24_185_CBR_WB_000.j2k -cinema2K 24
# image_to_j2k -i input/X_5_2K_24_235_CBR_STEM24_000.tif -o temp/X_5_2K_24_235_CBR_STEM24_000.j2k -cinema2K 24
# image_to_j2k -i input/X_6_2K_24_FULL_CBR_CIRCLE_000.tif -o temp/X_6_2K_24_FULL_CBR_CIRCLE_000.j2k -cinema2K 24

View File

@ -0,0 +1,63 @@
# This file list all the input commands of the tests run by the ctest command which
# are not related to the conformance files.
#
# For each line of this file (exept line which begin with #) an image_to_j2k test or a
# j2k_to_image is run and its related tests.
# + For encoder related tests = dump, compare dump to base, decode the encoded file with
# reference and compare the decoded file with the baseline decoded previously with
# ref decoder.
# + For decoder related tests = dump, compare dump to base, (TODO: compare outpout decoding
# image to base)
#
# Line begin with ! should failed (should be used for bad jpeg2000 file which should be
# gracefully rejected)
#
# You can use @INPUT_NR_PATH@ and @TEMP_PATH@ cmake variable which refers to OPJ_DATA_ROOT
# repository. However you can use relative path or absolute path.
# ENCODER TEST SUITE
image_to_j2k -i @INPUT_NR_PATH@/Bretagne1.ppm -o @TEMP_PATH@/Bretagne1_0.j2k -r 200,50,10
image_to_j2k -i @INPUT_NR_PATH@/Bretagne1.ppm -o @TEMP_PATH@/Bretagne1_1.j2k -q 30,35,40 -n 2
image_to_j2k -i @INPUT_NR_PATH@/Bretagne1.ppm -o @TEMP_PATH@/Bretagne1_2.j2k -q 30,35,40 -b 16,16 -c [64,64]
image_to_j2k -i @INPUT_NR_PATH@/Bretagne2.ppm -o @TEMP_PATH@/Bretagne2_0.j2k -c [128,128],[128,128],[128,128] -r 100,20,2 -t 640,480 -b 32,32
image_to_j2k -i @INPUT_NR_PATH@/Bretagne2.ppm -o @TEMP_PATH@/Bretagne2_1.j2k -t 127,127 -p PCRL
image_to_j2k -i @INPUT_NR_PATH@/Bretagne2.ppm -o @TEMP_PATH@/Bretagne2_2.j2k -s 2,2 -SOP
image_to_j2k -i @INPUT_NR_PATH@/Bretagne2.ppm -o @TEMP_PATH@/Bretagne2_3.j2k -EPH -M 38
image_to_j2k -i @INPUT_NR_PATH@/Bretagne2.ppm -o @TEMP_PATH@/Bretagne2_4.j2k -d 150,300 -r 800
image_to_j2k -i @INPUT_NR_PATH@/Cevennes1.bmp -o @TEMP_PATH@/Cevennes1.j2k -r 10
image_to_j2k -i @INPUT_NR_PATH@/Cevennes2.ppm -o @TEMP_PATH@/Cevennes2.jp2 -r 50
image_to_j2k -i @INPUT_NR_PATH@/Rome.bmp -o @TEMP_PATH@/Rome.jp2 -q 30,35,50 -p LRCP -n 3
image_to_j2k -i @INPUT_NR_PATH@/X_4_2K_24_185_CBR_WB_000.tif -o @TEMP_PATH@/X_4_2K_24_185_CBR_WB_000.j2k -cinema2K 24
image_to_j2k -i @INPUT_NR_PATH@/X_5_2K_24_235_CBR_STEM24_000.tif -o @TEMP_PATH@/X_5_2K_24_235_CBR_STEM24_000.j2k -cinema2K 24
image_to_j2k -i @INPUT_NR_PATH@/X_6_2K_24_FULL_CBR_CIRCLE_000.tif -o @TEMP_PATH@/X_6_2K_24_FULL_CBR_CIRCLE_000.j2k -cinema2K 24
# DECODER TEST SUITE
j2k_to_image -i @INPUT_NR_PATH@/Bretagne2.j2k -o @TEMP_PATH@/Bretagne2.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/_00042.j2k -o @TEMP_PATH@/_00042.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/123.j2c -o @TEMP_PATH@/123.j2c.pgx
j2k_to_image -i @INPUT_NR_PATH@/broken.jp2 -o @TEMP_PATH@/broken.jp2.pgx
j2k_to_image -i @INPUT_NR_PATH@/broken2.jp2 -o @TEMP_PATH@/broken2.jp2.pgx
j2k_to_image -i @INPUT_NR_PATH@/broken3.jp2 -o @TEMP_PATH@/broken3.jp2.pgx
j2k_to_image -i @INPUT_NR_PATH@/broken4.jp2 -o @TEMP_PATH@/broken4.jp2.pgx
j2k_to_image -i @INPUT_NR_PATH@/bug.j2c -o @TEMP_PATH@/bug.j2c.pgx
j2k_to_image -i @INPUT_NR_PATH@/buxI.j2k -o @TEMP_PATH@/buxI.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/buxR.j2k -o @TEMP_PATH@/buxR.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/Cannotreaddatawithnosizeknown.j2k -o @TEMP_PATH@/Cannotreaddatawithnosizeknown.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/cthead1.j2k -o @TEMP_PATH@/cthead1.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/CT_Phillips_JPEG2K_Decompr_Problem.j2k -o @TEMP_PATH@/CT_Phillips_JPEG2K_Decompr_Problem.j2k.pgx
!j2k_to_image -i @INPUT_NR_PATH@/illegalcolortransform.j2k -o @TEMP_PATH@/illegalcolortransform.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/j2k32.j2k -o @TEMP_PATH@/j2k32.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/kakadu_v4-4_openjpegv2_broken.j2k -o @TEMP_PATH@/kakadu_v4-4_openjpegv2_broken.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/MarkerIsNotCompliant.j2k -o @TEMP_PATH@/MarkerIsNotCompliant.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/Marrin.jp2 -o @TEMP_PATH@/Marrin.jp2.pgx
j2k_to_image -i @INPUT_NR_PATH@/merged.jp2 -o @TEMP_PATH@/merged.jp2.pgx
j2k_to_image -i @INPUT_NR_PATH@/movie_00000.j2k -o @TEMP_PATH@/movie_00000.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/movie_00001.j2k -o @TEMP_PATH@/movie_00001.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/movie_00002.j2k -o @TEMP_PATH@/movie_00002.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/orb-blue10-lin-j2k.j2k -o @TEMP_PATH@/orb-blue10-lin-j2k.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/orb-blue10-lin-jp2.jp2 -o @TEMP_PATH@/orb-blue10-lin-jp2.jp2.pgx
j2k_to_image -i @INPUT_NR_PATH@/orb-blue10-win-j2k.j2k -o @TEMP_PATH@/orb-blue10-win-j2k.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/orb-blue10-win-jp2.jp2 -o @TEMP_PATH@/orb-blue10-win-jp2.jp2.pgx
j2k_to_image -i @INPUT_NR_PATH@/relax.jp2 -o @TEMP_PATH@/relax.jp2.pgx
j2k_to_image -i @INPUT_NR_PATH@/test_lossless.j2k -o @TEMP_PATH@/test_lossless.j2k.pgx
j2k_to_image -i @INPUT_NR_PATH@/text_GBR.jp2 -o @TEMP_PATH@/text_GBR.jp2.pgx