/** * Initialize the cinfo struct. * Calls jpeg_create_decompress, makes customizations, and * finally calls jpeg_read_header. Returns true if jpeg_read_header * returns JPEG_HEADER_OK. * If cinfo was already initialized, destroyInfo must be called to * destroy the old one. Must not be called after startTileDecompress. */ bool initializeInfoAndReadHeader() { SkASSERT(!fInfoInitialized && !fDecompressStarted); initialize_info(&fCInfo, &fSrcMgr); fInfoInitialized = true; const bool success = (JPEG_HEADER_OK == jpeg_read_header(&fCInfo, true)); SkDEBUGCODE(fReadHeaderSucceeded = success;) return success;
/*------------------------------------------------------------------------ * _ChunkArray --- * converts an input array to chunked format using the information * provided by the access pattern. * Results: * creates a new file that stores the chunked array and returns * information about the chunked file *----------------------------------------------------------------------- */ char * _ChunkArray(int fd, FILE *afd, int ndim, int dim[], int baseSize, int *nbytes, char *chunkfile) { int cfd; int chunk[MAXDIM], csize; bool reorgFlag; if (chunkfile == NULL) reorgFlag = true; else reorgFlag = false; #ifdef LOARRAY if (reorgFlag) /* create new LO for chunked file */ chunkfile = _array_newLO( &cfd, fileFlag ); else cfd = LOopen(chunkfile, O_RDONLY); #endif if (cfd < 0) elog(WARN, "Enable to open chunk file"); strcpy (cInfo.lo_name, chunkfile); /* find chunk size */ csize = GetChunkSize(afd, ndim, dim, baseSize, chunk); if (reorgFlag) /* copy data from input file to chunked file */ _ConvertToChunkFile(ndim, baseSize, dim, chunk, fd, cfd); initialize_info(&cInfo, ndim, dim, chunk); *nbytes = sizeof(CHUNK_INFO); return (char *) &cInfo ; }