Bogus Huffman table definition
Moderator: Moderator Team
Bogus Huffman table definition
Hi,
I tried converting a DICOM image.
The details of the DICOM Image is as below
The transfersyntax is EXS_JPEGProcess14TransferSyntax
the dataset->chooseRepresentation(EXS_LittleEndianExplicit, NULL);
throws an error string "Bogus Huffman table definition". can any one help me sorting out this issue
I tried converting a DICOM image.
The details of the DICOM Image is as below
The transfersyntax is EXS_JPEGProcess14TransferSyntax
the dataset->chooseRepresentation(EXS_LittleEndianExplicit, NULL);
throws an error string "Bogus Huffman table definition". can any one help me sorting out this issue
Last edited by ajan_p on Thu, 2011-09-29, 06:15, edited 1 time in total.
Thanks & Warm Regards,
Ajan
Ajan
-
- DCMTK Developer
- Posts: 2512
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Issue sorted out
The issue was sorted out by a change in the source code of dcmjpeg library.
Thanks & Warm Regards,
Ajan
Ajan
-
- DCMTK Developer
- Posts: 2512
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
-
- DCMTK Developer
- Posts: 2512
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Last edited by ajan_p on Fri, 2011-09-23, 09:37, edited 1 time in total.
Thanks & Warm Regards,
Ajan
Ajan
-
- DCMTK Developer
- Posts: 2512
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Thank you. I guess you are referring to the following patch, right?
If I interpret the comment correctly, Philips is doing something wrong with their MRI images, don't you agree?
Code: Select all
Index: jdhuff.c
===================================================================
RCS file: /cvs/public/gdcm/src/jpeg/libijg8/jdhuff.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 jdhuff.c
--- jdhuff.c 24 Jun 2003 10:09:48 -0000 1.1
+++ jdhuff.c 7 Oct 2004 02:29:43 -0000
@@ -259,8 +259,11 @@ jpeg_make_d_derived_tbl (j_decompress_pt
if (isDC) {
for (i = 0; i < numsymbols; i++) {
int sym = htbl->huffval[i];
- if (sym < 0 || sym > 15)
- ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
+ if (sym < 0 || sym > 15) {
+ // Now, we can read Philips MRI Images
+ htbl->huffval[i]=15;
+// ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
+ }
}
}
}
-
- DCMTK Developer
- Posts: 120
- Joined: Thu, 2009-11-26, 08:15
-
- DCMTK Developer
- Posts: 120
- Joined: Thu, 2009-11-26, 08:15
Hi,
thanks for the image. However, I don't think we should apply your change to the ijg jpeg library.
JPEG splits the image up in blocks. For each block, the difference between the average luminance of this and the previous blocks gets entropy encoded. This is where the DC Huffman table that we have a problem with is used. Obviously, there is a maximum possible value for this difference. Your JPEG specifies how to encode a difference larger than this maximum possible value in its huffmann table.
Your patch only works because this image doesn't actually use the large value from the DC table.
I have no idea what would happen if this value actually gets used, but I guess that things would blow up in strange ways.
Also, I haven't found anything else which allows reading this broken image.
Uli
thanks for the image. However, I don't think we should apply your change to the ijg jpeg library.
JPEG splits the image up in blocks. For each block, the difference between the average luminance of this and the previous blocks gets entropy encoded. This is where the DC Huffman table that we have a problem with is used. Obviously, there is a maximum possible value for this difference. Your JPEG specifies how to encode a difference larger than this maximum possible value in its huffmann table.
Your patch only works because this image doesn't actually use the large value from the DC table.
I have no idea what would happen if this value actually gets used, but I guess that things would blow up in strange ways.
Also, I haven't found anything else which allows reading this broken image.
Uli
Who is online
Users browsing this forum: Semrush [Bot] and 1 guest