Index: core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/openjpeg.h |
diff --git a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/openjpeg.h b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/openjpeg.h |
index 29a9a9084fbcef99b3f4f04bdfe9aad8d57b9d63..988db720092c63f71de29213d5e1462708620a8f 100644 |
--- a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/openjpeg.h |
+++ b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/openjpeg.h |
@@ -42,11 +42,6 @@ |
#ifndef OPENJPEG_H |
#define OPENJPEG_H |
-#ifndef OPJ_STATIC |
-#define OPJ_STATIC |
-#endif |
- |
- |
/* |
========================================================== |
@@ -116,6 +111,7 @@ typedef char OPJ_CHAR; |
typedef float OPJ_FLOAT32; |
typedef double OPJ_FLOAT64; |
typedef unsigned char OPJ_BYTE; |
+ |
#include "opj_stdint.h" |
typedef int8_t OPJ_INT8; |
@@ -177,30 +173,88 @@ typedef size_t OPJ_SIZE_T; |
#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 chosing 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 0x0401 /** 4K Single Tile Lossy IMF profile defined in 15444-1 AMD 8 */ |
+#define OPJ_PROFILE_IMF_8K 0x0402 /** 8K Single Tile Lossy IMF profile defined in 15444-1 AMD 8 */ |
+#define OPJ_PROFILE_IMF_2K_R 0x0403 /** 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 0x0801 /** 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) |
+ |
+/** |
+ * 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 */ |
/* |
========================================================== |
enum definitions |
========================================================== |
*/ |
-/** |
+ |
+/** |
+ * DEPRECATED: use RSIZ, OPJ_PROFILE_* and OPJ_EXTENSION_* instead |
* Rsiz Capabilities |
* */ |
typedef enum RSIZ_CAPABILITIES { |
- OPJ_STD_RSIZ = 0, /** Standard JPEG2000 profile*/ |
- OPJ_CINEMA2K = 3, /** Profile name for a 2K image*/ |
- OPJ_CINEMA4K = 4, /** Profile name for a 4K image*/ |
- OPJ_MCT = 0x8100 |
+ OPJ_STD_RSIZ = 0, /** Standard JPEG2000 profile*/ |
+ OPJ_CINEMA2K = 3, /** Profile name for a 2K image*/ |
+ OPJ_CINEMA4K = 4, /** Profile name for a 4K image*/ |
+ OPJ_MCT = 0x8100 |
} OPJ_RSIZ_CAPABILITIES; |
-/** |
+/** |
+ * DEPRECATED: use RSIZ, OPJ_PROFILE_* and OPJ_EXTENSION_* instead |
* Digital cinema operation mode |
* */ |
typedef enum CINEMA_MODE { |
- OPJ_OFF = 0, /** Not Digital Cinema*/ |
- OPJ_CINEMA2K_24 = 1, /** 2K Digital Cinema at 24 fps*/ |
- OPJ_CINEMA2K_48 = 2, /** 2K Digital Cinema at 48 fps*/ |
- OPJ_CINEMA4K_24 = 3 /** 4K Digital Cinema at 24 fps*/ |
+ OPJ_OFF = 0, /** Not Digital Cinema*/ |
+ OPJ_CINEMA2K_24 = 1, /** 2K Digital Cinema at 24 fps*/ |
+ OPJ_CINEMA2K_48 = 2, /** 2K Digital Cinema at 48 fps*/ |
+ OPJ_CINEMA4K_24 = 3 /** 4K Digital Cinema at 24 fps*/ |
}OPJ_CINEMA_MODE; |
/** |
@@ -219,12 +273,13 @@ typedef enum PROG_ORDER { |
* Supported image color spaces |
*/ |
typedef enum COLOR_SPACE { |
- OPJ_CLRSPC_UNKNOWN = -1, /**< not supported by the library */ |
- OPJ_CLRSPC_UNSPECIFIED = 0, /**< not specified in the codestream */ |
- OPJ_CLRSPC_SRGB = 1, /**< sRGB */ |
- OPJ_CLRSPC_GRAY = 2, /**< grayscale */ |
- OPJ_CLRSPC_SYCC = 3, /**< YUV */ |
- OPJ_CLRSPC_EYCC = 4 /**< e-YCC */ |
+ OPJ_CLRSPC_UNKNOWN = -1, /**< not supported by the library */ |
+ OPJ_CLRSPC_UNSPECIFIED = 0, /**< not specified in the codestream */ |
+ OPJ_CLRSPC_SRGB = 1, /**< sRGB */ |
+ OPJ_CLRSPC_GRAY = 2, /**< grayscale */ |
+ OPJ_CLRSPC_SYCC = 3, /**< YUV */ |
+ OPJ_CLRSPC_EYCC = 4, /**< e-YCC */ |
+ OPJ_CLRSPC_CMYK = 5 /**< CMYK */ |
} OPJ_COLOR_SPACE; |
/** |
@@ -234,7 +289,9 @@ typedef enum CODEC_FORMAT { |
OPJ_CODEC_UNKNOWN = -1, /**< place-holder */ |
OPJ_CODEC_J2K = 0, /**< JPEG-2000 codestream : read/write */ |
OPJ_CODEC_JPT = 1, /**< JPT-stream (JPEG 2000, JPIP) : read only */ |
- OPJ_CODEC_JP2 = 2 /**< JPEG-2000 file format : read/write */ |
+ OPJ_CODEC_JP2 = 2, /**< JP2 file format : read/write */ |
+ OPJ_CODEC_JPP = 3, /**< JPP-stream (JPEG 2000, JPIP) : to be coded */ |
+ OPJ_CODEC_JPX = 4 /**< JPX file format (JPEG 2000 Part-2) : to be coded */ |
} OPJ_CODEC_FORMAT; |
@@ -320,7 +377,7 @@ typedef struct opj_cparameters { |
OPJ_UINT32 numpocs; |
/** number of layers */ |
int tcp_numlayers; |
- /** rates of layers */ |
+ /** rates of layers - might be subsequently limited by the max_cs_size field */ |
float tcp_rates[100]; |
/** different psnr for successive layers */ |
float tcp_distoratio[100]; |
@@ -401,12 +458,21 @@ typedef struct opj_cparameters { |
/*@}*/ |
/* <<UniPG */ |
- /** Digital Cinema compliance 0-not compliant, 1-compliant*/ |
- OPJ_CINEMA_MODE cp_cinema; |
- /** Maximum rate for each component. If == 0, component size limitation is not considered */ |
+ /** |
+ * DEPRECATED: use RSIZ, OPJ_PROFILE_* and MAX_COMP_SIZE instead |
+ * Digital Cinema compliance 0-not compliant, 1-compliant |
+ * */ |
+ OPJ_CINEMA_MODE cp_cinema; |
+ /** |
+ * Maximum size (in bytes) for each component. |
+ * If == 0, component size limitation is not considered |
+ * */ |
int max_comp_size; |
- /** Profile name*/ |
- OPJ_RSIZ_CAPABILITIES cp_rsiz; |
+ /** |
+ * DEPRECATED: use RSIZ, OPJ_PROFILE_* and OPJ_EXTENSION_* instead |
+ * Profile name |
+ * */ |
+ OPJ_RSIZ_CAPABILITIES cp_rsiz; |
/** Tile part generation*/ |
char tp_on; |
/** Flag for Tile part generation*/ |
@@ -418,6 +484,16 @@ typedef struct opj_cparameters { |
/** Naive implementation of MCT restricted to a single reversible array based |
encoding without offset concerning all the components. */ |
void * mct_data; |
+ /** |
+ * Maximum size (in bytes) for the whole codestream. |
+ * If == 0, codestream size limitation is not considered |
+ * If it does not comply with tcp_rates, max_cs_size prevails |
+ * and a warning is issued. |
+ * */ |
+ int max_cs_size; |
+ /** RSIZ value |
+ To be used to combine OPJ_PROFILE_*, OPJ_EXTENSION_* and (sub)levels values. */ |
+ OPJ_UINT16 rsiz; |
} opj_cparameters_t; |
#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001 |
@@ -597,8 +673,6 @@ typedef struct opj_image { |
OPJ_BYTE *icc_profile_buf; |
/** size of ICC profile */ |
OPJ_UINT32 icc_profile_len; |
- |
- OPJ_INT8 useColorSpace; //liang |
} opj_image_t; |
@@ -1042,14 +1116,6 @@ OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size, O |
* @param p_stream the stream to destroy. |
*/ |
OPJ_API void OPJ_CALLCONV opj_stream_destroy(opj_stream_t* p_stream); |
- |
-/** |
- * Destroys a stream created by opj_create_stream. This function does NOT close the abstract stream. |
- * If needed the user must close its own implementation of the stream. |
- * |
- * @param p_stream the stream to destroy. |
- */ |
-OPJ_API void OPJ_CALLCONV opj_stream_destroy_v3(opj_stream_t* p_stream); |
/** |
* Sets the given function to be used as a read function. |
@@ -1083,17 +1149,9 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_seek_function(opj_stream_t* p_stream, o |
* Sets the given data to be used as a user data for the stream. |
* @param p_stream the stream to modify |
* @param p_data the data to set. |
- * @warning depending on your source object p_stream this function may leak, use opj_stream_set_user_data_v3 |
-*/ |
-OPJ_DEPRECATED(OPJ_API void OPJ_CALLCONV opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data)); |
- |
-/** |
- * Sets the given data to be used as a user data for the stream. |
- * @param p_stream the stream to modify |
- * @param p_data the data to set. |
* @param p_function the function to free p_data when opj_stream_destroy() is called. |
*/ |
-OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_v3 (opj_stream_t* p_stream, void * p_data, opj_stream_free_user_data_fn p_function); |
+OPJ_API void OPJ_CALLCONV opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data, opj_stream_free_user_data_fn p_function); |
/** |
* Sets the length of the user data for the stream. |
@@ -1108,14 +1166,14 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream |
* @param fname the filename of the file to stream |
* @param p_is_read_stream whether the stream is a read stream (true) or not (false) |
*/ |
-OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream_v3 (const char *fname, OPJ_BOOL p_is_read_stream); |
+OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream (const char *fname, OPJ_BOOL p_is_read_stream); |
/** Create a stream from a file identified with its filename with a specific buffer size |
* @param fname the filename of the file to stream |
* @param p_buffer_size size of the chunk used to stream |
* @param p_is_read_stream whether the stream is a read stream (true) or not (false) |
*/ |
-OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream_v3 (const char *fname, |
+OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream (const char *fname, |
OPJ_SIZE_T p_buffer_size, |
OPJ_BOOL p_is_read_stream); |