Skip to content

Commit 1a36a20

Browse files
author
Grok Compression
committed
jph: set compatability list to jph
fixes #412
1 parent 82ce381 commit 1a36a20

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/lib/core/fileformat/compress/FileFormatJP2Compress.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ bool FileFormatJP2Compress::init(grk_cparameters* parameters, GrkImage* image)
748748
}
749749
if(jpx_branding_)
750750
brand = JP2_JPX;
751+
bool jph_branding = (brand == JP2_JPH);
751752
minversion = 0; /* MinV */
752753
numcl = jpx_branding_ ? 2 : 1;
753754
cl = (uint32_t*)grk_malloc(sizeof(uint32_t) * numcl);
@@ -756,9 +757,19 @@ bool FileFormatJP2Compress::init(grk_cparameters* parameters, GrkImage* image)
756757
grklog.error("Not enough memory when set up the JP2 compressor");
757758
return false;
758759
}
759-
cl[0] = JP2_JP2;
760-
if(jpx_branding_)
761-
cl[1] = JP2_JPX;
760+
if(jph_branding)
761+
{
762+
/* ISO/IEC 15444-15: a JPH file's compatibility list is 'jph ' only
763+
(matches the OpenHTJ2K reference writer; a Part-1 reader cannot
764+
decode an HT codestream, so 'jp2 ' would be a false claim). */
765+
cl[0] = JP2_JPH;
766+
}
767+
else
768+
{
769+
cl[0] = JP2_JP2;
770+
if(jpx_branding_)
771+
cl[1] = JP2_JPX;
772+
}
762773

763774
/* Image Header box */
764775
numcomps = inputImage_->numcomps; /* NC */

0 commit comments

Comments
 (0)