Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add grok/openjpeg to docker, add uncompressed bytes to results CSV #9

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions convert/convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down