added first version of the encoding tests suite
This commit is contained in:
parent
0c65d2cc0c
commit
7c2feb78d2
3
CHANGES
3
CHANGES
|
@ -5,6 +5,9 @@ What's New for OpenJPEG
|
||||||
! : changed
|
! : changed
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
|
August 30, 2011
|
||||||
|
+ [mickael] added first version of the encoding tests suite
|
||||||
|
|
||||||
August 16, 2011
|
August 16, 2011
|
||||||
+ [antonin] added NEWS, AUTHORS and THANKS files. Cosmetic changes in autotools files.
|
+ [antonin] added NEWS, AUTHORS and THANKS files. Cosmetic changes in autotools files.
|
||||||
- [antonin] removed obsolete testing directory and *.nix files
|
- [antonin] removed obsolete testing directory and *.nix files
|
||||||
|
|
|
@ -243,18 +243,19 @@ IF(BUILD_TESTING)
|
||||||
ENABLE_TESTING()
|
ENABLE_TESTING()
|
||||||
INCLUDE(CTest)
|
INCLUDE(CTest)
|
||||||
|
|
||||||
# Add repository where to find tests
|
|
||||||
ADD_SUBDIRECTORY(tests)
|
|
||||||
|
|
||||||
# Search openjpeg data needed for the tests
|
# Search openjpeg data needed for the tests
|
||||||
# They could be found via svn on the OpenJPEG google code project
|
# They could be found via svn on the OpenJPEG google code project
|
||||||
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
||||||
FIND_PATH(OPJ_DATA_ROOT README-OPJ-Data
|
FIND_PATH(OPJ_DATA_ROOT README-OPJ-Data
|
||||||
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data)
|
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data)
|
||||||
|
|
||||||
SET (REF_DECODER_BIN_PATH "NOT-FOUND" CACHE PATH "Single directory where find the reference encoder binaries to enable encoding test suite.")
|
# For encoding tests we need the path to the ref decoder exe/lib (kakadu)
|
||||||
|
SET (REF_DECODER_BIN_PATH "NOTFOUND" CACHE PATH "Single directory where find the reference decoder binaries to enable encoding test suite.")
|
||||||
MARK_AS_ADVANCED(REF_DECODER_BIN_PATH)
|
MARK_AS_ADVANCED(REF_DECODER_BIN_PATH)
|
||||||
|
|
||||||
|
# Add repository where to find tests
|
||||||
|
ADD_SUBDIRECTORY(tests)
|
||||||
|
|
||||||
ELSE(BUILD_CODEC)
|
ELSE(BUILD_CODEC)
|
||||||
message(FATAL_ERROR "You need build codec to run the tests")
|
message(FATAL_ERROR "You need build codec to run the tests")
|
||||||
ENDIF(BUILD_CODEC)
|
ENDIF(BUILD_CODEC)
|
||||||
|
|
|
@ -66,3 +66,158 @@ FOREACH(filepath ${OPJ_DATA_NR_LIST})
|
||||||
# NR-${filename}-decode)
|
# NR-${filename}-decode)
|
||||||
|
|
||||||
ENDFOREACH(filepath)
|
ENDFOREACH(filepath)
|
||||||
|
|
||||||
|
|
||||||
|
# TEST ENCODER SUITE
|
||||||
|
# Read a input file to know which files processed and with which options.
|
||||||
|
|
||||||
|
IF (NOT WIN32)
|
||||||
|
CONFIGURE_FILE("opj_ref_decode_cmd.sh.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/opj_ref_decode_cmd.sh"
|
||||||
|
@ONLY)
|
||||||
|
ELSE (NOT WIN32)
|
||||||
|
|
||||||
|
CONFIGURE_FILE("opj_ref_decode_cmd.bat.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/opj_ref_decode_cmd.bat"
|
||||||
|
@ONLY)
|
||||||
|
ENDIF (NOT WIN32)
|
||||||
|
|
||||||
|
# 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
|
||||||
|
string(COMPARE EQUAL ${REF_DECODER_BIN_PATH} "NOTFOUND" REF_DECODER_NOTFOUND)
|
||||||
|
|
||||||
|
IF (NOT REF_DECODER_NOTFOUND)
|
||||||
|
IF (NOT WIN32)
|
||||||
|
# Need a bash script to export the path of the kakadu library into PATH
|
||||||
|
ADD_TEST(NAME NR-ENC-${INPUT_FILENAME_NAME}-${it_test}-decode-ref
|
||||||
|
COMMAND sh ${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)
|
||||||
|
ELSE (NOT REF_DECODER_NOTFOUND)
|
||||||
|
MESSAGE(STATUS "REF_DECODER_BIN_PATH not found, if you want all the encoding tests suite please provide a ragular path")
|
||||||
|
ENDIF (NOT REF_DECODER_NOTFOUND)
|
||||||
|
|
||||||
|
# Compare the decoding file with baseline generated from the kdu_expand and baseline.j2k
|
||||||
|
#ADD_TEST(NR-ENC-${it_test}-compare_expand
|
||||||
|
# -b ${BASELINE_NR}/.raw
|
||||||
|
# -t ${TEMP}/${OUTPUT_FILENAME}.raw
|
||||||
|
#)
|
||||||
|
|
||||||
|
ENDIF(NOT IGNORE_LINE_FOUND)
|
||||||
|
|
||||||
|
ENDFOREACH(OPJ_TEST_ENC_CMD_LINE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
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
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
export LD_LIBRARY_PATH="@REF_DECODER_BIN_PATH@"
|
||||||
|
echo run following command: @REF_DECODER_BIN_PATH@/kdu_expand $@
|
||||||
|
@REF_DECODER_BIN_PATH@/kdu_expand $@
|
Loading…
Reference in New Issue