|
|
@ -18,11 +18,11 @@
|
|
|
|
#include <iostream>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
|
|
// JPEG-2000 box types
|
|
|
|
// JPEG-2000 box types
|
|
|
|
const uint32_t kJp2BoxTypeJp2Header = 0x6a703268; // 'jp2h'
|
|
|
|
static constexpr uint32_t kJp2BoxTypeJp2Header = 0x6a703268; // 'jp2h'
|
|
|
|
const uint32_t kJp2BoxTypeImageHeader = 0x69686472; // 'ihdr'
|
|
|
|
static constexpr uint32_t kJp2BoxTypeImageHeader = 0x69686472; // 'ihdr'
|
|
|
|
const uint32_t kJp2BoxTypeColorHeader = 0x636f6c72; // 'colr'
|
|
|
|
static constexpr uint32_t kJp2BoxTypeColorHeader = 0x636f6c72; // 'colr'
|
|
|
|
const uint32_t kJp2BoxTypeUuid = 0x75756964; // 'uuid'
|
|
|
|
static constexpr uint32_t kJp2BoxTypeUuid = 0x75756964; // 'uuid'
|
|
|
|
const uint32_t kJp2BoxTypeClose = 0x6a703263; // 'jp2c'
|
|
|
|
static constexpr uint32_t kJp2BoxTypeClose = 0x6a703263; // 'jp2c'
|
|
|
|
|
|
|
|
|
|
|
|
// from openjpeg-2.1.2/src/lib/openjp2/jp2.h
|
|
|
|
// from openjpeg-2.1.2/src/lib/openjp2/jp2.h
|
|
|
|
/*#define JPIP_JPIP 0x6a706970*/
|
|
|
|
/*#define JPIP_JPIP 0x6a706970*/
|
|
|
@ -53,30 +53,31 @@ const uint32_t kJp2BoxTypeClose = 0x6a703263; // 'jp2c'
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// See http://www.jpeg.org/public/wg1n2600.doc for information about embedding IPTC-NAA data in JPEG-2000 files
|
|
|
|
// See http://www.jpeg.org/public/wg1n2600.doc for information about embedding IPTC-NAA data in JPEG-2000 files
|
|
|
|
// See http://www.adobe.com/devnet/xmp/pdfs/xmp_specification.pdf for information about embedding XMP data in JPEG-2000 files
|
|
|
|
// See http://www.adobe.com/devnet/xmp/pdfs/xmp_specification.pdf for information about embedding XMP data in JPEG-2000 files
|
|
|
|
const unsigned char kJp2UuidExif[] = "JpgTiffExif->JP2";
|
|
|
|
static constexpr unsigned char kJp2UuidExif[] = "JpgTiffExif->JP2";
|
|
|
|
const unsigned char kJp2UuidIptc[] = "\x33\xc7\xa4\xd2\xb8\x1d\x47\x23\xa0\xba\xf1\xa3\xe0\x97\xad\x38";
|
|
|
|
static constexpr unsigned char kJp2UuidIptc[] = "\x33\xc7\xa4\xd2\xb8\x1d\x47\x23\xa0\xba\xf1\xa3\xe0\x97\xad\x38";
|
|
|
|
const unsigned char kJp2UuidXmp[] = "\xbe\x7a\xcf\xcb\x97\xa9\x42\xe8\x9c\x71\x99\x94\x91\xe3\xaf\xac";
|
|
|
|
static constexpr unsigned char kJp2UuidXmp[] = "\xbe\x7a\xcf\xcb\x97\xa9\x42\xe8\x9c\x71\x99\x94\x91\xe3\xaf\xac";
|
|
|
|
|
|
|
|
|
|
|
|
// See section B.1.1 (JPEG 2000 Signature box) of JPEG-2000 specification
|
|
|
|
// See section B.1.1 (JPEG 2000 Signature box) of JPEG-2000 specification
|
|
|
|
const unsigned char Jp2Signature[12] = { 0x00, 0x00, 0x00, 0x0c, 0x6a, 0x50, 0x20, 0x20, 0x0d, 0x0a, 0x87, 0x0a };
|
|
|
|
static constexpr unsigned char Jp2Signature[] = {
|
|
|
|
|
|
|
|
0x00, 0x00, 0x00, 0x0c, 0x6a, 0x50, 0x20, 0x20, 0x0d, 0x0a, 0x87, 0x0a,
|
|
|
|
const unsigned char Jp2Blank[] = { 0x00,0x00,0x00,0x0c,0x6a,0x50,0x20,0x20,0x0d,0x0a,0x87,0x0a,0x00,0x00,0x00,0x14,
|
|
|
|
};
|
|
|
|
0x66,0x74,0x79,0x70,0x6a,0x70,0x32,0x20,0x00,0x00,0x00,0x00,0x6a,0x70,0x32,0x20,
|
|
|
|
|
|
|
|
0x00,0x00,0x00,0x2d,0x6a,0x70,0x32,0x68,0x00,0x00,0x00,0x16,0x69,0x68,0x64,0x72,
|
|
|
|
static constexpr unsigned char Jp2Blank[] = {
|
|
|
|
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x07,0x07,0x00,0x00,0x00,0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x0c, 0x6a, 0x50, 0x20, 0x20, 0x0d, 0x0a, 0x87, 0x0a, 0x00, 0x00, 0x00, 0x14, 0x66, 0x74,
|
|
|
|
0x00,0x0f,0x63,0x6f,0x6c,0x72,0x01,0x00,0x00,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
|
|
|
|
0x79, 0x70, 0x6a, 0x70, 0x32, 0x20, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x70, 0x32, 0x20, 0x00, 0x00, 0x00, 0x2d,
|
|
|
|
0x00,0x6a,0x70,0x32,0x63,0xff,0x4f,0xff,0x51,0x00,0x29,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x6a, 0x70, 0x32, 0x68, 0x00, 0x00, 0x00, 0x16, 0x69, 0x68, 0x64, 0x72, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
|
|
|
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00, 0x01, 0x00, 0x01, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x63, 0x6f, 0x6c, 0x72, 0x01, 0x00,
|
|
|
|
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x70, 0x32, 0x63, 0xff, 0x4f, 0xff, 0x51, 0x00,
|
|
|
|
0x01,0x01,0xff,0x64,0x00,0x23,0x00,0x01,0x43,0x72,0x65,0x61,0x74,0x6f,0x72,0x3a,
|
|
|
|
0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x20,0x4a,0x61,0x73,0x50,0x65,0x72,0x20,0x56,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x31,0x2e,0x39,0x30,0x30,0x2e,0x31,0xff,0x52,0x00,0x0c,0x00,0x00,0x00,0x01,0x00,
|
|
|
|
0x01, 0x07, 0x01, 0x01, 0xff, 0x64, 0x00, 0x23, 0x00, 0x01, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3a,
|
|
|
|
0x05,0x04,0x04,0x00,0x01,0xff,0x5c,0x00,0x13,0x40,0x40,0x48,0x48,0x50,0x48,0x48,
|
|
|
|
0x20, 0x4a, 0x61, 0x73, 0x50, 0x65, 0x72, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x2e,
|
|
|
|
0x50,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0xff,0x90,0x00,0x0a,0x00,0x00,
|
|
|
|
0x39, 0x30, 0x30, 0x2e, 0x31, 0xff, 0x52, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x04, 0x04, 0x00,
|
|
|
|
0x00,0x00,0x00,0x2d,0x00,0x01,0xff,0x5d,0x00,0x14,0x00,0x40,0x40,0x00,0x00,0x00,
|
|
|
|
0x01, 0xff, 0x5c, 0x00, 0x13, 0x40, 0x40, 0x48, 0x48, 0x50, 0x48, 0x48, 0x50, 0x48, 0x48, 0x50, 0x48, 0x48,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x93,0xcf,0xb4,
|
|
|
|
0x50, 0x48, 0x48, 0x50, 0xff, 0x90, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0xff, 0x5d,
|
|
|
|
0x04,0x00,0x80,0x80,0x80,0x80,0x80,0xff,0xd9
|
|
|
|
0x00, 0x14, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
};
|
|
|
|
0x00, 0x00, 0xff, 0x93, 0xcf, 0xb4, 0x04, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xd9,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//! @cond IGNORE
|
|
|
|
//! @cond IGNORE
|
|
|
|
struct Jp2BoxHeader
|
|
|
|
struct Jp2BoxHeader
|
|
|
|