Update libmng snapshot. Not in default build.

This commit is contained in:
tor%cs.brown.edu 2000-06-14 14:20:55 +00:00
Родитель d8fa510492
Коммит fe1f97085c
3 изменённых файлов: 192 добавлений и 73 удалений

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_chunk_io.c copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Chunk I/O routines (implementation) * */
/* * * */
@ -65,6 +65,11 @@
/* * 0.5.2 - 06/03/2000 - G.Juyn * */
/* * - fixed makeup for Linux gcc compile * */
/* * * */
/* * 0.5.3 - 06/12/2000 - G.Juyn * */
/* * - added processing of color-info on delta-image * */
/* * 0.5.3 - 06/13/2000 - G.Juyn * */
/* * - fixed handling of empty SAVE chunk * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -1136,13 +1141,25 @@ READ_CHUNK (read_gama)
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))
#endif
{
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_imagep pImage;
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
if (pData->bHasDHDR) /* update delta image ? */
{
pImage = (mng_imagep)pData->pDeltaImage;
pImage->pImgbuf->iGamma = mng_get_uint32 (pRawdata);
pImage->pImgbuf->bHasGAMA = MNG_TRUE;
}
else
{
pImage = (mng_imagep)pData->pCurrentobj;
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
/* store for color-processing routines */
pImage->pImgbuf->iGamma = mng_get_uint32 (pRawdata);
pImage->pImgbuf->bHasGAMA = MNG_TRUE;
pImage->pImgbuf->iGamma = mng_get_uint32 (pRawdata);
pImage->pImgbuf->bHasGAMA = MNG_TRUE;
}
}
else
{ /* store as global */
@ -1237,23 +1254,44 @@ READ_CHUNK (read_chrm)
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))
#endif
{
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_imagep pImage;
mng_imagedatap pBuf;
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
if (pData->bHasDHDR) /* update delta image ? */
{
pImage = (mng_imagep)pData->pDeltaImage;
pBuf = pImage->pImgbuf; /* address object buffer */
pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */
pBuf = pImage->pImgbuf; /* address object buffer */
pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */
/* store for color-processing routines */
pBuf->iWhitepointx = mng_get_uint32 (pRawdata);
pBuf->iWhitepointy = mng_get_uint32 (pRawdata+4);
pBuf->iPrimaryredx = mng_get_uint32 (pRawdata+8);
pBuf->iPrimaryredy = mng_get_uint32 (pRawdata+12);
pBuf->iPrimarygreenx = mng_get_uint32 (pRawdata+16);
pBuf->iPrimarygreeny = mng_get_uint32 (pRawdata+20);
pBuf->iPrimarybluex = mng_get_uint32 (pRawdata+24);
pBuf->iPrimarybluey = mng_get_uint32 (pRawdata+28);
pBuf->iWhitepointx = mng_get_uint32 (pRawdata);
pBuf->iWhitepointy = mng_get_uint32 (pRawdata+4);
pBuf->iPrimaryredx = mng_get_uint32 (pRawdata+8);
pBuf->iPrimaryredy = mng_get_uint32 (pRawdata+12);
pBuf->iPrimarygreenx = mng_get_uint32 (pRawdata+16);
pBuf->iPrimarygreeny = mng_get_uint32 (pRawdata+20);
pBuf->iPrimarybluex = mng_get_uint32 (pRawdata+24);
pBuf->iPrimarybluey = mng_get_uint32 (pRawdata+28);
}
else
{
pImage = (mng_imagep)pData->pCurrentobj;
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
pBuf = pImage->pImgbuf; /* address object buffer */
pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */
/* store for color-processing routines */
pBuf->iWhitepointx = mng_get_uint32 (pRawdata);
pBuf->iWhitepointy = mng_get_uint32 (pRawdata+4);
pBuf->iPrimaryredx = mng_get_uint32 (pRawdata+8);
pBuf->iPrimaryredy = mng_get_uint32 (pRawdata+12);
pBuf->iPrimarygreenx = mng_get_uint32 (pRawdata+16);
pBuf->iPrimarygreeny = mng_get_uint32 (pRawdata+20);
pBuf->iPrimarybluex = mng_get_uint32 (pRawdata+24);
pBuf->iPrimarybluey = mng_get_uint32 (pRawdata+28);
}
}
else
{ /* store as global */
@ -1372,13 +1410,25 @@ READ_CHUNK (read_srgb)
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))
#endif
{
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_imagep pImage;
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
if (pData->bHasDHDR) /* update delta image ? */
{
pImage = (mng_imagep)pData->pDeltaImage;
pImage->pImgbuf->iRenderingintent = *pRawdata;
pImage->pImgbuf->bHasSRGB = MNG_TRUE;
}
else
{
pImage = (mng_imagep)pData->pCurrentobj;
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
/* store for color-processing routines */
pImage->pImgbuf->iRenderingintent = *pRawdata;
pImage->pImgbuf->bHasSRGB = MNG_TRUE;
pImage->pImgbuf->iRenderingintent = *pRawdata;
pImage->pImgbuf->bHasSRGB = MNG_TRUE;
}
}
else
{ /* store as global */
@ -1498,17 +1548,37 @@ READ_CHUNK (read_iccp)
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))
#endif
{
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_imagep pImage;
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
/* store as local */
if (pData->bHasDHDR) /* update delta image ? */
{
pImage = (mng_imagep)pData->pDeltaImage;
if (pImage->pImgbuf->pProfile) /* profile existed ? */
MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize)
/* allocate a buffer & copy it */
MNG_ALLOC (pData, pImage->pImgbuf->pProfile, iProfilesize)
MNG_COPY (pImage->pImgbuf->pProfile, pBuf, iProfilesize)
MNG_ALLOC (pData, pImage->pImgbuf->pProfile, iProfilesize)
MNG_COPY (pImage->pImgbuf->pProfile, pBuf, iProfilesize)
/* store it's length as well */
pImage->pImgbuf->iProfilesize = iProfilesize;
pImage->pImgbuf->bHasICCP = MNG_TRUE;
pImage->pImgbuf->iProfilesize = iProfilesize;
pImage->pImgbuf->bHasICCP = MNG_TRUE;
}
else
{
pImage = (mng_imagep)pData->pCurrentobj;
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
if (pImage->pImgbuf->pProfile) /* profile existed ? */
MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize)
/* allocate a buffer & copy it */
MNG_ALLOC (pData, pImage->pImgbuf->pProfile, iProfilesize)
MNG_COPY (pImage->pImgbuf->pProfile, pBuf, iProfilesize)
/* store it's length as well */
pImage->pImgbuf->iProfilesize = iProfilesize;
pImage->pImgbuf->bHasICCP = MNG_TRUE;
}
}
else
{ /* store as global */
@ -4190,7 +4260,7 @@ READ_CHUNK (read_save)
/* store the fields */
((mng_savep)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0);
if (!iRawlen) /* not empty ? */
if (iRawlen) /* not empty ? */
{
mng_uint8 iOtype = *pRawdata;
mng_uint8 iEtype;

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_display.c copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Display management (implementation) * */
/* * * */
@ -50,6 +50,11 @@
/* * 0.5.2 - 06/10/2000 - G.Juyn * */
/* * - fixed some compilation-warnings (contrib Jason Morris) * */
/* * * */
/* * 0.5.3 - 06/12/2000 - G.Juyn * */
/* * - fixed display of stored JNG images * */
/* * 0.5.3 - 06/13/2000 - G.Juyn * */
/* * - fixed problem with BASI-IEND as object 0 * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -577,49 +582,87 @@ mng_retcode display_image (mng_datap pData,
/* and image-buffer retrieval routine */
switch (pImage->pImgbuf->iColortype)
{
case 0 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_g16;
else
pData->fRetrieverow = (mng_ptr)retrieve_g8;
case 0 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_g16;
else
pData->fRetrieverow = (mng_ptr)retrieve_g8;
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
case 2 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_rgb16;
else
pData->fRetrieverow = (mng_ptr)retrieve_rgb8;
case 2 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_rgb16;
else
pData->fRetrieverow = (mng_ptr)retrieve_rgb8;
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
case 3 : { pData->fRetrieverow = (mng_ptr)retrieve_idx8;
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
case 3 : { pData->fRetrieverow = (mng_ptr)retrieve_idx8;
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
case 4 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_ga16;
else
pData->fRetrieverow = (mng_ptr)retrieve_ga8;
case 4 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_ga16;
else
pData->fRetrieverow = (mng_ptr)retrieve_ga8;
pData->bIsOpaque = MNG_FALSE;
break;
}
pData->bIsOpaque = MNG_FALSE;
break;
}
case 6 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_rgba16;
else
pData->fRetrieverow = (mng_ptr)retrieve_rgba8;
case 6 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_rgba16;
else
pData->fRetrieverow = (mng_ptr)retrieve_rgba8;
pData->bIsOpaque = MNG_FALSE;
break;
}
pData->bIsOpaque = MNG_FALSE;
break;
}
case 8 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_g16;
else
pData->fRetrieverow = (mng_ptr)retrieve_g8;
pData->bIsOpaque = MNG_TRUE;
break;
}
case 10 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_rgb16;
else
pData->fRetrieverow = (mng_ptr)retrieve_rgb8;
pData->bIsOpaque = MNG_TRUE;
break;
}
case 12 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_ga16;
else
pData->fRetrieverow = (mng_ptr)retrieve_ga8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case 14 : { if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_ptr)retrieve_rgba16;
else
pData->fRetrieverow = (mng_ptr)retrieve_rgba8;
pData->bIsOpaque = MNG_FALSE;
break;
}
}
@ -1572,7 +1615,7 @@ mng_retcode process_display_basi (mng_datap pData,
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_uint8p pWork;
mng_uint32 iX;
mng_imagedatap pBuf = pImage->pImgbuf;
mng_imagedatap pBuf;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
@ -1581,6 +1624,8 @@ mng_retcode process_display_basi (mng_datap pData,
if (!pImage) /* or is it an "on-the-fly" image ? */
pImage = (mng_imagep)pData->pObjzero;
/* address the object-buffer */
pBuf = pImage->pImgbuf;
pData->fDisplayrow = 0; /* do nothing by default */
pData->fCorrectrow = 0;
@ -1595,7 +1640,7 @@ mng_retcode process_display_basi (mng_datap pData,
return iRetcode;
/* save the viewable flag */
pImage->bViewable = (mng_bool)(iViewable == 1);
pImage->pImgbuf->bViewable = pImage->bViewable;
pBuf->bViewable = pImage->bViewable;
pData->pStoreobj = pImage; /* let row-routines know which object */
pWork = pBuf->pImgdata; /* fill the object-buffer with the specified
@ -1663,7 +1708,7 @@ mng_retcode process_display_basi (mng_datap pData,
}
case 3 : { /* indexed */
pImage->pImgbuf->bHasPLTE = MNG_TRUE;
pBuf->bHasPLTE = MNG_TRUE;
switch (pData->iBitdepth)
{
@ -2588,8 +2633,9 @@ mng_retcode process_display_jhdr (mng_datap pData)
if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_REPLACE))
{ /* 8-bit JPEG ? */
if (pData->iJHDRimgbitdepth == 8)
{
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
{ /* intermediate row is 8-bit deep */
pData->bIsRGBA16 = MNG_FALSE;
pData->iRowsamples = pData->iDatawidth;
switch (pData->iJHDRcolortype) /* determine pixel processing routines */
{

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_memory.h copyright (c) 2000 G.Juyn * */
/* * version : 0.5.1 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Memory management (definition) * */
/* * * */
@ -18,6 +18,9 @@
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * * */
/* * 0.5.3 - 06/12/2000 - G.Juyn * */
/* * - swapped MNG_COPY parameter-names * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -51,7 +54,7 @@
#define MNG_FREEX(H,P,L) { if (P) { H->fMemfree (P, L); } }
#endif /* mng_internal_memmngmt */
#define MNG_COPY(S,D,L) { memcpy (S, D, L); }
#define MNG_COPY(D,S,L) { memcpy (D, S, L); }
/* ************************************************************************** */