diff options
| author | Antonin Descampe <antonin@gmail.com> | 2011-01-02 18:10:09 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2011-01-02 18:10:09 +0000 |
| commit | 73a6ed7c21a355e198abcc7fce493b98457d7d8f (patch) | |
| tree | a55d026834f9702db21ca795ffc8b6b7e8b18e4c /codec | |
| parent | 56afd80506d4898d36cdbce9bdc1a3eacfc00880 (diff) | |
bug fixes to enable cmake compilation on WIN32 platform (see CHANGES for details)
Diffstat (limited to 'codec')
| -rw-r--r-- | codec/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | codec/j2k_dump.c | 78 |
2 files changed, 88 insertions, 2 deletions
diff --git a/codec/CMakeLists.txt b/codec/CMakeLists.txt index 6fd128f7..346f81ce 100644 --- a/codec/CMakeLists.txt +++ b/codec/CMakeLists.txt @@ -4,14 +4,14 @@ SET(common_SRCS convert.c index.c - ${PROJECT_SOURCE_DIR}/common/color.c + ${OPENJPEG_SOURCE_DIR}/common/color.c ) # If not getopt was found then add it to the lib: IF(DONT_HAVE_GETOPT) SET(common_SRCS ${common_SRCS} - ${PROJECT_SOURCE_DIR}/common/getopt.c + ${OPENJPEG_SOURCE_DIR}/common/getopt.c ) ENDIF(DONT_HAVE_GETOPT) @@ -28,6 +28,14 @@ IF(TIFF_FOUND) INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR}) ENDIF(TIFF_FOUND) +IF(WIN32) + IF(BUILD_SHARED_LIBS) + ADD_DEFINITIONS(-DOPJ_EXPORTS) + ELSE(BUILD_SHARED_LIBS) + ADD_DEFINITIONS(-DOPJ_STATIC) + ENDIF(BUILD_SHARED_LIBS) +ENDIF(WIN32) + # Loop over all executables: FOREACH(exe j2k_to_image image_to_j2k j2k_dump) ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS}) diff --git a/codec/j2k_dump.c b/codec/j2k_dump.c index 3c3e8d91..508dd65c 100644 --- a/codec/j2k_dump.c +++ b/codec/j2k_dump.c @@ -96,6 +96,8 @@ void decode_help_display() { } /* -------------------------------------------------------------------------- */ +static void j2k_dump_image(FILE *fd, opj_image_t * img); +static void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp); int get_num_images(char *imgdirpath){ DIR *dir; @@ -554,3 +556,79 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } + + +static void j2k_dump_image(FILE *fd, opj_image_t * img) { + int compno; + fprintf(fd, "image {\n"); + fprintf(fd, " x0=%d, y0=%d, x1=%d, y1=%d\n", img->x0, img->y0, img->x1, img->y1); + fprintf(fd, " numcomps=%d\n", img->numcomps); + for (compno = 0; compno < img->numcomps; compno++) { + opj_image_comp_t *comp = &img->comps[compno]; + fprintf(fd, " comp %d {\n", compno); + fprintf(fd, " dx=%d, dy=%d\n", comp->dx, comp->dy); + fprintf(fd, " prec=%d\n", comp->prec); + //fprintf(fd, " bpp=%d\n", comp->bpp); + fprintf(fd, " sgnd=%d\n", comp->sgnd); + fprintf(fd, " }\n"); + } + fprintf(fd, "}\n"); +} + +static void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp) { + int tileno, compno, layno, bandno, resno, numbands; + fprintf(fd, "coding parameters {\n"); + fprintf(fd, " tx0=%d, ty0=%d\n", cp->tx0, cp->ty0); + fprintf(fd, " tdx=%d, tdy=%d\n", cp->tdx, cp->tdy); + fprintf(fd, " tw=%d, th=%d\n", cp->tw, cp->th); + for (tileno = 0; tileno < cp->tw * cp->th; tileno++) { + opj_tcp_t *tcp = &cp->tcps[tileno]; + fprintf(fd, " tile %d {\n", tileno); + fprintf(fd, " csty=%x\n", tcp->csty); + fprintf(fd, " prg=%d\n", tcp->prg); + fprintf(fd, " numlayers=%d\n", tcp->numlayers); + fprintf(fd, " mct=%d\n", tcp->mct); + fprintf(fd, " rates="); + for (layno = 0; layno < tcp->numlayers; layno++) { + fprintf(fd, "%.1f ", tcp->rates[layno]); + } + fprintf(fd, "\n"); + for (compno = 0; compno < img->numcomps; compno++) { + opj_tccp_t *tccp = &tcp->tccps[compno]; + fprintf(fd, " comp %d {\n", compno); + fprintf(fd, " csty=%x\n", tccp->csty); + fprintf(fd, " numresolutions=%d\n", tccp->numresolutions); + fprintf(fd, " cblkw=%d\n", tccp->cblkw); + fprintf(fd, " cblkh=%d\n", tccp->cblkh); + fprintf(fd, " cblksty=%x\n", tccp->cblksty); + fprintf(fd, " qmfbid=%d\n", tccp->qmfbid); + fprintf(fd, " qntsty=%d\n", tccp->qntsty); + fprintf(fd, " numgbits=%d\n", tccp->numgbits); + fprintf(fd, " roishift=%d\n", tccp->roishift); + fprintf(fd, " stepsizes="); + numbands = tccp->qntsty == J2K_CCP_QNTSTY_SIQNT ? 1 : tccp->numresolutions * 3 - 2; + for (bandno = 0; bandno < numbands; bandno++) { + fprintf(fd, "(%d,%d) ", tccp->stepsizes[bandno].mant, + tccp->stepsizes[bandno].expn); + } + fprintf(fd, "\n"); + + if (tccp->csty & J2K_CCP_CSTY_PRT) { + fprintf(fd, " prcw="); + for (resno = 0; resno < tccp->numresolutions; resno++) { + fprintf(fd, "%d ", tccp->prcw[resno]); + } + fprintf(fd, "\n"); + fprintf(fd, " prch="); + for (resno = 0; resno < tccp->numresolutions; resno++) { + fprintf(fd, "%d ", tccp->prch[resno]); + } + fprintf(fd, "\n"); + } + fprintf(fd, " }\n"); + } + fprintf(fd, " }\n"); + } + fprintf(fd, "}\n"); +} + |
