summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2014-03-14 13:53:36 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2014-03-14 13:53:36 +0000
commite8abf1fb250819822f6a96b11a5ed1a848f3e47a (patch)
treeb95f9fd376fe29edc64bccf82c0a7f405208e87a /src/lib
parentb7fe7d25e1fcffe3bca03b61da54a04d72cb7965 (diff)
[trunk] Add internal implementation to dump all tiles/comp info
Eg: opj_dump -f 8 -i input.j2k Update issue 3
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/openjp2/j2k.c119
-rw-r--r--src/lib/openjp2/openjpeg.h2
2 files changed, 65 insertions, 56 deletions
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c
index 93d9999c..8790fc33 100644
--- a/src/lib/openjp2/j2k.c
+++ b/src/lib/openjp2/j2k.c
@@ -8676,6 +8676,58 @@ void opj_j2k_copy_tile_quantization_parameters( opj_j2k_t *p_j2k )
}
}
+static void opj_j2k_dump_tile_info( opj_tcp_t * l_default_tile,OPJ_INT32 numcomps,FILE* out_stream)
+{
+ if (l_default_tile)
+ {
+ OPJ_INT32 compno;
+
+ fprintf(out_stream, "\t default tile {\n");
+ fprintf(out_stream, "\t\t csty=%#x\n", l_default_tile->csty);
+ fprintf(out_stream, "\t\t prg=%#x\n", l_default_tile->prg);
+ fprintf(out_stream, "\t\t numlayers=%d\n", l_default_tile->numlayers);
+ fprintf(out_stream, "\t\t mct=%x\n", l_default_tile->mct);
+
+ for (compno = 0; compno < numcomps; compno++) {
+ opj_tccp_t *l_tccp = &(l_default_tile->tccps[compno]);
+ OPJ_UINT32 resno;
+ OPJ_INT32 bandno, numbands;
+
+ /* coding style*/
+ fprintf(out_stream, "\t\t comp %d {\n", compno);
+ fprintf(out_stream, "\t\t\t csty=%#x\n", l_tccp->csty);
+ fprintf(out_stream, "\t\t\t numresolutions=%d\n", l_tccp->numresolutions);
+ fprintf(out_stream, "\t\t\t cblkw=2^%d\n", l_tccp->cblkw);
+ fprintf(out_stream, "\t\t\t cblkh=2^%d\n", l_tccp->cblkh);
+ fprintf(out_stream, "\t\t\t cblksty=%#x\n", l_tccp->cblksty);
+ fprintf(out_stream, "\t\t\t qmfbid=%d\n", l_tccp->qmfbid);
+
+ fprintf(out_stream, "\t\t\t preccintsize (w,h)=");
+ for (resno = 0; resno < l_tccp->numresolutions; resno++) {
+ fprintf(out_stream, "(%d,%d) ", l_tccp->prcw[resno], l_tccp->prch[resno]);
+ }
+ fprintf(out_stream, "\n");
+
+ /* quantization style*/
+ fprintf(out_stream, "\t\t\t qntsty=%d\n", l_tccp->qntsty);
+ fprintf(out_stream, "\t\t\t numgbits=%d\n", l_tccp->numgbits);
+ fprintf(out_stream, "\t\t\t stepsizes (m,e)=");
+ numbands = (l_tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) ? 1 : (OPJ_INT32)l_tccp->numresolutions * 3 - 2;
+ for (bandno = 0; bandno < numbands; bandno++) {
+ fprintf(out_stream, "(%d,%d) ", l_tccp->stepsizes[bandno].mant,
+ l_tccp->stepsizes[bandno].expn);
+ }
+ fprintf(out_stream, "\n");
+
+ /* RGN value*/
+ fprintf(out_stream, "\t\t\t roishift=%d\n", l_tccp->roishift);
+
+ fprintf(out_stream, "\t\t }\n");
+ } /*end of component of default tile*/
+ fprintf(out_stream, "\t }\n"); /*end of default tile*/
+ }
+}
+
void j2k_dump (opj_j2k_t* p_j2k, OPJ_INT32 flag, FILE* out_stream)
{
/* Check if the flag is compatible with j2k file*/
@@ -8694,6 +8746,16 @@ void j2k_dump (opj_j2k_t* p_j2k, OPJ_INT32 flag, FILE* out_stream)
if (flag & OPJ_J2K_MH_INFO){
opj_j2k_dump_MH_info(p_j2k, out_stream);
}
+ /* Dump all tile/codestream info */
+ if (flag & OPJ_J2K_TCH_INFO){
+ OPJ_UINT32 l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw;
+ OPJ_UINT32 i;
+ opj_tcp_t * l_tcp = p_j2k->m_cp.tcps;
+ for (i=0;i<l_nb_tiles;++i) {
+ opj_j2k_dump_tile_info( l_tcp,(OPJ_INT32)p_j2k->m_private_image->numcomps, out_stream);
+ ++l_tcp;
+ }
+ }
/* Dump the codestream info of the current tile */
if (flag & OPJ_J2K_TH_INFO){
@@ -8780,70 +8842,17 @@ void opj_j2k_dump_MH_index(opj_j2k_t* p_j2k, FILE* out_stream)
}
+
void opj_j2k_dump_MH_info(opj_j2k_t* p_j2k, FILE* out_stream)
{
- opj_tcp_t * l_default_tile=NULL;
fprintf(out_stream, "Codestream info from main header: {\n");
fprintf(out_stream, "\t tx0=%d, ty0=%d\n", p_j2k->m_cp.tx0, p_j2k->m_cp.ty0);
fprintf(out_stream, "\t tdx=%d, tdy=%d\n", p_j2k->m_cp.tdx, p_j2k->m_cp.tdy);
fprintf(out_stream, "\t tw=%d, th=%d\n", p_j2k->m_cp.tw, p_j2k->m_cp.th);
-
- l_default_tile = p_j2k->m_specific_param.m_decoder.m_default_tcp;
- if (l_default_tile)
- {
- OPJ_INT32 compno;
- OPJ_INT32 numcomps = (OPJ_INT32)p_j2k->m_private_image->numcomps;
-
- fprintf(out_stream, "\t default tile {\n");
- fprintf(out_stream, "\t\t csty=%#x\n", l_default_tile->csty);
- fprintf(out_stream, "\t\t prg=%#x\n", l_default_tile->prg);
- fprintf(out_stream, "\t\t numlayers=%d\n", l_default_tile->numlayers);
- fprintf(out_stream, "\t\t mct=%x\n", l_default_tile->mct);
-
- for (compno = 0; compno < numcomps; compno++) {
- opj_tccp_t *l_tccp = &(l_default_tile->tccps[compno]);
- OPJ_UINT32 resno;
- OPJ_INT32 bandno, numbands;
-
- /* coding style*/
- fprintf(out_stream, "\t\t comp %d {\n", compno);
- fprintf(out_stream, "\t\t\t csty=%#x\n", l_tccp->csty);
- fprintf(out_stream, "\t\t\t numresolutions=%d\n", l_tccp->numresolutions);
- fprintf(out_stream, "\t\t\t cblkw=2^%d\n", l_tccp->cblkw);
- fprintf(out_stream, "\t\t\t cblkh=2^%d\n", l_tccp->cblkh);
- fprintf(out_stream, "\t\t\t cblksty=%#x\n", l_tccp->cblksty);
- fprintf(out_stream, "\t\t\t qmfbid=%d\n", l_tccp->qmfbid);
-
- fprintf(out_stream, "\t\t\t preccintsize (w,h)=");
- for (resno = 0; resno < l_tccp->numresolutions; resno++) {
- fprintf(out_stream, "(%d,%d) ", l_tccp->prcw[resno], l_tccp->prch[resno]);
- }
- fprintf(out_stream, "\n");
-
- /* quantization style*/
- fprintf(out_stream, "\t\t\t qntsty=%d\n", l_tccp->qntsty);
- fprintf(out_stream, "\t\t\t numgbits=%d\n", l_tccp->numgbits);
- fprintf(out_stream, "\t\t\t stepsizes (m,e)=");
- numbands = (l_tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) ? 1 : (OPJ_INT32)l_tccp->numresolutions * 3 - 2;
- for (bandno = 0; bandno < numbands; bandno++) {
- fprintf(out_stream, "(%d,%d) ", l_tccp->stepsizes[bandno].mant,
- l_tccp->stepsizes[bandno].expn);
- }
- fprintf(out_stream, "\n");
-
- /* RGN value*/
- fprintf(out_stream, "\t\t\t roishift=%d\n", l_tccp->roishift);
-
- fprintf(out_stream, "\t\t }\n");
- } /*end of component of default tile*/
- fprintf(out_stream, "\t }\n"); /*end of default tile*/
-
- }
-
+ opj_j2k_dump_tile_info(p_j2k->m_specific_param.m_decoder.m_default_tcp,(OPJ_INT32)p_j2k->m_private_image->numcomps, out_stream);
fprintf(out_stream, "}\n");
-
}
void j2k_dump_image_header(opj_image_t* img_header, OPJ_BOOL dev_dump_flag, FILE* out_stream)
diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h
index 59a1cdc4..1ea2af80 100644
--- a/src/lib/openjp2/openjpeg.h
+++ b/src/lib/openjp2/openjpeg.h
@@ -160,7 +160,7 @@ typedef size_t OPJ_SIZE_T;
#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 */
-/*FIXME #define OPJ_J2K_CSTR_INFO 6*/ /**< */
+#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*/ /**< */