parent
e6cf1744d4
commit
f3dad25c77
|
@ -145,6 +145,387 @@ void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision)
|
|||
}
|
||||
|
||||
|
||||
/* planar / interleaved conversions */
|
||||
/* used by PNG/TIFF */
|
||||
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];
|
||||
}
|
||||
}
|
||||
const convert_32s_CXPX convert_32s_CXPX_LUT[5] = {
|
||||
NULL,
|
||||
convert_32s_C1P1,
|
||||
convert_32s_C2P2,
|
||||
convert_32s_C3P3,
|
||||
convert_32s_C4P4
|
||||
};
|
||||
|
||||
static void convert_32s_P1C1(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_INT32* pSrc0 = pSrc[0];
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
pDst[i] = pSrc0[i] + adjust;
|
||||
}
|
||||
}
|
||||
static void convert_32s_P2C2(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_INT32* pSrc0 = pSrc[0];
|
||||
const OPJ_INT32* pSrc1 = pSrc[1];
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
pDst[2*i+0] = pSrc0[i] + adjust;
|
||||
pDst[2*i+1] = pSrc1[i] + adjust;
|
||||
}
|
||||
}
|
||||
static void convert_32s_P3C3(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_INT32* pSrc0 = pSrc[0];
|
||||
const OPJ_INT32* pSrc1 = pSrc[1];
|
||||
const OPJ_INT32* pSrc2 = pSrc[2];
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
pDst[3*i+0] = pSrc0[i] + adjust;
|
||||
pDst[3*i+1] = pSrc1[i] + adjust;
|
||||
pDst[3*i+2] = pSrc2[i] + adjust;
|
||||
}
|
||||
}
|
||||
static void convert_32s_P4C4(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_INT32* pSrc0 = pSrc[0];
|
||||
const OPJ_INT32* pSrc1 = pSrc[1];
|
||||
const OPJ_INT32* pSrc2 = pSrc[2];
|
||||
const OPJ_INT32* pSrc3 = pSrc[3];
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
pDst[4*i+0] = pSrc0[i] + adjust;
|
||||
pDst[4*i+1] = pSrc1[i] + adjust;
|
||||
pDst[4*i+2] = pSrc2[i] + adjust;
|
||||
pDst[4*i+3] = pSrc3[i] + adjust;
|
||||
}
|
||||
}
|
||||
const convert_32s_PXCX convert_32s_PXCX_LUT[5] = {
|
||||
NULL,
|
||||
convert_32s_P1C1,
|
||||
convert_32s_P2C2,
|
||||
convert_32s_P3C3,
|
||||
convert_32s_P4C4
|
||||
};
|
||||
|
||||
/* bit depth conversions */
|
||||
/* used by PNG/TIFF up to 8bpp */
|
||||
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)7U); 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)3U); 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)1U); 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_6u32s_C1R(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)3U); i+=4U) {
|
||||
OPJ_UINT32 val0 = *pSrc++;
|
||||
OPJ_UINT32 val1 = *pSrc++;
|
||||
OPJ_UINT32 val2 = *pSrc++;
|
||||
pDst[i+0] = (OPJ_INT32)(val0 >> 2);
|
||||
pDst[i+1] = (OPJ_INT32)(((val0 & 0x3U) << 4) | (val1 >> 4));
|
||||
pDst[i+2] = (OPJ_INT32)(((val1 & 0xFU) << 2) | (val2 >> 6));
|
||||
pDst[i+3] = (OPJ_INT32)(val2 & 0x3FU);
|
||||
|
||||
}
|
||||
if (length & 3U) {
|
||||
OPJ_UINT32 val0 = *pSrc++;
|
||||
length = length & 3U;
|
||||
pDst[i+0] = (OPJ_INT32)(val0 >> 2);
|
||||
|
||||
if (length > 1U) {
|
||||
OPJ_UINT32 val1 = *pSrc++;
|
||||
pDst[i+1] = (OPJ_INT32)(((val0 & 0x3U) << 4) | (val1 >> 4));
|
||||
if (length > 2U) {
|
||||
OPJ_UINT32 val2 = *pSrc++;
|
||||
pDst[i+2] = (OPJ_INT32)(((val1 & 0xFU) << 2) | (val2 >> 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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];
|
||||
}
|
||||
}
|
||||
const convert_XXx32s_C1R convert_XXu32s_C1R_LUT[9] = {
|
||||
NULL,
|
||||
convert_1u32s_C1R,
|
||||
convert_2u32s_C1R,
|
||||
NULL,
|
||||
convert_4u32s_C1R,
|
||||
NULL,
|
||||
convert_6u32s_C1R,
|
||||
NULL,
|
||||
convert_8u32s_C1R
|
||||
};
|
||||
|
||||
|
||||
static void convert_32s1u_C1R(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)7U); i+=8U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
OPJ_UINT32 src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
OPJ_UINT32 src3 = (OPJ_UINT32)pSrc[i+3];
|
||||
OPJ_UINT32 src4 = (OPJ_UINT32)pSrc[i+4];
|
||||
OPJ_UINT32 src5 = (OPJ_UINT32)pSrc[i+5];
|
||||
OPJ_UINT32 src6 = (OPJ_UINT32)pSrc[i+6];
|
||||
OPJ_UINT32 src7 = (OPJ_UINT32)pSrc[i+7];
|
||||
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 7) | (src1 << 6) | (src2 << 5) | (src3 << 4) | (src4 << 3) | (src5 << 2) | (src6 << 1) | src7);
|
||||
}
|
||||
|
||||
if (length & 7U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = 0U;
|
||||
OPJ_UINT32 src2 = 0U;
|
||||
OPJ_UINT32 src3 = 0U;
|
||||
OPJ_UINT32 src4 = 0U;
|
||||
OPJ_UINT32 src5 = 0U;
|
||||
OPJ_UINT32 src6 = 0U;
|
||||
length = length & 7U;
|
||||
|
||||
if (length > 1U) {
|
||||
src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
if (length > 2U) {
|
||||
src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
if (length > 3U) {
|
||||
src3 = (OPJ_UINT32)pSrc[i+3];
|
||||
if (length > 4U) {
|
||||
src4 = (OPJ_UINT32)pSrc[i+4];
|
||||
if (length > 5U) {
|
||||
src5 = (OPJ_UINT32)pSrc[i+5];
|
||||
if (length > 6U) {
|
||||
src6 = (OPJ_UINT32)pSrc[i+6];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 7) | (src1 << 6) | (src2 << 5) | (src3 << 4) | (src4 << 3) | (src5 << 2) | (src6 << 1));
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_32s2u_C1R(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)3U); i+=4U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
OPJ_UINT32 src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
OPJ_UINT32 src3 = (OPJ_UINT32)pSrc[i+3];
|
||||
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 6) | (src1 << 4) | (src2 << 2) | src3);
|
||||
}
|
||||
|
||||
if (length & 3U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = 0U;
|
||||
OPJ_UINT32 src2 = 0U;
|
||||
length = length & 3U;
|
||||
|
||||
if (length > 1U) {
|
||||
src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
if (length > 2U) {
|
||||
src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
}
|
||||
}
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 6) | (src1 << 4) | (src2 << 2));
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_32s4u_C1R(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)1U); i+=2U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 4) | src1);
|
||||
}
|
||||
|
||||
if (length & 1U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 4));
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_32s6u_C1R(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)3U); i+=4U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
OPJ_UINT32 src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
OPJ_UINT32 src3 = (OPJ_UINT32)pSrc[i+3];
|
||||
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 2) | (src1 >> 4));
|
||||
*pDst++ = (OPJ_BYTE)(((src1 & 0xFU) << 4) | (src2 >> 2));
|
||||
*pDst++ = (OPJ_BYTE)(((src2 & 0x3U) << 6) | src3);
|
||||
}
|
||||
|
||||
if (length & 3U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = 0U;
|
||||
OPJ_UINT32 src2 = 0U;
|
||||
length = length & 3U;
|
||||
|
||||
if (length > 1U) {
|
||||
src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
if (length > 2U) {
|
||||
src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
}
|
||||
}
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 2) | (src1 >> 4));
|
||||
if (length > 1U) {
|
||||
*pDst++ = (OPJ_BYTE)(((src1 & 0xFU) << 4) | (src2 >> 2));
|
||||
if (length > 2U) {
|
||||
*pDst++ = (OPJ_BYTE)(((src2 & 0x3U) << 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static void convert_32s8u_C1R(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < length; ++i) {
|
||||
pDst[i] = (OPJ_BYTE)pSrc[i];
|
||||
}
|
||||
}
|
||||
const convert_32sXXx_C1R convert_32sXXu_C1R_LUT[9] = {
|
||||
NULL,
|
||||
convert_32s1u_C1R,
|
||||
convert_32s2u_C1R,
|
||||
NULL,
|
||||
convert_32s4u_C1R,
|
||||
NULL,
|
||||
convert_32s6u_C1R,
|
||||
NULL,
|
||||
convert_32s8u_C1R
|
||||
};
|
||||
|
||||
/* -->> -->> -->> -->>
|
||||
|
||||
TGA IMAGE FORMAT
|
||||
|
|
|
@ -70,6 +70,18 @@ void clip_component(opj_image_comp_t* component, OPJ_UINT32 precision);
|
|||
/* Component precision scaling */
|
||||
void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision);
|
||||
|
||||
/* planar / interleaved conversions */
|
||||
typedef void (* convert_32s_CXPX)(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, OPJ_SIZE_T length);
|
||||
const convert_32s_CXPX convert_32s_CXPX_LUT[5];
|
||||
typedef void (* convert_32s_PXCX)(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust);
|
||||
const convert_32s_PXCX convert_32s_PXCX_LUT[5];
|
||||
/* bit depth conversions */
|
||||
typedef void (* convert_XXx32s_C1R)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length);
|
||||
const convert_XXx32s_C1R convert_XXu32s_C1R_LUT[9]; /* up to 8bpp */
|
||||
typedef void (* convert_32sXXx_C1R)(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length);
|
||||
const convert_32sXXx_C1R convert_32sXXu_C1R_LUT[9]; /* up to 8bpp */
|
||||
|
||||
|
||||
/* TGA conversion */
|
||||
opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters);
|
||||
int imagetotga(opj_image_t * image, const char *outfile);
|
||||
|
|
|
@ -53,135 +53,7 @@
|
|||
#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)7U); 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)3U); 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)1U); 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;
|
||||
|
@ -279,40 +151,31 @@ opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params)
|
|||
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;
|
||||
}
|
||||
cvtCxToPx = convert_32s_CXPX_LUT[nr_comp];
|
||||
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;
|
||||
cvtXXTo32s = convert_XXu32s_C1R_LUT[bit_depth];
|
||||
break;
|
||||
case 16:
|
||||
case 16: /* 16 bpp is specific to PNG */
|
||||
cvtXXTo32s = convert_16u32s_C1R;
|
||||
break;
|
||||
default:
|
||||
|
@ -387,49 +250,96 @@ fin:
|
|||
|
||||
}/* pngtoimage() */
|
||||
|
||||
|
||||
static void convert_32s16u_C1R(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < length; i++) {
|
||||
OPJ_UINT32 val = (OPJ_UINT32)pSrc[i];
|
||||
*pDst++ = (OPJ_BYTE)(val >> 8);
|
||||
*pDst++ = (OPJ_BYTE)val;
|
||||
}
|
||||
}
|
||||
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;
|
||||
int prec, ushift, dshift, is16, force16, force8;
|
||||
unsigned short mask;
|
||||
FILE * volatile writer = NULL;
|
||||
png_structp png = NULL;
|
||||
png_infop info = NULL;
|
||||
png_bytep volatile row_buf = NULL;
|
||||
int nr_comp, color_type;
|
||||
volatile int prec;
|
||||
png_color_8 sig_bit;
|
||||
OPJ_INT32 const* planes[4];
|
||||
int i;
|
||||
OPJ_INT32* volatile buffer32s = NULL;
|
||||
|
||||
volatile int fails = 1;
|
||||
|
||||
is16 = force16 = force8 = ushift = dshift = 0;
|
||||
memset(&sig_bit, 0, sizeof(sig_bit));
|
||||
prec = (int)image->comps[0].prec;
|
||||
planes[0] = image->comps[0].data;
|
||||
nr_comp = (int)image->numcomps;
|
||||
|
||||
if (nr_comp > 4) {
|
||||
nr_comp = 4;
|
||||
}
|
||||
for (i = 1; i < nr_comp; ++i) {
|
||||
if (image->comps[0].dx != image->comps[i].dx) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].dy != image->comps[i].dy) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].prec != image->comps[i].prec) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].sgnd != image->comps[i].sgnd) {
|
||||
break;
|
||||
}
|
||||
planes[i] = image->comps[i].data;
|
||||
}
|
||||
if (i != nr_comp) {
|
||||
fprintf(stderr,"imagetopng: All components shall have the same subsampling, same bit depth, same sign.\n");
|
||||
fprintf(stderr,"\tAborting\n");
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
clip_component(&(image->comps[i]), image->comps[0].prec);
|
||||
}
|
||||
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;
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
scale_component(&(image->comps[i]), 16);
|
||||
}
|
||||
prec = 16;
|
||||
}
|
||||
else if(prec < 8 && nr_comp > 1)/* GRAY_ALPHA, RGB, RGB_ALPHA */
|
||||
{
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
scale_component(&(image->comps[i]), 8);
|
||||
}
|
||||
prec = 8;
|
||||
} else if((prec > 1) && (prec < 8) && ((prec == 6) || ((prec & 1)==1))) { /* GRAY with non native precision */
|
||||
if ((prec == 5) || (prec == 6)) {
|
||||
prec = 8;
|
||||
} else {
|
||||
prec++;
|
||||
}
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
scale_component(&(image->comps[i]), (OPJ_UINT32)prec);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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
|
||||
|
@ -476,291 +386,107 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
|||
*/
|
||||
png_set_compression_level(png, Z_BEST_COMPRESSION);
|
||||
|
||||
mask = 0xffff;
|
||||
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)
|
||||
if(nr_comp >= 3) /* RGB(A) */
|
||||
{
|
||||
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;
|
||||
|
||||
color_type = PNG_COLOR_TYPE_RGB;
|
||||
sig_bit.red = sig_bit.green = sig_bit.blue = (png_byte)prec;
|
||||
}
|
||||
else /* GRAY(A) */
|
||||
{
|
||||
color_type = PNG_COLOR_TYPE_GRAY;
|
||||
sig_bit.gray = (png_byte)prec;
|
||||
}
|
||||
if((nr_comp & 1) == 0) /* ALPHA */
|
||||
{
|
||||
color_type |= PNG_COLOR_MASK_ALPHA;
|
||||
sig_bit.alpha = (png_byte)prec;
|
||||
}
|
||||
|
||||
png_set_IHDR(png, info, image->comps[0].w, image->comps[0].h, prec, 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);
|
||||
|
||||
/* setup conversion */
|
||||
{
|
||||
OPJ_SIZE_T rowStride;
|
||||
png_size_t png_row_size;
|
||||
|
||||
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);
|
||||
png_row_size = png_get_rowbytes(png, info);
|
||||
rowStride = ((OPJ_SIZE_T)image->comps[0].w * (OPJ_SIZE_T)nr_comp * (OPJ_SIZE_T)prec + 7U) / 8U;
|
||||
if (rowStride != (OPJ_SIZE_T)png_row_size) {
|
||||
fprintf(stderr, "Invalid PNG row size\n");
|
||||
goto fin;
|
||||
}
|
||||
row_buf = (png_bytep)malloc(png_row_size);
|
||||
if (row_buf == NULL) {
|
||||
fprintf(stderr, "Can't allocate memory for PNG row\n");
|
||||
goto fin;
|
||||
}
|
||||
buffer32s = (OPJ_INT32*)malloc((OPJ_SIZE_T)image->comps[0].w * (OPJ_SIZE_T)nr_comp * sizeof(OPJ_INT32));
|
||||
if (buffer32s == NULL) {
|
||||
fprintf(stderr, "Can't allocate memory for interleaved 32s row\n");
|
||||
goto fin;
|
||||
}
|
||||
}
|
||||
|
||||
/* convert */
|
||||
{
|
||||
OPJ_SIZE_T width= image->comps[0].w;
|
||||
OPJ_UINT32 y;
|
||||
convert_32s_PXCX cvtPxToCx = convert_32s_PXCX_LUT[nr_comp];
|
||||
convert_32sXXx_C1R cvt32sToPack = NULL;
|
||||
OPJ_INT32 adjust = image->comps[0].sgnd ? 1 << (prec - 1) : 0;
|
||||
png_bytep row_buf_cpy = row_buf;
|
||||
OPJ_INT32* buffer32s_cpy = buffer32s;
|
||||
|
||||
switch (prec) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 8:
|
||||
cvt32sToPack = convert_32sXXu_C1R_LUT[prec];
|
||||
break;
|
||||
case 16:
|
||||
cvt32sToPack = convert_32s16u_C1R;
|
||||
break;
|
||||
default:
|
||||
/* never here */
|
||||
break;
|
||||
}
|
||||
|
||||
for(y = 0; y < image->comps[0].h; ++y)
|
||||
{
|
||||
cvtPxToCx(planes, buffer32s_cpy, width, adjust);
|
||||
cvt32sToPack(buffer32s_cpy, row_buf_cpy, width * (OPJ_SIZE_T)nr_comp);
|
||||
png_write_row(png, row_buf_cpy);
|
||||
planes[0] += width;
|
||||
planes[1] += width;
|
||||
planes[2] += width;
|
||||
planes[3] += width;
|
||||
}
|
||||
}
|
||||
|
||||
png_write_end(png, info);
|
||||
|
||||
fails = 0;
|
||||
|
||||
fin:
|
||||
|
||||
if(png)
|
||||
{
|
||||
if(png) {
|
||||
png_destroy_write_struct(&png, &info);
|
||||
}
|
||||
if(row_buf) {
|
||||
free(row_buf);
|
||||
}
|
||||
if(buffer32s) {
|
||||
free(buffer32s);
|
||||
}
|
||||
fclose(writer);
|
||||
|
||||
if(fails) remove(write_idf);
|
||||
|
||||
return fails;
|
||||
}/* imagetopng() */
|
||||
|
||||
|
|
|
@ -56,142 +56,7 @@
|
|||
TIFF IMAGE FORMAT
|
||||
|
||||
<<-- <<-- <<-- <<-- */
|
||||
typedef void (* tif_32stoX)(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length);
|
||||
|
||||
static void tif_32sto1u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)7U); i+=8U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
OPJ_UINT32 src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
OPJ_UINT32 src3 = (OPJ_UINT32)pSrc[i+3];
|
||||
OPJ_UINT32 src4 = (OPJ_UINT32)pSrc[i+4];
|
||||
OPJ_UINT32 src5 = (OPJ_UINT32)pSrc[i+5];
|
||||
OPJ_UINT32 src6 = (OPJ_UINT32)pSrc[i+6];
|
||||
OPJ_UINT32 src7 = (OPJ_UINT32)pSrc[i+7];
|
||||
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 7) | (src1 << 6) | (src2 << 5) | (src3 << 4) | (src4 << 3) | (src5 << 2) | (src6 << 1) | src7);
|
||||
}
|
||||
|
||||
if (length & 7U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = 0U;
|
||||
OPJ_UINT32 src2 = 0U;
|
||||
OPJ_UINT32 src3 = 0U;
|
||||
OPJ_UINT32 src4 = 0U;
|
||||
OPJ_UINT32 src5 = 0U;
|
||||
OPJ_UINT32 src6 = 0U;
|
||||
length = length & 7U;
|
||||
|
||||
if (length > 1U) {
|
||||
src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
if (length > 2U) {
|
||||
src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
if (length > 3U) {
|
||||
src3 = (OPJ_UINT32)pSrc[i+3];
|
||||
if (length > 4U) {
|
||||
src4 = (OPJ_UINT32)pSrc[i+4];
|
||||
if (length > 5U) {
|
||||
src5 = (OPJ_UINT32)pSrc[i+5];
|
||||
if (length > 6U) {
|
||||
src6 = (OPJ_UINT32)pSrc[i+6];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 7) | (src1 << 6) | (src2 << 5) | (src3 << 4) | (src4 << 3) | (src5 << 2) | (src6 << 1));
|
||||
}
|
||||
}
|
||||
|
||||
static void tif_32sto2u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)3U); i+=4U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
OPJ_UINT32 src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
OPJ_UINT32 src3 = (OPJ_UINT32)pSrc[i+3];
|
||||
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 6) | (src1 << 4) | (src2 << 2) | src3);
|
||||
}
|
||||
|
||||
if (length & 3U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = 0U;
|
||||
OPJ_UINT32 src2 = 0U;
|
||||
length = length & 3U;
|
||||
|
||||
if (length > 1U) {
|
||||
src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
if (length > 2U) {
|
||||
src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
}
|
||||
}
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 6) | (src1 << 4) | (src2 << 2));
|
||||
}
|
||||
}
|
||||
|
||||
static void tif_32sto4u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)1U); i+=2U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 4) | src1);
|
||||
}
|
||||
|
||||
if (length & 1U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 4));
|
||||
}
|
||||
}
|
||||
|
||||
static void tif_32sto6u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)3U); i+=4U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
OPJ_UINT32 src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
OPJ_UINT32 src3 = (OPJ_UINT32)pSrc[i+3];
|
||||
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 2) | (src1 >> 4));
|
||||
*pDst++ = (OPJ_BYTE)(((src1 & 0xFU) << 4) | (src2 >> 2));
|
||||
*pDst++ = (OPJ_BYTE)(((src2 & 0x3U) << 6) | src3);
|
||||
}
|
||||
|
||||
if (length & 3U) {
|
||||
OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i+0];
|
||||
OPJ_UINT32 src1 = 0U;
|
||||
OPJ_UINT32 src2 = 0U;
|
||||
length = length & 3U;
|
||||
|
||||
if (length > 1U) {
|
||||
src1 = (OPJ_UINT32)pSrc[i+1];
|
||||
if (length > 2U) {
|
||||
src2 = (OPJ_UINT32)pSrc[i+2];
|
||||
}
|
||||
}
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 2) | (src1 >> 4));
|
||||
if (length > 1U) {
|
||||
*pDst++ = (OPJ_BYTE)(((src1 & 0xFU) << 4) | (src2 >> 2));
|
||||
if (length > 2U) {
|
||||
*pDst++ = (OPJ_BYTE)(((src2 & 0x3U) << 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static void tif_32sto8u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < length; ++i) {
|
||||
pDst[i] = (OPJ_BYTE)pSrc[i];
|
||||
}
|
||||
}
|
||||
static void tif_32sto10u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
|
@ -298,56 +163,6 @@ static void tif_32sto16u(const OPJ_INT32* pSrc, OPJ_UINT16* pDst, OPJ_SIZE_T len
|
|||
}
|
||||
}
|
||||
|
||||
typedef void (* convert_32s_PXCX)(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust);
|
||||
static void convert_32s_P1C1(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_INT32* pSrc0 = pSrc[0];
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
pDst[i] = pSrc0[i] + adjust;
|
||||
}
|
||||
}
|
||||
static void convert_32s_P2C2(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_INT32* pSrc0 = pSrc[0];
|
||||
const OPJ_INT32* pSrc1 = pSrc[1];
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
pDst[2*i+0] = pSrc0[i] + adjust;
|
||||
pDst[2*i+1] = pSrc1[i] + adjust;
|
||||
}
|
||||
}
|
||||
static void convert_32s_P3C3(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_INT32* pSrc0 = pSrc[0];
|
||||
const OPJ_INT32* pSrc1 = pSrc[1];
|
||||
const OPJ_INT32* pSrc2 = pSrc[2];
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
pDst[3*i+0] = pSrc0[i] + adjust;
|
||||
pDst[3*i+1] = pSrc1[i] + adjust;
|
||||
pDst[3*i+2] = pSrc2[i] + adjust;
|
||||
}
|
||||
}
|
||||
static void convert_32s_P4C4(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_INT32* pSrc0 = pSrc[0];
|
||||
const OPJ_INT32* pSrc1 = pSrc[1];
|
||||
const OPJ_INT32* pSrc2 = pSrc[2];
|
||||
const OPJ_INT32* pSrc3 = pSrc[3];
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
pDst[4*i+0] = pSrc0[i] + adjust;
|
||||
pDst[4*i+1] = pSrc1[i] + adjust;
|
||||
pDst[4*i+2] = pSrc2[i] + adjust;
|
||||
pDst[4*i+3] = pSrc3[i] + adjust;
|
||||
}
|
||||
}
|
||||
|
||||
int imagetotif(opj_image_t * image, const char *outfile)
|
||||
{
|
||||
int width, height;
|
||||
|
@ -361,7 +176,7 @@ int imagetotif(opj_image_t * image, const char *outfile)
|
|||
OPJ_INT32* buffer32s = NULL;
|
||||
OPJ_INT32 const* planes[4];
|
||||
convert_32s_PXCX cvtPxToCx = NULL;
|
||||
tif_32stoX cvt32sToTif = NULL;
|
||||
convert_32sXXx_C1R cvt32sToTif = NULL;
|
||||
|
||||
bps = (int)image->comps[0].prec;
|
||||
planes[0] = image->comps[0].data;
|
||||
|
@ -413,38 +228,14 @@ int imagetotif(opj_image_t * image, const char *outfile)
|
|||
for (i = 0U; i < numcomps; ++i) {
|
||||
clip_component(&(image->comps[i]), image->comps[0].prec);
|
||||
}
|
||||
switch (numcomps) {
|
||||
case 1:
|
||||
cvtPxToCx = convert_32s_P1C1;
|
||||
break;
|
||||
case 2:
|
||||
cvtPxToCx = convert_32s_P2C2;
|
||||
break;
|
||||
case 3:
|
||||
cvtPxToCx = convert_32s_P3C3;
|
||||
break;
|
||||
case 4:
|
||||
cvtPxToCx = convert_32s_P4C4;
|
||||
break;
|
||||
default:
|
||||
/* never here */
|
||||
break;
|
||||
}
|
||||
cvtPxToCx = convert_32s_PXCX_LUT[numcomps];
|
||||
switch (bps) {
|
||||
case 1:
|
||||
cvt32sToTif = tif_32sto1u;
|
||||
break;
|
||||
case 2:
|
||||
cvt32sToTif = tif_32sto2u;
|
||||
break;
|
||||
case 4:
|
||||
cvt32sToTif = tif_32sto4u;
|
||||
break;
|
||||
case 6:
|
||||
cvt32sToTif = tif_32sto6u;
|
||||
break;
|
||||
case 8:
|
||||
cvt32sToTif = tif_32sto8u;
|
||||
cvt32sToTif = convert_32sXXu_C1R_LUT[bps];
|
||||
break;
|
||||
case 10:
|
||||
cvt32sToTif = tif_32sto10u;
|
||||
|
@ -456,7 +247,7 @@ int imagetotif(opj_image_t * image, const char *outfile)
|
|||
cvt32sToTif = tif_32sto14u;
|
||||
break;
|
||||
case 16:
|
||||
cvt32sToTif = (tif_32stoX)tif_32sto16u;
|
||||
cvt32sToTif = (convert_32sXXx_C1R)tif_32sto16u;
|
||||
break;
|
||||
default:
|
||||
/* never here */
|
||||
|
@ -510,119 +301,6 @@ int imagetotif(opj_image_t * image, const char *outfile)
|
|||
return 0;
|
||||
}/* imagetotif() */
|
||||
|
||||
typedef void (* tif_Xto32s)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length);
|
||||
|
||||
static void tif_1uto32s(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)7U); 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 tif_2uto32s(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)3U); 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 tif_4uto32s(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)1U); 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 tif_6uto32s(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < (length & ~(OPJ_SIZE_T)3U); i+=4U) {
|
||||
OPJ_UINT32 val0 = *pSrc++;
|
||||
OPJ_UINT32 val1 = *pSrc++;
|
||||
OPJ_UINT32 val2 = *pSrc++;
|
||||
pDst[i+0] = (OPJ_INT32)(val0 >> 2);
|
||||
pDst[i+1] = (OPJ_INT32)(((val0 & 0x3U) << 4) | (val1 >> 4));
|
||||
pDst[i+2] = (OPJ_INT32)(((val1 & 0xFU) << 2) | (val2 >> 6));
|
||||
pDst[i+3] = (OPJ_INT32)(val2 & 0x3FU);
|
||||
|
||||
}
|
||||
if (length & 3U) {
|
||||
OPJ_UINT32 val0 = *pSrc++;
|
||||
length = length & 3U;
|
||||
pDst[i+0] = (OPJ_INT32)(val0 >> 2);
|
||||
|
||||
if (length > 1U) {
|
||||
OPJ_UINT32 val1 = *pSrc++;
|
||||
pDst[i+1] = (OPJ_INT32)(((val0 & 0x3U) << 4) | (val1 >> 4));
|
||||
if (length > 2U) {
|
||||
OPJ_UINT32 val2 = *pSrc++;
|
||||
pDst[i+2] = (OPJ_INT32)(((val1 & 0xFU) << 2) | (val2 >> 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static void tif_8uto32s(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 tif_10uto32s(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
|
@ -718,52 +396,6 @@ static void tif_16uto32s(const OPJ_UINT16* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T len
|
|||
}
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* libtiff/tif_getimage.c : 1,2,4,8,16 bitspersample accepted
|
||||
* CINEMA : 12 bit precision
|
||||
|
@ -784,7 +416,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
|||
unsigned short tiBps, tiPhoto, tiSf, tiSpp, tiPC;
|
||||
unsigned int tiWidth, tiHeight;
|
||||
OPJ_BOOL is_cinema = OPJ_IS_CINEMA(parameters->rsiz);
|
||||
tif_Xto32s cvtTifTo32s = NULL;
|
||||
convert_XXx32s_C1R cvtTifTo32s = NULL;
|
||||
convert_32s_CXPX cvtCxToPx = NULL;
|
||||
OPJ_INT32* buffer32s = NULL;
|
||||
OPJ_INT32* planes[4];
|
||||
|
@ -825,20 +457,13 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
|||
|
||||
switch (tiBps) {
|
||||
case 1:
|
||||
cvtTifTo32s = tif_1uto32s;
|
||||
break;
|
||||
case 2:
|
||||
cvtTifTo32s = tif_2uto32s;
|
||||
break;
|
||||
case 4:
|
||||
cvtTifTo32s = tif_4uto32s;
|
||||
break;
|
||||
case 6:
|
||||
cvtTifTo32s = tif_6uto32s;
|
||||
break;
|
||||
case 8:
|
||||
cvtTifTo32s = tif_8uto32s;
|
||||
cvtTifTo32s = convert_XXu32s_C1R_LUT[tiBps];
|
||||
break;
|
||||
/* others are specific to TIFF */
|
||||
case 10:
|
||||
cvtTifTo32s = tif_10uto32s;
|
||||
break;
|
||||
|
@ -849,7 +474,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
|||
cvtTifTo32s = tif_14uto32s;
|
||||
break;
|
||||
case 16:
|
||||
cvtTifTo32s = (tif_Xto32s)tif_16uto32s;
|
||||
cvtTifTo32s = (convert_XXx32s_C1R)tif_16uto32s;
|
||||
break;
|
||||
default:
|
||||
/* never here */
|
||||
|
@ -908,25 +533,9 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
|||
color_space = OPJ_CLRSPC_GRAY;
|
||||
}
|
||||
|
||||
switch (numcomps) {
|
||||
case 1:
|
||||
cvtCxToPx = convert_32s_C1P1;
|
||||
break;
|
||||
case 2:
|
||||
cvtCxToPx = convert_32s_C2P2;
|
||||
break;
|
||||
case 3:
|
||||
cvtCxToPx = convert_32s_C3P3;
|
||||
break;
|
||||
case 4:
|
||||
cvtCxToPx = convert_32s_C4P4;
|
||||
break;
|
||||
default:
|
||||
/* never here */
|
||||
break;
|
||||
}
|
||||
cvtCxToPx = convert_32s_CXPX_LUT[numcomps];
|
||||
if (tiPC == PLANARCONFIG_SEPARATE) {
|
||||
cvtCxToPx = convert_32s_C1P1; /* override */
|
||||
cvtCxToPx = convert_32s_CXPX_LUT[1]; /* override */
|
||||
tiSpp = 1U; /* consider only one sample per plane */
|
||||
}
|
||||
|
||||
|
|
|
@ -94,58 +94,58 @@ fdad26b1e078aa32bd4b77a5f44da43c orb-blue10-lin-jp2.jp2_2.pgx
|
|||
7442756e83571c0e87493e03f12b2d34 orb-blue10-win-jp2.jp2_1.pgx
|
||||
5f99ff2aeb17e167fe7049bcf339d0b3 orb-blue10-win-jp2.jp2_2.pgx
|
||||
fe028d56d6c7aaee87239a115093412a orb-blue10-win-jp2.jp2_3.pgx
|
||||
dc78dd4b7739c92cd5291b043cc232ed p0_04_1.j2k.png
|
||||
e157ce3ec092931d48cdaf275180ed34 p0_04_2.j2k.png
|
||||
0f0a9b3b8b41f2afaf5d80bf2f36f68c p0_04_3.j2k.png
|
||||
f78b09250d08365b836654f717ec798c p0_04_4.j2k.png
|
||||
d7243f4004a30d8856ef4dfa0b9f4bc8 p0_04_5.j2k.png
|
||||
344233bbe643ad651f82d4e8aaa3be54 p0_04_6_1.j2k.png
|
||||
d105747d8fb755ef18b37ef83832f7d3 p0_04_6_2.j2k.png
|
||||
89000c4cb8a83fcb4166624055905258 p0_04_6_3.j2k.png
|
||||
af2a3ce7be9c8fb2db66ddbceff1dd53 p0_04_6_4.j2k.png
|
||||
757340902e8dc6d5baa4f8f4628e2bc4 p0_04_6_5.j2k.png
|
||||
4ec7002317a835f71630a7787cbff30a p0_04_6.j2k.png
|
||||
d7ed089096806af2f1bf687e1adb427f p0_04.j2k.png
|
||||
4fecc6d5ebdc2db3bf3ef6bbbbb5b031 p1_04_10.j2k.png
|
||||
ab969b1d17341d062a6f4d6966a1f221 p1_04_11.j2k.png
|
||||
70fd9d6f155585258b13cb4b6c469e3f p1_04_12.j2k.png
|
||||
38f9113129eed30445266dd67ac8ad7d p1_04_13.j2k.png
|
||||
92945201639e6d8718dc474058f63e45 p1_04_14.j2k.png
|
||||
bf7b8807d1617b8baa1cbd11af727061 p1_04_15.j2k.png
|
||||
22afbf50bda7cd1ad562e6c0601c759a p1_04_16.j2k.png
|
||||
d41f829c40140ec9972edf86681ee53a p1_04_17_t63.j2k.png
|
||||
70fd9d6f155585258b13cb4b6c469e3f p1_04_17_t63_r2.j2k.png
|
||||
80bde56ea4d1a5c2b81f3c4227ef754c p1_04_18.t12.j2k.png
|
||||
5bb3e76ec9d742ec742959f3bb865018 p1_04_19_t12_r1.j2k.png
|
||||
ef287e72806290a81f61e3d271bdb1dc p1_04_1.j2k.png
|
||||
d41f829c40140ec9972edf86681ee53a p1_04_2.j2k.png
|
||||
4dd2a41c60bcf71b8c410833b12706cf p1_04_3.j2k.png
|
||||
75b9b427ddded86219e361206669482a p1_04_4.j2k.png
|
||||
de2e66f82b9da9bc2dabda183a455b2f p1_04_5.j2k.png
|
||||
d12b3c90d4b1cf78f0ad23eedcabe0ea p1_04_6.j2k.png
|
||||
b3fccf3cbb7186841ba7b86e34cac0c2 p1_04.j2k.png
|
||||
071597783b2141a12db1765b85943c1d p1_06_10_1.j2k.png
|
||||
6778de9e9236144747fe4542d03bf6e5 p1_06_10_2.j2k.png
|
||||
af083204299bbdd993286892b4c9cd29 p1_06_10.j2k.png
|
||||
af083204299bbdd993286892b4c9cd29 p1_06_11.j2k.png
|
||||
72a7f65be34450c9ec126fbc58399354 p1_06_1.j2k.png
|
||||
85b4f3b8f7b987f83972a820d34372a7 p1_06_2.j2k.png
|
||||
d4fc3ff73e8b5eafbcc2a111b97d362b p1_06_3.j2k.png
|
||||
a954722553fb25692556cfa87a26bc1a p1_06_4.j2k.png
|
||||
a62bb79d066e230ea7b34e24681de189 p1_06_5.j2k.png
|
||||
13d78a5091b06239c2b2012f7927dce8 p1_06_6.j2k.png
|
||||
da21d175c4dcb03ce1f0a227f49ed7b8 p1_06_7_1.j2k.png
|
||||
5c434a489375fc9624bab49679cdec76 p1_06_7_2.j2k.png
|
||||
ce2de61ad83a71c9b13ca5df0a987a69 p1_06_7_3.j2k.png
|
||||
18f9fbfb0d29e83f697fa93523c53a2b p1_06_7_4.j2k.png
|
||||
66ede889502134412872b9d8b1e40887 p1_06_7_5.j2k.png
|
||||
071597783b2141a12db1765b85943c1d p1_06_7_6.j2k.png
|
||||
85a2b9a1324d72a8cec7041f80529242 p1_06_7.j2k.png
|
||||
7045c8722e92fb2d447a6dc235a3c619 p1_06_9_1.j2k.png
|
||||
d41856648d936229f1e3e2cf7d7c7a4d p1_06_9_2.j2k.png
|
||||
85b4f3b8f7b987f83972a820d34372a7 p1_06_9_3.j2k.png
|
||||
5fa6e85d6cfa0ed51e5933b2e35f4854 p1_06_9.j2k.png
|
||||
2e80dbe4a6af432b7f1b54dfa4e164ae p1_06.j2k.png
|
||||
03bd6de1f4e9924f2dcff8d4edaab718 p0_04_1.j2k.png
|
||||
7898b580781d69fda800016378bab80c p0_04_2.j2k.png
|
||||
e7cde963434e37ba00e128efb7e5c5c3 p0_04_3.j2k.png
|
||||
a486db59bf5e7c39275aaf62304cf0b7 p0_04_4.j2k.png
|
||||
59a08fe073e52a778128f22feffcdaf8 p0_04_5.j2k.png
|
||||
c6f01ceef58442fed6a6af181b27ff06 p0_04_6_1.j2k.png
|
||||
c3cbab7a2a5bf6b10f67afdd4e125120 p0_04_6_2.j2k.png
|
||||
04457ca5d9bde5700140cedf8cf2aeea p0_04_6_3.j2k.png
|
||||
dac32a0a17d0cc4e4f67d49767fc54c1 p0_04_6_4.j2k.png
|
||||
ef27ff4ff2f6d7d3919808d7378bf119 p0_04_6_5.j2k.png
|
||||
44ac3a7d98c90f5ab24b6801a601faa9 p0_04_6.j2k.png
|
||||
bd0f12125f8e3f367dae1c6179f52212 p0_04.j2k.png
|
||||
ff00bc86aa73a8266e381c5428c17c28 p1_04_10.j2k.png
|
||||
72a6b3b455c6b3397f95cdf40ead75a0 p1_04_11.j2k.png
|
||||
060809d8a5969f162f3b662adc3cbccb p1_04_12.j2k.png
|
||||
92d8168db18cf51d108b0fc1a4f0aeea p1_04_13.j2k.png
|
||||
bd5650ff4c977e42e4d84304c92222a0 p1_04_14.j2k.png
|
||||
3920307d5b6cb855065f144b7683609b p1_04_15.j2k.png
|
||||
1e94024252ca36e86b09e37370005ad0 p1_04_16.j2k.png
|
||||
d271f149dc89c4d897fbd935189b159b p1_04_17_t63.j2k.png
|
||||
060809d8a5969f162f3b662adc3cbccb p1_04_17_t63_r2.j2k.png
|
||||
c92cb973e7dc716830ddf3d257e93fb3 p1_04_18.t12.j2k.png
|
||||
c9b66b78895609fb0250ca5bd2e89c1d p1_04_19_t12_r1.j2k.png
|
||||
68e1408710e68669f434937714fd5623 p1_04_1.j2k.png
|
||||
d271f149dc89c4d897fbd935189b159b p1_04_2.j2k.png
|
||||
9583a4c09567d8b67d23c5857ca10dc5 p1_04_3.j2k.png
|
||||
6f405d502508b37f6133342ab2e7876c p1_04_4.j2k.png
|
||||
4f084579cba30bec1cc9d89e55e99c5a p1_04_5.j2k.png
|
||||
cd5326c62fa50d68b0d8f08bc3da617c p1_04_6.j2k.png
|
||||
e50b0e1c1d28f0a40ad9d5c64a4b1cf4 p1_04.j2k.png
|
||||
b367ad625d2a44a066b3cdd291da619c p1_06_10_1.j2k.png
|
||||
0bc2db37548e0f6e342af2ea86380300 p1_06_10_2.j2k.png
|
||||
32415e97cb64b4fda976c883bbb16103 p1_06_10.j2k.png
|
||||
32415e97cb64b4fda976c883bbb16103 p1_06_11.j2k.png
|
||||
3a99df46b0fbf7a9e7703d2b0e7355a5 p1_06_1.j2k.png
|
||||
2702da6fca94765767365c7d80933ee2 p1_06_2.j2k.png
|
||||
bb8d24257705393e5536fa77bdeb362c p1_06_3.j2k.png
|
||||
9add0b9211f51ae2da1d01588ed3f9cf p1_06_4.j2k.png
|
||||
5d037fefa22029a90d8e3ac82246a2e1 p1_06_5.j2k.png
|
||||
821d1c176a2908136f5246599a47c462 p1_06_6.j2k.png
|
||||
9d4cf96edeae63e461bff66d8c0b7b82 p1_06_7_1.j2k.png
|
||||
6d6713374c1e443539a02f82baad5c98 p1_06_7_2.j2k.png
|
||||
8317d23c60a0e891405339e0d9848efa p1_06_7_3.j2k.png
|
||||
aa4a63ad4322a92c7f4d5a7f29ad0723 p1_06_7_4.j2k.png
|
||||
e8748d54c7696069e14501c85d6f6638 p1_06_7_5.j2k.png
|
||||
b367ad625d2a44a066b3cdd291da619c p1_06_7_6.j2k.png
|
||||
93c72c4eaffdf0c3081a00e1d21829f6 p1_06_7.j2k.png
|
||||
024d2b209513c21438f9b5c60b7d945d p1_06_9_1.j2k.png
|
||||
c3f42d42eef90d42a98ad27d0612af9f p1_06_9_2.j2k.png
|
||||
2702da6fca94765767365c7d80933ee2 p1_06_9_3.j2k.png
|
||||
695444198428363c61871586add6d666 p1_06_9.j2k.png
|
||||
c494419005e8aae82f46d3f48da6caf1 p1_06.j2k.png
|
||||
371aa0a7ff40a73b45f1fa41e210d1db pacs.ge.j2k_0.pgx
|
||||
6ae110e1fb5a869af3dbc5fbc735b0bd relax.jp2_0.pgx
|
||||
518a8f28dacc034982507f43763b88dd relax.jp2_1.pgx
|
||||
|
@ -221,3 +221,39 @@ b6f71c941e3a5b8d2547792ccec58d54 p0_14_tif-4.tif
|
|||
dd15b3d487d36a3682be0679300a4319 issue235.jp2_0.pgx
|
||||
b9cd6dc76b141fb1fec15f50c1f70e01 issue235.jp2_1.pgx
|
||||
3edef2ae197ef30b08deda1b28825399 issue235.jp2_2.pgx
|
||||
b6a84b3215333efc80326715f9078c58 a1_mono_png-1.png
|
||||
88f96456667b8b3fd69c406fe40636b5 a1_mono_png-10.png
|
||||
077148452a9506a2337afa2777c57834 a1_mono_png-12.png
|
||||
c4eee75c1da8d43e1510cb36326f948b a1_mono_png-14.png
|
||||
b22b7badb943c5c375b7c55032f49def a1_mono_png-16.png
|
||||
c7e209abe0d4c5ec1407bfe2cfa932de a1_mono_png-2.png
|
||||
313d1e2d0d41231003587d3061b6119f a1_mono_png-4.png
|
||||
d92241d97e8603509027176dd3b3168a a1_mono_png-6.png
|
||||
a86b3b0720229491ce82556d3fc97bf3 a1_mono_png-8.png
|
||||
159d1413263e2183e50ecc8dc7487b98 basn4a08_png-1.png
|
||||
cc501ac5219200ed5d7d33df907d3390 basn4a08_png-10.png
|
||||
9006ec767be7645c1808eef4e8c6ee7a basn4a08_png-12.png
|
||||
df3484a4ecfaddc1f62d4bf202944ad5 basn4a08_png-14.png
|
||||
699c25624e99c72fd45cfdb5660920c2 basn4a08_png-16.png
|
||||
95090b2194e811e8c490e12632e8a5f3 basn4a08_png-2.png
|
||||
c66f969b198eff8ddf663a3ccbb8e272 basn4a08_png-4.png
|
||||
02484627d57e7bcb45d3c1bff11a4687 basn4a08_png-6.png
|
||||
3bf91c974abc17e520c6a5efa883a58a basn4a08_png-8.png
|
||||
cd6b948268967b1e9b54d60607b8de0a basn6a08_png-1.png
|
||||
549e7a5566f37f7e08030cfa2aee8994 basn6a08_png-10.png
|
||||
d9e6472bc020607327cd082464d03616 basn6a08_png-12.png
|
||||
54e9b4d5e3fadd939a54722f05cadbe9 basn6a08_png-14.png
|
||||
94bba5bebc9e9209f2af13c6dd5a2c12 basn6a08_png-16.png
|
||||
16a9287d409a1c80158973f95eb3c04e basn6a08_png-2.png
|
||||
4065c615d124289bd06cd9c9bfb4adab basn6a08_png-4.png
|
||||
3235c0b759dd47e0c2df5bc9ac827e70 basn6a08_png-6.png
|
||||
0db8bf6fa69191c20936701ef365b82a basn6a08_png-8.png
|
||||
d3c82c8552f2e47c179372933725c8d7 p0_14_png-1.png
|
||||
7bce012868556bd04e5c0567b67d2896 p0_14_png-10.png
|
||||
d66fe6bbe653a18e60416e0cda1b1949 p0_14_png-12.png
|
||||
b3f01308ae57518ff157c926563b01b2 p0_14_png-14.png
|
||||
629bc0a76c5454e875eab9cacc653dfd p0_14_png-16.png
|
||||
fc2844a9f3c8e924e349180ba9e122dd p0_14_png-2.png
|
||||
428c7a19b9df4120d35b5df7fafdf253 p0_14_png-4.png
|
||||
0c1cc85c051dd95394d06103c8d9bbef p0_14_png-6.png
|
||||
230e4968cb445b222ee2095014ba1d26 p0_14_png-8.png
|
||||
|
|
|
@ -447,3 +447,44 @@ opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-16.ti
|
|||
#issue 235 CMAP outside jp2h box. CMAP is buggy
|
||||
opj_decompress -i @INPUT_NR_PATH@/issue235.jp2 -o @TEMP_PATH@/issue235.jp2.pgx
|
||||
|
||||
# issue 264, add checks for png
|
||||
# GRAYSCALE
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_png-1.png -p 1S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_png-2.png -p 2S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_png-4.png -p 4S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_png-6.png -p 6S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_png-8.png -p 8S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_png-10.png -p 10S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_png-12.png -p 12S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_png-14.png -p 14S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_png-16.png -p 16S
|
||||
# GRAYSCALE ALPHA
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_png-1.png -p 1S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_png-2.png -p 2S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_png-4.png -p 4S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_png-6.png -p 6S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_png-8.png -p 8S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_png-10.png -p 10S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_png-12.png -p 12S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_png-14.png -p 14S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_png-16.png -p 16S
|
||||
# RGB
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_png-1.png -p 1S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_png-2.png -p 2S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_png-4.png -p 4S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_png-6.png -p 6S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_png-8.png -p 8S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_png-10.png -p 10S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_png-12.png -p 12S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_png-14.png -p 14S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_png-16.png -p 16S
|
||||
# RGBA
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-1.png -p 1S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-2.png -p 2S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-4.png -p 4S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-6.png -p 6S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-8.png -p 8S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-10.png -p 10S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-12.png -p 12S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-14.png -p 14S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_png-16.png -p 16S
|
||||
|
|
Loading…
Reference in New Issue