Allow to write 3/5/7/9/11/13/15 bpp TIF files
Update uclouvain/openjpeg#729
This commit is contained in:
parent
06e8dc9edd
commit
29e8a1cfa4
|
@ -56,6 +56,229 @@
|
|||
TIFF IMAGE FORMAT
|
||||
|
||||
<<-- <<-- <<-- <<-- */
|
||||
#define PUTBITS2(s, nb) \
|
||||
trailing <<= remaining; \
|
||||
trailing |= (unsigned int)((s) >> (nb - remaining)); \
|
||||
*pDst++ = (OPJ_BYTE)trailing; \
|
||||
trailing = (unsigned int)((s) & ((1U << (nb - remaining)) - 1U)); \
|
||||
if (nb >= (remaining + 8)) { \
|
||||
*pDst++ = (OPJ_BYTE)(trailing >> (nb - (remaining + 8))); \
|
||||
trailing &= (unsigned int)((1U << (nb - (remaining + 8))) - 1U); \
|
||||
remaining += 16 - nb; \
|
||||
} else { \
|
||||
remaining += 8 - nb; \
|
||||
}
|
||||
|
||||
#define PUTBITS(s, nb) \
|
||||
if (nb >= remaining) { \
|
||||
PUTBITS2(s, nb) \
|
||||
} else { \
|
||||
trailing <<= nb; \
|
||||
trailing |= (unsigned int)(s); \
|
||||
remaining -= nb; \
|
||||
}
|
||||
#define FLUSHBITS() \
|
||||
if (remaining != 8) { \
|
||||
trailing <<= remaining; \
|
||||
*pDst++ = (OPJ_BYTE)trailing; \
|
||||
}
|
||||
|
||||
static void tif_32sto3u(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 << 5) | (src1 << 2) | (src2 >> 1));
|
||||
*pDst++ = (OPJ_BYTE)((src2 << 7) | (src3 << 4) | (src4 << 1) | (src5 >> 2));
|
||||
*pDst++ = (OPJ_BYTE)((src5 << 6) | (src6 << 3) | (src7));
|
||||
}
|
||||
|
||||
if (length & 7U) {
|
||||
OPJ_BYTE trailing = 0U;
|
||||
int remaining = 8U;
|
||||
length &= 7U;
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+0], 3)
|
||||
if (length > 1U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+1], 3)
|
||||
if (length > 2U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+2], 3)
|
||||
if (length > 3U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+3], 3)
|
||||
if (length > 4U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+4], 3)
|
||||
if (length > 5U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+5], 3)
|
||||
if (length > 6U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+6], 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FLUSHBITS()
|
||||
}
|
||||
}
|
||||
|
||||
static void tif_32sto5u(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 << 3) | (src1 >> 2));
|
||||
*pDst++ = (OPJ_BYTE)((src1 << 6) | (src2 << 1) | (src3 >> 4));
|
||||
*pDst++ = (OPJ_BYTE)((src3 << 4) | (src4 >> 1));
|
||||
*pDst++ = (OPJ_BYTE)((src4 << 7) | (src5 << 2) | (src6 >> 3));
|
||||
*pDst++ = (OPJ_BYTE)((src6 << 5) | (src7));
|
||||
|
||||
}
|
||||
|
||||
if (length & 7U) {
|
||||
OPJ_BYTE trailing = 0U;
|
||||
int remaining = 8U;
|
||||
length &= 7U;
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+0], 5)
|
||||
if (length > 1U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+1], 5)
|
||||
if (length > 2U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+2], 5)
|
||||
if (length > 3U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+3], 5)
|
||||
if (length > 4U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+4], 5)
|
||||
if (length > 5U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+5], 5)
|
||||
if (length > 6U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+6], 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FLUSHBITS()
|
||||
}
|
||||
}
|
||||
|
||||
static void tif_32sto7u(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 << 1) | (src1 >> 6));
|
||||
*pDst++ = (OPJ_BYTE)((src1 << 2) | (src2 >> 5));
|
||||
*pDst++ = (OPJ_BYTE)((src2 << 3) | (src3 >> 4));
|
||||
*pDst++ = (OPJ_BYTE)((src3 << 4) | (src4 >> 3));
|
||||
*pDst++ = (OPJ_BYTE)((src4 << 5) | (src5 >> 2));
|
||||
*pDst++ = (OPJ_BYTE)((src5 << 6) | (src6 >> 1));
|
||||
*pDst++ = (OPJ_BYTE)((src6 << 7) | (src7));
|
||||
}
|
||||
|
||||
if (length & 7U) {
|
||||
OPJ_BYTE trailing = 0U;
|
||||
int remaining = 8U;
|
||||
length &= 7U;
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+0], 7)
|
||||
if (length > 1U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+1], 7)
|
||||
if (length > 2U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+2], 7)
|
||||
if (length > 3U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+3], 7)
|
||||
if (length > 4U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+4], 7)
|
||||
if (length > 5U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+5], 7)
|
||||
if (length > 6U) {
|
||||
PUTBITS((OPJ_UINT32)pSrc[i+6], 7)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FLUSHBITS()
|
||||
}
|
||||
}
|
||||
|
||||
static void tif_32sto9u(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 >> 1));
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 7) | (src1 >> 2));
|
||||
*pDst++ = (OPJ_BYTE)((src1 << 6) | (src2 >> 3));
|
||||
*pDst++ = (OPJ_BYTE)((src2 << 5) | (src3 >> 4));
|
||||
*pDst++ = (OPJ_BYTE)((src3 << 4) | (src4 >> 5));
|
||||
*pDst++ = (OPJ_BYTE)((src4 << 3) | (src5 >> 6));
|
||||
*pDst++ = (OPJ_BYTE)((src5 << 2) | (src6 >> 7));
|
||||
*pDst++ = (OPJ_BYTE)((src6 << 1) | (src7 >> 8));
|
||||
*pDst++ = (OPJ_BYTE)(src7);
|
||||
}
|
||||
|
||||
if (length & 7U) {
|
||||
OPJ_BYTE trailing = 0U;
|
||||
int remaining = 8U;
|
||||
length &= 7U;
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+0], 9)
|
||||
if (length > 1U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+1], 9)
|
||||
if (length > 2U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+2], 9)
|
||||
if (length > 3U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+3], 9)
|
||||
if (length > 4U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+4], 9)
|
||||
if (length > 5U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+5], 9)
|
||||
if (length > 6U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+6], 9)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FLUSHBITS()
|
||||
}
|
||||
}
|
||||
|
||||
static void tif_32sto10u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
|
@ -95,6 +318,59 @@ static void tif_32sto10u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T lengt
|
|||
}
|
||||
}
|
||||
}
|
||||
static void tif_32sto11u(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 >> 3));
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 5) | (src1 >> 6));
|
||||
*pDst++ = (OPJ_BYTE)((src1 << 2) | (src2 >> 9));
|
||||
*pDst++ = (OPJ_BYTE)((src2 >> 1));
|
||||
*pDst++ = (OPJ_BYTE)((src2 << 7) | (src3 >> 4));
|
||||
*pDst++ = (OPJ_BYTE)((src3 << 4) | (src4 >> 7));
|
||||
*pDst++ = (OPJ_BYTE)((src4 << 1) | (src5 >> 10));
|
||||
*pDst++ = (OPJ_BYTE)((src5 >> 2));
|
||||
*pDst++ = (OPJ_BYTE)((src5 << 6) | (src6 >> 5));
|
||||
*pDst++ = (OPJ_BYTE)((src6 << 3) | (src7 >> 8));
|
||||
*pDst++ = (OPJ_BYTE)(src7);
|
||||
}
|
||||
|
||||
if (length & 7U) {
|
||||
unsigned int trailing = 0U;
|
||||
int remaining = 8U;
|
||||
length &= 7U;
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+0], 11)
|
||||
if (length > 1U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+1], 11)
|
||||
if (length > 2U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+2], 11)
|
||||
if (length > 3U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+3], 11)
|
||||
if (length > 4U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+4], 11)
|
||||
if (length > 5U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+5], 11)
|
||||
if (length > 6U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+6], 11)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FLUSHBITS()
|
||||
}
|
||||
}
|
||||
static void tif_32sto12u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
|
@ -113,6 +389,61 @@ static void tif_32sto12u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T lengt
|
|||
*pDst++ = (OPJ_BYTE)(((src0 & 0xFU) << 4));
|
||||
}
|
||||
}
|
||||
static void tif_32sto13u(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 >> 5));
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 3) | (src1 >> 10));
|
||||
*pDst++ = (OPJ_BYTE)((src1 >> 2));
|
||||
*pDst++ = (OPJ_BYTE)((src1 << 6) | (src2 >> 7));
|
||||
*pDst++ = (OPJ_BYTE)((src2 << 1) | (src3 >> 12));
|
||||
*pDst++ = (OPJ_BYTE)((src3 >> 4));
|
||||
*pDst++ = (OPJ_BYTE)((src3 << 4) | (src4 >> 9));
|
||||
*pDst++ = (OPJ_BYTE)((src4 >> 1));
|
||||
*pDst++ = (OPJ_BYTE)((src4 << 7) | (src5 >> 6));
|
||||
*pDst++ = (OPJ_BYTE)((src5 << 2) | (src6 >> 11));
|
||||
*pDst++ = (OPJ_BYTE)((src6 >> 3));
|
||||
*pDst++ = (OPJ_BYTE)((src6 << 5) | (src7 >> 8));
|
||||
*pDst++ = (OPJ_BYTE)(src7);
|
||||
}
|
||||
|
||||
if (length & 7U) {
|
||||
unsigned int trailing = 0U;
|
||||
int remaining = 8U;
|
||||
length &= 7U;
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+0], 13)
|
||||
if (length > 1U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+1], 13)
|
||||
if (length > 2U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+2], 13)
|
||||
if (length > 3U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+3], 13)
|
||||
if (length > 4U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+4], 13)
|
||||
if (length > 5U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+5], 13)
|
||||
if (length > 6U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+6], 13)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FLUSHBITS()
|
||||
}
|
||||
}
|
||||
static void tif_32sto14u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
|
@ -155,6 +486,63 @@ static void tif_32sto14u(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T lengt
|
|||
}
|
||||
}
|
||||
}
|
||||
static void tif_32sto15u(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));
|
||||
*pDst++ = (OPJ_BYTE)((src0 << 1) | (src1 >> 14));
|
||||
*pDst++ = (OPJ_BYTE)((src1 >> 6));
|
||||
*pDst++ = (OPJ_BYTE)((src1 << 2) | (src2 >> 13));
|
||||
*pDst++ = (OPJ_BYTE)((src2 >> 5));
|
||||
*pDst++ = (OPJ_BYTE)((src2 << 3) | (src3 >> 12));
|
||||
*pDst++ = (OPJ_BYTE)((src3 >> 4));
|
||||
*pDst++ = (OPJ_BYTE)((src3 << 4) | (src4 >> 11));
|
||||
*pDst++ = (OPJ_BYTE)((src4 >> 3));
|
||||
*pDst++ = (OPJ_BYTE)((src4 << 5) | (src5 >> 10));
|
||||
*pDst++ = (OPJ_BYTE)((src5 >> 2));
|
||||
*pDst++ = (OPJ_BYTE)((src5 << 6) | (src6 >> 9));
|
||||
*pDst++ = (OPJ_BYTE)((src6 >> 1));
|
||||
*pDst++ = (OPJ_BYTE)((src6 << 7) | (src7 >> 8));
|
||||
*pDst++ = (OPJ_BYTE)(src7);
|
||||
}
|
||||
|
||||
if (length & 7U) {
|
||||
unsigned int trailing = 0U;
|
||||
int remaining = 8U;
|
||||
length &= 7U;
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+0], 15)
|
||||
if (length > 1U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+1], 15)
|
||||
if (length > 2U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+2], 15)
|
||||
if (length > 3U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+3], 15)
|
||||
if (length > 4U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+4], 15)
|
||||
if (length > 5U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+5], 15)
|
||||
if (length > 6U) {
|
||||
PUTBITS2((OPJ_UINT32)pSrc[i+6], 15)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FLUSHBITS()
|
||||
}
|
||||
}
|
||||
static void tif_32sto16u(const OPJ_INT32* pSrc, OPJ_UINT16* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
|
@ -223,10 +611,10 @@ int imagetotif(opj_image_t * image, const char *outfile)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if((bps > 16) || ((bps != 1) && (bps & 1))) bps = 0;
|
||||
if(bps > 16) bps = 0;
|
||||
if(bps == 0)
|
||||
{
|
||||
fprintf(stderr,"imagetotif: Bits=%d, Only 1, 2, 4, 6, 8, 10, 12, 14 and 16 bits implemented\n",bps);
|
||||
fprintf(stderr,"imagetotif: Bits=%d, Only 1 to 16 bits implemented\n",bps);
|
||||
fprintf(stderr,"\tAborting\n");
|
||||
return 1;
|
||||
}
|
||||
|
@ -248,15 +636,36 @@ int imagetotif(opj_image_t * image, const char *outfile)
|
|||
case 8:
|
||||
cvt32sToTif = convert_32sXXu_C1R_LUT[bps];
|
||||
break;
|
||||
case 3:
|
||||
cvt32sToTif = tif_32sto3u;
|
||||
break;
|
||||
case 5:
|
||||
cvt32sToTif = tif_32sto5u;
|
||||
break;
|
||||
case 7:
|
||||
cvt32sToTif = tif_32sto7u;
|
||||
break;
|
||||
case 9:
|
||||
cvt32sToTif = tif_32sto9u;
|
||||
break;
|
||||
case 10:
|
||||
cvt32sToTif = tif_32sto10u;
|
||||
break;
|
||||
case 11:
|
||||
cvt32sToTif = tif_32sto11u;
|
||||
break;
|
||||
case 12:
|
||||
cvt32sToTif = tif_32sto12u;
|
||||
break;
|
||||
case 13:
|
||||
cvt32sToTif = tif_32sto13u;
|
||||
break;
|
||||
case 14:
|
||||
cvt32sToTif = tif_32sto14u;
|
||||
break;
|
||||
case 15:
|
||||
cvt32sToTif = tif_32sto15u;
|
||||
break;
|
||||
case 16:
|
||||
cvt32sToTif = (convert_32sXXx_C1R)tif_32sto16u;
|
||||
break;
|
||||
|
|
|
@ -182,40 +182,68 @@ d33fb5dbddb9b9b4438eb51fa27445a3 issue495.jp2_0.pgx
|
|||
97da625d2f2d0b75bf891d8083ce8bfb issue495.jp2_2.pgx
|
||||
86729c5f2b74b2dfd42cb0d8e47aef79 a1_mono_tif-1.tif
|
||||
fa9b7b896536b25a7a1d8eeeacb59141 a1_mono_tif-10.tif
|
||||
e1f194f69d1c58ce8bed62cd4f1d5b6a a1_mono_tif-11.tif
|
||||
b0ee13aa90ca4421e09a3b7b41f410c0 a1_mono_tif-12.tif
|
||||
de53251a33356e206a793fbdbaf90db2 a1_mono_tif-13.tif
|
||||
4699894fedd3758727d8288cd7adb56c a1_mono_tif-14.tif
|
||||
012958af4207f4a779c0cdc9e18bc9be a1_mono_tif-15.tif
|
||||
4ad682c58e63d3223914c10a6656c8ae a1_mono_tif-16.tif
|
||||
22c2fa09a4d7b9fade6a3cddc6c6a4dc a1_mono_tif-2.tif
|
||||
7aea003d047d6c26475d0d257a0cfdfc a1_mono_tif-3.tif
|
||||
996c5e67a663218be90e86bff8ecad89 a1_mono_tif-4.tif
|
||||
0489a5d490588fa603a8e59af60ef8fc a1_mono_tif-5.tif
|
||||
7f451a5ac89915c5cdc023fd8c813a3c a1_mono_tif-6.tif
|
||||
e164a6c0219737ee05a3d55d6e3a3104 a1_mono_tif-7.tif
|
||||
c3ebfcf478b1c4fc786748813f2b5d53 a1_mono_tif-8.tif
|
||||
67adb084f1fe234f240a1d0b2698507e a1_mono_tif-9.tif
|
||||
31650ec40241737634179fff6ad306f8 basn4a08_tif-1.tif
|
||||
abf884080bcfbf58c044a9d86bfa5e5d basn4a08_tif-10.tif
|
||||
b0d82c12aa2c9b3ecd96c6a5b5663a8c basn4a08_tif-11.tif
|
||||
916d97c098d9792993cc91fee4a83f77 basn4a08_tif-12.tif
|
||||
90cabbb0f401b75dcfa64e4fbb987020 basn4a08_tif-13.tif
|
||||
57643174986481d336db6ddf04b970df basn4a08_tif-14.tif
|
||||
3cbf7868617a0dfdbeddd5c50ea96b31 basn4a08_tif-15.tif
|
||||
fb5cf848d63c61dc485c87c9246ee9c7 basn4a08_tif-16.tif
|
||||
5d7b01d98c82ad563bb28c2d83484a2a basn4a08_tif-2.tif
|
||||
7928de544e7d9731572a625beeb2b3ee basn4a08_tif-3.tif
|
||||
2401cebbb1d5494fcbe0d899484c342d basn4a08_tif-4.tif
|
||||
05ea9dfd48a6cd613bf935394988ec38 basn4a08_tif-5.tif
|
||||
6dbeb5b708bbde76e204c0887da61f6b basn4a08_tif-6.tif
|
||||
18a59ac6036ee64e92af19b7e3cd3d64 basn4a08_tif-7.tif
|
||||
dc40cc1da6de28e7e973c8ba796ca189 basn4a08_tif-8.tif
|
||||
824b776a5aa3459b77894b5f77621311 basn4a08_tif-9.tif
|
||||
59e32c45591fd3bb44fe99381a116ba1 basn6a08_tif-1.tif
|
||||
630e6fb6deba0b3efd93b610561d607a basn6a08_tif-10.tif
|
||||
5419fec92f0e0e5907d838dacf9712b4 basn6a08_tif-11.tif
|
||||
765555e75e59de27f7b2177d04f36bc1 basn6a08_tif-12.tif
|
||||
7d20d3e026fc1ac25be16dd44e9fb2e5 basn6a08_tif-13.tif
|
||||
62384c112d5fe40aefd0a9b0b9a4bcc6 basn6a08_tif-14.tif
|
||||
325de66e18e133f2ad865fc1faa20439 basn6a08_tif-15.tif
|
||||
d725d41557658a28ab31dff74e2467fa basn6a08_tif-16.tif
|
||||
96d91df6b10e866ea26ebbf0b8ddc7da basn6a08_tif-2.tif
|
||||
36690c1fe565b6efc229f5c7e486de31 basn6a08_tif-3.tif
|
||||
a324032339808d5fe85d6e354f14c183 basn6a08_tif-4.tif
|
||||
64dfb6af672ea8e890e24cfb208c6755 basn6a08_tif-5.tif
|
||||
d60864a6a5c8a49a202d98ae6f5165c7 basn6a08_tif-6.tif
|
||||
086fd12fec963995fe2e405dcef7e477 basn6a08_tif-7.tif
|
||||
c3e93f61125f82a9832d0b9440468034 basn6a08_tif-8.tif
|
||||
a9723dcc0732e74c9e8cd2bf93474a7d basn6a08_tif-9.tif
|
||||
cfe04d15cf9d615fc36357dcb3b3956b p0_14_tif-1.tif
|
||||
9ad87e7fddc77ac85e2e92509bee2365 p0_14_tif-10.tif
|
||||
f144e26d6d5aa24d98f0415f10751025 p0_14_tif-11.tif
|
||||
38e67f9d573e61166761d5eee0104448 p0_14_tif-12.tif
|
||||
4e804903537e4c52a7e4c15bd74eb15c p0_14_tif-13.tif
|
||||
77486f0468694b94290d0b55361498a0 p0_14_tif-14.tif
|
||||
2aa3211823a8ee41cc5061f401dfd52d p0_14_tif-15.tif
|
||||
51be675689949dd08b6ee1427af3eb4a p0_14_tif-16.tif
|
||||
3e34e94bd8f7380c8d159676fee9ea57 p0_14_tif-2.tif
|
||||
f623c6b98711ba8582f2b60620c6494a p0_14_tif-3.tif
|
||||
b6f71c941e3a5b8d2547792ccec58d54 p0_14_tif-4.tif
|
||||
5a8498d473cc57318ab9d216fdc5dcc9 p0_14_tif-5.tif
|
||||
81fcdd90917efb95aed94c6522d1c188 p0_14_tif-6.tif
|
||||
951c99efbd922d8f3feb015e9ef8e350 p0_14_tif-7.tif
|
||||
6808377b760b4ef3559ba8b14ed9b91a p0_14_tif-8.tif
|
||||
96aa7dafa873d0ce33f84bb1ff78fa9b p0_14_tif-9.tif
|
||||
dd15b3d487d36a3682be0679300a4319 issue235.jp2_0.pgx
|
||||
b9cd6dc76b141fb1fec15f50c1f70e01 issue235.jp2_1.pgx
|
||||
3edef2ae197ef30b08deda1b28825399 issue235.jp2_2.pgx
|
||||
|
|
|
@ -508,3 +508,37 @@ opj_decompress -i @INPUT_NR_PATH@/issue559-eci-091-CIELab.jp2 -o @TEMP_PATH@/iss
|
|||
|
||||
# issue 653 Last box of undefined size byg
|
||||
opj_decompress -i @INPUT_NR_PATH@/issue653-zero-unknownbox.jp2 -o @TEMP_PATH@/issue653-zero-unknownbox.jp2.png -p 8S
|
||||
|
||||
# issue 729 decompress 3/5/7/9/11/13/15 bits precision to tiff
|
||||
# GRAYSCALE
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-3.tif -p 3S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-5.tif -p 5S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-7.tif -p 7S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-9.tif -p 9S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-11.tif -p 11S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-13.tif -p 13S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/a1_mono.j2c -o @TEMP_PATH@/a1_mono_tif-15.tif -p 15S
|
||||
# GRAYSCALE ALPHA
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-3.tif -p 3S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-5.tif -p 5S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-7.tif -p 7S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-9.tif -p 9S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-11.tif -p 11S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-13.tif -p 13S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn4a08.jp2 -o @TEMP_PATH@/basn4a08_tif-15.tif -p 15S
|
||||
# RGB
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-3.tif -p 3S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-5.tif -p 5S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-7.tif -p 7S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-9.tif -p 9S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-11.tif -p 11S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-13.tif -p 13S
|
||||
opj_decompress -i @INPUT_CONF_PATH@/p0_14.j2k -o @TEMP_PATH@/p0_14_tif-15.tif -p 15S
|
||||
# RGBA
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-3.tif -p 3S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-5.tif -p 5S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-7.tif -p 7S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-9.tif -p 9S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-11.tif -p 11S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-13.tif -p 13S
|
||||
opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-15.tif -p 15S
|
||||
|
|
Loading…
Reference in New Issue