From d53e6fdb0a86ca1ddb12876a60f7f2d7508b5349 Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Tue, 30 Sep 2014 11:12:05 -0700 Subject: Update openjpeg BUG=407964, 414182, 413447 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/589243004 --- .../fx_libopenjpeg/libopenjpeg20/openjpeg.h | 156 ++++++++++++++------- 1 file changed, 107 insertions(+), 49 deletions(-) (limited to '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 29a9a9084f..988db72009 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 { /*@}*/ /* <