Skip to content

Commit

Permalink
Merge branch 'master' into build_WebP
Browse files Browse the repository at this point in the history
  • Loading branch information
zachlewis committed Sep 17, 2024
2 parents 0d17669 + 9c7f522 commit a8e99c4
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 47 deletions.
38 changes: 38 additions & 0 deletions src/cmake/build_ZLIB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO

######################################################################
# ZLIB by hand!
######################################################################

set_cache (ZLIB_BUILD_VERSION 1.3.1 "ZLIB version for local builds")
set (ZLIB_GIT_REPOSITORY "https://github.com/madler/zlib")
set (ZLIB_GIT_TAG "v${ZLIB_BUILD_VERSION}")

set_cache (ZLIB_BUILD_SHARED_LIBS ${LOCAL_BUILD_SHARED_LIBS_DEFAULT}
DOC "Should execute a local ZLIB build, if necessary, build shared libraries" ADVANCED)

string (MAKE_C_IDENTIFIER ${ZLIB_BUILD_VERSION} ZLIB_VERSION_IDENT)

build_dependency_with_cmake(ZLIB
VERSION ${ZLIB_BUILD_VERSION}
GIT_REPOSITORY ${ZLIB_GIT_REPOSITORY}
GIT_TAG ${ZLIB_GIT_TAG}
CMAKE_ARGS
-D BUILD_SHARED_LIBS=${ZLIB_BUILD_SHARED_LIBS}
-D CMAKE_POSITION_INDEPENDENT_CODE=ON
-D CMAKE_INSTALL_LIBDIR=lib
)

# Set some things up that we'll need for a subsequent find_package to work
set (ZLIB_ROOT ${ZLIB_LOCAL_INSTALL_DIR})

# Signal to caller that we need to find again at the installed location
set (ZLIB_REFIND TRUE)
set (ZLIB_VERSION ${ZLIB_BUILD_VERSION})
set (ZLIB_REFIND_VERSION ${ZLIB_BUILD_VERSION})

if (ZLIB_BUILD_SHARED_LIBS)
install_local_dependency_libs (ZLIB ZLIB)
endif ()
64 changes: 32 additions & 32 deletions testsuite/oiiotool-demosaic/ref/out.txt
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
Computing diff of "testimage_float.exr" vs "result_float_RGGB-linear.exr"
Computing diff of "testimage.exr" vs "result_float_RGGB-linear.exr"
PASS
Computing diff of "testimage_float.exr" vs "result_float_GRBG-linear.exr"
Computing diff of "testimage.exr" vs "result_float_GRBG-linear.exr"
PASS
Computing diff of "testimage_float.exr" vs "result_float_GBRG-linear.exr"
Computing diff of "testimage.exr" vs "result_float_GBRG-linear.exr"
PASS
Computing diff of "testimage_float.exr" vs "result_float_BGGR-linear.exr"
Computing diff of "testimage.exr" vs "result_float_BGGR-linear.exr"
PASS
Computing diff of "testimage_float.exr" vs "result_float_RGGB-MHC.exr"
Computing diff of "testimage.exr" vs "result_float_RGGB-MHC.exr"
PASS
Computing diff of "testimage_float.exr" vs "result_float_GRBG-MHC.exr"
Computing diff of "testimage.exr" vs "result_float_GRBG-MHC.exr"
PASS
Computing diff of "testimage_float.exr" vs "result_float_GBRG-MHC.exr"
Computing diff of "testimage.exr" vs "result_float_GBRG-MHC.exr"
PASS
Computing diff of "testimage_float.exr" vs "result_float_BGGR-MHC.exr"
Computing diff of "testimage.exr" vs "result_float_BGGR-MHC.exr"
PASS
Computing diff of "testimage_half.exr" vs "result_half_RGGB-linear.exr"
Computing diff of "testimage.exr" vs "result_half_RGGB-linear.exr"
PASS
Computing diff of "testimage_half.exr" vs "result_half_GRBG-linear.exr"
Computing diff of "testimage.exr" vs "result_half_GRBG-linear.exr"
PASS
Computing diff of "testimage_half.exr" vs "result_half_GBRG-linear.exr"
Computing diff of "testimage.exr" vs "result_half_GBRG-linear.exr"
PASS
Computing diff of "testimage_half.exr" vs "result_half_BGGR-linear.exr"
Computing diff of "testimage.exr" vs "result_half_BGGR-linear.exr"
PASS
Computing diff of "testimage_half.exr" vs "result_half_RGGB-MHC.exr"
Computing diff of "testimage.exr" vs "result_half_RGGB-MHC.exr"
PASS
Computing diff of "testimage_half.exr" vs "result_half_GRBG-MHC.exr"
Computing diff of "testimage.exr" vs "result_half_GRBG-MHC.exr"
PASS
Computing diff of "testimage_half.exr" vs "result_half_GBRG-MHC.exr"
Computing diff of "testimage.exr" vs "result_half_GBRG-MHC.exr"
PASS
Computing diff of "testimage_half.exr" vs "result_half_BGGR-MHC.exr"
Computing diff of "testimage.exr" vs "result_half_BGGR-MHC.exr"
PASS
Computing diff of "testimage_uint16.tiff" vs "result_uint16_RGGB-linear.tiff"
Computing diff of "testimage.exr" vs "result_uint16_RGGB-linear.tiff"
PASS
Computing diff of "testimage_uint16.tiff" vs "result_uint16_GRBG-linear.tiff"
Computing diff of "testimage.exr" vs "result_uint16_GRBG-linear.tiff"
PASS
Computing diff of "testimage_uint16.tiff" vs "result_uint16_GBRG-linear.tiff"
Computing diff of "testimage.exr" vs "result_uint16_GBRG-linear.tiff"
PASS
Computing diff of "testimage_uint16.tiff" vs "result_uint16_BGGR-linear.tiff"
Computing diff of "testimage.exr" vs "result_uint16_BGGR-linear.tiff"
PASS
Computing diff of "testimage_uint16.tiff" vs "result_uint16_RGGB-MHC.tiff"
Computing diff of "testimage.exr" vs "result_uint16_RGGB-MHC.tiff"
PASS
Computing diff of "testimage_uint16.tiff" vs "result_uint16_GRBG-MHC.tiff"
Computing diff of "testimage.exr" vs "result_uint16_GRBG-MHC.tiff"
PASS
Computing diff of "testimage_uint16.tiff" vs "result_uint16_GBRG-MHC.tiff"
Computing diff of "testimage.exr" vs "result_uint16_GBRG-MHC.tiff"
PASS
Computing diff of "testimage_uint16.tiff" vs "result_uint16_BGGR-MHC.tiff"
Computing diff of "testimage.exr" vs "result_uint16_BGGR-MHC.tiff"
PASS
Computing diff of "testimage_uint8.tiff" vs "result_uint8_RGGB-linear.tiff"
Computing diff of "testimage.exr" vs "result_uint8_RGGB-linear.tiff"
PASS
Computing diff of "testimage_uint8.tiff" vs "result_uint8_GRBG-linear.tiff"
Computing diff of "testimage.exr" vs "result_uint8_GRBG-linear.tiff"
PASS
Computing diff of "testimage_uint8.tiff" vs "result_uint8_GBRG-linear.tiff"
Computing diff of "testimage.exr" vs "result_uint8_GBRG-linear.tiff"
PASS
Computing diff of "testimage_uint8.tiff" vs "result_uint8_BGGR-linear.tiff"
Computing diff of "testimage.exr" vs "result_uint8_BGGR-linear.tiff"
PASS
Computing diff of "testimage_uint8.tiff" vs "result_uint8_RGGB-MHC.tiff"
Computing diff of "testimage.exr" vs "result_uint8_RGGB-MHC.tiff"
PASS
Computing diff of "testimage_uint8.tiff" vs "result_uint8_GRBG-MHC.tiff"
Computing diff of "testimage.exr" vs "result_uint8_GRBG-MHC.tiff"
PASS
Computing diff of "testimage_uint8.tiff" vs "result_uint8_GBRG-MHC.tiff"
Computing diff of "testimage.exr" vs "result_uint8_GBRG-MHC.tiff"
PASS
Computing diff of "testimage_uint8.tiff" vs "result_uint8_BGGR-MHC.tiff"
Computing diff of "testimage.exr" vs "result_uint8_BGGR-MHC.tiff"
PASS
29 changes: 14 additions & 15 deletions testsuite/oiiotool-demosaic/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
"BGGR": make_pattern_BGGR
}

# Create a test image with color gradients
make_testimage = f"--pattern fill:topleft=0,0,1:topright=0,1,0:bottomleft=1,0,1:bottomright=1,1,0 {width}x{height} 3 "


types = [
{
"type" : "float",
Expand All @@ -51,29 +47,32 @@
]


# Create a test image with color gradient
make_testimage = f"--pattern fill:topleft=0,0,1:topright=0,1,0:bottomleft=1,0,1:bottomright=1,1,0 {width}x{height} 3 "
command += oiiotool (make_testimage + f" -o:type=float testimage.exr")

# For each Bayer pattern (RGGB, RGRB, GBRG, BGGR), create an image with that
# pure pattern ({pattern}.exr), then multiply it by the test image and take
# the channel sum to get a Bayer mosaic image ({pattern}-bayer.exr).
# This is somewhat expensive, so we do it only once (for float) and then will
# convert it to the appropriate type upon input.
for pattern, maker in layouts.items():
command += oiiotool (f"{maker} -o:type=float pattern_{pattern}.exr testimage.exr -mul -chsum -o:type=float bayer_{pattern}.exr")


for dict in types:

type = dict["type"]
ext = dict["ext"]
threshold = dict["threshold"]

command += oiiotool (make_testimage + f" -o:type={type} testimage_{type}.{ext}")

# For each Bayer pattern (RGGB, RGRB, GBRG, BGGR), create an image with that
# pure pattern ({pattern}.exr), then multiply it by the test image and take
# the channel sum to get a Bayer mosaic image ({pattern}-bayer.exr).
for pattern, maker in layouts.items():
command += oiiotool (f"{maker} -o:type={type} pattern_{type}_{pattern}.{ext} testimage_{type}.{ext} -mul -chsum -o:type={type} bayer_{type}_{pattern}.{ext}")

test = f" --fail {threshold} --hardfail {threshold} --warn {threshold} --diff "


# For each algorithm, try demosaicing each pattern test image and compare to
# the original test image.
for algo in ['linear', 'MHC']:
for pattern, maker in layouts.items():
command += oiiotool (f"-i:type={type} testimage_{type}.{ext} -i:type={type} bayer_{type}_{pattern}.{ext} --demosaic:algorithm={algo}:layout={pattern} -o:type={type} result_{type}_{pattern}-{algo}.{ext} ")
command += oiiotool (f"-i:type={type} testimage.exr -i:type={type} bayer_{pattern}.exr --demosaic:algorithm={algo}:layout={pattern} -o:type={type} result_{type}_{pattern}-{algo}.{ext} ")

crop = 2

Expand All @@ -82,4 +81,4 @@
else:
cut_cmd = ""

command += oiiotool (f"testimage_{type}.{ext} " + cut_cmd + f"result_{type}_{pattern}-{algo}.{ext} " + cut_cmd + test)
command += oiiotool (f"testimage.exr " + cut_cmd + f"result_{type}_{pattern}-{algo}.{ext} " + cut_cmd + test)

0 comments on commit a8e99c4

Please sign in to comment.