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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? main.c

?? VC小波應(yīng)用程序
?? C
字號(hào):
#include "local.h"

static char *progname = NULL;

static enum {
	FTYP_BATTLE,
	FTYP_BURT,
	FTYP_COIFLET,
	FTYP_DAUB,
	FTYP_HAAR,
	FTYP_PSCOIFLET,
	FTYP_SPLINE
} ftyp = FTYP_HAAR;

static int orderCoif = 2;
static int orderDaub = 4;
static char orderSpline[2] = "";
static bool overrideOffsets = FALSE;
static int offH = 0;
static int offG = 0;
static int offHtilde = 0;
static int offGtilde = 0;
static bool exchangeCoeffs = FALSE;
static bool isStd = TRUE;

static double thresh = 0.0;
static double fComp = 0.0;
static bool isVerbose = FALSE;

static void ppmwthresh _PROTO((char *fnImg, FILE *fpImg));
static double thresh_apply _PROTO((double thresh, float *y, int ny,
		int *nBelow));
static void usage _PROTO((void));
static waveletfilter *wfltr_select _PROTO((void));

void main(argc, argv)
	int argc;
	char **argv;
{
	int ch;
	extern char *optarg;
	extern int optind;
	bool ok = TRUE;
	char *pOptarg;
	FILE *fpImg;
	char *fnImg;
	double rComp;

	progname = argv[0];
	while ((ch = getopt(argc, argv, "ABC:D:ef:Hno:Pr:S:t:v?")) != -1) {
		switch (ch) {

		case 'A':
			ftyp = FTYP_BURT;
			break;

		case 'B':
			ftyp = FTYP_BATTLE;
			break;

		case 'C':
			ftyp = FTYP_COIFLET;
			orderCoif = atoi(optarg);
			if (orderCoif != 2 && orderCoif != 4 && orderCoif != 6)
				ok = FALSE;
			break;

		case 'D':
			ftyp = FTYP_DAUB;
			orderDaub = atoi(optarg);
			if (orderDaub != 4 && orderDaub != 6 && orderDaub != 8
					&& orderDaub != 10 && orderDaub != 12 && orderDaub != 20)
				ok = FALSE;
			break;

		case 'e':
			exchangeCoeffs = TRUE;
			break;

		case 'f':
			fComp = atof(optarg);
			if (fComp < 0.0 || 1.0 < fComp)
				ok = FALSE;
			break;

		case 'H':
			ftyp = FTYP_HAAR;
			break;

		case 'n':
			isStd = FALSE;
			break;

		case 'o':
			pOptarg = optarg;
			overrideOffsets = TRUE;
			offH = strtol(pOptarg, &pOptarg, 10);
			if (pOptarg == optarg)
				ok = FALSE;
			else {
				/* mirrored coefficients default to the same offsets */
				if (*pOptarg == ',') {
					pOptarg++;
					offG = strtol(pOptarg, &pOptarg, 10);
					if (*pOptarg == ',') {
						pOptarg++;
						offHtilde = strtol(pOptarg, &pOptarg, 10);
						if (*pOptarg == ',') {
							pOptarg++;
							offGtilde = strtol(pOptarg, &pOptarg, 10);
						} else
							offGtilde = offH;
					} else {
						offHtilde = offG;
						offGtilde = offH;
					}
				} else
					offGtilde = offHtilde = offG = offH;
				if (*pOptarg != '\0')
					ok = FALSE;
			}
			break;

		case 'P':
			ftyp = FTYP_PSCOIFLET;
			break;

		case 'r':
			rComp = atof(optarg);
			if (rComp < 1.0)
				ok = FALSE;
			else {
				fComp = 1.0 - 1/rComp;
			}
			break;

		case 'S':
			ftyp = FTYP_SPLINE;
			if (strlen(optarg) != 3)
				ok = FALSE;
			else {
				strcpy(orderSpline, optarg);
				if (!STR_EQ(orderSpline, "2,2")
						&& !STR_EQ(orderSpline, "2,4")
						&& !STR_EQ(orderSpline, "3,3")
						&& !STR_EQ(orderSpline, "3,7"))
					ok = FALSE;
			}
			break;

		case 't':
			thresh = atof(optarg);
			if (thresh < 0.0)
				ok = FALSE;
			break;

		case 'v':
			isVerbose = TRUE;
			break;

		case '?':
			usage();
			exit(0);
		}
	}

	if (!ok) {
		usage();
		exit(1);
	}
	if (optind == argc - 1) {
		fnImg = argv[optind];
		fpImg = fopen(fnImg, "r");
		if (fpImg == NULL) {
			(void) fprintf(stderr, "can\'t open \"%s\" for reading\n", fnImg);
			exit(1);
		}
		ppmwthresh(fnImg, fpImg);
		fclose(fpImg);
	} else if (optind == argc) {
		ppmwthresh("standard input", stdin);
	} else {
		usage();
		exit(1);
	}
	exit(0);
}

static void ppmwthresh(fnImg, fpImg)
	char *fnImg;
	FILE *fpImg;
{
#define ABS(val) ( (val) >= 0 ? (val) : -(val) )
	char *whynot;
	int px, py;
	pixel pxl;
	image *img;
	int n[2];
	float *p;
	int ipxl, npxl;
	int lg2npx, lg2npy;
	int pxlR, pxlG, pxlB;
	int nBelow0, nAbove255, nBelowThresh;
	double err;
	waveletfilter *wfltr = NULL;
	int iq, nq, lower, upper;
	float *q, qSwap, qAbsMin;

	wfltr = wfltr_select();

	img = img_read(fpImg, &whynot);
	if (img == NULL) {
		(void) fprintf(stderr,
				"can\'t read image from \"%s\"\n  %s -- exiting\n",
				fnImg, whynot);
		exit(1);
	}

	for (lg2npx = 0; (1 << lg2npx) < img->npx; lg2npx++)
		continue;
	for (lg2npy = 0; (1 << lg2npy) < img->npy; lg2npy++)
		continue;
	if (img->npx != (1 << lg2npx) || img->npy != (1 << lg2npy)) {
		(void) fprintf(stderr,
				"dimensions of image must be powers of two -- exiting\n");
		exit(1);
	}

	n[0] = img->npy;
	n[1] = img->npx;
	npxl = img->npx * img->npy;
	MALLOC_OR_ELSE_LINTOK(p, 3 * npxl, float);

	ipxl = 0;
	for (py = 0; py < img->npy; py++) {
		for (px = 0; px < img->npx; px++) {
			pxl = IMG_PXL_AT_XY(img, px, py);
			p[ipxl] = R_OF_PXL(pxl);
			p[ipxl + npxl] = G_OF_PXL(pxl);
			p[ipxl + 2*npxl] = B_OF_PXL(pxl);
			ipxl++;
		}
	}

	err = 0.0;

	wxfrm_fand(&p[0], n, 2, TRUE, isStd, wfltr, &p[0]);
	wxfrm_fand(&p[npxl], n, 2, TRUE, isStd, wfltr, &p[npxl]);
	wxfrm_fand(&p[2*npxl], n, 2, TRUE, isStd, wfltr, &p[2*npxl]);

	/*
	 *	It may be that the user has specified *both* a threshold and a percent
	 *	compression (or compression ratio).  In such cases, we apply both
	 *	criteria.
	 */
	err = thresh_apply(thresh, &p[0], 3 * npxl, &nBelowThresh);

	/*
	 *	To apply fractional compression, we determine the equivalent threshold
	 *	by using a heap.  Then we threshold the original data with that value.
	 */
	if (fComp > 0.0) {
		nq = ceil((1 - fComp) * 3 * npxl);
		if (nq == 0)
			err += thresh_apply(MAXFLOAT, &p[0], 3 * npxl, &nBelowThresh);
		else {
			MALLOC_OR_ELSE_LINTOK(q, nq, float);
			for (ipxl = 0; ipxl < 3 * npxl; ipxl++) {
				/*
				 *	Let the heap grow until there are nq elements in it.
				 */
				if (ipxl < nq) {
					lower = ipxl;
					q[lower] = ABS(p[ipxl]);
					upper = (lower - 1) / 2;
					while (lower != 0 && q[upper] > q[lower]) {
						qSwap = q[upper]; q[upper] = q[lower]; q[lower] = qSwap;
						lower = upper;
						upper = (lower - 1) / 2;
					}
				} else if (ABS(p[ipxl]) > q[0]) {
					/*
					 *	There are now nq elements in the heap.  q[0] is the
					 *	smallest.  If the new value (ABS(p[ipxl])) is less than or
					 *	equal to q[0], we can ignore it.  Otherwise, we replace
					 *	q[0] with the new value and sift downwards.
					 */
					q[0] = ABS(p[ipxl]);
					upper = 0;
					lower = 2 * upper + 1;
					while (lower < nq) {
						if (lower + 1 < nq && q[lower+1] < q[lower])
							lower++;
						/*
						 *	If q[upper] is smaller than either of its one or two
						 *	children, swap and continue down.
						 */
						if (q[upper] < q[lower])
							break;
						qSwap = q[upper]; q[upper] = q[lower]; q[lower] = qSwap;
						upper = lower;
						lower = 2 * upper + 1;
					}
				}
			}
			/*
			 *	q[0] is now the smallest value in the heap.  We can use it as
			 *	a threshold value.
			 */
			if (q[0] > thresh) {
				thresh = q[0];
				err += thresh_apply(thresh, &p[0], 3 * npxl, &nBelowThresh);
			}
			FREE_LINTOK(q);
		}
	}

	/*
	 *	Invert the transform.
	 */
	wxfrm_fand(&p[0], n, 2, FALSE, isStd, wfltr, &p[0]);
	wxfrm_fand(&p[npxl], n, 2, FALSE, isStd, wfltr, &p[npxl]);
	wxfrm_fand(&p[2*npxl], n, 2, FALSE, isStd, wfltr, &p[2*npxl]);

	/*
	 *	Put the results back in the image.
	 */
	ipxl = 0;
	nBelow0 = 0;
	nAbove255 = 0;
	for (py = 0; py < img->npy; py++) {
		for (px = 0; px < img->npx; px++) {
			pxlR = floor(p[ipxl] + 0.5);
			if (pxlR < 0) {
				nBelow0++;
				pxlR = 0;
			} else if (pxlR > 255) {
				nAbove255++;
				pxlR = 255;
			}
			pxlG = floor(p[ipxl + npxl] + 0.5);
			if (pxlG < 0) {
				nBelow0++;
				pxlG = 0;
			} else if (pxlG > 255) {
				nAbove255++;
				pxlG = 255;
			}
			pxlB = floor(p[ipxl + 2*npxl] + 0.5);
			if (pxlB < 0) {
				nBelow0++;
				pxlB = 0;
			} else if (pxlB > 255) {
				nAbove255++;
				pxlB = 255;
			}
			PXL_SET_RGB(IMG_PXL_AT_XY(img, px, py), pxlR, pxlG, pxlB);
			ipxl++;
		}
	}

	img_write(img, FALSE, stdout);

	if (isVerbose) {
		(void) fprintf(stderr, "%10.1f = threshold\n",
				thresh);
		(void) fprintf(stderr, "%10d pixel values below threshold\n",
				nBelowThresh);
		fComp = RATIO(nBelowThresh, 3 * npxl);
		(void) fprintf(stderr, "%10.6f compression (0 = no compression)\n",
				fComp);
		if (fComp < 1.0) {
			(void) fprintf(stderr, "%8.1f:1 compression ratio\n",
					1.0 / (1.0 - fComp));
		} else
			(void) fprintf(stderr, "     INF:1 compression ratio\n");
		(void) fprintf(stderr, "%10.2f = RMS error\n",
				sqrt(err / (3 * npxl)));
		(void) fprintf(stderr, "%10d reconstructed pixel values below 0\n",
				nBelow0);
		(void) fprintf(stderr, "%10d reconstructed pixel values above 255\n",
				nAbove255);
	}

	FREE_LINTOK(p);
	img_delete(img);

	return;
}

/* thresh_apply -- apply a magnitude threshold to an array of values */
static double thresh_apply(thresh, y, n, nBelow)
	double thresh;
	float *y;
	int n;
	int (*nBelow);
{
	double err = 0.0;
	int i;
	double yval;

	(*nBelow) = 0;
	if (thresh > 0.0) {
		for (i = 0; i < n; i++) {
			yval = y[i];
			if (-thresh < yval && yval < thresh) {
				err += yval*yval;
				y[i] = 0.0;
				(*nBelow)++;
			}
		}
	}
	return err;
}

/* usage -- issue a usage error message */
static void usage()
{
	(void) fprintf(stderr,
			"usage: %s [{args}] [{PPM image file}]\n", progname);
	(void) fprintf(stderr, "%s\n",
			" {args} are:");
	(void) fprintf(stderr, "%s\n",
			"  -A       use Burt-Adelson basis");
	(void) fprintf(stderr, "%s\n",
			"  -B       use Battle-Lemarie basis");
	(void) fprintf(stderr, "%s\n",
			"  -C {#}   use Coiflet order {#} (= 2, 4, or 6) basis");
	(void) fprintf(stderr, "%s\n",
			"  -D {#}   use Daubechies order {#} (= 4, 6, 8, 10, 12, or 20) basis");
	(void) fprintf(stderr, "%s\n",
			"  -e       exchange normal and tilde components");
	(void) fprintf(stderr, "%s\n",
			"  -f {#}   compress to fraction {#} of original data size (default: 1.0)");
	(void) fprintf(stderr, "%s\n",
			"  -H       use Haar basis (default)");
	(void) fprintf(stderr, "%s\n",
			"  -n       use non-standard multidimensional basis");
	(void) fprintf(stderr, "%s\n",
			"  -o {#,#[,#,#]} override H, G, and (for biorthogonal wavelets)");
	(void) fprintf(stderr, "%s\n",
			"             H~ and G~ offsets with {#}'s");
	(void) fprintf(stderr, "%s\n",
			"  -P       use Pseudocoiflet (4, 4) basis");
	(void) fprintf(stderr, "%s\n",
			"  -r {#}   apply compression ratio {#}:1 to wavelet coefficients (default: none)");
	(void) fprintf(stderr, "%s\n",
			"  -S {#}   use Spline order {#} (= \"2,2\", \"2,4\", \"3,3\", or \"3,7\")");
	(void) fprintf(stderr, "%s\n",
			"  -t {#}   apply threshold {#} to wavelet coefficients (default: no threshold)");
	(void) fprintf(stderr, "%s\n",
			"  -v       verbosely display compression statistics on stderr");
	(void) fprintf(stderr, "%s\n",
			"  -?       this message");
	return;
}

/* wfltr_select -- select the wavelet filter being used */
static waveletfilter *wfltr_select()
{
	waveletfilter *wfltr = NULL;

	switch (ftyp) {

	case FTYP_BATTLE:
		wfltr = &wfltrBattleLemarie;
		break;

	case FTYP_BURT:
		wfltr = &wfltrBurtAdelson;
		break;

	case FTYP_COIFLET:
		switch (orderCoif) {

		case 2:
			wfltr = &wfltrCoiflet_2;
			break;

		case 4:
			wfltr = &wfltrCoiflet_4;
			break;

		case 6:
			wfltr = &wfltrCoiflet_6;
			break;

		default:
			NOT_REACHED;
		}
		break;

	case FTYP_DAUB:
		switch (orderDaub) {

		case 4:
			wfltr = &wfltrDaubechies_4;
			break;

		case 6:
			wfltr = &wfltrDaubechies_6;
			break;

		case 8:
			wfltr = &wfltrDaubechies_8;
			break;

		case 10:
			wfltr = &wfltrDaubechies_10;
			break;

		case 12:
			wfltr = &wfltrDaubechies_12;
			break;

		case 20:
			wfltr = &wfltrDaubechies_20;
			break;

		default:
			NOT_REACHED;
		}
		break;

	case FTYP_HAAR:
		wfltr = &wfltrHaar;
		break;

	case FTYP_PSCOIFLET:
		wfltr = &wfltrPseudocoiflet_4_4;
		break;

	case FTYP_SPLINE:
		if (STR_EQ(orderSpline, "2,2"))
			wfltr = &wfltrSpline_2_2;
		else if (STR_EQ(orderSpline, "2,4"))
			wfltr = &wfltrSpline_2_4;
		else if (STR_EQ(orderSpline, "3,3"))
			wfltr = &wfltrSpline_3_3;
		else {
			assert(STR_EQ(orderSpline, "3,7"));
			wfltr = &wfltrSpline_3_7;
		}
		break;
	}
	if (wfltr == NULL) {
		(void) fprintf(stderr,
				"requested filter not yet supported -- exiting\n");
		exit(1);
	}

	/* exchange normal and tilde components, if requested */
	if (exchangeCoeffs)
		wfltr_exchange(wfltr, wfltr);

	/* override offsets, if requested */
	if (overrideOffsets) {
		wfltr->offH = offH;
		wfltr->offG = offG;
		wfltr->offHtilde = offHtilde;
		wfltr->offGtilde = offGtilde;
	}

	return wfltr;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人动漫精品| 日本亚洲最大的色成网站www| 欧美三级乱人伦电影| 粉嫩蜜臀av国产精品网站| 亚洲一区二区三区中文字幕在线| 26uuu精品一区二区在线观看| 91黄色免费网站| 成人在线视频首页| 国内精品在线播放| 亚洲一线二线三线视频| 欧美激情综合在线| 亚洲精品一区二区三区影院 | 欧美色图天堂网| 国产成人激情av| 美国毛片一区二区| 亚洲bt欧美bt精品| 亚洲综合色婷婷| 国产精品久久久久久久久免费丝袜| 日韩写真欧美这视频| 欧美性大战xxxxx久久久| av高清不卡在线| 成人av在线网| 国产一区二区精品久久| 麻豆freexxxx性91精品| 日日噜噜夜夜狠狠视频欧美人| 亚洲美女在线一区| 一区二区中文字幕在线| 国产欧美综合色| 国产日韩精品一区二区三区 | 99r国产精品| 成人av免费在线| 东方欧美亚洲色图在线| 国产成人在线免费| 粉嫩一区二区三区在线看| 国产xxx精品视频大全| 国产在线播放一区| 国产精品99久久久久久似苏梦涵| 久久69国产一区二区蜜臀| 毛片基地黄久久久久久天堂| 久久精品二区亚洲w码| 免费在线观看一区| 久久精品国产成人一区二区三区 | 国产精品综合久久| 精品一区二区在线视频| 韩国v欧美v亚洲v日本v| 国产乱人伦偷精品视频不卡| 国产成人亚洲综合a∨婷婷图片| 国产1区2区3区精品美女| hitomi一区二区三区精品| 91免费观看国产| 欧美日韩一级大片网址| 欧美一区二区观看视频| 91精品国产综合久久小美女| 欧美成人r级一区二区三区| 精品免费国产二区三区| 国产午夜一区二区三区| 国产精品日日摸夜夜摸av| 成人欧美一区二区三区白人| 亚洲激情在线激情| 五月婷婷色综合| 免费精品99久久国产综合精品| 国产精品一区二区无线| 成人黄色a**站在线观看| 在线视频一区二区免费| 日韩一级在线观看| 中文欧美字幕免费| 亚洲一区二区av电影| 久久精品国产999大香线蕉| 成人激情图片网| 在线区一区二视频| 欧美精品一区二区三区很污很色的| 国产精品午夜电影| 婷婷久久综合九色综合绿巨人| 国产在线看一区| 一本大道久久精品懂色aⅴ| 91精品国产综合久久精品图片| 久久九九久精品国产免费直播| 亚洲日本中文字幕区| 免费成人美女在线观看| 不卡大黄网站免费看| 91精品国产综合久久国产大片| 亚洲国产高清不卡| 国产福利一区二区三区视频 | 欧美日韩免费不卡视频一区二区三区| 91精品国产综合久久久久久| 中文字幕一区二区三区在线播放| 日本在线不卡视频| 色综合天天综合网天天狠天天| 日韩视频在线永久播放| 亚洲视频 欧洲视频| 久久9热精品视频| 欧美手机在线视频| 国产精品久久久久aaaa樱花| 日产精品久久久久久久性色| 91亚洲国产成人精品一区二三| 日韩欧美一区二区不卡| 亚洲毛片av在线| 国产91在线看| 精品欧美一区二区在线观看| 亚洲综合在线视频| 国产成人免费视频一区| 欧美一区欧美二区| 亚洲精品乱码久久久久| 岛国av在线一区| 欧美一二三四在线| 亚洲图片一区二区| av电影在线观看一区| 久久久久久久综合色一本| 日本欧美一区二区在线观看| 欧洲av在线精品| 国产精品国产馆在线真实露脸| 国产乱码一区二区三区| 日韩欧美成人一区二区| 亚洲第一成人在线| 色婷婷综合久久久中文一区二区| 国产精品美女一区二区| 国产中文字幕一区| 欧美一级高清片| 天天色 色综合| 欧美日韩三级一区二区| 亚洲精品美腿丝袜| 色94色欧美sute亚洲线路一久| 国产精品欧美经典| 国产成人夜色高潮福利影视| 久久视频一区二区| 国产精品一二三四五| 久久久久高清精品| 国产精品一区二区久激情瑜伽| 精品成人佐山爱一区二区| 婷婷亚洲久悠悠色悠在线播放| 欧美日韩一区二区三区四区五区 | 色综合久久中文综合久久97| 国产精品久线观看视频| 成人一区二区三区视频| 国产精品福利av| 成人性生交大片| 国产精品白丝在线| 不卡视频一二三四| 亚洲人成电影网站色mp4| 91视视频在线观看入口直接观看www | 亚洲午夜av在线| 欧洲av在线精品| 五月婷婷另类国产| 欧美一区三区二区| 精品一区二区三区免费| 久久久久9999亚洲精品| 成人免费视频网站在线观看| 亚洲少妇屁股交4| 欧美日韩一区二区三区视频| 天涯成人国产亚洲精品一区av| 欧美一区二区高清| 国产精品538一区二区在线| 国产精品久久午夜夜伦鲁鲁| 91免费在线视频观看| 五月激情综合色| 欧美大片在线观看一区二区| 国模无码大尺度一区二区三区| 国产亚洲福利社区一区| 欧美日韩成人一区| 日本在线不卡一区| 国产亚洲精久久久久久| 日本乱人伦一区| 日韩高清不卡一区二区三区| 精品国产91亚洲一区二区三区婷婷| 懂色av一区二区夜夜嗨| 亚洲精品视频在线观看免费| 欧美日韩和欧美的一区二区| 韩国av一区二区三区在线观看| 国产精品黄色在线观看| 欧美日韩免费高清一区色橹橹 | 日本二三区不卡| 蜜桃视频在线观看一区二区| 国产女同互慰高潮91漫画| 一本大道久久精品懂色aⅴ| 六月丁香综合在线视频| 国产精品看片你懂得| 777欧美精品| hitomi一区二区三区精品| 丝袜美腿亚洲综合| 中文字幕av一区 二区| 色婷婷综合中文久久一本| 经典三级视频一区| 夜夜亚洲天天久久| 日韩欧美第一区| 在线观看成人小视频| 国产精品一卡二| 亚洲va欧美va人人爽午夜| 久久精品免费在线观看| 欧美日韩精品久久久| 成人激情文学综合网| 久久精品国产精品亚洲红杏| 亚洲男人都懂的| 国产女人18毛片水真多成人如厕| 欧美日韩亚洲国产综合| 成人午夜av电影| 麻豆精品一区二区综合av| 亚洲欧美一区二区三区久本道91| 日韩欧美第一区| 欧美日本在线视频| 色悠悠亚洲一区二区|