From 72009d316366d667eb478d077509ecfa76a1b048 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 12 Sep 2021 17:04:39 +0200 Subject: [PATCH 1/2] Add dummy parsing of HTJ2K CAP and CPF marker to avoid annoying warning --- src/lib/openjp2/j2k.c | 78 +++++++++++++++++++++++++++++++++++++++++++ src/lib/openjp2/j2k.h | 2 ++ 2 files changed, 80 insertions(+) diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index 6586c7018..2d7a7c6d2 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -1177,6 +1177,30 @@ static OPJ_BOOL opj_j2k_read_cbd(opj_j2k_t *p_j2k, OPJ_UINT32 p_header_size, opj_event_mgr_t * p_manager); +/** + * Reads a CAP marker (capacity definition). Empty implementation. Found in HTJ2K files + * @param p_header_data the data contained in the CAP box. + * @param p_j2k the jpeg2000 codec. + * @param p_header_size the size of the data contained in the CAP marker. + * @param p_manager the user event manager. +*/ +static OPJ_BOOL opj_j2k_read_cap(opj_j2k_t *p_j2k, + OPJ_BYTE * p_header_data, + OPJ_UINT32 p_header_size, + opj_event_mgr_t * p_manager); + +/** + * Reads a CPF marker (corresponding profile). Empty implementation. Found in HTJ2K files + * @param p_header_data the data contained in the CPF box. + * @param p_j2k the jpeg2000 codec. + * @param p_header_size the size of the data contained in the CPF marker. + * @param p_manager the user event manager. +*/ +static OPJ_BOOL opj_j2k_read_cpf(opj_j2k_t *p_j2k, + OPJ_BYTE * p_header_data, + OPJ_UINT32 p_header_size, + opj_event_mgr_t * p_manager); + /** * Writes COC marker for each component. @@ -1399,6 +1423,8 @@ static const opj_dec_memory_marker_handler_t j2k_memory_marker_handler_tab [] = {J2K_MS_COM, J2K_STATE_MH | J2K_STATE_TPH, opj_j2k_read_com}, {J2K_MS_MCT, J2K_STATE_MH | J2K_STATE_TPH, opj_j2k_read_mct}, {J2K_MS_CBD, J2K_STATE_MH, opj_j2k_read_cbd}, + {J2K_MS_CAP, J2K_STATE_MH, opj_j2k_read_cap}, + {J2K_MS_CPF, J2K_STATE_MH, opj_j2k_read_cpf}, {J2K_MS_MCC, J2K_STATE_MH | J2K_STATE_TPH, opj_j2k_read_mcc}, {J2K_MS_MCO, J2K_STATE_MH | J2K_STATE_TPH, opj_j2k_read_mco}, #ifdef USE_JPWL @@ -6594,6 +6620,58 @@ static OPJ_BOOL opj_j2k_read_cbd(opj_j2k_t *p_j2k, return OPJ_TRUE; } +/** + * Reads a CAP marker (capacity definition). Empty implementation. Found in HTJ2K files + * @param p_header_data the data contained in the CAP box. + * @param p_j2k the jpeg2000 codec. + * @param p_header_size the size of the data contained in the CAP marker. + * @param p_manager the user event manager. +*/ +static OPJ_BOOL opj_j2k_read_cap(opj_j2k_t *p_j2k, + OPJ_BYTE * p_header_data, + OPJ_UINT32 p_header_size, + opj_event_mgr_t * p_manager + ) +{ + /* preconditions */ + assert(p_header_data != 00); + assert(p_j2k != 00); + assert(p_manager != 00); + + (void)p_j2k; + (void)p_header_data; + (void)p_header_size; + (void)p_manager; + + return OPJ_TRUE; +} + +/** + * Reads a CPF marker (corresponding profile). Empty implementation. Found in HTJ2K files + * @param p_header_data the data contained in the CPF box. + * @param p_j2k the jpeg2000 codec. + * @param p_header_size the size of the data contained in the CPF marker. + * @param p_manager the user event manager. +*/ +static OPJ_BOOL opj_j2k_read_cpf(opj_j2k_t *p_j2k, + OPJ_BYTE * p_header_data, + OPJ_UINT32 p_header_size, + opj_event_mgr_t * p_manager + ) +{ + /* preconditions */ + assert(p_header_data != 00); + assert(p_j2k != 00); + assert(p_manager != 00); + + (void)p_j2k; + (void)p_header_data; + (void)p_header_size; + (void)p_manager; + + return OPJ_TRUE; +} + /* ----------------------------------------------------------------------- */ /* J2K / JPT decoder interface */ /* ----------------------------------------------------------------------- */ diff --git a/src/lib/openjp2/j2k.h b/src/lib/openjp2/j2k.h index 51e7c23e6..2b08e8407 100644 --- a/src/lib/openjp2/j2k.h +++ b/src/lib/openjp2/j2k.h @@ -73,9 +73,11 @@ The functions in J2K.C have for goal to read/write the several parts of the code #define J2K_MS_SOT 0xff90 /**< SOT marker value */ #define J2K_MS_SOD 0xff93 /**< SOD marker value */ #define J2K_MS_EOC 0xffd9 /**< EOC marker value */ +#define J2K_MS_CAP 0xff50 /**< CAP marker value */ #define J2K_MS_SIZ 0xff51 /**< SIZ marker value */ #define J2K_MS_COD 0xff52 /**< COD marker value */ #define J2K_MS_COC 0xff53 /**< COC marker value */ +#define J2K_MS_CPF 0xff59 /**< CPF marker value */ #define J2K_MS_RGN 0xff5e /**< RGN marker value */ #define J2K_MS_QCD 0xff5c /**< QCD marker value */ #define J2K_MS_QCC 0xff5d /**< QCC marker value */ From 31e406005d1c0e3be16086d183c5e1273e753af1 Mon Sep 17 00:00:00 2001 From: Aous Naman Date: Wed, 15 Sep 2021 11:57:43 +1000 Subject: [PATCH 2/2] Update j2k.c Modified the word "capacity" to "extended capabilities". --- src/lib/openjp2/j2k.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index 2d7a7c6d2..92c20415d 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -1178,7 +1178,9 @@ static OPJ_BOOL opj_j2k_read_cbd(opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager); /** - * Reads a CAP marker (capacity definition). Empty implementation. Found in HTJ2K files + * Reads a CAP marker (extended capabilities definition). Empty implementation. + * Found in HTJ2K files + * * @param p_header_data the data contained in the CAP box. * @param p_j2k the jpeg2000 codec. * @param p_header_size the size of the data contained in the CAP marker. @@ -6621,7 +6623,9 @@ static OPJ_BOOL opj_j2k_read_cbd(opj_j2k_t *p_j2k, } /** - * Reads a CAP marker (capacity definition). Empty implementation. Found in HTJ2K files + * Reads a CAP marker (extended capabilities definition). Empty implementation. + * Found in HTJ2K files. + * * @param p_header_data the data contained in the CAP box. * @param p_j2k the jpeg2000 codec. * @param p_header_size the size of the data contained in the CAP marker.