diff --git a/Dockerfile b/Dockerfile index d2ad3aa..1755e7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get -y install unzip RUN apt-get -y install cmake RUN apt-get -y install g++ +RUN apt-get -y install git # set Kakadu distribution version and unique serial number ARG KDU_SOURCE_NAME=v8_2_1-00462N @@ -45,12 +46,29 @@ RUN apt-get install -y libvips-tools # install bc RUN apt-get -y install bc -# Install dependencies: +# Install python dependencies: WORKDIR /usr/src/iiif-htj2k/src RUN apt-get -y install python3-pip COPY ./src/requirements.txt ./ RUN pip install -r ./requirements.txt +# install openjpeg +RUN apt-get -y install libopenjp2-tools + +# upgrade cmake +RUN pip install --upgrade cmake +# update G++ to version 10 +RUN apt-get -y install build-essential +RUN apt install -y gcc-10 g++-10 cpp-10 +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 +# install grok +WORKDIR /usr/src/ +RUN git clone https://github.com/GrokImageCompression/grok.git +WORKDIR /usr/src/grok/build +RUN cmake .. +RUN make +RUN make install + # Copy the repo WORKDIR /usr/src/iiif-htj2k COPY --chmod=755 ./src ./src diff --git a/convert/convert.sh b/convert/convert.sh index 129279a..5faad98 100755 --- a/convert/convert.sh +++ b/convert/convert.sh @@ -22,14 +22,14 @@ format=$3 logs_directory=$4 echo "Input pattern: ${in_ptn}" -number_of_encode_cycle_iterations=10 +number_of_encode_cycle_iterations=3 # setup log files date_for_filename=`date +"%Y-%m-%d-%H-%M-%S_%N"` log_filename="$logs_directory/$format.${date_for_filename}.log.txt" # write header to log file -printf "input_filepath,input_filename,width,height,format," > $log_filename +printf "input_filepath,input_filename,width,height,number_of_components,input_size_in_bytes,format," > $log_filename for encoding_cycle_iteration in $(seq 1 $number_of_encode_cycle_iterations); do printf "encode_time_in_seconds_iteration_%d," $encoding_cycle_iteration >> $log_filename done @@ -42,9 +42,11 @@ for in_path in $in_ptn/*.{tif,TIF}; do echo "Converting $in_fname to $format format..." width=$(vipsheader -f Xsize $in_path) height=$(vipsheader -f Ysize $in_path) + number_of_components=$(vipsheader -f bands $in_path) + uncompressed_file_bytes=$(du -sb ${in_path} | cut -f1) # add initial log entries - printf "%s,%s,%s,%s,%s," $in_path $in_fname $width $height $format >> $log_filename + printf "%s,%s,%s,%s,%s,%s,%s," $in_path $in_fname $width $height $number_of_components $uncompressed_file_bytes $format >> $log_filename # start timer let duration_all_iterations_nanoseconds=0