Project

General

Profile

Actions

Bug #1160

closed

dcmcjpls generates an invalid JPEG-LS bitstream with signed pixel data in cooked mode

Added by Marco Eichelberg 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Category:
Library and Apps
Target version:
-
Start date:
2025-06-13
Due date:
% Done:

100%

Estimated time:
2:00 h
Module:
dcmjpls
Operating System:
Compiler:

Description

The dcmcjpls generates an invalid JPEG-LS bitstream when compressing images that contain signed pixel data (i.e. PhotometricInterpretation=1) when the tool operates in the "cooked mode" (command line option --prefer-cooked), which is not the default, and the number of bits per sample (i.e. BitsStored) is not 8 or 16.

The issue is likely caused by the way DCMTK passes negative numbers to the JPEG-LS encoder: DCMTK extends the sign bit to the full 8-bit or 16-bit structure (i.e. represents a 13-bit number with the value -1 as 0xFFFF), whereas the CharLS library apparently requires the unused bits to be zeroed, i.e. a 13-bit number with value -1 to be passed as 0x1FFF.

Reported 2025-06-12 by Mathieu Malaterre <>

Actions

Also available in: Atom PDF