+#define OPJ_IMG_INFO 1 /**< Basic image information provided to the user */
+#define OPJ_J2K_MH_INFO 2 /**< Codestream information based only on the main header */
+#define OPJ_J2K_TH_INFO 4 /**< Tile information based on the current tile header */
+#define OPJ_J2K_TCH_INFO 8 /**< Tile/Component information of all tiles */
+#define OPJ_J2K_MH_IND 16 /**< Codestream index based only on the main header */
+#define OPJ_J2K_TH_IND 32 /**< Tile index based on the current tile */
+/*FIXME #define OPJ_J2K_CSTR_IND 48*/ /**< */
+#define OPJ_JP2_INFO 128 /**< JP2 file information */
+#define OPJ_JP2_IND 256 /**< JP2 file index */
+
+/**
+ * JPEG 2000 Profiles, see Table A.10 from 15444-1 (updated in various AMD)
+ * These values help choosing the RSIZ value for the J2K codestream.
+ * The RSIZ value triggers various encoding options, as detailed in Table A.10.
+ * If OPJ_PROFILE_PART2 is chosen, it has to be combined with one or more extensions
+ * described hereunder.
+ * Example: rsiz = OPJ_PROFILE_PART2 | OPJ_EXTENSION_MCT;
+ * For broadcast profiles, the OPJ_PROFILE value has to be combined with the targeted
+ * mainlevel (3-0 LSB, value between 0 and 11):
+ * Example: rsiz = OPJ_PROFILE_BC_MULTI | 0x0005; (here mainlevel 5)
+ * For IMF profiles, the OPJ_PROFILE value has to be combined with the targeted mainlevel
+ * (3-0 LSB, value between 0 and 11) and sublevel (7-4 LSB, value between 0 and 9):
+ * Example: rsiz = OPJ_PROFILE_IMF_2K | 0x0040 | 0x0005; (here main 5 and sublevel 4)
+ * */
+#define OPJ_PROFILE_NONE 0x0000 /** no profile, conform to 15444-1 */
+#define OPJ_PROFILE_0 0x0001 /** Profile 0 as described in 15444-1,Table A.45 */
+#define OPJ_PROFILE_1 0x0002 /** Profile 1 as described in 15444-1,Table A.45 */
+#define OPJ_PROFILE_PART2 0x8000 /** At least 1 extension defined in 15444-2 (Part-2) */
+#define OPJ_PROFILE_CINEMA_2K 0x0003 /** 2K cinema profile defined in 15444-1 AMD1 */
+#define OPJ_PROFILE_CINEMA_4K 0x0004 /** 4K cinema profile defined in 15444-1 AMD1 */
+#define OPJ_PROFILE_CINEMA_S2K 0x0005 /** Scalable 2K cinema profile defined in 15444-1 AMD2 */
+#define OPJ_PROFILE_CINEMA_S4K 0x0006 /** Scalable 4K cinema profile defined in 15444-1 AMD2 */
+#define OPJ_PROFILE_CINEMA_LTS 0x0007 /** Long term storage cinema profile defined in 15444-1 AMD2 */
+#define OPJ_PROFILE_BC_SINGLE 0x0100 /** Single Tile Broadcast profile defined in 15444-1 AMD3 */
+#define OPJ_PROFILE_BC_MULTI 0x0200 /** Multi Tile Broadcast profile defined in 15444-1 AMD3 */
+#define OPJ_PROFILE_BC_MULTI_R 0x0300 /** Multi Tile Reversible Broadcast profile defined in 15444-1 AMD3 */
+#define OPJ_PROFILE_IMF_2K 0x0400 /** 2K Single Tile Lossy IMF profile defined in 15444-1 AMD 8 */
+#define OPJ_PROFILE_IMF_4K 0x0500 /** 4K Single Tile Lossy IMF profile defined in 15444-1 AMD 8 */
+#define OPJ_PROFILE_IMF_8K 0x0600 /** 8K Single Tile Lossy IMF profile defined in 15444-1 AMD 8 */
+#define OPJ_PROFILE_IMF_2K_R 0x0700 /** 2K Single/Multi Tile Reversible IMF profile defined in 15444-1 AMD 8 */
+#define OPJ_PROFILE_IMF_4K_R 0x0800 /** 4K Single/Multi Tile Reversible IMF profile defined in 15444-1 AMD 8 */
+#define OPJ_PROFILE_IMF_8K_R 0x0900 /** 8K Single/Multi Tile Reversible IMF profile defined in 15444-1 AMD 8 */
+
+/**
+ * JPEG 2000 Part-2 extensions
+ * */
+#define OPJ_EXTENSION_NONE 0x0000 /** No Part-2 extension */
+#define OPJ_EXTENSION_MCT 0x0100 /** Custom MCT support */
+
+/**
+ * JPEG 2000 profile macros
+ * */
+#define OPJ_IS_CINEMA(v) (((v) >= OPJ_PROFILE_CINEMA_2K)&&((v) <= OPJ_PROFILE_CINEMA_S4K))
+#define OPJ_IS_STORAGE(v) ((v) == OPJ_PROFILE_CINEMA_LTS)
+#define OPJ_IS_BROADCAST(v) (((v) >= OPJ_PROFILE_BC_SINGLE)&&((v) <= ((OPJ_PROFILE_BC_MULTI_R) | (0x000b))))
+#define OPJ_IS_IMF(v) (((v) >= OPJ_PROFILE_IMF_2K)&&((v) <= ((OPJ_PROFILE_IMF_8K_R) | (0x009b))))
+#define OPJ_IS_PART2(v) ((v) & OPJ_PROFILE_PART2)
+
+#define OPJ_GET_IMF_PROFILE(v) ((v) & 0xff00) /** Extract IMF profile without mainlevel/sublevel */
+#define OPJ_GET_IMF_MAINLEVEL(v) ((v) & 0xf) /** Extract IMF main level */
+#define OPJ_GET_IMF_SUBLEVEL(v) (((v) >> 4) & 0xf) /** Extract IMF sub level */
+
+#define OPJ_IMF_MAINLEVEL_MAX 11 /** Maximum main level */
+
+/** Max. Components Sampling Rate (MSamples/sec) per IMF main level */
+#define OPJ_IMF_MAINLEVEL_1_MSAMPLESEC 65 /** MSamples/sec for IMF main level 1 */
+#define OPJ_IMF_MAINLEVEL_2_MSAMPLESEC 130 /** MSamples/sec for IMF main level 2 */
+#define OPJ_IMF_MAINLEVEL_3_MSAMPLESEC 195 /** MSamples/sec for IMF main level 3 */
+#define OPJ_IMF_MAINLEVEL_4_MSAMPLESEC 260 /** MSamples/sec for IMF main level 4 */
+#define OPJ_IMF_MAINLEVEL_5_MSAMPLESEC 520 /** MSamples/sec for IMF main level 5 */
+#define OPJ_IMF_MAINLEVEL_6_MSAMPLESEC 1200 /** MSamples/sec for IMF main level 6 */
+#define OPJ_IMF_MAINLEVEL_7_MSAMPLESEC 2400 /** MSamples/sec for IMF main level 7 */
+#define OPJ_IMF_MAINLEVEL_8_MSAMPLESEC 4800 /** MSamples/sec for IMF main level 8 */
+#define OPJ_IMF_MAINLEVEL_9_MSAMPLESEC 9600 /** MSamples/sec for IMF main level 9 */
+#define OPJ_IMF_MAINLEVEL_10_MSAMPLESEC 19200 /** MSamples/sec for IMF main level 10 */
+#define OPJ_IMF_MAINLEVEL_11_MSAMPLESEC 38400 /** MSamples/sec for IMF main level 11 */
+
+/** Max. compressed Bit Rate (Mbits/s) per IMF sub level */
+#define OPJ_IMF_SUBLEVEL_1_MBITSSEC 200 /** Mbits/s for IMF sub level 1 */
+#define OPJ_IMF_SUBLEVEL_2_MBITSSEC 400 /** Mbits/s for IMF sub level 2 */
+#define OPJ_IMF_SUBLEVEL_3_MBITSSEC 800 /** Mbits/s for IMF sub level 3 */
+#define OPJ_IMF_SUBLEVEL_4_MBITSSEC 1600 /** Mbits/s for IMF sub level 4 */
+#define OPJ_IMF_SUBLEVEL_5_MBITSSEC 3200 /** Mbits/s for IMF sub level 5 */
+#define OPJ_IMF_SUBLEVEL_6_MBITSSEC 6400 /** Mbits/s for IMF sub level 6 */
+#define OPJ_IMF_SUBLEVEL_7_MBITSSEC 12800 /** Mbits/s for IMF sub level 7 */
+#define OPJ_IMF_SUBLEVEL_8_MBITSSEC 25600 /** Mbits/s for IMF sub level 8 */
+#define OPJ_IMF_SUBLEVEL_9_MBITSSEC 51200 /** Mbits/s for IMF sub level 9 */
+
+/**
+ * JPEG 2000 codestream and component size limits in cinema profiles
+ * */
+#define OPJ_CINEMA_24_CS 1302083 /** Maximum codestream length for 24fps */
+#define OPJ_CINEMA_48_CS 651041 /** Maximum codestream length for 48fps */
+#define OPJ_CINEMA_24_COMP 1041666 /** Maximum size per color component for 2K & 4K @ 24fps */
+#define OPJ_CINEMA_48_COMP 520833 /** Maximum size per color component for 2K @ 48fps */
+
+/*