Skip to content

Commit 270c9b0

Browse files
committed
add basic jxl encoder&decoder
1 parent 1d8cf2a commit 270c9b0

File tree

7 files changed

+608
-13
lines changed

7 files changed

+608
-13
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
jobs:
88
build:
99
strategy:
10+
fail-fast: false
1011
matrix:
1112
include:
1213
- os: win32
@@ -25,7 +26,7 @@ jobs:
2526
run: |
2627
md build
2728
cd build
28-
cmake .. -G "Visual Studio 17 2022" -A ${{ matrix.cos }} -DAWK=off
29+
cmake .. -G "Visual Studio 17 2022" -A ${{ matrix.cos }} -DCMAKE_MSVC_RUNTIME_LIBRARY="$<$<NOT:$<CONFIG:Debug>>:MultiThreaded>"
2930
cmake --build . --config Release
3031
move Release\*.dll .
3132
move plugin\Release\*.${{ matrix.ext }} .

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ ENDIF()
3838
OPTION(QT_PLUGIN "Build QT plugin" OFF)
3939
OPTION(CONV_TEST "Build a simple convert test program" OFF)
4040

41+
SET(AWK OFF)
4142
SET(BUILD_SHARED_LIBS OFF)
4243
SET(WITH_GTEST OFF)
4344
SET(ZLIB_ENABLE_TESTS OFF)
@@ -93,7 +94,7 @@ ADD_SUBDIRECTORY(${3RDPARTY_DIR}/libtiff)
9394
ADD_SUBDIRECTORY(${3RDPARTY_DIR}/libwebp)
9495
ADD_SUBDIRECTORY(${3RDPARTY_DIR}/libjxl)
9596

96-
TARGET_LINK_LIBRARIES(freeimage libjxr zlibstatic png_static jpegli-static jpegli-libjpeg-obj libtiff webpdecoder webp libwebpmux webpdemux)
97+
TARGET_LINK_LIBRARIES(freeimage libjxr zlibstatic png_static jpegli-static jpegli-libjpeg-obj libtiff webpdecoder webp libwebpmux webpdemux jxl jxl_threads)
9798

9899
INCLUDE_DIRECTORIES(
99100
${PROJECT_DIR}
@@ -109,6 +110,7 @@ INCLUDE_DIRECTORIES(
109110
${3RDPARTY_DIR}/libwebp/src
110111
${CMAKE_BINARY_DIR}/3rdparty/zlib-ng
111112
${CMAKE_BINARY_DIR}/3rdparty/libpng
113+
${CMAKE_BINARY_DIR}/3rdparty/libjxl/lib/include
112114
${CMAKE_BINARY_DIR}/3rdparty/libjxl/lib/include/jpegli
113115
${CMAKE_BINARY_DIR}/3rdparty/libtiff
114116
)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
|libjxl 0.11.1|https://github.com/libjxl/libjxl|
2222

2323
## 3rd Parties CMakeLists.txt Modification
24-
libpng - include zlib-ng directory
24+
libpng - include zlib-ng directory
2525
libjxl - remove add_subdirectory(tools) | third-party find lcms2 | jpegli.cmake allow win32 JPEGXL_ENABLE_JPEGLI_LIBJPEG and configure_file
2626

2727
# Windows Context Menu Previewer

src/FreeImage.h

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,14 @@ FI_ENUM(FREE_IMAGE_FORMAT) {
376376
FIF_GIF = 3,
377377
FIF_TARGA = 4,
378378
FIF_WEBP = 5,
379-
FIF_JXR = 6,
380-
FIF_TIFF = 7,
381-
FIF_PSD = 8,
382-
FIF_ICO = 9,
383-
FIF_DDS = 10,
384-
FIF_HDR = 11,
385-
FIF_PNM = 12
379+
FIF_JXL = 6,
380+
FIF_JXR = 7,
381+
FIF_TIFF = 8,
382+
FIF_PSD = 9,
383+
FIF_ICO = 10,
384+
FIF_DDS = 11,
385+
FIF_HDR = 12,
386+
FIF_PNM = 13
386387
};
387388

388389
/** Image type used in FreeImage.
@@ -593,8 +594,8 @@ typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id);
593594
#define PNG_IGNOREGAMMA 1 // loading: avoid gamma correction
594595
#define PNG_INTERLACED 0x0200 // save using Adam7 interlacing (use | to combine with other save flags)
595596
#define PNM_DEFAULT 0
596-
#define PNM_SAVE_RAW 0 //! if set the writer saves in RAW format (i.e. P4, P5 or P6)
597-
#define PNM_SAVE_ASCII 1 //! if set the writer saves in ASCII format (i.e. P1, P2 or P3)
597+
#define PNM_SAVE_RAW 0 //! if set the writer saves in RAW format (i.e. P4, P5 or P6)
598+
#define PNM_SAVE_ASCII 1 //! if set the writer saves in ASCII format (i.e. P1, P2 or P3)
598599
#define PSD_DEFAULT 0
599600
#define PSD_NONE 0x0100 // save without any compression
600601
#define PSD_RLE 0x0200 // save using RLE compression
@@ -617,8 +618,14 @@ typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id);
617618
#define JXR_PROGRESSIVE 0x4000 // save as a progressive-JXR (use | to combine with other save flags)
618619
#define WEBP_DEFAULT 0 // save with quality 75 & 4:2:0
619620
#define WEBP_LOSSLESS 100 // save lossless vp8 photo
620-
#define WEBP_SHARPYUV 0x0100 // use sharper (and slower) RGB->YUV conversion for vp8 photo
621+
#define WEBP_SHARPYUV 0x0100 // use sharper (and slower) RGB->YUV conversion for vp8 photo
621622
#define DDS_DEFAULT 0
623+
#define JXL_DEFAULT 0 // save with quality 90, use 12bit depth for hdr image
624+
#define JXL_LOSSLESS 100 // save lossless jpeg-xl
625+
#define JXL_BITDEPTH_10 0x0100 // save jpeg-xl with 10bit depth for hdr image
626+
#define JXL_BITDEPTH_12 0x0200 // save jpeg-xl with 12bit depth for hdr image
627+
#define JXL_BITDEPTH_16 0x0400 // save jpeg-xl with 16bit depth for hdr image
628+
#define JXL_BITDEPTH_32 0x0800 // save jpeg-xl with 32bit depth for hdr image
622629

623630
// Background filling options ---------------------------------------------------------
624631
// Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas

src/FreeImage/Plugin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ FreeImage_Initialise(BOOL load_local_plugins_only) {
238238
s_plugins->AddNode(InitGIF);
239239
s_plugins->AddNode(InitTARGA);
240240
s_plugins->AddNode(InitWEBP);
241+
s_plugins->AddNode(InitJXL);
241242
s_plugins->AddNode(InitJXR);
242243
s_plugins->AddNode(InitTIFF);
243244
s_plugins->AddNode(InitPSD);

0 commit comments

Comments
 (0)