Alien-FreeImage

 view release on metacpan or  search on metacpan

src/Source/FreeImage.h  view on Meta::CPAN

	FIMD_COMMENTS		= 0,	//! single comment or keywords
	FIMD_EXIF_MAIN		= 1,	//! Exif-TIFF metadata
	FIMD_EXIF_EXIF		= 2,	//! Exif-specific metadata
	FIMD_EXIF_GPS		= 3,	//! Exif GPS metadata
	FIMD_EXIF_MAKERNOTE = 4,	//! Exif maker note metadata
	FIMD_EXIF_INTEROP	= 5,	//! Exif interoperability metadata
	FIMD_IPTC			= 6,	//! IPTC/NAA metadata
	FIMD_XMP			= 7,	//! Abobe XMP metadata
	FIMD_GEOTIFF		= 8,	//! GeoTIFF metadata
	FIMD_ANIMATION		= 9,	//! Animation metadata
	FIMD_CUSTOM			= 10,	//! Used to attach other metadata types to a dib
	FIMD_EXIF_RAW		= 11	//! Exif metadata as a raw buffer
};

/**
  Handle to a metadata model
*/
FI_STRUCT (FIMETADATA) { void *data; };

/**
  Handle to a FreeImage tag

src/Source/FreeImage/BitmapAccess.cpp  view on Meta::CPAN

	BYTE transparent_table[256];
	/** number of transparent colors */
	int  transparency_count;
	/** TRUE if the image is transparent */
	BOOL transparent;
	//@}

	/** space to hold ICC profile */
	FIICCPROFILE iccProfile;

	/** contains a list of metadata models attached to the bitmap */
	METADATAMAP *metadata;

	/** FALSE if the FIBITMAP only contains the header and no pixel data */
	BOOL has_pixels;

	/** optionally contains a thumbnail attached to the bitmap */
	FIBITMAP *thumbnail;

	/**@name external pixel buffer management */
	//@{
	/** pointer to user provided pixels, NULL otherwise */
	BYTE *external_bits;
	/** user provided pitch, 0 otherwise */
	unsigned external_pitch;
	//@}

src/Source/FreeImage/BitmapAccess.cpp  view on Meta::CPAN


			FIICCPROFILE *iccProfile = FreeImage_GetICCProfile(bitmap);
			iccProfile->size = 0;
			iccProfile->data = 0;
			iccProfile->flags = 0;

			// initialize metadata models list

			fih->metadata = new(std::nothrow) METADATAMAP;

			// initialize attached thumbnail

			fih->thumbnail = NULL;

			// store a pointer to user provided pixel buffer (if any)

			fih->external_bits = ext_bits;
			fih->external_pitch = ext_pitch;

			// write out the BITMAPINFOHEADER

src/Source/FreeImage/ColorLookup.cpp  view on Meta::CPAN


    // lookup color
    i = FreeImage_LookupNamedColor(szColor, X11ColorMap, sizeof(X11ColorMap)/sizeof(X11ColorMap[0]));
    if (i >= 0) {
        *nRed   = X11ColorMap[i].r;
        *nGreen = X11ColorMap[i].g;
        *nBlue  = X11ColorMap[i].b;
        return TRUE;
    }

    // not found, try for grey color with attached percent value
    if ( (szColor[0] == 'g' || szColor[0] == 'G') &&
         (szColor[1] == 'r' || szColor[1] == 'R') &&
         (szColor[2] == 'e' || szColor[2] == 'E' || szColor[2] == 'a' || szColor[2] == 'A' ) &&
         (szColor[3] == 'y' || szColor[3] == 'Y' ) )  {

        // grey<num>, or gray<num>, num 1...100
        i = strtol(szColor+4, NULL, 10);
        *nRed   = (BYTE)(255.0/100.0 * i);
        *nGreen = *nRed;
        *nBlue  = *nRed;

src/Source/FreeImage/ColorLookup.cpp  view on Meta::CPAN


    // lookup color
    i = FreeImage_LookupNamedColor(szColor, SVGColorMap, sizeof(SVGColorMap)/sizeof(SVGColorMap[0]));
    if (i >= 0) {
        *nRed   = SVGColorMap[i].r;
        *nGreen = SVGColorMap[i].g;
        *nBlue  = SVGColorMap[i].b;
        return TRUE;
    }

    // not found, try for grey color with attached percent value
    if ( (szColor[0] == 'g' || szColor[0] == 'G') &&
         (szColor[1] == 'r' || szColor[1] == 'R') &&
         (szColor[2] == 'e' || szColor[2] == 'E' || szColor[2] == 'a' || szColor[2] == 'A' ) &&
         (szColor[3] == 'y' || szColor[3] == 'Y' ) )  {

        // grey<num>, or gray<num>, num 1...100
        i = strtol(szColor+4, NULL, 10);
        *nRed   = (BYTE)(255.0/100.0 * i);
        *nGreen = *nRed;
        *nBlue  = *nRed;

src/Source/FreeImage/PluginJPEG.cpp  view on Meta::CPAN

	
	// stores the thumbnail as a baseline JPEG into a memory block
	// return the memory block only if its size is within JFXX marker size limit!
	FIMEMORY *stream = FreeImage_OpenMemory();
	
	if(FreeImage_SaveToMemory(FIF_JPEG, thumbnail, stream, JPEG_BASELINE)) {
		// check that the memory block size is within JFXX marker size limit
		FreeImage_SeekMemory(stream, 0, SEEK_END);
		const long eof = FreeImage_TellMemory(stream);
		if(eof > MAX_JFXX_THUMB_SIZE) {
			FreeImage_OutputMessageProc(s_format_id, "Warning: attached thumbnail is %d bytes larger than maximum supported size - Thumbnail saving aborted", eof - MAX_JFXX_THUMB_SIZE);
			FreeImage_CloseMemory(stream);
			return FALSE;
		}
	} else {
		FreeImage_CloseMemory(stream);
		return FALSE;
	}

	BYTE* thData = NULL;
	DWORD thSize = 0;

src/Source/FreeImage/PluginJXR.cpp  view on Meta::CPAN


	BOOL header_only = (flags & FIF_LOAD_NOPIXELS) == FIF_LOAD_NOPIXELS;

	try {
		int width, height;	// image dimensions (in pixels)

		// create a JXR decoder interface and initialize function pointers with *_WMP functions
		error_code = PKImageDecode_Create_WMP(&pDecoder);
		JXR_CHECK(error_code);

		// attach the stream to the decoder ...
		// ... then read the image container and the metadata
		error_code = pDecoder->Initialize(pDecoder, pDecodeStream);
		JXR_CHECK(error_code);

		// set decoder parameters
		SetDecoderParameters(pDecoder, flags);

		// get dst image format specifications
		unsigned red_mask = 0, green_mask = 0, blue_mask = 0;
		error_code = GetInputPixelFormat(pDecoder, &guid_format, &image_type, &bpp, &red_mask, &green_mask, &blue_mask);

src/Source/FreeImage/PluginJXR.cpp  view on Meta::CPAN

		error_code = GetOutputPixelFormat(dib, &guid_format, &bHasAlpha);
		JXR_CHECK(error_code);
		pixelInfo.pGUIDPixFmt = &guid_format;
		error_code = PixelFormatLookup(&pixelInfo, LOOKUP_FORWARD);
		JXR_CHECK(error_code);

		// create a JXR encoder interface and initialize function pointers with *_WMP functions
		error_code = PKImageEncode_Create_WMP(&pEncoder);
		JXR_CHECK(error_code);

		// attach the stream to the encoder and set all encoder parameters to zero ...
		error_code = pEncoder->Initialize(pEncoder, pEncodeStream, &pEncoder->WMP.wmiSCP, sizeof(CWMIStrCodecParam));
		JXR_CHECK(error_code);

		// ... then configure the encoder
		SetEncoderParameters(&pEncoder->WMP.wmiSCP, &pixelInfo, flags, bHasAlpha);

		// set pixel format
		pEncoder->SetPixelFormat(pEncoder, guid_format);

		// set image size

src/Source/FreeImage/PluginRAW.cpp  view on Meta::CPAN

		if(RawProcessor->unpack_thumb() != LIBRAW_SUCCESS) {
			// run silently "LibRaw : failed to run unpack_thumb"
			return NULL;
		}

		// retrieve thumb image
		int error_code = 0;
		thumb_image = RawProcessor->dcraw_make_mem_thumb(&error_code);
		if(thumb_image) {
			if(thumb_image->type != LIBRAW_IMAGE_BITMAP) {
				// attach the binary data to a memory stream
				FIMEMORY *hmem = FreeImage_OpenMemory((BYTE*)thumb_image->data, (DWORD)thumb_image->data_size);
				// get the file type
				FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromMemory(hmem, 0);
				if(fif == FIF_JPEG) {
					// rotate according to Exif orientation
					flags |= JPEG_EXIFROTATE;
				}
				// load an image from the memory stream
				dib = FreeImage_LoadFromMemory(fif, hmem, flags);
				// close the stream

src/Source/LibJPEG/install.txt  view on Meta::CPAN

assume the address of a local variable is an ordinary (not FAR) pointer;
that isn't true in a medium-model DLL.

  2. Microsoft C cannot pass file pointers between applications and DLLs.
(See Microsoft Knowledge Base, PSS ID Number Q50336.)  So jdatasrc.c and
jdatadst.c don't work if you open a file in your application and then pass
the pointer to the DLL.  One workaround is to make jdatasrc.c/jdatadst.c
part of your main application rather than part of the DLL.

  3. You'll probably need to modify the macros GLOBAL() and EXTERN() to
attach suitable linkage keywords to the exported routine names.  Similarly,
you'll want to modify METHODDEF() and JMETHOD() to ensure function pointers
are declared in a way that lets application routines be called back through
the function pointers.  These macros are in jmorecfg.h.  Typical definitions
for a 16-bit DLL are:
	#define GLOBAL(type)		type _far _pascal _loadds _export
	#define EXTERN(type)		extern type _far _pascal _loadds
	#define METHODDEF(type)		static type _far _pascal
	#define JMETHOD(type,methodname,arglist)  \
		type (_far _pascal *methodname) arglist
For a 32-bit DLL you may want something like

src/Source/LibJPEG/usage.txt  view on Meta::CPAN

			the int method, but is much slower unless your machine
			has very fast floating-point hardware.  Also note that
			results of the floating-point method may vary slightly
			across machines, while the integer methods should give
			the same results everywhere.  The fast integer method
			is much less accurate than the other two.

	-nosmooth	Don't use high-quality downsampling.

	-restart N	Emit a JPEG restart marker every N MCU rows, or every
			N MCU blocks if "B" is attached to the number.
			-restart 0 (the default) means no restart markers.

	-smooth N	Smooth the input image to eliminate dithering noise.
			N, ranging from 1 to 100, indicates the strength of
			smoothing.  0 (the default) means no smoothing.

	-maxmemory N	Set limit for amount of memory to use in processing
			large images.  Value is in thousands of bytes, or
			millions of bytes if "M" is attached to the number.
			For example, -max 4m selects 4000000 bytes.  If more
			space is needed, temporary files will be used.

	-verbose	Enable debug printout.  More -v's give more printout.
	or  -debug	Also, version information is printed at startup.

The -restart option inserts extra markers that allow a JPEG decoder to
resynchronize after a transmission error.  Without restart markers, any damage
to a compressed file will usually ruin the image from the point of the error
to the end of the image; with restart markers, the damage is usually confined

src/Source/LibJPEG/usage.txt  view on Meta::CPAN


	-onepass	Use one-pass instead of two-pass color quantization.
			The one-pass method is faster and needs less memory,
			but it produces a lower-quality image.  -onepass is
			ignored unless you also say -colors N.  Also,
			the one-pass method is always used for gray-scale
			output (the two-pass method is no improvement then).

	-maxmemory N	Set limit for amount of memory to use in processing
			large images.  Value is in thousands of bytes, or
			millions of bytes if "M" is attached to the number.
			For example, -max 4m selects 4000000 bytes.  If more
			space is needed, temporary files will be used.

	-verbose	Enable debug printout.  More -v's give more printout.
	or  -debug	Also, version information is printed at startup.


HINTS FOR CJPEG

Color GIF files are not the ideal input for JPEG; JPEG is really intended for

src/Source/LibJPEG/usage.txt  view on Meta::CPAN

On most non-Unix systems, you say:
	jpegtran [switches] inputfile outputfile
where both the input and output files are JPEG files.

To specify the coded JPEG representation used in the output file,
jpegtran accepts a subset of the switches recognized by cjpeg:
	-optimize	Perform optimization of entropy encoding parameters.
	-progressive	Create progressive JPEG file.
	-arithmetic	Use arithmetic coding.
	-restart N	Emit a JPEG restart marker every N MCU rows, or every
			N MCU blocks if "B" is attached to the number.
	-scans file	Use the scan script given in the specified text file.
See the previous discussion of cjpeg for more details about these switches.
If you specify none of these switches, you get a plain baseline-JPEG output
file.  The quality setting and so forth are determined by the input file.

The image can be losslessly transformed by giving one of these switches:
	-flip horizontal	Mirror image horizontally (left-right).
	-flip vertical		Mirror image vertically (top-bottom).
	-rotate 90		Rotate image 90 degrees clockwise.
	-rotate 180		Rotate image 180 degrees.

src/Source/LibJXR/image/decode/JXRTranscode.c  view on Meta::CPAN

        if((pSCDec->m_pNextSC = (CWMImageStrCodec *)malloc(sizeof(CWMImageStrCodec))) == NULL)
            return ICERR_ERROR;
        *pSCDec->m_pNextSC = *pSCDec;
        pSCDec->m_pNextSC->p1MBbuffer[0] = MBBufAlpha;
        pSCDec->m_pNextSC->WMISCP.cfColorFormat = pSCDec->m_pNextSC->WMII.cfColorFormat = pSCDec->m_pNextSC->m_param.cfColorFormat = Y_ONLY;
        pSCDec->m_pNextSC->WMISCP.cChannel  = pSCDec->m_pNextSC->m_param.cNumChannels = 1;
        pSCDec->m_pNextSC->m_bSecondary = TRUE;
        pSCDec->m_pNextSC->m_pNextSC = pSCDec;
 
        // read plane header of second image plane
        if(attach_SB(&SB, pSCDec->WMISCP.pWStream) != ICERR_OK)
            return ICERR_ERROR;
        ReadImagePlaneHeader(&pSCDec->m_pNextSC->WMII, &pSCDec->m_pNextSC->WMISCP, &pSCDec->m_pNextSC->m_param, &SB);
        detach_SB(&SB);

        if(StrDecInit(pSCDec->m_pNextSC) != ICERR_OK)
            return ICERR_ERROR;
    }
    else
        pParam->uAlphaMode = 0;

src/Source/LibJXR/image/decode/JXRTranscode.c  view on Meta::CPAN

        pSCEnc->WMII.oOrientation = (pSCEnc->WMII.oOrientation & 1) * 2 + (pSCEnc->WMII.oOrientation >> 1);
    }
    else if(oO >= O_RCW && pSCEnc->WMII.oOrientation < O_RCW)
        pSCEnc->WMII.oOrientation = oO ^ ((pSCEnc->WMII.oOrientation & 1) * 2 + (pSCEnc->WMII.oOrientation >> 1));
    else
        pSCEnc->WMII.oOrientation ^= ((oO & 1) * 2 + (oO >> 1));
    
//    pSCEnc->WMISCP.nExpBias += 128;

    if(pParam->bIgnoreOverlap == TRUE){
        attachISWrite(pSCEnc->pIOHeader, pSCEnc->WMISCP.pWStream);
        pSCEnc->pTile = pSCDec->pTile;
        if(pSCEnc->WMISCP.cNumOfSliceMinus1H + pSCEnc->WMISCP.cNumOfSliceMinus1V == 0 && pSCEnc->WMISCP.bfBitstreamFormat == SPATIAL)
            pSCEnc->m_param.bIndexTable = FALSE;
        WriteWMIHeader(pSCEnc);
    }
    else{
        pTileQPInfo = (CTileQPInfo *)malloc((oO == O_NONE ? 1 : (pSCEnc->WMISCP.cNumOfSliceMinus1H + 1) * (pSCEnc->WMISCP.cNumOfSliceMinus1V + 1)) * sizeof( CTileQPInfo));
        if(pTileQPInfo == NULL || ((oO == O_NONE ? 1 : (pSCEnc->WMISCP.cNumOfSliceMinus1H + 1) * (pSCEnc->WMISCP.cNumOfSliceMinus1V + 1)) * sizeof( CTileQPInfo) < (oO == O_NONE ? 1 : (pSCEnc->WMISCP.cNumOfSliceMinus1H + 1) * (pSCEnc->WMISCP.cNumOfSli...
            return ICERR_ERROR;
        

src/Source/LibJXR/image/decode/strdec.c  view on Meta::CPAN

            }
        }
        else {
            // get sizes of each packet and update index table
            for(k = 0; k < pSC->cNumBitIO; k ++){
                if(pSC->ppWStream != NULL){ // new API
                    unsigned cBands = (pSC->WMISCP.bfBitstreamFormat == SPATIAL ? 1 : pSC->cSB);
                    struct WMPStream ** ppWS = pSC->ppWStream + (pSC->WMISCP.cNumOfSliceMinus1V + 1) * pSC->cTileRow * cBands
                        + k / cBands * cBands + (k % cBands);

                    if(pSC->cTileRow > 0 && pSC->m_ppBitIO[k]->pWS != NULL)     // attached to the same packet of the tile on top
                        detachISRead(pSC, pSC->m_ppBitIO[k]);    // detach it
                    
                    if(ppWS[0] != NULL)
                        attachISRead(pSC->m_ppBitIO[k], ppWS[0], pSC); // need to attach it
                }
                else{
                    if(pSC->cTileRow > 0)
                        detachISRead(pSC, pSC->m_ppBitIO[k]);
                    pSC->WMISCP.pWStream->SetPos(pSC->WMISCP.pWStream, pSC->pIndexTable[pSC->cNumBitIO * pSC->cTileRow + k] + pSC->cHeaderSize);
                    attachISRead(pSC->m_ppBitIO[k], pSC->WMISCP.pWStream, pSC);
                }
            }
            
            if(pSC->cNumBitIO == 0){
                detachISRead(pSC, pSC->pIOHeader);
                if(pSC->ppWStream != NULL){// new API
                    attachISRead(pSC->pIOHeader, pSC->ppWStream[0], pSC); // need to attach it
                }
                else{
                    pSC->WMISCP.pWStream->SetPos(pSC->WMISCP.pWStream, pSC->cHeaderSize);
                    attachISRead(pSC->pIOHeader, pSC->WMISCP.pWStream, pSC);
                }
            }
            
            for(k = 0; k <= pSC->WMISCP.cNumOfSliceMinus1V; k ++){
                U8 pID = (U8)((pSC->cTileRow * (pSC->WMISCP.cNumOfSliceMinus1V + 1) + k) & 0x1F);
                
                // read packet header
                if(pSC->WMISCP.bfBitstreamFormat == SPATIAL){
                    BitIOInfo * pIO = (pSC->cNumBitIO == 0 ? pSC->pIOHeader : pSC->m_ppBitIO[k]);

src/Source/LibJXR/image/decode/strdec.c  view on Meta::CPAN


    return ICERR_OK;
}

Int StrIODecInit(CWMImageStrCodec* pSC)
{
    if(allocateBitIOInfo(pSC) != ICERR_OK){
        return ICERR_ERROR;
    }
    
    attachISRead(pSC->pIOHeader, pSC->WMISCP.pWStream, pSC);

    readIndexTable(pSC);

    if(pSC->WMISCP.bVerbose){
        U32 i, j;

        printf("\n%d horizontal tiles:\n", pSC->WMISCP.cNumOfSliceMinus1H + 1);
        for(i = 0; i <= pSC->WMISCP.cNumOfSliceMinus1H; i ++){
            printf("    offset of tile %d in MBs: %d\n", i, pSC->WMISCP.uiTileY[i]);
        }

src/Source/LibJXR/image/decode/strdec.c  view on Meta::CPAN

    // U32 bits = 0;
    // Int HEADERSIZE = 0;

    assert(pSC != NULL);
    //================================
// 0
    /** signature **/
    Call(pWS->Read(pWS, szMS, sizeof(szMS)));
    FailIf(szMS != (U8 *) strstr((char *) szMS, "WMPHOTO"), WMP_errUnsupportedFormat);
    //================================
    Call(attach_SB(pSB, pWS));

// 8
    /** codec version and subversion **/
    i = getBit32_SB(pSB, 4);
    FailIf((i != CODEC_VERSION), WMP_errIncorrectCodecVersion);
    pSC->cVersion = i;
    i = getBit32_SB(pSB, 4); // subversion
    FailIf((i != CODEC_SUBVERSION &&
        i != CODEC_SUBVERSION_NEWSCALING_SOFT_TILES && i != CODEC_SUBVERSION_NEWSCALING_HARD_TILES),
        WMP_errIncorrectCodecSubVersion);

src/Source/LibJXR/image/decode/strdec.c  view on Meta::CPAN

        cb = sizeof(*pNextSC) + (128 - 1) + cbMacBlockStride * cMacBlock * 2;
        // if primary image is safe to allocate, alpha channel is certainly safe
        pb = malloc(cb);
        if(pb == NULL)
            return WMP_errOutOfMemory;
        memset(pb, 0, cb);
        //================================================
        pNextSC = (CWMImageStrCodec*)pb; pb += sizeof(*pNextSC);

        // read plane header of second image plane
        Call(attach_SB(&SB, pSCP->pWStream));
        InitializeStrDec(pNextSC, &SC.m_param, &SC);
        ReadImagePlaneHeader(&pNextSC->WMII, &pNextSC->WMISCP, &pNextSC->m_param, &SB);
        detach_SB(&SB);

        // 2. initialize pNextSC
        if(pNextSC == NULL)
            return ICERR_ERROR;
        pNextSC->m_Dparam = pSC->m_Dparam;
        pNextSC->cbChannel = cbChannel;
        //================================================

src/Source/LibJXR/image/encode/strenc.c  view on Meta::CPAN

// BitIOInfo init/term for encoding
const size_t MAX_MEMORY_SIZE_IN_WORDS = 64 << 20; // 1 << 20 \approx 1 million

Int StrIOEncInit(CWMImageStrCodec* pSC)
{
    pSC->m_param.bIndexTable = !(pSC->WMISCP.bfBitstreamFormat == SPATIAL && pSC->WMISCP.cNumOfSliceMinus1H + pSC->WMISCP.cNumOfSliceMinus1V == 0);
    if(allocateBitIOInfo(pSC) != ICERR_OK){
        return ICERR_ERROR;
    }

    attachISWrite(pSC->pIOHeader, pSC->WMISCP.pWStream);

    if(pSC->cNumBitIO > 0){
        size_t i;
#if defined(_WINDOWS_) || defined(UNDER_CE)  // tmpnam does not exist in VS2005 WinCE CRT
        TCHAR szPath[MAX_PATH];
        DWORD cSize, j, k;
#endif
        char * pFilename;

        pSC->ppWStream = (struct WMPStream **)malloc(pSC->cNumBitIO * sizeof(struct WMPStream *));

src/Source/LibJXR/image/encode/strenc.c  view on Meta::CPAN

                if ((pFilename = tmpnam(NULL)) == NULL)
                    return ICERR_ERROR;                
                strcpy(pSC->ppTempFile[i], pFilename);
#endif
                if(CreateWS_File(pSC->ppWStream + i, pFilename, "w+b") != ICERR_OK) return ICERR_ERROR;                

            }
            else {
                if(CreateWS_List(pSC->ppWStream + i) != ICERR_OK) return ICERR_ERROR;
            }
            attachISWrite(pSC->m_ppBitIO[i], pSC->ppWStream[i]);
        }
    }

    return ICERR_OK;
}

#define PUTBITS putBit16
/*************************************************************************
    Write variable length byte aligned integer
*************************************************************************/

src/Source/LibJXR/image/sys/common.h  view on Meta::CPAN


/** adaptive huffman encoding / decoding struct **/
typedef struct CAdaptiveHuffman
{
    Int     m_iNSymbols;
    const Int *m_pTable;
    const Int *m_pDelta, *m_pDelta1;
    Int     m_iTableIndex;
    const short *m_hufDecTable;
    Bool    m_bInitialize;
    //Char    m_pLabel[8]; // for debugging - label attached to constructor

    Int     m_iDiscriminant, m_iDiscriminant1;
    Int     m_iUpperBound;
    Int     m_iLowerBound;
} CAdaptiveHuffman;


/************************************************************************************
  Context structures
************************************************************************************/

src/Source/LibJXR/image/sys/strcodec.c  view on Meta::CPAN

{
    *poffPos = pWS->state.buf.cbCur + PACKETLENGTH * pWS->state.buf.cbBufCount;

    return WMP_errSuccess;
}

//================================================================
// Simple BitIO access functions
//================================================================
// init SimpleBitIO
ERR attach_SB(SimpleBitIO* pSB, struct WMPStream* pWS)
{
    pSB->pWS = pWS;
    pSB->cbRead = 0;
    pSB->bAccumulator = 0;
    pSB->cBitLeft = 0;

    return WMP_errSuccess;
}

// extract upto 32bit from input stream

src/Source/LibJXR/image/sys/strcodec.c  view on Meta::CPAN

{
    return (U32)(UINTPTR_T)(pIO->pbStart + PACKETLENGTH * 2 - pIO->pbCurrent) - pIO->cBitsUsed / 8;
}

U32 getSizeWrite(BitIOInfo* pIO)
{
    return (U32)(UINTPTR_T)(pIO->pbCurrent + (pIO->pbStart <= pIO->pbCurrent ? 0 : PACKETLENGTH * 2) - pIO->pbStart) + pIO->cBitsUsed / 8;
}

//----------------------------------------------------------------
// Query stream offset from attached BitIO object for dec
//----------------------------------------------------------------
U32 getPosRead(BitIOInfo* pIO)
{
    size_t cbCached = (pIO->pbStart + PACKETLENGTH * 2 - pIO->pbCurrent) - pIO->cBitsUsed / 8;
    return (U32)(pIO->offRef - cbCached);
}

//================================================================
// Block I/O functions
//================================================================
#ifndef ARMOPT_BITIO
ERR attachISRead(BitIOInfo* pIO, struct WMPStream* pWS, CWMImageStrCodec* pSC)
{
    UNREFERENCED_PARAMETER( pSC );

    pWS->GetPos(pWS, &pIO->offRef);

    pIO->pbStart = (U8*)pIO - PACKETLENGTH * 2;
    pIO->pbCurrent = pIO->pbStart;

    PERFTIMER_STOP(pSC->m_fMeasurePerf, pSC->m_ptEncDecPerf);
    pWS->SetPos(pWS, pIO->offRef);

src/Source/LibJXR/image/sys/strcodec.c  view on Meta::CPAN

    cbRemain = (pIO->pbStart + PACKETLENGTH * 2) - (pIO->pbCurrent + pIO->cBitsUsed / 8);
    pWS->SetPos(pWS, pIO->offRef - cbRemain);

    pIO->pWS = NULL;
Cleanup:
    return err;
}
#endif  // ARMOPT_BITIO

//----------------------------------------------------------------
ERR attachISWrite(BitIOInfo* pIO, struct WMPStream* pWS)
{
    pWS->GetPos(pWS, &pIO->offRef);

    pIO->pbStart = (U8*)pIO - PACKETLENGTH * 2;
    pIO->pbCurrent = pIO->pbStart;

    pIO->uiAccumulator = 0;
    pIO->cBitsUsed = 0;
    pIO->iMask = ~(PACKETLENGTH * 2);

src/Source/LibJXR/image/sys/strcodec.h  view on Meta::CPAN

    U8* pbStart;    // start pointer
#ifndef ARMOPT_BITIO
    U8* pbCurrent;  // current pointer
#else
    U32* pbCurrent;  // current pointer
#endif

    struct WMPStream* pWS;  // pointer to WMPStream
    size_t offRef;  // reference offset on IStream,
                            // for read, it moves along the stream
                            // for write, it stays at the attach point
} BitIOInfo;

//================================================================
typedef struct tagCWMIQuantizer {
    U8 iIndex;
    I32 iQP;
    I32 iOffset;
    I32 iMan;
    I32 iExp;
#if defined(WMP_OPT_QT)

src/Source/LibJXR/image/sys/strcodec.h  view on Meta::CPAN

U32 getPosRead(BitIOInfo* pIO);

// safe function, solely for the convenience of test code
#ifndef ARMOPT_BITIO
U32 getBit16_S(CWMImageStrCodec* pSC, BitIOInfo* pIO, U32 cBits);
#endif  // ARMOPT_BITIO

//================================================================
// packet I/O
//================================================================
ERR attachISRead(BitIOInfo* pIO, struct WMPStream* pWS, CWMImageStrCodec* pSC);
ERR readIS(CWMImageStrCodec* pSC, BitIOInfo* pIO);
ERR detachISRead(CWMImageStrCodec* pSC, BitIOInfo* pIO);

ERR attachISWrite(BitIOInfo* pIO, struct WMPStream* pWS);
ERR writeIS(CWMImageStrCodec* pSC, BitIOInfo* pIO);
ERR detachISWrite(CWMImageStrCodec* pSC, BitIOInfo* pIO);


//================================================================
// post processing for decoder
//================================================================
Int initPostProc(struct tagPostProcInfo * strPostProcInfo[MAX_CHANNELS][2], size_t mbWidth, size_t iNumChannels);
Void termPostProc(struct tagPostProcInfo * strPostProcInfo[MAX_CHANNELS][2], size_t iNumChannels);
Void slideOneMBRow(struct tagPostProcInfo * strPostProcInfo[MAX_CHANNELS][2], size_t iNumChannels, size_t mbWidth, Bool top, Bool bottom);

src/Source/LibJXR/image/sys/strcodec.h  view on Meta::CPAN

// Simple BitIO access functions
//================================================================
typedef struct tagSimpleBitIO
{
    struct WMPStream* pWS;
    U32 cbRead;
    U8 bAccumulator;
    U32 cBitLeft;
} SimpleBitIO;

ERR attach_SB(SimpleBitIO* pSB, struct WMPStream* pWS);
U32 getBit32_SB(SimpleBitIO* pSB, U32 cBits);
Void flushToByte_SB(SimpleBitIO* pSB);
U32 getByteRead_SB(SimpleBitIO* pSB);
ERR detach_SB(SimpleBitIO* pSB);

//----------------------------------------------------------------
EXTERN_C Bool EOSWS_File(struct WMPStream* pWS);

EXTERN_C ERR ReadWS_File(struct WMPStream* pWS, void* pv, size_t cb);
EXTERN_C ERR WriteWS_File(struct WMPStream* pWS, const void* pv, size_t cb);

src/Source/LibJXR/jxrgluelib/JXRGlue.c  view on Meta::CPAN

    // get decode PKIID
    Call(GetImageDecodeIID(pExt, &pIID));

    // create stream
    Call(CreateWS_File(&pStream, szFilename, "rb"));

    // Create decoder
    Call(PKCodecFactory_CreateCodec(pIID, (void **) ppDecoder));
    pDecoder = *ppDecoder;

    // attach stream to decoder
    Call(pDecoder->Initialize(pDecoder, pStream));
    pDecoder->fStreamOwner = !0;

Cleanup:
    return err;
}

ERR PKCodecFactory_CreateFormatConverter(PKFormatConverter** ppFConverter)
{
    ERR err = WMP_errSuccess;

src/Source/LibPNG/png.c  view on Meta::CPAN

   /* Free any PLTE entry that was internally allocated */
   if (((mask & PNG_FREE_PLTE) & info_ptr->free_me) != 0)
   {
      png_free(png_ptr, info_ptr->palette);
      info_ptr->palette = NULL;
      info_ptr->valid &= ~PNG_INFO_PLTE;
      info_ptr->num_palette = 0;
   }

#ifdef PNG_INFO_IMAGE_SUPPORTED
   /* Free any image bits attached to the info structure */
   if (((mask & PNG_FREE_ROWS) & info_ptr->free_me) != 0)
   {
      if (info_ptr->row_pointers != 0)
      {
         png_uint_32 row;
         for (row = 0; row < info_ptr->height; row++)
            png_free(png_ptr, info_ptr->row_pointers[row]);

         png_free(png_ptr, info_ptr->row_pointers);
         info_ptr->row_pointers = NULL;

src/Source/LibPNG/pnginfo.h  view on Meta::CPAN

 * With libpng < 0.95, it was only possible to directly set and read the
 * the values in the png_info_struct, which meant that the contents and
 * order of the values had to remain fixed.  With libpng 0.95 and later,
 * however, there are now functions that abstract the contents of
 * png_info_struct from the application, so this makes it easier to use
 * libpng with dynamic libraries, and even makes it possible to use
 * libraries that don't have all of the libpng ancillary chunk-handing
 * functionality.  In libpng-1.5.0 this was moved into a separate private
 * file that is not visible to applications.
 *
 * The following members may have allocated storage attached that should be
 * cleaned up before the structure is discarded: palette, trans, text,
 * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
 * splt_palettes, scal_unit, row_pointers, and unknowns.   By default, these
 * are automatically freed when the info structure is deallocated, if they were
 * allocated internally by libpng.  This behavior can be changed by means
 * of the png_data_freer() function.
 *
 * More allocation details: all the chunk-reading functions that
 * change these members go through the corresponding png_set_*
 * functions.  A function to clear these members is available: see

src/Source/LibRawLite/dcraw/dcraw.c  view on Meta::CPAN

            parse_makernote (base, 0x3400);
          }
      }

    else if (!strncmp(make, "NIKON", 5))
      {
        if (tag == 0x1d)							// serial number
          while ((c = fgetc(ifp)) && c != EOF)
            serial = serial * 10 + (isdigit(c) ? c - '0' : c % 10);

        else if (tag == 0x0082)				// lens attachment
          {
            fread(imgdata.lens.makernotes.Attachment, len, 1, ifp);
          }
        else if (tag == 0x0083)				// lens type
          {
            imgdata.lens.nikon.NikonLensType = fgetc(ifp);
            if (!(imgdata.lens.nikon.NikonLensType & 0x01))
              {
                imgdata.lens.makernotes.LensFeatures_pre[0] = 'A';
                imgdata.lens.makernotes.LensFeatures_pre[1] = 'F';

src/Source/LibRawLite/dcraw/dcraw.c  view on Meta::CPAN

          }

        else if (tag == 0x3400)
          {
            parse_makernote (base, 0x3400);
          }
      }

    else if (!strncmp(make, "NIKON",5))
      {
        if (tag == 0x0082)						// lens attachment
          {
            fread(imgdata.lens.makernotes.Attachment, len, 1, ifp);
          }
        else if (tag == 0x0083)				// lens type
          {
            imgdata.lens.nikon.NikonLensType = fgetc(ifp);
            if (!(imgdata.lens.nikon.NikonLensType & 0x01))
              {
                imgdata.lens.makernotes.LensFeatures_pre[0] = 'A';
                imgdata.lens.makernotes.LensFeatures_pre[1] = 'F';

src/Source/LibRawLite/internal/dcraw_common.cpp  view on Meta::CPAN

            parse_makernote (base, 0x3400);
          }
      }

    else if (!strncmp(make, "NIKON", 5))
      {
        if (tag == 0x1d)							// serial number
          while ((c = fgetc(ifp)) && c != EOF)
            serial = serial * 10 + (isdigit(c) ? c - '0' : c % 10);

        else if (tag == 0x0082)				// lens attachment
          {
            fread(imgdata.lens.makernotes.Attachment, len, 1, ifp);
          }
        else if (tag == 0x0083)				// lens type
          {
            imgdata.lens.nikon.NikonLensType = fgetc(ifp);
            if (!(imgdata.lens.nikon.NikonLensType & 0x01))
              {
                imgdata.lens.makernotes.LensFeatures_pre[0] = 'A';
                imgdata.lens.makernotes.LensFeatures_pre[1] = 'F';

src/Source/LibRawLite/internal/dcraw_common.cpp  view on Meta::CPAN

          }

        else if (tag == 0x3400)
          {
            parse_makernote (base, 0x3400);
          }
      }

    else if (!strncmp(make, "NIKON",5))
      {
        if (tag == 0x0082)						// lens attachment
          {
            fread(imgdata.lens.makernotes.Attachment, len, 1, ifp);
          }
        else if (tag == 0x0083)				// lens type
          {
            imgdata.lens.nikon.NikonLensType = fgetc(ifp);
            if (!(imgdata.lens.nikon.NikonLensType & 0x01))
              {
                imgdata.lens.makernotes.LensFeatures_pre[0] = 'A';
                imgdata.lens.makernotes.LensFeatures_pre[1] = 'F';

src/Source/LibRawLite/src/libraw_cxx.cpp  view on Meta::CPAN

        (this->*load_raw)();
        if(load_raw == &LibRaw::unpacked_load_raw && !strcasecmp(imgdata.idata.make,"Nikon"))
          C.maximum = m_save;
        if(decoder_info.decoder_flags &  LIBRAW_DECODER_OWNALLOC)
          {
            // x3f foveon decoder only: do nothing

          }
        else if (!(imgdata.idata.filters || P1.colors == 1))
          {
            // successfully decoded legacy image, attach image to raw_alloc
            imgdata.rawdata.raw_alloc = imgdata.image;
            imgdata.image = 0;
            // Restore saved values. Note: Foveon have masked frame
            // Other 4-color legacy data: no borders
            S.raw_width = S.width;
            S.left_margin = 0;
            S.raw_height = S.height;
            S.top_margin = 0;
          }
      }

src/Source/LibTIFF4/ChangeLog  view on Meta::CPAN

2006-03-23  Andrey Kiselev  <dron@ak4719.spb.edu>

	* libtiff 3.8.2 released.

	* tools/Makefile.am: Use runtime paths linker flags when rpath
	option enabled.

2006-03-21  Andrey Kiselev  <dron@ak4719.spb.edu>

	* libtiff/libtiff.def: Added missed exports as per bug
	http://bugzilla.remotesensing.org/attachment.cgi?id=337

	* contrib/addtiffo/Makefile.vc, libtiff/Makefile.vc, port/Makefile.vc,
	tools/Makefile.vc: Makefiles improvements as per bug
	http://bugzilla.remotesensing.org/show_bug.cgi?id=1128

	* nmake.opt libtiff/{tif_config.h.vc, tif_unix.c, tiffio.h},
	tools/{fax2ps.c, fax2tiff.c, tiff2pdf.c}: Fixed win32 I/O functions
	usage as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1127

	* libtiff/tif_strip.c: Take subsampling in account when calculating

src/Source/LibWebP/src/webp/mux.h  view on Meta::CPAN

                        // frames in the output. The library may insert some key
                        // frames as needed to satisfy this criteria.
                        // Note that these conditions should hold: kmax > kmin
                        // and kmin >= kmax / 2 + 1. Also, if kmin == 0, then
                        // key-frame insertion is disabled; and if kmax == 0,
                        // then all frames will be key-frames.
  int allow_mixed;      // If true, use mixed compression mode; may choose
                        // either lossy and lossless for each frame.

  // TODO(urvang): Instead of printing errors to STDERR, we should have an error
  // string attached to the encoder.
  int verbose;          // If true, print encoding info.
  uint32_t padding[4];  // Padding for later use.
} WebPAnimEncoderOptions;

// Internal, version-checked, entry point.
WEBP_EXTERN(int) WebPAnimEncoderOptionsInitInternal(
    WebPAnimEncoderOptions*, int);

// Should always be called, to initialize a fresh WebPAnimEncoderOptions
// structure before modification. Returns false in case of version mismatch.

src/Source/OpenEXR/Iex/IexErrnoExc.h  view on Meta::CPAN

DEFINE_EXC (EremoteioExc, ErrnoExc)
DEFINE_EXC (EinitExc, ErrnoExc)
DEFINE_EXC (EremdevExc, ErrnoExc)
DEFINE_EXC (EcanceledExc, ErrnoExc)
DEFINE_EXC (EnolimfileExc, ErrnoExc)
DEFINE_EXC (EproclimExc, ErrnoExc)
DEFINE_EXC (EdisjointExc, ErrnoExc)
DEFINE_EXC (EnologinExc, ErrnoExc)
DEFINE_EXC (EloginlimExc, ErrnoExc)
DEFINE_EXC (EgrouploopExc, ErrnoExc)
DEFINE_EXC (EnoattachExc, ErrnoExc)
DEFINE_EXC (EnotsupExc, ErrnoExc)
DEFINE_EXC (EnoattrExc, ErrnoExc)
DEFINE_EXC (EdircorruptedExc, ErrnoExc)
DEFINE_EXC (EdquotExc, ErrnoExc)
DEFINE_EXC (EnfsremoteExc, ErrnoExc)
DEFINE_EXC (EcontrollerExc, ErrnoExc)
DEFINE_EXC (EnotcontrollerExc, ErrnoExc)
DEFINE_EXC (EenqueuedExc, ErrnoExc)
DEFINE_EXC (EnotenqueuedExc, ErrnoExc)
DEFINE_EXC (EjoinedExc, ErrnoExc)

src/Source/OpenEXR/Iex/IexForward.h  view on Meta::CPAN

class EremoteioExc;
class EinitExc;
class EremdevExc;
class EcanceledExc;
class EnolimfileExc;
class EproclimExc;
class EdisjointExc;
class EnologinExc;
class EloginlimExc;
class EgrouploopExc;
class EnoattachExc;
class EnotsupExc;
class EnoattrExc;
class EdircorruptedExc;
class EdquotExc;
class EnfsremoteExc;
class EcontrollerExc;
class EnotcontrollerExc;
class EenqueuedExc;
class EnotenqueuedExc;
class EjoinedExc;

src/Source/OpenEXR/Iex/IexThrowErrnoExc.cpp  view on Meta::CPAN

	    throw EloginlimExc (tmp);
      #endif

      #if defined (EGROUPLOOP)
	  case EGROUPLOOP:
	    throw EgrouploopExc (tmp);
      #endif

      #if defined (ENOATTACH)
	  case ENOATTACH:
	    throw EnoattachExc (tmp);
      #endif

      #if defined (ENOTSUP) && defined (EOPNOTSUPP)
	  #if ENOTSUP != EOPNOTSUPP
	      case ENOTSUP:
		throw EnotsupExc (tmp);
	  #endif
      #elif defined (ENOTSUP)
	  case ENOTSUP:
	    throw EnotsupExc (tmp);

src/Source/OpenEXR/IlmImf/ImfAcesFile.h  view on Meta::CPAN

    //-------------------------------------------------------
    // Constructor -- opens the file with the specified name,
    // destructor will automatically close the file.
    //-------------------------------------------------------

    AcesInputFile (const std::string &name,
		   int numThreads = globalThreadCount());


    //-----------------------------------------------------------
    // Constructor -- attaches the new AcesInputFile object to a
    // file that has already been opened by the caller.
    // Destroying the AcesInputFile object will not automatically
    // close the file.
    //-----------------------------------------------------------

    AcesInputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,
		   int numThreads = globalThreadCount());


    //-----------

src/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.h  view on Meta::CPAN

    //
    // numThreads determines the number of threads that will be
    // used to write the file (see ImfThreading.h).
    //-----------------------------------------------------------

    DeepScanLineOutputFile (const char fileName[], const Header &header,
                int numThreads = globalThreadCount());


    //------------------------------------------------------------
    // Constructor -- attaches the new DeepScanLineOutputFile object
    // to a file that has already been opened, and writes the file header.
    // The file header is also copied into the DeepScanLineOutputFile
    // object, and can later be accessed via the header() method.
    // Destroying this DeepScanLineOutputFile object does not automatically
    // close the file.
    //
    // numThreads determines the number of threads that will be
    // used to write the file (see ImfThreading.h).
    //------------------------------------------------------------

src/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.h  view on Meta::CPAN

    //--------------------------------------------------------------

    void                updatePreviewImage (const PreviewRgba newPixels[]);


    struct Data;

  private:

    //------------------------------------------------------------
    // Constructor -- attaches the OutputStreamMutex to the
    // given one from MultiPartOutputFile. Set the previewPosition
    // and lineOffsetsPosition which have been acquired from
    // the constructor of MultiPartOutputFile as well.
    //------------------------------------------------------------
    DeepScanLineOutputFile (const OutputPartData* part);

    DeepScanLineOutputFile (const DeepScanLineOutputFile &);                    // not implemented
    DeepScanLineOutputFile & operator = (const DeepScanLineOutputFile &);       // not implemented

    void                initialize (const Header &header);

src/Source/OpenEXR/IlmImf/ImfDeepTiledInputFile.h  view on Meta::CPAN

    // file will try to keep busy when decompressing individual tiles.
    // Destroying TiledInputFile objects constructed with this constructor
    // automatically closes the corresponding files.
    //--------------------------------------------------------------------

    DeepTiledInputFile (const char fileName[],
                    int numThreads = globalThreadCount ());


    // ----------------------------------------------------------
    // A constructor that attaches the new TiledInputFile object
    // to a file that has already been opened.
    // Destroying TiledInputFile objects constructed with this
    // constructor does not automatically close the corresponding
    // files.
    // ----------------------------------------------------------

    DeepTiledInputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int numThreads = globalThreadCount ());


    //-----------

src/Source/OpenEXR/IlmImf/ImfDeepTiledOutputFile.h  view on Meta::CPAN

    // faster than reading the tiles in random order (see writeTile,
    // below).
    //-------------------------------------------------------------------

    DeepTiledOutputFile (const char fileName[],
                         const Header &header,
                         int numThreads = globalThreadCount ());


    // ----------------------------------------------------------------
    // A constructor that attaches the new TiledOutputFile object to
    // a file that has already been opened.  Destroying TiledOutputFile
    // objects constructed with this constructor does not automatically
    // close the corresponding files.
    // ----------------------------------------------------------------

    DeepTiledOutputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os,
                         const Header &header,
                         int numThreads = globalThreadCount ());


src/Source/OpenEXR/IlmImf/ImfDeepTiledOutputFile.h  view on Meta::CPAN

    void                breakTile  (int dx, int dy,
                                    int lx, int ly,
                                    int offset,
                                    int length,
                                    char c);
    struct Data;

  private:

    // ----------------------------------------------------------------
    // A constructor attaches the OutputStreamMutex to the
    // given one from MultiPartOutputFile. Set the previewPosition
    // and lineOffsetsPosition which have been acquired from
    // the constructor of MultiPartOutputFile as well.
    // ----------------------------------------------------------------
    DeepTiledOutputFile (const OutputPartData* part);

    DeepTiledOutputFile (const DeepTiledOutputFile &);              // not implemented
    DeepTiledOutputFile & operator = (const DeepTiledOutputFile &); // not implemented

    void                initialize (const Header &header);

src/Source/OpenEXR/IlmImf/ImfInputFile.h  view on Meta::CPAN

    // Destroying the InputFile object will close the file.
    //
    // numThreads determines the number of threads that will be
    // used to read the file (see ImfThreading.h).
    //-----------------------------------------------------------

    InputFile (const char fileName[], int numThreads = globalThreadCount());


    //-------------------------------------------------------------
    // A constructor that attaches the new InputFile object to a
    // file that has already been opened.  Destroying the InputFile
    // object will not close the file.
    //
    // numThreads determines the number of threads that will be
    // used to read the file (see ImfThreading.h).
    //-------------------------------------------------------------

    InputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int numThreads = globalThreadCount());




( run in 0.954 second using v1.01-cache-2.11-cpan-4991d5b9bd9 )