Skip to content

ENH: Remove old bundled itkjpeg, use only libjpeg-turbo#6153

Merged
blowekamp merged 1 commit intoInsightSoftwareConsortium:mainfrom
blowekamp:dropBundledItkjpeg
May 8, 2026
Merged

ENH: Remove old bundled itkjpeg, use only libjpeg-turbo#6153
blowekamp merged 1 commit intoInsightSoftwareConsortium:mainfrom
blowekamp:dropBundledItkjpeg

Conversation

@blowekamp
Copy link
Copy Markdown
Member

Remove the old bundled libjpeg (JPEG-8b-based) source tree and the
ITK_USE_JPEG_TURBO option. libjpeg-turbo 3.0.4 is now the sole
bundled JPEG implementation. ITK_USE_SYSTEM_JPEG is unchanged.

The ITK_USE_JPEG_TURBO option was ON by default; this change
removes the dead code path and ~37,600 lines of the legacy source tree.

Changes
  • Modules/ThirdParty/JPEG/CMakeLists.txt — removed option(ITK_USE_JPEG_TURBO ...)
  • Modules/ThirdParty/JPEG/src/CMakeLists.txt — replaced if/else with unconditional add_subdirectory(itkjpeg-turbo)
  • Modules/ThirdParty/JPEG/src/itk_jpeg.h.in — simplified three-way include to two-way (system vs. turbo)
  • Modules/ThirdParty/JPEG/src/itkjpeg/ — deleted entire old source directory
AI assistance
  • Tool: GitHub Copilot (Claude Sonnet 4.6)
  • Role: identified all affected files, made edits, wrote commit message
  • Local build verified: cmake --preset release --fresh configured without errors; cmake --build --preset default --target ITKIOJPEG compiled libjpeg-turbo sources and linked successfully

The ITK_USE_JPEG_TURBO option was always ON by default. Remove the
option and the old bundled libjpeg (JPEG-8b-based) source tree.
libjpeg-turbo 3.0.4 is now the sole bundled JPEG implementation.
ITK_USE_SYSTEM_JPEG is unchanged and still supported.
@github-actions github-actions Bot added the type:Enhancement Improvement of existing methods or implementation label Apr 27, 2026
Copy link
Copy Markdown
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When was libjpeg-turbo added? Was it added during 5.x or only after we started 6.0 development?

@blowekamp
Copy link
Copy Markdown
Member Author

When was libjpeg-turbo added? Was it added during 5.x or only after we started 6.0 development?

It was with 8181c07 in Nov 2025. So it has only been with v6.

There is the feature of supporting using both as system libraries, and then maintaining both in the third-party libraries. These can be considered independently.

@blowekamp
Copy link
Copy Markdown
Member Author

@thewtex @hjmjohnson Any thoughts on removing the older, and non-updated jpeg library so we are only maintaining one and distributing libjpeg-turbo?

@thewtex
Copy link
Copy Markdown
Member

thewtex commented May 8, 2026

+1 for just maintaining one, libjpeg-turbo.

@blowekamp blowekamp marked this pull request as ready for review May 8, 2026 20:57
@blowekamp blowekamp merged commit 0c3c0e4 into InsightSoftwareConsortium:main May 8, 2026
13 checks passed
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 8, 2026

Greptile Summary

This PR removes the legacy JPEG-8b bundled source tree (itkjpeg/) and the ITK_USE_JPEG_TURBO CMake option, making libjpeg-turbo 3.0.4 the sole bundled JPEG implementation. The option was already ON by default, so the default build path is unchanged; this change eliminates ~37,600 lines of dead code.

  • CMakeLists.txt: option(ITK_USE_JPEG_TURBO ...) removed; src/CMakeLists.txt collapses to an unconditional add_subdirectory(itkjpeg-turbo).
  • itk_jpeg.h.in: The three-way #ifdef (system / turbo / legacy) is simplified to a two-way (system / turbo) include guard; the #cmakedefine ITK_USE_JPEG_TURBO line is gone.
  • itkjpeg/: All 60 legacy source files are deleted.

Confidence Score: 5/5

Safe to merge — this is a straightforward dead-code removal with no functional change to the default build path.

The ITK_USE_JPEG_TURBO option defaulted to ON, so removing it and unconditionally selecting libjpeg-turbo leaves the default build path identical. All references to ITK_USE_JPEG_TURBO and the legacy itkjpeg/ source tree have been completely excised from the repository. The itk_jpeg.h.in two-way include is correct and simpler than before.

No files require special attention.

Important Files Changed

Filename Overview
Modules/ThirdParty/JPEG/CMakeLists.txt Removes the ITK_USE_JPEG_TURBO option; ITK_USE_SYSTEM_JPEG path is unchanged.
Modules/ThirdParty/JPEG/src/CMakeLists.txt Replaces the if/else block with an unconditional add_subdirectory(itkjpeg-turbo).
Modules/ThirdParty/JPEG/src/itk_jpeg.h.in Removes the ITK_USE_JPEG_TURBO cmakedefine and collapses the three-way include into a clean two-way (system vs turbo) branch.
Modules/ThirdParty/JPEG/src/itkjpeg/CMakeLists.txt Deleted as part of the legacy itkjpeg source tree removal.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[CMake configure ITKJPEG] --> B{ITK_USE_SYSTEM_JPEG?}
    B -- Yes --> C[find_package JPEG\nsystem libjpeg]
    B -- No --> D[add_subdirectory itkjpeg-turbo\nbundled libjpeg-turbo 3.0.4]
    C --> E[itk_jpeg.h: include jpeglib.h / jerror.h]
    D --> F[itk_jpeg.h: include itkjpeg-turbo/jpeglib.h / jerror.h]
Loading

Reviews (1): Last reviewed commit: "ENH: Remove old bundled itkjpeg, use onl..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:Enhancement Improvement of existing methods or implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants