亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tif_read.c

?? 支持各種柵格圖像和矢量圖像讀取的庫
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* $Id: tif_read.c,v 1.15 2006/10/12 15:01:30 dron Exp $ *//* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and  * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. *  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.   *  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE  * OF THIS SOFTWARE. *//* * TIFF Library. * Scanline-oriented Read Support */#include "tiffiop.h"#include <stdio.h>	int TIFFFillStrip(TIFF*, tstrip_t);	int TIFFFillTile(TIFF*, ttile_t);static	int TIFFStartStrip(TIFF*, tstrip_t);static	int TIFFStartTile(TIFF*, ttile_t);static	int TIFFCheckRead(TIFF*, int);#define	NOSTRIP	((tstrip_t) -1)			/* undefined state */#define	NOTILE	((ttile_t) -1)			/* undefined state *//* * Seek to a random row+sample in a file. */static intTIFFSeek(TIFF* tif, uint32 row, tsample_t sample){	register TIFFDirectory *td = &tif->tif_dir;	tstrip_t strip;	if (row >= td->td_imagelength) {	/* out of range */		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Row out of range, max %lu",		    (unsigned long) row, (unsigned long) td->td_imagelength);		return (0);	}	if (td->td_planarconfig == PLANARCONFIG_SEPARATE) {		if (sample >= td->td_samplesperpixel) {			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			    "%lu: Sample out of range, max %lu",			    (unsigned long) sample, (unsigned long) td->td_samplesperpixel);			return (0);		}		strip = sample*td->td_stripsperimage + row/td->td_rowsperstrip;	} else		strip = row / td->td_rowsperstrip;	if (strip != tif->tif_curstrip) { 	/* different strip, refill */		if (!TIFFFillStrip(tif, strip))			return (0);	} else if (row < tif->tif_row) {		/*		 * Moving backwards within the same strip: backup		 * to the start and then decode forward (below).		 *		 * NB: If you're planning on lots of random access within a		 * strip, it's better to just read and decode the entire		 * strip, and then access the decoded data in a random fashion.		 */		if (!TIFFStartStrip(tif, strip))			return (0);	}	if (row != tif->tif_row) {		/*		 * Seek forward to the desired row.		 */		if (!(*tif->tif_seek)(tif, row - tif->tif_row))			return (0);		tif->tif_row = row;	}	return (1);}intTIFFReadScanline(TIFF* tif, tdata_t buf, uint32 row, tsample_t sample){	int e;	if (!TIFFCheckRead(tif, 0))		return (-1);	if( (e = TIFFSeek(tif, row, sample)) != 0) {		/*		 * Decompress desired row into user buffer.		 */		e = (*tif->tif_decoderow)		    (tif, (tidata_t) buf, tif->tif_scanlinesize, sample);		/* we are now poised at the beginning of the next row */		tif->tif_row = row + 1;		if (e)			(*tif->tif_postdecode)(tif, (tidata_t) buf,			    tif->tif_scanlinesize);	}	return (e > 0 ? 1 : -1);}/* * Read a strip of data and decompress the specified * amount into the user-supplied buffer. */tsize_tTIFFReadEncodedStrip(TIFF* tif, tstrip_t strip, tdata_t buf, tsize_t size){	TIFFDirectory *td = &tif->tif_dir;	uint32 nrows;	tsize_t stripsize;        tstrip_t sep_strip, strips_per_sep;	if (!TIFFCheckRead(tif, 0))		return (-1);	if (strip >= td->td_nstrips) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%ld: Strip out of range, max %ld",		    (long) strip, (long) td->td_nstrips);		return (-1);	}	/*	 * Calculate the strip size according to the number of	 * rows in the strip (check for truncated last strip on any	 * of the separations).	 */	if( td->td_rowsperstrip >= td->td_imagelength )		strips_per_sep = 1;	else		strips_per_sep = (td->td_imagelength+td->td_rowsperstrip-1)		    / td->td_rowsperstrip;	sep_strip = strip % strips_per_sep;	if (sep_strip != strips_per_sep-1 ||	    (nrows = td->td_imagelength % td->td_rowsperstrip) == 0)		nrows = td->td_rowsperstrip;	stripsize = TIFFVStripSize(tif, nrows);	if (size == (tsize_t) -1)		size = stripsize;	else if (size > stripsize)		size = stripsize;	if (TIFFFillStrip(tif, strip)	    && (*tif->tif_decodestrip)(tif, (tidata_t) buf, size,   	    (tsample_t)(strip / td->td_stripsperimage)) > 0 ) {		(*tif->tif_postdecode)(tif, (tidata_t) buf, size);		return (size);	} else		return ((tsize_t) -1);}static tsize_tTIFFReadRawStrip1(TIFF* tif,    tstrip_t strip, tdata_t buf, tsize_t size, const char* module){	TIFFDirectory *td = &tif->tif_dir;	assert((tif->tif_flags&TIFF_NOREADRAW)==0);	if (!isMapped(tif)) {		tsize_t cc;		if (!SeekOK(tif, td->td_stripoffset[strip])) {			TIFFErrorExt(tif->tif_clientdata, module,			    "%s: Seek error at scanline %lu, strip %lu",			    tif->tif_name,			    (unsigned long) tif->tif_row, (unsigned long) strip);			return (-1);		}		cc = TIFFReadFile(tif, buf, size);		if (cc != size) {			TIFFErrorExt(tif->tif_clientdata, module,		"%s: Read error at scanline %lu; got %lu bytes, expected %lu",			    tif->tif_name,			    (unsigned long) tif->tif_row,			    (unsigned long) cc,			    (unsigned long) size);			return (-1);		}	} else {		if (td->td_stripoffset[strip] + size > tif->tif_size) {			TIFFErrorExt(tif->tif_clientdata, module,    "%s: Read error at scanline %lu, strip %lu; got %lu bytes, expected %lu",			    tif->tif_name,			    (unsigned long) tif->tif_row,			    (unsigned long) strip,			    (unsigned long) tif->tif_size - td->td_stripoffset[strip],			    (unsigned long) size);			return (-1);		}		_TIFFmemcpy(buf, tif->tif_base + td->td_stripoffset[strip],                            size);	}	return (size);}/* * Read a strip of data from the file. */tsize_tTIFFReadRawStrip(TIFF* tif, tstrip_t strip, tdata_t buf, tsize_t size){	static const char module[] = "TIFFReadRawStrip";	TIFFDirectory *td = &tif->tif_dir;	tsize_t bytecount;	if (!TIFFCheckRead(tif, 0))		return ((tsize_t) -1);	if (strip >= td->td_nstrips) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Strip out of range, max %lu",		    (unsigned long) strip, (unsigned long) td->td_nstrips);		return ((tsize_t) -1);	}	if (tif->tif_flags&TIFF_NOREADRAW)	{		TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Compression scheme does not support access to raw uncompressed data");		return ((tsize_t) -1);	}	bytecount = td->td_stripbytecount[strip];	if (bytecount <= 0) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,		    "%lu: Invalid strip byte count, strip %lu",		    (unsigned long) bytecount, (unsigned long) strip);		return ((tsize_t) -1);	}	if (size != (tsize_t)-1 && size < bytecount)		bytecount = size;	return (TIFFReadRawStrip1(tif, strip, buf, bytecount, module));}/* * Read the specified strip and setup for decoding. The data buffer is * expanded, as necessary, to hold the strip's data. */intTIFFFillStrip(TIFF* tif, tstrip_t strip){	static const char module[] = "TIFFFillStrip";	TIFFDirectory *td = &tif->tif_dir;	if ((tif->tif_flags&TIFF_NOREADRAW)==0)	{		tsize_t bytecount = td->td_stripbytecount[strip];		if (bytecount <= 0) {			TIFFErrorExt(tif->tif_clientdata, module,			    "%s: Invalid strip byte count %lu, strip %lu",			    tif->tif_name, (unsigned long) bytecount,			    (unsigned long) strip);			return (0);		}		if (isMapped(tif) &&		    (isFillOrder(tif, td->td_fillorder)		    || (tif->tif_flags & TIFF_NOBITREV))) {			/*			 * The image is mapped into memory and we either don't			 * need to flip bits or the compression routine is			 * going to handle this operation itself.  In this			 * case, avoid copying the raw data and instead just			 * reference the data from the memory mapped file			 * image.  This assumes that the decompression			 * routines do not modify the contents of the raw data			 * buffer (if they try to, the application will get a			 * fault since the file is mapped read-only).			 */			if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)				_TIFFfree(tif->tif_rawdata);			tif->tif_flags &= ~TIFF_MYBUFFER;			/*			 * We must check for overflow, potentially causing			 * an OOB read. Instead of simple			 *			 *  td->td_stripoffset[strip]+bytecount > tif->tif_size			 *			 * comparison (which can overflow) we do the following			 * two comparisons:			 */			if (bytecount > tif->tif_size ||			    td->td_stripoffset[strip] > tif->tif_size - bytecount) {				/*				 * This error message might seem strange, but				 * it's what would happen if a read were done				 * instead.				 */				TIFFErrorExt(tif->tif_clientdata, module,					"%s: Read error on strip %lu; "					"got %lu bytes, expected %lu",					tif->tif_name, (unsigned long) strip,					(unsigned long) tif->tif_size - td->td_stripoffset[strip],					(unsigned long) bytecount);				tif->tif_curstrip = NOSTRIP;				return (0);			}			tif->tif_rawdatasize = bytecount;			tif->tif_rawdata = tif->tif_base + td->td_stripoffset[strip];		} else {			/*			 * Expand raw data buffer, if needed, to hold data			 * strip coming from file (perhaps should set upper			 * bound on the size of a buffer we'll use?).			 */			if (bytecount > tif->tif_rawdatasize) {				tif->tif_curstrip = NOSTRIP;				if ((tif->tif_flags & TIFF_MYBUFFER) == 0) {					TIFFErrorExt(tif->tif_clientdata, module,					"%s: Data buffer too small to hold strip %lu",					    tif->tif_name, (unsigned long) strip);					return (0);				}				if (!TIFFReadBufferSetup(tif, 0,				    TIFFroundup(bytecount, 1024)))					return (0);			}			if (TIFFReadRawStrip1(tif, strip,					      (unsigned char *)tif->tif_rawdata,					      bytecount, module) != bytecount)				return (0);			if (!isFillOrder(tif, td->td_fillorder) &&			    (tif->tif_flags & TIFF_NOBITREV) == 0)				TIFFReverseBits(tif->tif_rawdata, bytecount);		}	}	return (TIFFStartStrip(tif, strip));}/* * Tile-oriented Read Support * Contributed by Nancy Cam (Silicon Graphics). *//* * Read and decompress a tile of data.  The * tile is selected by the (x,y,z,s) coordinates. */tsize_tTIFFReadTile(TIFF* tif,    tdata_t buf, uint32 x, uint32 y, uint32 z, tsample_t s){

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品亚洲人成人网| 91精品国产一区二区三区| 国产精品女主播av| 成人永久aaa| 亚洲男人都懂的| 欧美在线你懂得| 免费人成网站在线观看欧美高清| 日韩一区国产二区欧美三区| 国产另类ts人妖一区二区| 国产精品久久久久久久久久久免费看 | 欧美丝袜丝nylons| 视频一区二区国产| 久久久蜜臀国产一区二区| 国v精品久久久网| 亚洲男女毛片无遮挡| 欧美一区二区三区影视| 国产宾馆实践打屁股91| 亚洲美女淫视频| 欧美www视频| 成人动漫精品一区二区| 五月婷婷激情综合网| 国产亚洲欧美在线| 欧美午夜一区二区三区免费大片| 九九视频精品免费| 亚洲理论在线观看| 久久亚洲免费视频| 欧美在线不卡视频| 国产一区 二区| 亚洲国产精品久久艾草纯爱| 国产午夜精品久久久久久久 | 亚洲综合在线五月| 欧美一卡在线观看| 99视频在线观看一区三区| 中文字幕亚洲在| 日韩一区二区在线看片| jizzjizzjizz欧美| 九一久久久久久| 久久99精品国产.久久久久久| 国产女主播在线一区二区| 欧美日韩视频专区在线播放| 国产精品综合av一区二区国产馆| 一区二区三区不卡在线观看| 久久免费看少妇高潮| 欧美性猛交xxxxxxxx| 粗大黑人巨茎大战欧美成人| 性久久久久久久久| 亚洲免费观看高清完整版在线观看熊| 日韩三级伦理片妻子的秘密按摩| 一本一道综合狠狠老| 国产精品一级黄| 日韩电影在线观看一区| 成人欧美一区二区三区在线播放| 精品成人一区二区三区| 欧美三级日本三级少妇99| 成人黄色大片在线观看| 国内久久精品视频| 视频一区免费在线观看| 亚洲在线视频一区| 一区二区三区日韩精品视频| 国产女人18毛片水真多成人如厕| 日韩欧美国产三级| 91精品国产综合久久蜜臀| 欧美性猛交xxxxxx富婆| 在线看一区二区| 91亚洲精品久久久蜜桃| 懂色av中文字幕一区二区三区| 国产一区二区女| 伦理电影国产精品| 精品一区二区日韩| 麻豆久久久久久久| 麻豆成人av在线| 麻豆成人91精品二区三区| 日本麻豆一区二区三区视频| 丝袜亚洲精品中文字幕一区| 尤物在线观看一区| 亚洲激情男女视频| 亚洲黄色尤物视频| 亚洲1区2区3区视频| 午夜在线成人av| 日韩电影免费在线观看网站| 日韩avvvv在线播放| 免费一区二区视频| 国产在线视频精品一区| 国产一区不卡精品| 成人性生交大片免费看视频在线 | 成人综合婷婷国产精品久久蜜臀| 国内精品国产三级国产a久久 | 成人精品视频.| 豆国产96在线|亚洲| 99久久亚洲一区二区三区青草 | 亚洲国产欧美一区二区三区丁香婷| 亚洲精品成人少妇| 午夜伦理一区二区| 精品一区二区三区影院在线午夜| 国产在线视视频有精品| 99riav久久精品riav| 在线观看亚洲精品| 日韩欧美一区二区久久婷婷| 久久亚洲精品国产精品紫薇| 国产精品卡一卡二| 韩国v欧美v日本v亚洲v| 成人福利视频在线| 欧美色欧美亚洲另类二区| 精品免费视频一区二区| 国产精品美女久久久久av爽李琼 | 成人免费在线视频观看| 夜夜揉揉日日人人青青一国产精品| 五月激情丁香一区二区三区| 久久精品99国产精品日本| 国产成人av一区二区三区在线观看| 91丨porny丨在线| 日韩欧美国产一区二区在线播放| 亚洲国产精品t66y| 天堂一区二区在线| 国产不卡在线一区| 欧美日韩黄色影视| 国产精品污污网站在线观看| 午夜欧美视频在线观看| 懂色av噜噜一区二区三区av| 欧美精品在线一区二区三区| 国产欧美一区二区三区在线老狼| 一个色妞综合视频在线观看| 91精品综合久久久久久| 国产精品色哟哟| 亚洲va欧美va人人爽午夜| 国产精品911| 91精品国产综合久久精品| 国产精品你懂的在线欣赏| 日韩黄色免费网站| 99国产精品久久| 久久精品人人做人人爽人人| 天天影视色香欲综合网老头| 99热99精品| 久久久精品国产免费观看同学| 午夜激情一区二区三区| 色综合亚洲欧洲| 国产欧美在线观看一区| 日本不卡的三区四区五区| 在线视频一区二区三| 中文字幕的久久| 黑人精品欧美一区二区蜜桃| 欧美日韩精品一二三区| 综合在线观看色| 风流少妇一区二区| 精品久久久久一区二区国产| 亚洲v日本v欧美v久久精品| 不卡视频在线看| 日韩欧美亚洲国产另类| 亚洲综合激情网| 91丨九色丨国产丨porny| 国产日韩精品视频一区| 激情图片小说一区| 欧美α欧美αv大片| 亚洲成人福利片| 欧美性大战久久| 亚洲乱码中文字幕| 色综合天天综合| 亚洲色图在线看| 91在线看国产| 免费观看日韩av| 欧美高清性hdvideosex| 亚洲成av人片在www色猫咪| 欧美在线观看你懂的| 亚洲精品久久嫩草网站秘色| 91麻豆国产精品久久| 亚洲色图在线视频| 91在线观看美女| 一区二区三区日韩在线观看| 色悠悠亚洲一区二区| 一区二区国产视频| 欧美日韩精品免费观看视频 | 色综合欧美在线视频区| 亚洲黄色尤物视频| 欧美日韩国产一级片| 天堂va蜜桃一区二区三区漫画版| 欧美另类z0zxhd电影| 日韩二区三区在线观看| 337p日本欧洲亚洲大胆色噜噜| 国产一区视频网站| 国产日韩三级在线| 97se亚洲国产综合自在线不卡| 一区二区三区免费| 欧美美女黄视频| 麻豆视频观看网址久久| 国产欧美日韩精品在线| 91亚洲国产成人精品一区二三| 亚洲欧美国产77777| 7777精品伊人久久久大香线蕉 | 一本大道久久a久久综合| 亚洲自拍偷拍网站| 91精品国产全国免费观看| 久久成人久久鬼色| 欧美激情一区三区| 欧美亚洲国产一卡| 久草在线在线精品观看| 中文字幕在线不卡一区| 欧美日韩精品是欧美日韩精品| 国内精品久久久久影院色| 亚洲色图视频网| 亚洲欧洲日本在线|