Project

General

Profile

Actions

Feature #1104

open

Replace IJG in DCMTK with libjpeg-turbo as an external library

Added by Marco Eichelberg over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2024-01-24
Due date:
% Done:

0%

Estimated time:
Module:
dcmjpeg
Operating System:
Compiler:

Description

The most recent versions (>=3.0.0) of libjpeg-turbo have added support for lossless compression.
To this end, libjpeg-turbo has added new bitwidth-prefixed functions to their API: https://github.com/libjpeg-turbo/libjpeg-turbo/blob/3.0.1/libjpeg.txt#L114

Here is a hacky proof-of-concept patch to enable libjpeg-turbo support in DCMTK: https://github.com/kevle/vcpkg/blob/dcmtk-remove-vendored-jpeg/ports/dcmtk/use_jpeg-turbo.patch
This patch has been tailored for vcpkg, so some changes to the CMake files might not apply to DCMTK build system considerations.

From what I can tell, functional patches made to the original ijg-libjpeg + lossless library DCMTK uses, to properly support DICOM, fall into the following categories:

  • Querying the lossless flag during decompression for color space guessing
  • Inserting SOF1 markers instead of SOF0 markers when using transfer syntax 1.2.840.10008.1.2.4.51 and 8-bit coding
  • Predictor 6 workaround
  • Cornell bug workaround
  • Safety checks using internal libjpeg data structures to determine whether start_compress has already been called

Of those, only the SOF1 marker thing might be difficult to achieve with libjpeg-turbo without modifications upstream. I do not know whether the “Predictor 6” and “Cornell bug” workarounds are still relevant.

Feature request and patch provided 2024-01-23 by Kevin Leonardic <>.

No data to display

Actions

Also available in: Atom PDF