Skip to content
Merged
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
13 changes: 12 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,15 @@
path = dependencies/DirectX-Headers
url = https://github.com/Tom94/DirectX-Headers
shallow = true

[submodule "dependencies/KTX-Software"]
path = dependencies/KTX-Software
url = https://github.com/Tom94/KTX-Software
shallow = true
[submodule "dependencies/bcdec"]
path = dependencies/bcdec
url = https://github.com/Tom94/bcdec
shallow = true
[submodule "dependencies/etcdec"]
path = dependencies/etcdec
url = https://github.com/Tom94/etcdec
shallow = true
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ set(TEV_SOURCES
include/tev/imageio/JpegTurboImageLoader.h src/imageio/JpegTurboImageLoader.cpp
include/tev/imageio/JpegTurboImageSaver.h src/imageio/JpegTurboImageSaver.cpp
include/tev/imageio/JxrImageLoader.h src/imageio/JxrImageLoader.cpp
include/tev/imageio/KtxImageLoader.h src/imageio/KtxImageLoader.cpp
include/tev/imageio/PfmImageLoader.h src/imageio/PfmImageLoader.cpp
include/tev/imageio/PngImageLoader.h src/imageio/PngImageLoader.cpp
include/tev/imageio/PngImageSaver.h src/imageio/PngImageSaver.cpp
Expand Down Expand Up @@ -276,7 +277,7 @@ endif()

target_compile_definitions(tev PRIVATE ${TEV_DEFINITIONS})

set(TEV_LIBS cfitsio clip exif_static gdcm-tev JPEG::JPEG jxrglue libraw::libraw_r nanogui OpenEXR::OpenEXR openjpeg-tev png_static tiff webpdemux XMPCore xsimd)
set(TEV_LIBS cfitsio clip exif_static gdcm-tev JPEG::JPEG jxrglue ktx_read libraw::libraw_r nanogui OpenEXR::OpenEXR openjpeg-tev png_static tiff webpdemux XMPCore xsimd)
if (MSVC)
list(APPEND TEV_LIBS wsock32 ws2_32)
endif()
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ $ cpack --config build/CPackConfig.cmake
- __PFM__, PAM, PNM, PBM, PGM, PPM (generally: see [NetPBM](https://netpbm.sourceforge.net/) and [PFM](https://www.pauldebevec.com/Research/HDR/PFM/))
- __QOI__ (via [qoi](https://github.com/phoboslab/qoi))
- __DDS__ (via [DirectXTex](https://github.com/microsoft/DirectXTex))
- __KTX2__, __KTX__ (via [KTX-Software](https://github.com/KhronosGroup/KTX-Software), [bcdec](https://github.com/iOrange/bcdec), and [encdec](https://github.com/iOrange/etcdec))
- __WEBP__ (via [libwebp](https://chromium.googlesource.com/webm/libwebp))
- __TIFF__, __DNG__ (via [libtiff](https://gitlab.com/libtiff/libtiff))
- __AVIF__ (including gain maps, e.g. HDR pictures from Android; via [dav1d](https://github.com/videolan/dav1d)+[libheif](https://github.com/strukturag/libheif))
Expand Down
25 changes: 25 additions & 0 deletions dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,31 @@ target_include_directories(gdcm-tev INTERFACE ${GDCM_INCLUDE_PATH})
# Compile jxrlib for JPEG XR support
add_subdirectory(jxrlib EXCLUDE_FROM_ALL)

# Compile KTX-Software for KTX2 support
set(BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
set(KTX_FEATURE_JS OFF CACHE BOOL " " FORCE)
set(KTX_FEATURE_TESTS OFF CACHE BOOL " " FORCE)
set(KTX_FEATURE_TOOLS OFF CACHE BOOL " " FORCE)
set(LIBKTX_VERSION_READ_ONLY ON CACHE BOOL " " FORCE)
set(LIBKTX_VERSION_FULL OFF CACHE BOOL " " FORCE)
set(LIBKTX_FEATURE_KTX1 ON CACHE BOOL " " FORCE)
set(LIBKTX_FEATURE_KTX2 ON CACHE BOOL " " FORCE)
set(LIBKTX_FEATURE_VK_UPLOAD OFF CACHE BOOL " " FORCE)
set(LIBKTX_FEATURE_GL_UPLOAD OFF CACHE BOOL " " FORCE)
set(LIBKTX_FEATURE_ETC_UNPACK ON CACHE BOOL " " FORCE)

if (HAS_SSE2)
if (APPLE)
# Since we're targeting macOS 10.15 and later, Intel macOS always has SSE4.1
set(ASTCENC_ISA_SSE41 ON)
else()
# Otherwise, assume only SSE2, *not* ASTENC's default of AVX2 on Intel platforms
set(ASTCENC_ISA_SSE2 ON)
endif()
endif()

add_subdirectory(KTX-Software EXCLUDE_FROM_ALL)

# Cross-platform SIMD
set(XSIMD_SKIP_INSTALL ON CACHE BOOL " " FORCE)
add_subdirectory(xsimd EXCLUDE_FROM_ALL)
1 change: 1 addition & 0 deletions dependencies/KTX-Software
Submodule KTX-Software added at ab47ac
1 change: 1 addition & 0 deletions dependencies/bcdec
Submodule bcdec added at 80859e
1 change: 1 addition & 0 deletions dependencies/etcdec
Submodule etcdec added at 972875
35 changes: 35 additions & 0 deletions include/tev/imageio/KtxImageLoader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* tev -- the EDR viewer
*
* Copyright (C) 2026 Thomas Müller <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include <tev/Image.h>
#include <tev/imageio/ImageLoader.h>

namespace tev {

class KtxImageLoader final : public ImageLoader {
public:
Task<std::vector<ImageData>> load(
std::istringstream& iStream, const fs::path& path, std::string_view channelSelector, const ImageLoaderSettings& settings, int priority
) const override;

std::string name() const override { return "KTX"; }
};

} // namespace tev
3 changes: 3 additions & 0 deletions src/HelpWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ HelpWindow::HelpWindow(Widget* parent, weak_ptr<Ipc> weakIpc, function<void()> c
addSpacer(about, 20);

addLibrary(about, "args", "Single-header argument parsing library");
addLibrary(about, "bcdec", "Single-header BC1-BC7 decoder library");
addLibrary(about, "cfitsio", "FITS data file library");
addLibrary(about, "clip", "Cross-platform clipboard library");
addLibrary(about, "concurrentqueue", "Cross-platform lightweight semaphore");
Expand All @@ -242,10 +243,12 @@ HelpWindow::HelpWindow(Widget* parent, weak_ptr<Ipc> weakIpc, function<void()> c
addLibrary(about, "DirectXMath", "DirectX math library");
addLibrary(about, "DirectX-Headers", "DirectX headers");
#endif
addLibrary(about, "etcdec", "Single-header ETC/EAC decoder library");
addLibrary(about, "GDCM", "Grassroots library for DICOM medical files");
addLibrary(about, "Glad", "Multi-language GL loader-generator");
addLibrary(about, "GLFW", "OpenGL desktop development library");
addLibrary(about, "jxrlib", "JPEG XR image format library");
addLibrary(about, "KTX-Software", "KTX (Khronos texture) library");
#ifdef TEV_SUPPORT_HEIC
addLibrary(about, "libde265", "Open h.265 video codec library");
#endif
Expand Down
1 change: 1 addition & 0 deletions src/ImageViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2437,6 +2437,7 @@ void ImageViewer::openImageDialog() {
{"jpeg,jpg", "JPEG image" },
{"jxl", "JPEG XL image" },
{"jxr,hdp,wdp", "JPEG XR image" },
{"ktx,ktx2", "Khronos texture" },
{"pam,pbm,pfm,pgm,pnm,ppm", "Portable *Map image" },
{"pic", "PIC image" },
{"png", "Portable Network Graphics image" },
Expand Down
4 changes: 4 additions & 0 deletions src/imageio/ImageLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <tev/imageio/Jpeg2000ImageLoader.h>
#include <tev/imageio/JpegTurboImageLoader.h>
#include <tev/imageio/JxrImageLoader.h>
#include <tev/imageio/KtxImageLoader.h>
#include <tev/imageio/PfmImageLoader.h>
#include <tev/imageio/PngImageLoader.h>
#include <tev/imageio/QoiImageLoader.h>
Expand Down Expand Up @@ -68,6 +69,7 @@ const vector<unique_ptr<ImageLoader>>& ImageLoader::getLoaders() {
#ifdef TEV_SUPPORT_JXL
imageLoaders.emplace_back(new JxlImageLoader());
#endif
imageLoaders.emplace_back(new KtxImageLoader());
imageLoaders.emplace_back(new FitsImageLoader());
imageLoaders.emplace_back(new QoiImageLoader());
imageLoaders.emplace_back(new WebpImageLoader());
Expand Down Expand Up @@ -108,6 +110,8 @@ const vector<string_view>& ImageLoader::supportedMimeTypes() {
"image/jpeg",
"image/jxl",
"image/jxr",
"image/ktx",
"image/ktx2",
"image/png",
"image/qoi",
"image/tga",
Expand Down
Loading
Loading