Merge remote-tracking branch 'uclouvain/master' into issue-235

This commit is contained in:
mayeut 2015-07-21 00:20:05 +02:00
commit 1bbb607069
17 changed files with 2073 additions and 1428 deletions

View File

@ -3,12 +3,23 @@
# First thing define the common source:
set(common_SRCS
convert.c
convert.h
convertbmp.c
index.c
index.h
${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c
${OPENJPEG_SOURCE_DIR}/src/bin/common/color.h
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.h
)
if(OPJ_HAVE_LIBTIFF)
list(APPEND common_SRCS converttif.c)
endif()
if(OPJ_HAVE_LIBPNG)
list(APPEND common_SRCS convertpng.c)
endif()
# Headers file are located here:
include_directories(
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h

File diff suppressed because it is too large Load Diff

761
src/bin/jp2/convertpng.c Normal file
View File

@ -0,0 +1,761 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2006-2007, Parvatha Elangovan
* Copyright (c) 2015, Matthieu Darbois
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "opj_apps_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <zlib.h>
#include <png.h>
#include "openjpeg.h"
#include "convert.h"
#define PNG_MAGIC "\x89PNG\x0d\x0a\x1a\x0a"
#define MAGIC_SIZE 8
/* PNG allows bits per sample: 1, 2, 4, 8, 16 */
typedef void (* convert_32s_CXPX)(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, OPJ_SIZE_T length);
static void convert_32s_C1P1(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, OPJ_SIZE_T length)
{
memcpy(pDst[0], pSrc, length * sizeof(OPJ_INT32));
}
static void convert_32s_C2P2(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, OPJ_SIZE_T length)
{
OPJ_SIZE_T i;
OPJ_INT32* pDst0 = pDst[0];
OPJ_INT32* pDst1 = pDst[1];
for (i = 0; i < length; i++) {
pDst0[i] = pSrc[2*i+0];
pDst1[i] = pSrc[2*i+1];
}
}
static void convert_32s_C3P3(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, OPJ_SIZE_T length)
{
OPJ_SIZE_T i;
OPJ_INT32* pDst0 = pDst[0];
OPJ_INT32* pDst1 = pDst[1];
OPJ_INT32* pDst2 = pDst[2];
for (i = 0; i < length; i++) {
pDst0[i] = pSrc[3*i+0];
pDst1[i] = pSrc[3*i+1];
pDst2[i] = pSrc[3*i+2];
}
}
static void convert_32s_C4P4(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, OPJ_SIZE_T length)
{
OPJ_SIZE_T i;
OPJ_INT32* pDst0 = pDst[0];
OPJ_INT32* pDst1 = pDst[1];
OPJ_INT32* pDst2 = pDst[2];
OPJ_INT32* pDst3 = pDst[3];
for (i = 0; i < length; i++) {
pDst0[i] = pSrc[4*i+0];
pDst1[i] = pSrc[4*i+1];
pDst2[i] = pSrc[4*i+2];
pDst3[i] = pSrc[4*i+3];
}
}
typedef void (* convert_XXx32s_C1R)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length);
static void convert_1u32s_C1R(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
{
OPJ_SIZE_T i;
for (i = 0; i < (length & -(OPJ_SIZE_T)8U); i+=8U) {
OPJ_UINT32 val = *pSrc++;
pDst[i+0] = (OPJ_INT32)( val >> 7);
pDst[i+1] = (OPJ_INT32)((val >> 6) & 0x1U);
pDst[i+2] = (OPJ_INT32)((val >> 5) & 0x1U);
pDst[i+3] = (OPJ_INT32)((val >> 4) & 0x1U);
pDst[i+4] = (OPJ_INT32)((val >> 3) & 0x1U);
pDst[i+5] = (OPJ_INT32)((val >> 2) & 0x1U);
pDst[i+6] = (OPJ_INT32)((val >> 1) & 0x1U);
pDst[i+7] = (OPJ_INT32)(val & 0x1U);
}
if (length & 7U) {
OPJ_UINT32 val = *pSrc++;
length = length & 7U;
pDst[i+0] = (OPJ_INT32)(val >> 7);
if (length > 1U) {
pDst[i+1] = (OPJ_INT32)((val >> 6) & 0x1U);
if (length > 2U) {
pDst[i+2] = (OPJ_INT32)((val >> 5) & 0x1U);
if (length > 3U) {
pDst[i+3] = (OPJ_INT32)((val >> 4) & 0x1U);
if (length > 4U) {
pDst[i+4] = (OPJ_INT32)((val >> 3) & 0x1U);
if (length > 5U) {
pDst[i+5] = (OPJ_INT32)((val >> 2) & 0x1U);
if (length > 6U) {
pDst[i+6] = (OPJ_INT32)((val >> 1) & 0x1U);
}
}
}
}
}
}
}
}
static void convert_2u32s_C1R(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
{
OPJ_SIZE_T i;
for (i = 0; i < (length & -(OPJ_SIZE_T)4U); i+=4U) {
OPJ_UINT32 val = *pSrc++;
pDst[i+0] = (OPJ_INT32)( val >> 6);
pDst[i+1] = (OPJ_INT32)((val >> 4) & 0x3U);
pDst[i+2] = (OPJ_INT32)((val >> 2) & 0x3U);
pDst[i+3] = (OPJ_INT32)(val & 0x3U);
}
if (length & 3U) {
OPJ_UINT32 val = *pSrc++;
length = length & 3U;
pDst[i+0] = (OPJ_INT32)(val >> 6);
if (length > 1U) {
pDst[i+1] = (OPJ_INT32)((val >> 4) & 0x3U);
if (length > 2U) {
pDst[i+2] = (OPJ_INT32)((val >> 2) & 0x3U);
}
}
}
}
static void convert_4u32s_C1R(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
{
OPJ_SIZE_T i;
for (i = 0; i < (length & -(OPJ_SIZE_T)2U); i+=2U) {
OPJ_UINT32 val = *pSrc++;
pDst[i+0] = (OPJ_INT32)(val >> 4);
pDst[i+1] = (OPJ_INT32)(val & 0xFU);
}
if (length & 1U) {
OPJ_UINT8 val = *pSrc++;
pDst[i+0] = (OPJ_INT32)(val >> 4);
}
}
static void convert_8u32s_C1R(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
{
OPJ_SIZE_T i;
for (i = 0; i < length; i++) {
pDst[i] = pSrc[i];
}
}
static void convert_16u32s_C1R(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
{
OPJ_SIZE_T i;
for (i = 0; i < length; i++) {
OPJ_INT32 val0 = *pSrc++;
OPJ_INT32 val1 = *pSrc++;
pDst[i] = val0 << 8 | val1;
}
}
opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params)
{
png_structp png;
png_infop info;
double gamma;
int bit_depth, interlace_type,compression_type, filter_type;
OPJ_UINT32 i;
png_uint_32 width, height;
int color_type;
FILE *reader = NULL;
OPJ_BYTE** rows = NULL;
OPJ_INT32* row32s = NULL;
/* j2k: */
opj_image_t *image = NULL;
opj_image_cmptparm_t cmptparm[4];
OPJ_UINT32 nr_comp;
OPJ_BYTE sigbuf[8];
convert_XXx32s_C1R cvtXXTo32s = NULL;
convert_32s_CXPX cvtCxToPx = NULL;
OPJ_INT32* planes[4];
if((reader = fopen(read_idf, "rb")) == NULL)
{
fprintf(stderr,"pngtoimage: can not open %s\n",read_idf);
return NULL;
}
if(fread(sigbuf, 1, MAGIC_SIZE, reader) != MAGIC_SIZE
|| memcmp(sigbuf, PNG_MAGIC, MAGIC_SIZE) != 0)
{
fprintf(stderr,"pngtoimage: %s is no valid PNG file\n",read_idf);
goto fin;
}
if((png = png_create_read_struct(PNG_LIBPNG_VER_STRING,
NULL, NULL, NULL)) == NULL)
goto fin;
if((info = png_create_info_struct(png)) == NULL)
goto fin;
if(setjmp(png_jmpbuf(png)))
goto fin;
png_init_io(png, reader);
png_set_sig_bytes(png, MAGIC_SIZE);
png_read_info(png, info);
if(png_get_IHDR(png, info, &width, &height,
&bit_depth, &color_type, &interlace_type,
&compression_type, &filter_type) == 0)
goto fin;
/* png_set_expand():
* expand paletted images to RGB, expand grayscale images of
* less than 8-bit depth to 8-bit depth, and expand tRNS chunks
* to alpha channels.
*/
if(color_type == PNG_COLOR_TYPE_PALETTE) {
png_set_expand(png);
}
if(png_get_valid(png, info, PNG_INFO_tRNS)) {
png_set_expand(png);
}
/* We might wan't to expand background */
/*
if(png_get_valid(png, info, PNG_INFO_bKGD)) {
png_color_16p bgnd;
png_get_bKGD(png, info, &bgnd);
png_set_background(png, bgnd, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
}
*/
if( !png_get_gAMA(png, info, &gamma))
gamma = 1.0;
/* we're not displaying but converting, screen gamma == 1.0 */
png_set_gamma(png, 1.0, gamma);
png_read_update_info(png, info);
color_type = png_get_color_type(png, info);
switch (color_type) {
case PNG_COLOR_TYPE_GRAY:
nr_comp = 1;
cvtCxToPx = convert_32s_C1P1;
break;
case PNG_COLOR_TYPE_GRAY_ALPHA:
nr_comp = 2;
cvtCxToPx = convert_32s_C2P2;
break;
case PNG_COLOR_TYPE_RGB:
nr_comp = 3;
cvtCxToPx = convert_32s_C3P3;
break;
case PNG_COLOR_TYPE_RGB_ALPHA:
nr_comp = 4;
cvtCxToPx = convert_32s_C4P4;
break;
default:
fprintf(stderr,"pngtoimage: colortype %d is not supported\n", color_type);
goto fin;
}
bit_depth = png_get_bit_depth(png, info);
switch (bit_depth) {
case 1:
cvtXXTo32s = convert_1u32s_C1R;
break;
case 2:
cvtXXTo32s = convert_2u32s_C1R;
break;
case 4:
cvtXXTo32s = convert_4u32s_C1R;
break;
case 8:
cvtXXTo32s = convert_8u32s_C1R;
break;
case 16:
cvtXXTo32s = convert_16u32s_C1R;
break;
default:
fprintf(stderr,"pngtoimage: bit depth %d is not supported\n", bit_depth);
goto fin;
}
rows = (OPJ_BYTE**)calloc(height+1, sizeof(OPJ_BYTE*));
for(i = 0; i < height; ++i)
rows[i] = (OPJ_BYTE*)malloc(png_get_rowbytes(png,info));
png_read_image(png, rows);
/* Create image */
memset(cmptparm, 0, sizeof(cmptparm));
for(i = 0; i < nr_comp; ++i)
{
cmptparm[i].prec = (OPJ_UINT32)bit_depth;
/* bits_per_pixel: 8 or 16 */
cmptparm[i].bpp = (OPJ_UINT32)bit_depth;
cmptparm[i].sgnd = 0;
cmptparm[i].dx = (OPJ_UINT32)params->subsampling_dx;
cmptparm[i].dy = (OPJ_UINT32)params->subsampling_dy;
cmptparm[i].w = (OPJ_UINT32)width;
cmptparm[i].h = (OPJ_UINT32)height;
}
image = opj_image_create(nr_comp, &cmptparm[0], (nr_comp > 2U) ? OPJ_CLRSPC_SRGB : OPJ_CLRSPC_GRAY);
if(image == NULL) goto fin;
image->x0 = (OPJ_UINT32)params->image_offset_x0;
image->y0 = (OPJ_UINT32)params->image_offset_y0;
image->x1 = (OPJ_UINT32)(image->x0 + (width - 1) * (OPJ_UINT32)params->subsampling_dx + 1 + image->x0);
image->y1 = (OPJ_UINT32)(image->y0 + (height - 1) * (OPJ_UINT32)params->subsampling_dy + 1 + image->y0);
row32s = malloc((size_t)width * nr_comp * sizeof(OPJ_INT32));
if(row32s == NULL) goto fin;
/* Set alpha channel */
image->comps[nr_comp-1U].alpha = 1U - (nr_comp & 1U);
for(i = 0; i < nr_comp; i++)
{
planes[i] = image->comps[i].data;
}
for(i = 0; i < height; ++i)
{
cvtXXTo32s(rows[i], row32s, (OPJ_SIZE_T)width * nr_comp);
cvtCxToPx(row32s, planes, width);
planes[0] += width;
planes[1] += width;
planes[2] += width;
planes[3] += width;
}
fin:
if(rows)
{
for(i = 0; i < height; ++i)
free(rows[i]);
free(rows);
}
if (row32s) {
free(row32s);
}
if(png)
png_destroy_read_struct(&png, &info, NULL);
fclose(reader);
return image;
}/* pngtoimage() */
int imagetopng(opj_image_t * image, const char *write_idf)
{
FILE *writer;
png_structp png;
png_infop info;
int *red, *green, *blue, *alpha;
unsigned char *row_buf, *d;
int has_alpha, width, height, nr_comp, color_type;
int adjustR, adjustG, adjustB, adjustA, x, y, fails;
int prec, ushift, dshift, is16, force16, force8;
unsigned short mask = 0xffff;
png_color_8 sig_bit;
is16 = force16 = force8 = ushift = dshift = 0; fails = 1;
prec = (int)image->comps[0].prec;
nr_comp = (int)image->numcomps;
if(prec > 8 && prec < 16)
{
ushift = 16 - prec; dshift = prec - ushift;
prec = 16; force16 = 1;
}
else
if(prec < 8 && nr_comp > 1)/* GRAY_ALPHA, RGB, RGB_ALPHA */
{
ushift = 8 - prec; dshift = 8 - ushift;
prec = 8; force8 = 1;
}
if(prec != 1 && prec != 2 && prec != 4 && prec != 8 && prec != 16)
{
fprintf(stderr,"imagetopng: can not create %s"
"\n\twrong bit_depth %d\n", write_idf, prec);
return fails;
}
writer = fopen(write_idf, "wb");
if(writer == NULL) return fails;
info = NULL; has_alpha = 0;
/* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method,
* you can supply NULL for the last three parameters. We also check that
* the library version is compatible with the one used at compile time,
* in case we are using dynamically linked libraries. REQUIRED.
*/
png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
NULL, NULL, NULL);
/*png_voidp user_error_ptr, user_error_fn, user_warning_fn); */
if(png == NULL) goto fin;
/* Allocate/initialize the image information data. REQUIRED
*/
info = png_create_info_struct(png);
if(info == NULL) goto fin;
/* Set error handling. REQUIRED if you are not supplying your own
* error handling functions in the png_create_write_struct() call.
*/
if(setjmp(png_jmpbuf(png))) goto fin;
/* I/O initialization functions is REQUIRED
*/
png_init_io(png, writer);
/* Set the image information here. Width and height are up to 2^31,
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE.
* REQUIRED
*
* ERRORS:
*
* color_type == PNG_COLOR_TYPE_PALETTE && bit_depth > 8
* color_type == PNG_COLOR_TYPE_RGB && bit_depth < 8
* color_type == PNG_COLOR_TYPE_GRAY_ALPHA && bit_depth < 8
* color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8
*
*/
png_set_compression_level(png, Z_BEST_COMPRESSION);
if(prec == 16) mask = 0xffff;
else
if(prec == 8) mask = 0x00ff;
else
if(prec == 4) mask = 0x000f;
else
if(prec == 2) mask = 0x0003;
else
if(prec == 1) mask = 0x0001;
if(nr_comp >= 3
&& image->comps[0].dx == image->comps[1].dx
&& image->comps[1].dx == image->comps[2].dx
&& image->comps[0].dy == image->comps[1].dy
&& image->comps[1].dy == image->comps[2].dy
&& image->comps[0].prec == image->comps[1].prec
&& image->comps[1].prec == image->comps[2].prec)
{
int v;
has_alpha = (nr_comp > 3);
is16 = (prec == 16);
width = (int)image->comps[0].w;
height = (int)image->comps[0].h;
red = image->comps[0].data;
green = image->comps[1].data;
blue = image->comps[2].data;
sig_bit.red = sig_bit.green = sig_bit.blue = (png_byte)prec;
if(has_alpha)
{
sig_bit.alpha = (png_byte)prec;
alpha = image->comps[3].data;
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
adjustA = (image->comps[3].sgnd ? 1 << (image->comps[3].prec - 1) : 0);
}
else
{
sig_bit.alpha = 0; alpha = NULL;
color_type = PNG_COLOR_TYPE_RGB;
adjustA = 0;
}
png_set_sBIT(png, info, &sig_bit);
png_set_IHDR(png, info, (png_uint_32)width, (png_uint_32)height, prec,
color_type,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
png_set_gamma(png, 2.2, 1./2.2);
png_set_sRGB(png, info, PNG_sRGB_INTENT_PERCEPTUAL);
/*=============================*/
png_write_info(png, info);
/*=============================*/
if(prec < 8)
{
png_set_packing(png);
}
// printf("%s:%d:sgnd(%d,%d,%d) w(%d) h(%d) alpha(%d)\n",__FILE__,__LINE__,
//image->comps[0].sgnd,
//image->comps[1].sgnd,image->comps[2].sgnd,width,height,has_alpha);
adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
adjustG = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
adjustB = (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
row_buf = (unsigned char*)malloc((size_t)width * (size_t)nr_comp * 2);
for(y = 0; y < height; ++y)
{
d = row_buf;
for(x = 0; x < width; ++x)
{
if(is16)
{
v = *red + adjustR; ++red;
if(v > 65535) v = 65535; else if(v < 0) v = 0;
if(force16) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
v = *green + adjustG; ++green;
if(v > 65535) v = 65535; else if(v < 0) v = 0;
if(force16) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
v = *blue + adjustB; ++blue;
if(v > 65535) v = 65535; else if(v < 0) v = 0;
if(force16) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
if(has_alpha)
{
v = *alpha + adjustA; ++alpha;
if(v > 65535) v = 65535; else if(v < 0) v = 0;
if(force16) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
}
continue;
}/* if(is16) */
v = *red + adjustR; ++red;
if(v > 255) v = 255; else if(v < 0) v = 0;
if(force8) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v & mask);
v = *green + adjustG; ++green;
if(v > 255) v = 255; else if(v < 0) v = 0;
if(force8) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v & mask);
v = *blue + adjustB; ++blue;
if(v > 255) v = 255; else if(v < 0) v = 0;
if(force8) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v & mask);
if(has_alpha)
{
v = *alpha + adjustA; ++alpha;
if(v > 255) v = 255; else if(v < 0) v = 0;
if(force8) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v & mask);
}
} /* for(x) */
png_write_row(png, row_buf);
} /* for(y) */
free(row_buf);
}/* nr_comp >= 3 */
else
if(nr_comp == 1 /* GRAY */
|| ( nr_comp == 2 /* GRAY_ALPHA */
&& image->comps[0].dx == image->comps[1].dx
&& image->comps[0].dy == image->comps[1].dy
&& image->comps[0].prec == image->comps[1].prec))
{
int v;
red = image->comps[0].data;
sig_bit.gray = (png_byte)prec;
sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 0;
alpha = NULL; adjustA = 0;
color_type = PNG_COLOR_TYPE_GRAY;
if(nr_comp == 2)
{
has_alpha = 1; sig_bit.alpha = (png_byte)prec;
alpha = image->comps[1].data;
color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
adjustA = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
}
width = (int)image->comps[0].w;
height = (int)image->comps[0].h;
png_set_IHDR(png, info, (png_uint_32)width, (png_uint_32)height, sig_bit.gray,
color_type,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
png_set_sBIT(png, info, &sig_bit);
png_set_gamma(png, 2.2, 1./2.2);
png_set_sRGB(png, info, PNG_sRGB_INTENT_PERCEPTUAL);
/*=============================*/
png_write_info(png, info);
/*=============================*/
adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
if(prec < 8)
{
png_set_packing(png);
}
if(prec > 8)
{
row_buf = (unsigned char*)
malloc((size_t)width * (size_t)nr_comp * sizeof(unsigned short));
for(y = 0; y < height; ++y)
{
d = row_buf;
for(x = 0; x < width; ++x)
{
v = *red + adjustR; ++red;
if(v > 65535) v = 65535; else if(v < 0) v = 0;
if(force16) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
if(has_alpha)
{
v = *alpha++;
if(v > 65535) v = 65535; else if(v < 0) v = 0;
if(force16) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
}
}/* for(x) */
png_write_row(png, row_buf);
} /* for(y) */
free(row_buf);
}
else /* prec <= 8 */
{
row_buf = (unsigned char*)calloc((size_t)width, (size_t)nr_comp * 2);
for(y = 0; y < height; ++y)
{
d = row_buf;
for(x = 0; x < width; ++x)
{
v = *red + adjustR; ++red;
if(v > 255) v = 255; else if(v < 0) v = 0;
if(force8) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v & mask);
if(has_alpha)
{
v = *alpha + adjustA; ++alpha;
if(v > 255) v = 255; else if(v < 0) v = 0;
if(force8) { v = (v<<ushift) + (v>>dshift); }
*d++ = (unsigned char)(v & mask);
}
}/* for(x) */
png_write_row(png, row_buf);
} /* for(y) */
free(row_buf);
}
}
else
{
fprintf(stderr,"imagetopng: can not create %s\n",write_idf);
goto fin;
}
png_write_end(png, info);
fails = 0;
fin:
if(png)
{
png_destroy_write_struct(&png, &info);
}
fclose(writer);
if(fails) remove(write_idf);
return fails;
}/* imagetopng() */

1038
src/bin/jp2/converttif.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -10,34 +10,60 @@ include_directories(
# Defines the source code for the library
set(OPENJPEG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/bio.c
${CMAKE_CURRENT_SOURCE_DIR}/bio.h
${CMAKE_CURRENT_SOURCE_DIR}/cio.c
${CMAKE_CURRENT_SOURCE_DIR}/cio.h
${CMAKE_CURRENT_SOURCE_DIR}/dwt.c
${CMAKE_CURRENT_SOURCE_DIR}/dwt.h
${CMAKE_CURRENT_SOURCE_DIR}/event.c
${CMAKE_CURRENT_SOURCE_DIR}/event.h
${CMAKE_CURRENT_SOURCE_DIR}/image.c
${CMAKE_CURRENT_SOURCE_DIR}/image.h
${CMAKE_CURRENT_SOURCE_DIR}/invert.c
${CMAKE_CURRENT_SOURCE_DIR}/invert.h
${CMAKE_CURRENT_SOURCE_DIR}/j2k.c
${CMAKE_CURRENT_SOURCE_DIR}/j2k.h
${CMAKE_CURRENT_SOURCE_DIR}/jp2.c
${CMAKE_CURRENT_SOURCE_DIR}/jp2.h
${CMAKE_CURRENT_SOURCE_DIR}/mct.c
${CMAKE_CURRENT_SOURCE_DIR}/mct.h
${CMAKE_CURRENT_SOURCE_DIR}/mqc.c
${CMAKE_CURRENT_SOURCE_DIR}/mqc.h
${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.c
${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.c
${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.h
${CMAKE_CURRENT_SOURCE_DIR}/pi.c
${CMAKE_CURRENT_SOURCE_DIR}/pi.h
${CMAKE_CURRENT_SOURCE_DIR}/raw.c
${CMAKE_CURRENT_SOURCE_DIR}/raw.h
${CMAKE_CURRENT_SOURCE_DIR}/t1.c
${CMAKE_CURRENT_SOURCE_DIR}/t1.h
${CMAKE_CURRENT_SOURCE_DIR}/t2.c
${CMAKE_CURRENT_SOURCE_DIR}/t2.h
${CMAKE_CURRENT_SOURCE_DIR}/tcd.c
${CMAKE_CURRENT_SOURCE_DIR}/tcd.h
${CMAKE_CURRENT_SOURCE_DIR}/tgt.c
${CMAKE_CURRENT_SOURCE_DIR}/tgt.h
${CMAKE_CURRENT_SOURCE_DIR}/function_list.c
${CMAKE_CURRENT_SOURCE_DIR}/function_list.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_codec.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_includes.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_intmath.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_malloc.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_stdint.h
)
if(BUILD_JPIP)
add_definitions(-DUSE_JPIP)
set(OPENJPEG_SRCS
${OPENJPEG_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/cidx_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/cidx_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/phix_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/ppix_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/thix_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/tpix_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/indexbox_manager.h
)
endif()

View File

@ -78,7 +78,7 @@ static OPJ_BOOL opj_bio_bytein(opj_bio_t *bio);
==========================================================
*/
OPJ_BOOL opj_bio_byteout(opj_bio_t *bio) {
static OPJ_BOOL opj_bio_byteout(opj_bio_t *bio) {
bio->buf = (bio->buf << 8) & 0xffff;
bio->ct = bio->buf == 0xff00 ? 7 : 8;
if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) {
@ -88,7 +88,7 @@ OPJ_BOOL opj_bio_byteout(opj_bio_t *bio) {
return OPJ_TRUE;
}
OPJ_BOOL opj_bio_bytein(opj_bio_t *bio) {
static OPJ_BOOL opj_bio_bytein(opj_bio_t *bio) {
bio->buf = (bio->buf << 8) & 0xffff;
bio->ct = bio->buf == 0xff00 ? 7 : 8;
if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) {
@ -98,7 +98,7 @@ OPJ_BOOL opj_bio_bytein(opj_bio_t *bio) {
return OPJ_TRUE;
}
void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) {
static void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) {
if (bio->ct == 0) {
opj_bio_byteout(bio); /* MSD: why not check the return value of this function ? */
}
@ -106,7 +106,7 @@ void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) {
bio->buf |= b << bio->ct;
}
OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio) {
static OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio) {
if (bio->ct == 0) {
opj_bio_bytein(bio); /* MSD: why not check the return value of this function ? */
}

View File

@ -193,7 +193,7 @@ static const OPJ_FLOAT64 opj_dwt_norms_real[4][10] = {
/* <summary> */
/* Forward lazy transform (horizontal). */
/* </summary> */
void opj_dwt_deinterleave_h(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
static void opj_dwt_deinterleave_h(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
OPJ_INT32 i;
OPJ_INT32 * l_dest = b;
OPJ_INT32 * l_src = a+cas;
@ -215,7 +215,7 @@ void opj_dwt_deinterleave_h(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32
/* <summary> */
/* Forward lazy transform (vertical). */
/* </summary> */
void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 x, OPJ_INT32 cas) {
static void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 x, OPJ_INT32 cas) {
OPJ_INT32 i = sn;
OPJ_INT32 * l_dest = b;
OPJ_INT32 * l_src = a+cas;
@ -240,7 +240,7 @@ void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32
/* <summary> */
/* Inverse lazy transform (horizontal). */
/* </summary> */
void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a) {
static void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a) {
OPJ_INT32 *ai = a;
OPJ_INT32 *bi = h->mem + h->cas;
OPJ_INT32 i = h->sn;
@ -260,7 +260,7 @@ void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a) {
/* <summary> */
/* Inverse lazy transform (vertical). */
/* </summary> */
void opj_dwt_interleave_v(opj_dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x) {
static void opj_dwt_interleave_v(opj_dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x) {
OPJ_INT32 *ai = a;
OPJ_INT32 *bi = v->mem + v->cas;
OPJ_INT32 i = v->sn;
@ -283,7 +283,7 @@ void opj_dwt_interleave_v(opj_dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x) {
/* <summary> */
/* Forward 5-3 wavelet transform in 1-D. */
/* </summary> */
void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
static void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
OPJ_INT32 i;
if (!cas) {
@ -304,7 +304,7 @@ void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
/* <summary> */
/* Inverse 5-3 wavelet transform in 1-D. */
/* </summary> */
void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
static void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
OPJ_INT32 i;
if (!cas) {
@ -325,14 +325,14 @@ void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas)
/* <summary> */
/* Inverse 5-3 wavelet transform in 1-D. */
/* </summary> */
void opj_dwt_decode_1(opj_dwt_t *v) {
static void opj_dwt_decode_1(opj_dwt_t *v) {
opj_dwt_decode_1_(v->mem, v->dn, v->sn, v->cas);
}
/* <summary> */
/* Forward 9-7 wavelet transform in 1-D. */
/* </summary> */
void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
static void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
OPJ_INT32 i;
if (!cas) {
if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */
@ -367,7 +367,7 @@ void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 c
}
}
void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_t *bandno_stepsize) {
static void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_t *bandno_stepsize) {
OPJ_INT32 p, n;
p = opj_int_floorlog2(stepsize) - 13;
n = 11 - opj_int_floorlog2(stepsize);
@ -385,7 +385,7 @@ void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_
/* <summary> */
/* Forward 5-3 wavelet transform in 2-D. */
/* </summary> */
INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) )
static INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) )
{
OPJ_INT32 i, j, k;
OPJ_INT32 *a = 00;
@ -541,7 +541,7 @@ void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec) {
/* <summary> */
/* Determine maximum computed resolution level for inverse wavelet transform */
/* </summary> */
OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i) {
static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i) {
OPJ_UINT32 mr = 0;
OPJ_UINT32 w;
while( --i ) {
@ -557,7 +557,7 @@ OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i
/* <summary> */
/* Inverse wavelet transform in 2-D. */
/* </summary> */
OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) {
static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) {
opj_dwt_t h;
opj_dwt_t v;
@ -613,7 +613,7 @@ OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1D
return OPJ_TRUE;
}
void opj_v4dwt_interleave_h(opj_v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OPJ_INT32 x, OPJ_INT32 size){
static void opj_v4dwt_interleave_h(opj_v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OPJ_INT32 x, OPJ_INT32 size){
OPJ_FLOAT32* restrict bi = (OPJ_FLOAT32*) (w->wavelet + w->cas);
OPJ_INT32 count = w->sn;
OPJ_INT32 i, k;
@ -656,7 +656,7 @@ void opj_v4dwt_interleave_h(opj_v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OP
}
}
void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , OPJ_INT32 x, OPJ_INT32 nb_elts_read){
static void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , OPJ_INT32 x, OPJ_INT32 nb_elts_read){
opj_v4_t* restrict bi = v->wavelet + v->cas;
OPJ_INT32 i;
@ -674,7 +674,7 @@ void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a ,
#ifdef __SSE__
void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c){
static void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c){
__m128* restrict vw = (__m128*) w;
OPJ_INT32 i;
/* 4x unrolled loop */
@ -723,7 +723,7 @@ void opj_v4dwt_decode_step2_sse(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32
#else
void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const OPJ_FLOAT32 c)
static void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const OPJ_FLOAT32 c)
{
OPJ_FLOAT32* restrict fw = (OPJ_FLOAT32*) w;
OPJ_INT32 i;
@ -739,7 +739,7 @@ void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const OPJ_FLOAT32 c)
}
}
void opj_v4dwt_decode_step2(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c)
static void opj_v4dwt_decode_step2(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c)
{
OPJ_FLOAT32* restrict fl = (OPJ_FLOAT32*) l;
OPJ_FLOAT32* restrict fw = (OPJ_FLOAT32*) w;

View File

@ -103,7 +103,7 @@ OPJ_BOOL opj_matrix_inversion_f(OPJ_FLOAT32 * pSrcMatrix,
Local functions
==========================================================
*/
OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
static OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
OPJ_FLOAT32 * p_swap_area,
OPJ_UINT32 nb_compo)
{
@ -204,7 +204,7 @@ OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
return OPJ_TRUE;
}
void opj_lupSolve (OPJ_FLOAT32 * pResult,
static void opj_lupSolve (OPJ_FLOAT32 * pResult,
OPJ_FLOAT32 * pMatrix,
OPJ_FLOAT32 * pVector,
OPJ_UINT32* pPermutations,
@ -266,7 +266,7 @@ void opj_lupSolve (OPJ_FLOAT32 * pResult,
}
void opj_lupInvert (OPJ_FLOAT32 * pSrcMatrix,
static void opj_lupInvert (OPJ_FLOAT32 * pSrcMatrix,
OPJ_FLOAT32 * pDestMatrix,
OPJ_UINT32 nb_compo,
OPJ_UINT32 * pPermutations,

View File

@ -202,7 +202,7 @@ static opj_mqc_state_t mqc_states[47 * 2] = {
==========================================================
*/
void opj_mqc_byteout(opj_mqc_t *mqc) {
static void opj_mqc_byteout(opj_mqc_t *mqc) {
if (*mqc->bp == 0xff) {
mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 20);
@ -232,7 +232,7 @@ void opj_mqc_byteout(opj_mqc_t *mqc) {
}
}
void opj_mqc_renorme(opj_mqc_t *mqc) {
static void opj_mqc_renorme(opj_mqc_t *mqc) {
do {
mqc->a <<= 1;
mqc->c <<= 1;
@ -243,7 +243,7 @@ void opj_mqc_renorme(opj_mqc_t *mqc) {
} while ((mqc->a & 0x8000) == 0);
}
void opj_mqc_codemps(opj_mqc_t *mqc) {
static void opj_mqc_codemps(opj_mqc_t *mqc) {
mqc->a -= (*mqc->curctx)->qeval;
if ((mqc->a & 0x8000) == 0) {
if (mqc->a < (*mqc->curctx)->qeval) {
@ -258,7 +258,7 @@ void opj_mqc_codemps(opj_mqc_t *mqc) {
}
}
void opj_mqc_codelps(opj_mqc_t *mqc) {
static void opj_mqc_codelps(opj_mqc_t *mqc) {
mqc->a -= (*mqc->curctx)->qeval;
if (mqc->a < (*mqc->curctx)->qeval) {
mqc->c += (*mqc->curctx)->qeval;
@ -269,7 +269,7 @@ void opj_mqc_codelps(opj_mqc_t *mqc) {
opj_mqc_renorme(mqc);
}
void opj_mqc_setbits(opj_mqc_t *mqc) {
static void opj_mqc_setbits(opj_mqc_t *mqc) {
OPJ_UINT32 tempc = mqc->c + mqc->a;
mqc->c |= 0xffff;
if (mqc->c >= tempc) {

View File

@ -214,7 +214,7 @@ static void opj_pi_update_decode_poc ( opj_pi_iterator_t * p_pi,
/**
* FIXME DOC
*/
OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
static OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
opj_cp_t *cp,
OPJ_UINT32 tileno,
OPJ_UINT32 pino,
@ -230,7 +230,7 @@ OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
==========================================================
*/
OPJ_BOOL opj_pi_next_lrcp(opj_pi_iterator_t * pi) {
static OPJ_BOOL opj_pi_next_lrcp(opj_pi_iterator_t * pi) {
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
OPJ_UINT32 index = 0;
@ -270,7 +270,7 @@ LABEL_SKIP:;
return OPJ_FALSE;
}
OPJ_BOOL opj_pi_next_rlcp(opj_pi_iterator_t * pi) {
static OPJ_BOOL opj_pi_next_rlcp(opj_pi_iterator_t * pi) {
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
OPJ_UINT32 index = 0;
@ -309,7 +309,7 @@ LABEL_SKIP:;
return OPJ_FALSE;
}
OPJ_BOOL opj_pi_next_rpcl(opj_pi_iterator_t * pi) {
static OPJ_BOOL opj_pi_next_rpcl(opj_pi_iterator_t * pi) {
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
OPJ_UINT32 index = 0;
@ -392,7 +392,7 @@ LABEL_SKIP:;
return OPJ_FALSE;
}
OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
static OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
OPJ_UINT32 index = 0;
@ -473,7 +473,7 @@ LABEL_SKIP:;
return OPJ_FALSE;
}
OPJ_BOOL opj_pi_next_cprl(opj_pi_iterator_t * pi) {
static OPJ_BOOL opj_pi_next_cprl(opj_pi_iterator_t * pi) {
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
OPJ_UINT32 index = 0;
@ -552,7 +552,7 @@ LABEL_SKIP:;
return OPJ_FALSE;
}
void opj_get_encoding_parameters( const opj_image_t *p_image,
static void opj_get_encoding_parameters( const opj_image_t *p_image,
const opj_cp_t *p_cp,
OPJ_UINT32 p_tileno,
OPJ_INT32 * p_tx0,
@ -666,7 +666,7 @@ void opj_get_encoding_parameters( const opj_image_t *p_image,
}
void opj_get_all_encoding_parameters( const opj_image_t *p_image,
static void opj_get_all_encoding_parameters( const opj_image_t *p_image,
const opj_cp_t *p_cp,
OPJ_UINT32 tileno,
OPJ_INT32 * p_tx0,
@ -789,7 +789,7 @@ void opj_get_all_encoding_parameters( const opj_image_t *p_image,
}
}
opj_pi_iterator_t * opj_pi_create( const opj_image_t *image,
static opj_pi_iterator_t * opj_pi_create( const opj_image_t *image,
const opj_cp_t *cp,
OPJ_UINT32 tileno )
{
@ -850,7 +850,7 @@ opj_pi_iterator_t * opj_pi_create( const opj_image_t *image,
return l_pi;
}
void opj_pi_update_encode_poc_and_final ( opj_cp_t *p_cp,
static void opj_pi_update_encode_poc_and_final ( opj_cp_t *p_cp,
OPJ_UINT32 p_tileno,
OPJ_INT32 p_tx0,
OPJ_INT32 p_tx1,
@ -928,7 +928,7 @@ void opj_pi_update_encode_poc_and_final ( opj_cp_t *p_cp,
}
}
void opj_pi_update_encode_not_poc ( opj_cp_t *p_cp,
static void opj_pi_update_encode_not_poc ( opj_cp_t *p_cp,
OPJ_UINT32 p_num_comps,
OPJ_UINT32 p_tileno,
OPJ_INT32 p_tx0,
@ -983,7 +983,7 @@ void opj_pi_update_encode_not_poc ( opj_cp_t *p_cp,
}
}
void opj_pi_update_decode_poc (opj_pi_iterator_t * p_pi,
static void opj_pi_update_decode_poc (opj_pi_iterator_t * p_pi,
opj_tcp_t * p_tcp,
OPJ_UINT32 p_max_precision,
OPJ_UINT32 p_max_res)
@ -1025,7 +1025,7 @@ void opj_pi_update_decode_poc (opj_pi_iterator_t * p_pi,
}
}
void opj_pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,
static void opj_pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,
opj_tcp_t * p_tcp,
OPJ_UINT32 p_max_precision,
OPJ_UINT32 p_max_res)
@ -1062,7 +1062,7 @@ void opj_pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,
OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
static OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
opj_cp_t *cp,
OPJ_UINT32 tileno,
OPJ_UINT32 pino,

View File

@ -295,7 +295,7 @@ static OPJ_BOOL opj_t1_decode_cblk( opj_t1_t *t1,
OPJ_UINT32 roishift,
OPJ_UINT32 cblksty);
OPJ_BOOL opj_t1_allocate_buffers( opj_t1_t *t1,
static OPJ_BOOL opj_t1_allocate_buffers( opj_t1_t *t1,
OPJ_UINT32 w,
OPJ_UINT32 h);
@ -305,25 +305,25 @@ OPJ_BOOL opj_t1_allocate_buffers( opj_t1_t *t1,
/* ----------------------------------------------------------------------- */
OPJ_BYTE opj_t1_getctxno_zc(OPJ_UINT32 f, OPJ_UINT32 orient) {
static OPJ_BYTE opj_t1_getctxno_zc(OPJ_UINT32 f, OPJ_UINT32 orient) {
return lut_ctxno_zc[(orient << 8) | (f & T1_SIG_OTH)];
}
OPJ_BYTE opj_t1_getctxno_sc(OPJ_UINT32 f) {
static OPJ_BYTE opj_t1_getctxno_sc(OPJ_UINT32 f) {
return lut_ctxno_sc[(f & (T1_SIG_PRIM | T1_SGN)) >> 4];
}
OPJ_UINT32 opj_t1_getctxno_mag(OPJ_UINT32 f) {
static OPJ_UINT32 opj_t1_getctxno_mag(OPJ_UINT32 f) {
OPJ_UINT32 tmp1 = (f & T1_SIG_OTH) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
OPJ_UINT32 tmp2 = (f & T1_REFINE) ? T1_CTXNO_MAG + 2 : tmp1;
return (tmp2);
}
OPJ_BYTE opj_t1_getspb(OPJ_UINT32 f) {
static OPJ_BYTE opj_t1_getspb(OPJ_UINT32 f) {
return lut_spb[(f & (T1_SIG_PRIM | T1_SGN)) >> 4];
}
OPJ_INT16 opj_t1_getnmsedec_sig(OPJ_UINT32 x, OPJ_UINT32 bitpos) {
static OPJ_INT16 opj_t1_getnmsedec_sig(OPJ_UINT32 x, OPJ_UINT32 bitpos) {
if (bitpos > 0) {
return lut_nmsedec_sig[(x >> (bitpos)) & ((1 << T1_NMSEDEC_BITS) - 1)];
}
@ -331,7 +331,7 @@ OPJ_INT16 opj_t1_getnmsedec_sig(OPJ_UINT32 x, OPJ_UINT32 bitpos) {
return lut_nmsedec_sig0[x & ((1 << T1_NMSEDEC_BITS) - 1)];
}
OPJ_INT16 opj_t1_getnmsedec_ref(OPJ_UINT32 x, OPJ_UINT32 bitpos) {
static OPJ_INT16 opj_t1_getnmsedec_ref(OPJ_UINT32 x, OPJ_UINT32 bitpos) {
if (bitpos > 0) {
return lut_nmsedec_ref[(x >> (bitpos)) & ((1 << T1_NMSEDEC_BITS) - 1)];
}
@ -339,7 +339,7 @@ OPJ_INT16 opj_t1_getnmsedec_ref(OPJ_UINT32 x, OPJ_UINT32 bitpos) {
return lut_nmsedec_ref0[x & ((1 << T1_NMSEDEC_BITS) - 1)];
}
void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride) {
static void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride) {
opj_flag_t *np = flagsp - stride;
opj_flag_t *sp = flagsp + stride;
@ -363,7 +363,7 @@ void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride) {
sp[1] |= T1_SIG_NW;
}
void opj_t1_enc_sigpass_step( opj_t1_t *t1,
static void opj_t1_enc_sigpass_step( opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_UINT32 orient,
@ -427,7 +427,7 @@ static INLINE void opj_t1_dec_sigpass_step_raw(
}
}
INLINE void opj_t1_dec_sigpass_step_mqc(
static INLINE void opj_t1_dec_sigpass_step_mqc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
@ -451,7 +451,7 @@ INLINE void opj_t1_dec_sigpass_step_mqc(
}
} /* VSC and BYPASS by Antonin */
INLINE void opj_t1_dec_sigpass_step_mqc_vsc(
static INLINE void opj_t1_dec_sigpass_step_mqc_vsc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
@ -478,7 +478,7 @@ INLINE void opj_t1_dec_sigpass_step_mqc_vsc(
void opj_t1_enc_sigpass(opj_t1_t *t1,
static void opj_t1_enc_sigpass(opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_UINT32 orient,
OPJ_INT32 *nmsedec,
@ -510,7 +510,7 @@ void opj_t1_enc_sigpass(opj_t1_t *t1,
}
}
void opj_t1_dec_sigpass_raw(
static void opj_t1_dec_sigpass_raw(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 orient,
@ -537,7 +537,7 @@ void opj_t1_dec_sigpass_raw(
}
} /* VSC and BYPASS by Antonin */
void opj_t1_dec_sigpass_mqc(
static void opj_t1_dec_sigpass_mqc(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 orient)
@ -580,7 +580,7 @@ void opj_t1_dec_sigpass_mqc(
}
} /* VSC and BYPASS by Antonin */
void opj_t1_dec_sigpass_mqc_vsc(
static void opj_t1_dec_sigpass_mqc_vsc(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 orient)
@ -608,7 +608,7 @@ void opj_t1_dec_sigpass_mqc_vsc(
void opj_t1_enc_refpass_step( opj_t1_t *t1,
static void opj_t1_enc_refpass_step( opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 bpno,
@ -636,7 +636,7 @@ void opj_t1_enc_refpass_step( opj_t1_t *t1,
}
}
INLINE void opj_t1_dec_refpass_step_raw(
static INLINE void opj_t1_dec_refpass_step_raw(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
@ -657,7 +657,7 @@ INLINE void opj_t1_dec_refpass_step_raw(
}
} /* VSC and BYPASS by Antonin */
INLINE void opj_t1_dec_refpass_step_mqc(
static INLINE void opj_t1_dec_refpass_step_mqc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
@ -678,7 +678,7 @@ INLINE void opj_t1_dec_refpass_step_mqc(
}
} /* VSC and BYPASS by Antonin */
INLINE void opj_t1_dec_refpass_step_mqc_vsc(
static INLINE void opj_t1_dec_refpass_step_mqc_vsc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
@ -701,7 +701,7 @@ INLINE void opj_t1_dec_refpass_step_mqc_vsc(
} /* VSC and BYPASS by Antonin */
void opj_t1_enc_refpass(
static void opj_t1_enc_refpass(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 *nmsedec,
@ -731,7 +731,7 @@ void opj_t1_enc_refpass(
}
}
void opj_t1_dec_refpass_raw(
static void opj_t1_dec_refpass_raw(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_INT32 cblksty)
@ -758,7 +758,7 @@ void opj_t1_dec_refpass_raw(
}
} /* VSC and BYPASS by Antonin */
void opj_t1_dec_refpass_mqc(
static void opj_t1_dec_refpass_mqc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{
@ -800,7 +800,7 @@ void opj_t1_dec_refpass_mqc(
}
} /* VSC and BYPASS by Antonin */
void opj_t1_dec_refpass_mqc_vsc(
static void opj_t1_dec_refpass_mqc_vsc(
opj_t1_t *t1,
OPJ_INT32 bpno)
{
@ -827,7 +827,7 @@ void opj_t1_dec_refpass_mqc_vsc(
} /* VSC and BYPASS by Antonin */
void opj_t1_enc_clnpass_step(
static void opj_t1_enc_clnpass_step(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
@ -937,7 +937,7 @@ LABEL_PARTIAL:
*flagsp &= ~T1_VISIT;
}
void opj_t1_enc_clnpass(
static void opj_t1_enc_clnpass(
opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_UINT32 orient,
@ -1161,7 +1161,7 @@ static OPJ_FLOAT64 opj_t1_getwmsedec(
return wmsedec;
}
OPJ_BOOL opj_t1_allocate_buffers(
static OPJ_BOOL opj_t1_allocate_buffers(
opj_t1_t *t1,
OPJ_UINT32 w,
OPJ_UINT32 h)
@ -1358,7 +1358,7 @@ OPJ_BOOL opj_t1_decode_cblks( opj_t1_t* t1,
}
OPJ_BOOL opj_t1_decode_cblk(opj_t1_t *t1,
static OPJ_BOOL opj_t1_decode_cblk(opj_t1_t *t1,
opj_tcd_cblk_dec_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 roishift,
@ -1556,7 +1556,7 @@ OPJ_BOOL opj_t1_encode_cblks( opj_t1_t *t1,
}
/** mod fixed_quality */
void opj_t1_encode_cblk(opj_t1_t *t1,
static void opj_t1_encode_cblk(opj_t1_t *t1,
opj_tcd_cblk_enc_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 compno,
@ -1696,7 +1696,7 @@ void opj_t1_encode_cblk(opj_t1_t *t1,
}
#if 0
void opj_t1_dec_refpass_step( opj_t1_t *t1,
static void opj_t1_dec_refpass_step( opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_INT32 poshalf,
@ -1728,7 +1728,7 @@ void opj_t1_dec_refpass_step( opj_t1_t *t1,
#if 0
void opj_t1_dec_sigpass_step( opj_t1_t *t1,
static void opj_t1_dec_sigpass_step( opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
OPJ_UINT32 orient,

View File

@ -158,7 +158,7 @@ static void opj_t2_putcommacode(opj_bio_t *bio, OPJ_INT32 n) {
opj_bio_write(bio, 0, 1);
}
OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio)
static OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio)
{
OPJ_UINT32 n = 0;
while (opj_bio_read(bio, 1)) {
@ -167,7 +167,7 @@ OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio)
return n;
}
void opj_t2_putnumpasses(opj_bio_t *bio, OPJ_UINT32 n) {
static void opj_t2_putnumpasses(opj_bio_t *bio, OPJ_UINT32 n) {
if (n == 1) {
opj_bio_write(bio, 0, 1);
} else if (n == 2) {
@ -181,7 +181,7 @@ void opj_t2_putnumpasses(opj_bio_t *bio, OPJ_UINT32 n) {
}
}
OPJ_UINT32 opj_t2_getnumpasses(opj_bio_t *bio) {
static OPJ_UINT32 opj_t2_getnumpasses(opj_bio_t *bio) {
OPJ_UINT32 n;
if (!opj_bio_read(bio, 1))
return 1;
@ -511,7 +511,7 @@ void opj_t2_destroy(opj_t2_t *t2) {
}
}
OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
static OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
opj_tcd_tile_t *p_tile,
opj_tcp_t *p_tcp,
opj_pi_iterator_t *p_pi,
@ -550,7 +550,7 @@ OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
return OPJ_TRUE;
}
OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
static OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
opj_tcd_tile_t * tile,
opj_tcp_t * tcp,
opj_pi_iterator_t *pi,
@ -825,7 +825,7 @@ static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
}
OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
opj_tcd_tile_t *p_tile,
opj_tcp_t *p_tcp,
opj_pi_iterator_t *p_pi,
@ -1094,7 +1094,7 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
return OPJ_TRUE;
}
OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
static OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
opj_tcd_tile_t *p_tile,
opj_pi_iterator_t *p_pi,
OPJ_BYTE *p_src_data,
@ -1228,7 +1228,7 @@ OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
return OPJ_TRUE;
}
OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
static OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
opj_tcd_tile_t *p_tile,
opj_pi_iterator_t *p_pi,
OPJ_UINT32 * p_data_read,

View File

@ -1462,7 +1462,7 @@ OPJ_BOOL opj_tcd_update_tile_data ( opj_tcd_t *p_tcd,
void opj_tcd_free_tile(opj_tcd_t *p_tcd)
static void opj_tcd_free_tile(opj_tcd_t *p_tcd)
{
OPJ_UINT32 compno, resno, bandno, precno;
opj_tcd_tile_t *l_tile = 00;
@ -1545,7 +1545,7 @@ void opj_tcd_free_tile(opj_tcd_t *p_tcd)
}
OPJ_BOOL opj_tcd_t2_decode (opj_tcd_t *p_tcd,
static OPJ_BOOL opj_tcd_t2_decode (opj_tcd_t *p_tcd,
OPJ_BYTE * p_src_data,
OPJ_UINT32 * p_data_read,
OPJ_UINT32 p_max_src_size,
@ -1577,7 +1577,7 @@ OPJ_BOOL opj_tcd_t2_decode (opj_tcd_t *p_tcd,
return OPJ_TRUE;
}
OPJ_BOOL opj_tcd_t1_decode ( opj_tcd_t *p_tcd )
static OPJ_BOOL opj_tcd_t1_decode ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 compno;
opj_t1_t * l_t1;
@ -1607,7 +1607,7 @@ OPJ_BOOL opj_tcd_t1_decode ( opj_tcd_t *p_tcd )
}
OPJ_BOOL opj_tcd_dwt_decode ( opj_tcd_t *p_tcd )
static OPJ_BOOL opj_tcd_dwt_decode ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 compno;
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
@ -1647,7 +1647,7 @@ OPJ_BOOL opj_tcd_dwt_decode ( opj_tcd_t *p_tcd )
return OPJ_TRUE;
}
OPJ_BOOL opj_tcd_mct_decode ( opj_tcd_t *p_tcd )
static OPJ_BOOL opj_tcd_mct_decode ( opj_tcd_t *p_tcd )
{
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcp_t * l_tcp = p_tcd->tcp;
@ -1725,7 +1725,7 @@ OPJ_BOOL opj_tcd_mct_decode ( opj_tcd_t *p_tcd )
}
OPJ_BOOL opj_tcd_dc_level_shift_decode ( opj_tcd_t *p_tcd )
static OPJ_BOOL opj_tcd_dc_level_shift_decode ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 compno;
opj_tcd_tilecomp_t * l_tile_comp = 00;
@ -1795,7 +1795,7 @@ OPJ_BOOL opj_tcd_dc_level_shift_decode ( opj_tcd_t *p_tcd )
/**
* Deallocates the encoding data of the given precinct.
*/
void opj_tcd_code_block_dec_deallocate (opj_tcd_precinct_t * p_precinct)
static void opj_tcd_code_block_dec_deallocate (opj_tcd_precinct_t * p_precinct)
{
OPJ_UINT32 cblkno , l_nb_code_blocks;
@ -1833,7 +1833,7 @@ void opj_tcd_code_block_dec_deallocate (opj_tcd_precinct_t * p_precinct)
/**
* Deallocates the encoding data of the given precinct.
*/
void opj_tcd_code_block_enc_deallocate (opj_tcd_precinct_t * p_precinct)
static void opj_tcd_code_block_enc_deallocate (opj_tcd_precinct_t * p_precinct)
{
OPJ_UINT32 cblkno , l_nb_code_blocks;
@ -1894,7 +1894,7 @@ OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_t *p_tcd )
return l_data_size;
}
OPJ_BOOL opj_tcd_dc_level_shift_encode ( opj_tcd_t *p_tcd )
static OPJ_BOOL opj_tcd_dc_level_shift_encode ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 compno;
opj_tcd_tilecomp_t * l_tile_comp = 00;
@ -1934,7 +1934,7 @@ OPJ_BOOL opj_tcd_dc_level_shift_encode ( opj_tcd_t *p_tcd )
return OPJ_TRUE;
}
OPJ_BOOL opj_tcd_mct_encode ( opj_tcd_t *p_tcd )
static OPJ_BOOL opj_tcd_mct_encode ( opj_tcd_t *p_tcd )
{
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_t * l_tile_comp = p_tcd->tcd_image->tiles->comps;
@ -1989,7 +1989,7 @@ OPJ_BOOL opj_tcd_mct_encode ( opj_tcd_t *p_tcd )
return OPJ_TRUE;
}
OPJ_BOOL opj_tcd_dwt_encode ( opj_tcd_t *p_tcd )
static OPJ_BOOL opj_tcd_dwt_encode ( opj_tcd_t *p_tcd )
{
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_t * l_tile_comp = p_tcd->tcd_image->tiles->comps;
@ -2015,7 +2015,7 @@ OPJ_BOOL opj_tcd_dwt_encode ( opj_tcd_t *p_tcd )
return OPJ_TRUE;
}
OPJ_BOOL opj_tcd_t1_encode ( opj_tcd_t *p_tcd )
static OPJ_BOOL opj_tcd_t1_encode ( opj_tcd_t *p_tcd )
{
opj_t1_t * l_t1;
const OPJ_FLOAT64 * l_mct_norms;
@ -2052,7 +2052,7 @@ OPJ_BOOL opj_tcd_t1_encode ( opj_tcd_t *p_tcd )
return OPJ_TRUE;
}
OPJ_BOOL opj_tcd_t2_encode (opj_tcd_t *p_tcd,
static OPJ_BOOL opj_tcd_t2_encode (opj_tcd_t *p_tcd,
OPJ_BYTE * p_dest_data,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 p_max_dest_size,
@ -2090,7 +2090,7 @@ OPJ_BOOL opj_tcd_t2_encode (opj_tcd_t *p_tcd,
}
OPJ_BOOL opj_tcd_rate_allocate_encode( opj_tcd_t *p_tcd,
static OPJ_BOOL opj_tcd_rate_allocate_encode( opj_tcd_t *p_tcd,
OPJ_BYTE * p_dest_data,
OPJ_UINT32 p_max_dest_size,
opj_codestream_info_t *p_cstr_info )

View File

@ -13,6 +13,7 @@ include_directories(
# First thing define the common source:
set(compare_images_SRCS compare_images.c
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/convert.c
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/converttif.c
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
)

View File

@ -32,7 +32,7 @@
get_filename_component(OUTFILENAME_NAME ${OUTFILENAME} NAME)
string(FIND ${OUTFILENAME_NAME} "." SHORTEST_EXT_POS REVERSE)
string(SUBSTRING ${OUTFILENAME_NAME} 0 ${SHORTEST_EXT_POS} OUTFILENAME_NAME_WE)
file(GLOB globfiles "Temporary/${OUTFILENAME_NAME_WE}*.pgx" "Temporary/${OUTFILENAME_NAME_WE}*.png")
file(GLOB globfiles "Temporary/${OUTFILENAME_NAME_WE}*.pgx" "Temporary/${OUTFILENAME_NAME_WE}*.png" "Temporary/${OUTFILENAME_NAME_WE}*.tif")
if(NOT globfiles)
message(SEND_ERROR "Could not find output PGX files: ${OUTFILENAME_NAME_WE}")
endif()

View File

@ -182,3 +182,39 @@ dacaf60e4c430916a8c2a9ebec32e71c issue458.jp2_3.pgx
d33fb5dbddb9b9b4438eb51fa27445a3 issue495.jp2_0.pgx
27db8c35e12a5d5eb94d403d2aae2909 issue495.jp2_1.pgx
97da625d2f2d0b75bf891d8083ce8bfb issue495.jp2_2.pgx
86729c5f2b74b2dfd42cb0d8e47aef79 a1_mono_tif-1.tif
fa9b7b896536b25a7a1d8eeeacb59141 a1_mono_tif-10.tif
b0ee13aa90ca4421e09a3b7b41f410c0 a1_mono_tif-12.tif
4699894fedd3758727d8288cd7adb56c a1_mono_tif-14.tif
4ad682c58e63d3223914c10a6656c8ae a1_mono_tif-16.tif
22c2fa09a4d7b9fade6a3cddc6c6a4dc a1_mono_tif-2.tif
996c5e67a663218be90e86bff8ecad89 a1_mono_tif-4.tif
7f451a5ac89915c5cdc023fd8c813a3c a1_mono_tif-6.tif
c3ebfcf478b1c4fc786748813f2b5d53 a1_mono_tif-8.tif
31650ec40241737634179fff6ad306f8 basn4a08_tif-1.tif
abf884080bcfbf58c044a9d86bfa5e5d basn4a08_tif-10.tif
916d97c098d9792993cc91fee4a83f77 basn4a08_tif-12.tif
57643174986481d336db6ddf04b970df basn4a08_tif-14.tif
fb5cf848d63c61dc485c87c9246ee9c7 basn4a08_tif-16.tif
5d7b01d98c82ad563bb28c2d83484a2a basn4a08_tif-2.tif
2401cebbb1d5494fcbe0d899484c342d basn4a08_tif-4.tif
6dbeb5b708bbde76e204c0887da61f6b basn4a08_tif-6.tif
dc40cc1da6de28e7e973c8ba796ca189 basn4a08_tif-8.tif
59e32c45591fd3bb44fe99381a116ba1 basn6a08_tif-1.tif
630e6fb6deba0b3efd93b610561d607a basn6a08_tif-10.tif
765555e75e59de27f7b2177d04f36bc1 basn6a08_tif-12.tif
62384c112d5fe40aefd0a9b0b9a4bcc6 basn6a08_tif-14.tif
d725d41557658a28ab31dff74e2467fa basn6a08_tif-16.tif
96d91df6b10e866ea26ebbf0b8ddc7da basn6a08_tif-2.tif
a324032339808d5fe85d6e354f14c183 basn6a08_tif-4.tif
d60864a6a5c8a49a202d98ae6f5165c7 basn6a08_tif-6.tif
c3e93f61125f82a9832d0b9440468034 basn6a08_tif-8.tif
cfe04d15cf9d615fc36357dcb3b3956b p0_14_tif-1.tif
9ad87e7fddc77ac85e2e92509bee2365 p0_14_tif-10.tif
38e67f9d573e61166761d5eee0104448 p0_14_tif-12.tif
77486f0468694b94290d0b55361498a0 p0_14_tif-14.tif
51be675689949dd08b6ee1427af3eb4a p0_14_tif-16.tif
3e34e94bd8f7380c8d159676fee9ea57 p0_14_tif-2.tif
b6f71c941e3a5b8d2547792ccec58d54 p0_14_tif-4.tif
81fcdd90917efb95aed94c6522d1c188 p0_14_tif-6.tif
6808377b760b4ef3559ba8b14ed9b91a p0_14_tif-8.tif

View File

@ -47,7 +47,7 @@ opj_compress -i @INPUT_NR_PATH@/Bretagne2.ppm -o @TEMP_PATH@/Bretagne2_5.j2k -c
# issue 316
opj_compress -i @INPUT_NR_PATH@/issue316.png -o @TEMP_PATH@/issue316.png.jp2
# issue 416 (cdef for png with alpha) + issue 436 (MCT norm read buffer overflow for num comp > 3 + Issue 215 number of decomp levels
opj_compress -i @INPUT_NR_PATH@/basn6a08.png -o @TEMP_PATH@/basn6a08.png.jp2 -n 6
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn6a08.png -o @TEMP_PATH@/basn6a08.png.jp2 -n 6
# issue 203 BMP Files not handled properly
opj_compress -i @INPUT_NR_PATH@/issue203-8bpp-width1.bmp -o @TEMP_PATH@/issue203-8bpp-width1.bmp.jp2
opj_compress -i @INPUT_NR_PATH@/issue203-rle8.bmp -o @TEMP_PATH@/issue203-rle8.bmp.jp2
@ -74,6 +74,66 @@ opj_compress -i @INPUT_NR_PATH@/issue203-33x33-bgrx16.bmp -o @TEMP_PATH@/issue20
opj_compress -i @INPUT_NR_PATH@/issue203-127x64-bgr16.bmp -o @TEMP_PATH@/issue203-127x64-bgr16.bmp.jp2
opj_compress -i @INPUT_NR_PATH@/issue203-127x64-bgrx.bmp -o @TEMP_PATH@/issue203-127x64-bgrx.bmp.jp2
# issue 322 limited tif support
opj_compress -i @INPUT_NR_PATH@/flower-minisblack-01.tif -o @TEMP_PATH@/flower-minisblack-01.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-minisblack-02.tif -o @TEMP_PATH@/flower-minisblack-02.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-minisblack-04.tif -o @TEMP_PATH@/flower-minisblack-04.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-minisblack-06.tif -o @TEMP_PATH@/flower-minisblack-06.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-minisblack-08.tif -o @TEMP_PATH@/flower-minisblack-08.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-minisblack-10.tif -o @TEMP_PATH@/flower-minisblack-10.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-minisblack-12.tif -o @TEMP_PATH@/flower-minisblack-12.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-minisblack-14.tif -o @TEMP_PATH@/flower-minisblack-14.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-minisblack-16.tif -o @TEMP_PATH@/flower-minisblack-16.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-contig-02.tif -o @TEMP_PATH@/flower-rgb-contig-02.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-contig-04.tif -o @TEMP_PATH@/flower-rgb-contig-04.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-contig-08.tif -o @TEMP_PATH@/flower-rgb-contig-08.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-contig-10.tif -o @TEMP_PATH@/flower-rgb-contig-10.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-contig-12.tif -o @TEMP_PATH@/flower-rgb-contig-12.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-contig-14.tif -o @TEMP_PATH@/flower-rgb-contig-14.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-contig-16.tif -o @TEMP_PATH@/flower-rgb-contig-16.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-planar-02.tif -o @TEMP_PATH@/flower-rgb-planar-02.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-planar-04.tif -o @TEMP_PATH@/flower-rgb-planar-04.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-planar-08.tif -o @TEMP_PATH@/flower-rgb-planar-08.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-planar-10.tif -o @TEMP_PATH@/flower-rgb-planar-10.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-planar-12.tif -o @TEMP_PATH@/flower-rgb-planar-12.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-planar-14.tif -o @TEMP_PATH@/flower-rgb-planar-14.tif.jp2
opj_compress -i @INPUT_NR_PATH@/flower-rgb-planar-16.tif -o @TEMP_PATH@/flower-rgb-planar-16.tif.jp2
opj_compress -i @INPUT_NR_PATH@/basn6a08.tif -o @TEMP_PATH@/basn6a08.tif.jp2
opj_compress -i @INPUT_NR_PATH@/basn4a08.tif -o @TEMP_PATH@/basn4a08.tif.jp2
# issue 536 (PNG images are always read as RGB(A) images) + issue 264 (convert.c is unmaintainable)
# Test all images from pngsuite
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn0g01.png -o @TEMP_PATH@/basn0g01.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn0g02.png -o @TEMP_PATH@/basn0g02.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn0g04.png -o @TEMP_PATH@/basn0g04.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn0g08.png -o @TEMP_PATH@/basn0g08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn0g16.png -o @TEMP_PATH@/basn0g16.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn2c08.png -o @TEMP_PATH@/basn2c08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn2c16.png -o @TEMP_PATH@/basn2c16.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn3p01.png -o @TEMP_PATH@/basn3p01.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn3p02.png -o @TEMP_PATH@/basn3p02.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn3p04.png -o @TEMP_PATH@/basn3p04.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn3p08.png -o @TEMP_PATH@/basn3p08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn4a08.png -o @TEMP_PATH@/basn4a08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn4a16.png -o @TEMP_PATH@/basn4a16.png.jp2
# already done opj_compress -i @INPUT_NR_PATH@/pngsuite/basn6a08.png -o @TEMP_PATH@/basn6a08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/basn6a16.png -o @TEMP_PATH@/basn6a16.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbbn0g01.png -o @TEMP_PATH@/ftbbn0g01.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbbn0g02.png -o @TEMP_PATH@/ftbbn0g02.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbbn0g04.png -o @TEMP_PATH@/ftbbn0g04.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbbn2c16.png -o @TEMP_PATH@/ftbbn2c16.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbbn3p08.png -o @TEMP_PATH@/ftbbn3p08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbgn2c16.png -o @TEMP_PATH@/ftbgn2c16.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbgn3p08.png -o @TEMP_PATH@/ftbgn3p08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbrn2c08.png -o @TEMP_PATH@/ftbrn2c08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbwn0g16.png -o @TEMP_PATH@/ftbwn0g16.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbwn3p08.png -o @TEMP_PATH@/ftbwn3p08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftbyn3p08.png -o @TEMP_PATH@/ftbyn3p08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftp0n0g08.png -o @TEMP_PATH@/ftp0n0g08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftp0n2c08.png -o @TEMP_PATH@/ftp0n2c08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftp0n3p08.png -o @TEMP_PATH@/ftp0n3p08.png.jp2
opj_compress -i @INPUT_NR_PATH@/pngsuite/ftp1n3p08.png -o @TEMP_PATH@/ftp1n3p08.png.jp2
# DECODER TEST SUITE
opj_decompress -i @INPUT_NR_PATH@/Bretagne2.j2k -o @TEMP_PATH@/Bretagne2.j2k.pgx
opj_decompress -i @INPUT_NR_PATH@/_00042.j2k -o @TEMP_PATH@/_00042.j2k.pgx
@ -341,3 +401,45 @@ opj_decompress -i @INPUT_CONF_PATH@/p0_04.j2k -o @TEMP_PATH@/p0_04_6_5.j2k.png -
#opj_decompress -i @INPUT_CONF_PATH@/p1_01.j2k -o @TEMP_PATH@/p1_01_3.j2k.png -d 10,150,190,210
#opj_decompress -i @INPUT_CONF_PATH@/p1_01.j2k -o @TEMP_PATH@/p1_01_4.j2k.png -d 100,80,200,150
#opj_decompress -i @INPUT_CONF_PATH@/p1_01.j2k -o @TEMP_PATH@/p1_01_5.j2k.png -d 150,20,200,50
# issue 322 limited tif support
# GRAYSCALE
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-1.tif -p 1S
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-2.tif -p 2S
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-4.tif -p 4S
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-6.tif -p 6S
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-8.tif -p 8S
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-10.tif -p 10S
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-12.tif -p 12S
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-14.tif -p 14S
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-16.tif -p 16S
# GRAYSCALE ALPHA
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-1.tif -p 1S
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-2.tif -p 2S
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-4.tif -p 4S
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-6.tif -p 6S
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-8.tif -p 8S
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-10.tif -p 10S
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-12.tif -p 12S
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-14.tif -p 14S
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-16.tif -p 16S
# RGB
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-1.tif -p 1S
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-2.tif -p 2S
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-4.tif -p 4S
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-6.tif -p 6S
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-8.tif -p 8S
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-10.tif -p 10S
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-12.tif -p 12S
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-14.tif -p 14S
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-16.tif -p 16S
# RGBA
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-1.tif -p 1S
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-2.tif -p 2S
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-4.tif -p 4S
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-6.tif -p 6S
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-8.tif -p 8S
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-10.tif -p 10S
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-12.tif -p 12S
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-14.tif -p 14S
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-16.tif -p 16S