1--- convert.h 2020-08-27 15:46:45.028628305 +0000 2+++ convert_helper.h 2020-08-27 14:26:02.155455250 +0000 3@@ -1,126 +1,8 @@ 4-/* 5- * The copyright in this software is being made available under the 2-clauses 6- * BSD License, included below. This software may be subject to other third 7- * party and contributor rights, including patent rights, and no such rights 8- * are granted under this license. 9- * 10- * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 11- * Copyright (c) 2002-2014, Professor Benoit Macq 12- * Copyright (c) 2001-2003, David Janssens 13- * Copyright (c) 2002-2003, Yannick Verschueren 14- * Copyright (c) 2003-2007, Francois-Olivier Devaux 15- * Copyright (c) 2003-2014, Antonin Descampe 16- * Copyright (c) 2005, Herve Drolon, FreeImage Team 17- * All rights reserved. 18- * 19- * Redistribution and use in source and binary forms, with or without 20- * modification, are permitted provided that the following conditions 21- * are met: 22- * 1. Redistributions of source code must retain the above copyright 23- * notice, this list of conditions and the following disclaimer. 24- * 2. Redistributions in binary form must reproduce the above copyright 25- * notice, this list of conditions and the following disclaimer in the 26- * documentation and/or other materials provided with the distribution. 27- * 28- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 29- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 32- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38- * POSSIBILITY OF SUCH DAMAGE. 39- */ 40-#ifndef __J2K_CONVERT_H 41-#define __J2K_CONVERT_H 42+// imagetopnm and the two functions it calls internaly are patched 43+// versions of the library's tools; from openjpeg/src/bin/jp2/convert.c 44 45-/**@name RAW component encoding parameters */ 46-/*@{*/ 47-typedef struct raw_comp_cparameters { 48- /** subsampling in X direction */ 49- int dx; 50- /** subsampling in Y direction */ 51- int dy; 52- /*@}*/ 53-} raw_comp_cparameters_t; 54- 55-/**@name RAW image encoding parameters */ 56-/*@{*/ 57-typedef struct raw_cparameters { 58- /** width of the raw image */ 59- int rawWidth; 60- /** height of the raw image */ 61- int rawHeight; 62- /** number of components of the raw image */ 63- int rawComp; 64- /** bit depth of the raw image */ 65- int rawBitDepth; 66- /** signed/unsigned raw image */ 67- OPJ_BOOL rawSigned; 68- /** raw components parameters */ 69- raw_comp_cparameters_t *rawComps; 70- /*@}*/ 71-} raw_cparameters_t; 72- 73-/* Component precision clipping */ 74-void clip_component(opj_image_comp_t* component, OPJ_UINT32 precision); 75-/* Component precision scaling */ 76-void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision); 77- 78-/* planar / interleaved conversions */ 79-typedef void (* convert_32s_CXPX)(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, 80- OPJ_SIZE_T length); 81-extern const convert_32s_CXPX convert_32s_CXPX_LUT[5]; 82-typedef void (* convert_32s_PXCX)(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, 83- OPJ_SIZE_T length, OPJ_INT32 adjust); 84-extern const convert_32s_PXCX convert_32s_PXCX_LUT[5]; 85-/* bit depth conversions */ 86-typedef void (* convert_XXx32s_C1R)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, 87- OPJ_SIZE_T length); 88-extern const convert_XXx32s_C1R convert_XXu32s_C1R_LUT[9]; /* up to 8bpp */ 89-typedef void (* convert_32sXXx_C1R)(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, 90- OPJ_SIZE_T length); 91-extern const convert_32sXXx_C1R convert_32sXXu_C1R_LUT[9]; /* up to 8bpp */ 92- 93- 94-/* TGA conversion */ 95-opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters); 96-int imagetotga(opj_image_t * image, const char *outfile); 97- 98-/* BMP conversion */ 99-opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters); 100-int imagetobmp(opj_image_t *image, const char *outfile); 101- 102-/* TIFF conversion*/ 103-opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters); 104-int imagetotif(opj_image_t *image, const char *outfile); 105-/** 106-Load a single image component encoded in PGX file format 107-@param filename Name of the PGX file to load 108-@param parameters *List ?* 109-@return Returns a greyscale image if successful, returns NULL otherwise 110-*/ 111-opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters); 112-int imagetopgx(opj_image_t *image, const char *outfile); 113- 114-opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters); 115-int imagetopnm(opj_image_t *image, const char *outfile, int force_split); 116- 117-/* RAW conversion */ 118-int imagetoraw(opj_image_t * image, const char *outfile); 119-int imagetorawl(opj_image_t * image, const char *outfile); 120-opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, 121- raw_cparameters_t *raw_cp); 122-opj_image_t* rawltoimage(const char *filename, opj_cparameters_t *parameters, 123- raw_cparameters_t *raw_cp); 124- 125-/* PNG conversion*/ 126-extern int imagetopng(opj_image_t *image, const char *write_idf); 127-extern opj_image_t* pngtoimage(const char *filename, 128- opj_cparameters_t *parameters); 129- 130-#endif /* __J2K_CONVERT_H */ 131+#include "openjp2_sapi.sapi.h" 132 133+const char* opj_version(void); 134+static int are_comps_similar(opj_image_t* image); 135+int imagetopnm(opj_image_t* image, const char* outfile, int force_split); 136