Skip to content

Commit

Permalink
update docker, simplify cmake for exr support
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldsmith committed Nov 22, 2024
1 parent 2fd7871 commit aadf57e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 50 deletions.
43 changes: 23 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y install cmake
RUN apt-get -y install g++
RUN apt-get -y install git
RUN apt-get -y install valgrind

# install optional openjph dependencies
RUN apt-get -y install libtiff-dev
#RUN apt-get -y install libopenexr-dev
#RUN apt-get -y install libilmbase-dev
RUN apt-get -y install libopenexr-dev

# install development debugging tools
RUN apt-get -y install valgrind

######### build/install openexr from source
# WORKDIR /usr/src/
Expand All @@ -23,30 +25,31 @@ RUN apt-get -y install valgrind
# RUN make
# RUN make install

WORKDIR /usr/src/
RUN git clone https://github.com/AcademySoftwareFoundation/Imath.git
WORKDIR /usr/src/Imath/build
RUN cmake ..
RUN make
RUN make install
# WORKDIR /usr/src/
# RUN git clone https://github.com/AcademySoftwareFoundation/Imath.git
# WORKDIR /usr/src/Imath/build
# RUN cmake ..
# RUN make
# RUN make install

WORKDIR /usr/src/
RUN git clone https://github.com/AcademySoftwareFoundation/openexr.git
WORKDIR /usr/src/openexr
#RUN git checkout RB-3.1
WORKDIR /usr/src/openexr/build
RUN cmake .. -DBUILD_TESTING=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF
RUN make
RUN make install
# WORKDIR /usr/src/
# RUN git clone https://github.com/AcademySoftwareFoundation/openexr.git
# WORKDIR /usr/src/openexr
# #RUN git checkout RB-3.1
# WORKDIR /usr/src/openexr/build
# RUN cmake .. -DBUILD_TESTING=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF
# RUN make
# RUN make install

# OpenJPH
WORKDIR /usr/src/openjph/
COPY . .
WORKDIR /usr/src/openjph/build
RUN rm -R * || true
# RUN cmake -DCMAKE_BUILD_TYPE=Release ../
# RUN make
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/src/openjph/bin
RUN cmake -DCMAKE_BUILD_TYPE=Release ../
RUN make
RUN make install
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/src/openjph/bin;/usr/local/lib/
ENV PATH=$PATH:/usr/src/openjph/bin

# finalize docker environment
Expand Down
64 changes: 41 additions & 23 deletions src/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,53 @@ endif()
############################################################
if( OJPH_ENABLE_OPENEXR_SUPPORT )

FIND_PACKAGE( Imath )

if( Imath_FOUND )
message(STATUS "Found Imath ${Imath_VERSION}")
message(STATUS " Imath_INCLUDE_DIR = ${Imath_INCLUDE_DIR}")
message(STATUS " Imath_INCLUDE_DIRS = ${Imath_INCLUDE_DIRS}")
message(STATUS " Imath_LIBRARY = ${Imath_LIBRARY}")
message(STATUS " Imath_LIBRARIES = ${Imath_LIBRARIES}")
include_directories( ${Imath_INCLUDE_DIR} )
else()
message(STATUS "Imath support has been enabled but no path to the Imath library "
"has been specified; please configure with -DCMAKE_PREFIX_PATH=<Imath library directory>, "
"or disable OpenEXR support using -DOJPH_ENABLE_OPENEXR_SUPPORT=OFF.")
endif( Imath_FOUND )
# FIND_PACKAGE( Imath )

# if( Imath_FOUND )
# message(STATUS "Found Imath ${Imath_VERSION}")
# message(STATUS " Imath_INCLUDE_DIR = ${Imath_INCLUDE_DIR}")
# message(STATUS " Imath_INCLUDE_DIRS = ${Imath_INCLUDE_DIRS}")
# message(STATUS " Imath_LIBRARY = ${Imath_LIBRARY}")
# message(STATUS " Imath_LIBRARIES = ${Imath_LIBRARIES}")
# include_directories( ${Imath_INCLUDE_DIR} )
# else()
# message(STATUS "Imath support has been enabled but no path to the Imath library "
# "has been specified; please configure with -DCMAKE_PREFIX_PATH=<Imath library directory>, "
# "or disable OpenEXR support using -DOJPH_ENABLE_OPENEXR_SUPPORT=OFF.")
# endif( Imath_FOUND )

# FIND_PACKAGE( OpenEXR )

FIND_PACKAGE( OpenEXR )
# if( OpenEXR_FOUND )
# message(STATUS "Found OpenEXR ${OpenEXR_VERSION}")
# message(STATUS " OpenEXR_INCLUDE_DIR = ${OpenEXR_INCLUDE_DIR}")
# message(STATUS " OpenEXR_INCLUDE_DIRS = ${OpenEXR_INCLUDE_DIRS}")
# set(USE_OPENEXR TRUE CACHE BOOL "Add OpenEXR support")
# include_directories( ${OpenEXR_INCLUDE_DIRS} )
# add_definitions(-DOJPH_ENABLE_OPENEXR_SUPPORT)
# else()
# message(STATUS "OpenEXR support has been enabled but no path to the OpenEXR library "
# "has been specified; please configure with -DCMAKE_PREFIX_PATH=<OpenEXR library directory>, "
# "or disable OpenEXR support using -DOJPH_ENABLE_OPENEXR_SUPPORT=OFF.")
# endif( OpenEXR_FOUND )

if( OpenEXR_FOUND )
find_package(OpenEXR 3 CONFIG QUIET)
if(OpenEXR_FOUND)
message(STATUS "Found OpenEXR ${OpenEXR_VERSION}")
message(STATUS " OpenEXR_INCLUDE_DIR = ${OpenEXR_INCLUDE_DIR}")
message(STATUS " OpenEXR_INCLUDE_DIRS = ${OpenEXR_INCLUDE_DIRS}")
set(USE_OPENEXR TRUE CACHE BOOL "Add OpenEXR support")
include_directories( ${OpenEXR_INCLUDE_DIRS} )
add_definitions(-DOJPH_ENABLE_OPENEXR_SUPPORT)
else()
message(STATUS "OpenEXR support has been enabled but no path to the OpenEXR library "
"has been specified; please configure with -DCMAKE_PREFIX_PATH=<OpenEXR library directory>, "
"or disable OpenEXR support using -DOJPH_ENABLE_OPENEXR_SUPPORT=OFF.")
endif( OpenEXR_FOUND )
find_package(IlmBase REQUIRED)
if(IlmBase_FOUND)
message(STATUS "Found IlmBase ${IlmBase_VERSION}")
endif()
find_package(OpenEXR 2 REQUIRED)
if(OpenEXR_FOUND)
message(STATUS "Found OpenEXR ${OpenEXR_VERSION}")
set(USE_OPENEXR TRUE CACHE BOOL "Add OpenEXR support")
add_definitions(-DOJPH_ENABLE_OPENEXR_SUPPORT)
endif()
endif()

endif()
############################################################
Expand Down
1 change: 0 additions & 1 deletion src/apps/ojph_expand/ojph_expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ int main(int argc, char *argv[]) {
"The file has %d color components; this cannot be saved to"
" .exr file (currently only 3 and 4 components are supported).\n",
siz.get_num_components());
bool is_signed = siz.is_signed(0);
ojph::ui32 width = siz.get_recon_width(0);
ojph::ui32 height = siz.get_recon_height(0);
ojph::ui32 bit_depth = siz.get_bit_depth(0);
Expand Down
13 changes: 7 additions & 6 deletions src/apps/others/ojph_img_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2340,25 +2340,25 @@ namespace ojph {
case 0:
for (ui32 i = 0; i < width; i++)
{
pixels[cur_line][i].r.setBits(line->i32[i]);
pixels[cur_line][i].r.setBits((si16)line->i32[i]);
}
break;
case 1:
for (ui32 i = 0; i < width; i++)
{
pixels[cur_line][i].g.setBits(line->i32[i]);
pixels[cur_line][i].g.setBits((si16)line->i32[i]);
}
break;
case 2:
for (ui32 i = 0; i < width; i++)
{
pixels[cur_line][i].b.setBits(line->i32[i]);
pixels[cur_line][i].b.setBits((si16)line->i32[i]);
}
break;
case 3:
for (ui32 i = 0; i < width; i++)
{
pixels[cur_line][i].a.setBits(line->i32[i]);
pixels[cur_line][i].a.setBits((si16)line->i32[i]);
}
break;
default:
Expand All @@ -2378,7 +2378,7 @@ namespace ojph {
{
if (true == is_open)
{
Imf::RgbaOutputFile* file;
Imf::RgbaOutputFile* file = NULL;
if (num_components == 4)
file = new Imf::RgbaOutputFile(fname, width, height, Imf::WRITE_RGBA);
else if (num_components == 3)
Expand All @@ -2390,7 +2390,8 @@ namespace ojph {
file->setFrameBuffer(&pixels[0][0], 1, width);
file->writePixels(height);

delete file;
if( NULL != file )
delete file;
}

fname = NULL;
Expand Down

0 comments on commit aadf57e

Please sign in to comment.