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

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

?? utils.c

?? spcaview用于Linux系統(tǒng)上的usb視頻采集程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
/****************************************************************************#	 	Spcaview:  Spca5xx Grabber                                  ## 		Copyright (C) 2004 2005 Michel Xhaard                       ##                                                                           ## This program is free software; you can redistribute it and/or modify      ## it under the terms of the GNU General Public License as published by      ## the Free Software Foundation; either version 2 of the License, or         ## (at your option) any later version.                                       ##                                                                           ## This program is distributed in the hope that it will be useful,           ## but WITHOUT ANY WARRANTY; without even the implied warranty of            ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             ## GNU General Public License for more details.                              ##                                                                           ## You should have received a copy of the GNU General Public License         ## along with this program; if not, write to the Free Software               ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA ##                                                                           #****************************************************************************/#include "utils.h"#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <linux/types.h>#include <string.h>#include <fcntl.h>#include <wait.h>#include <time.h>#include <limits.h>#include "jdatatype.h"#include "encoder.h"#include <linux/videodev.h>#include "jconfig.h"doublems_time (void);staticswapRB (char *Buffer, int size);void exit_fatal(char *messages){	printf("%s \n",messages);	exit(1);}doublems_time (void){  static struct timeval tod;  gettimeofday (&tod, NULL);  return ((double) tod.tv_sec * 1000.0 + (double) tod.tv_usec / 1000.0);}staticswapRB (char *Buffer, int size){  char temp;  int i;  for (i = 0; i < size; i += 3)    {      temp = Buffer[i];      Buffer[i] = Buffer[i + 2];      Buffer[i + 2] = temp;    }}#define CLIP(color) (unsigned char)((color>0xFF)?0xff:((color<0)?0:color))voidYUV420toRGB (unsigned char *src, unsigned char *dst, int width, int height,	     int flipUV, int ColSpace){  unsigned char *Y;  unsigned char *V;  unsigned char *U;  int y1, y2, u, v;  int v1, v2, u1, u2;  unsigned char *pty1, *pty2;  int i, j;  unsigned char *RGB1, *RGB2;  int r, g, b;  //Initialization  Y = src;  V = Y + width * height;  U = Y + width * height + width * height / 4;  pty1 = Y;  pty2 = pty1 + width;  RGB1 = dst;  RGB2 = RGB1 + 3 * width;  for (j = 0; j < height; j += 2)    {      //printf ("process line %d\n",j);      for (i = 0; i < width; i += 2)	{	  if (flipUV)	    {	      u = (*V++) - 128;	      v = (*U++) - 128;	    }	  else	    {	      v = (*V++) - 128;	      u = (*U++) - 128;	    }	  switch (ColSpace)	    {	      // M$ color space	    case 0:	      {		v1 = ((v << 10) + (v << 9) + (v << 6) + (v << 5)) >> 10;	// 1.593		u1 = ((u << 8) + (u << 7) + (u << 4)) >> 10;	//         0.390		v2 = ((v << 9) + (v << 4)) >> 10;	//                0.515		u2 = ((u << 11) + (u << 4)) >> 10;	//               2.015	      }	      break;	      // PAL specific	    case 1:	      {		v1 = ((v << 10) + (v << 7) + (v << 4)) >> 10;	//      1.1406		u1 = ((u << 8) + (u << 7) + (u << 4) + (u << 3)) >> 10;	// 0.3984		v2 = ((v << 9) + (v << 6) + (v << 4) + (v << 1)) >> 10;	// 0.5800		u2 = ((u << 11) + (u << 5)) >> 10;	//              2.0312	      }	      break;	      // V4l2	    case 2:	      {		v1 = ((v << 10) + (v << 8) + (v << 7) + (v << 5)) >> 10;	//       1.406		u1 = ((u << 8) + (u << 6) + (u << 5)) >> 10;	//                0.343		v2 = ((v << 9) + (v << 7) + (v << 6) + (v << 5)) >> 10;	//        0.718		u2 = ((u << 10) + (u << 9) + (u << 8) + (u << 4) + (u << 3)) >> 10;	// 1.773	      }	      break;	    case 3:	      {		v1 = u1 = v2 = u2 = 0;	      }	      break;	    default:	      break;	    }	  //up-left	  y1 = (*pty1++);	  if (y1 > 0)	    {	      r = y1 + (v1);	      g = y1 - (u1) - (v2);	      b = y1 + (u2);	      r = CLIP (r);	      g = CLIP (g);	      b = CLIP (b);	    }	  else	    {	      r = g = b = 0;	    }	  *RGB1++ = r;	  *RGB1++ = g;	  *RGB1++ = b;	  //down-left	  y2 = (*pty2++);	  if (y2 > 0)	    {	      r = y2 + (v1);	      g = y2 - (u1) - (v2);	      b = y2 + (u2);	      r = CLIP (r);	      g = CLIP (g);	      b = CLIP (b);	    }	  else	    {	      r = b = g = 0;	    }	  *RGB2++ = r;	  *RGB2++ = g;	  *RGB2++ = b;	  //up-right	  y1 = (*pty1++);	  if (y1 > 0)	    {	      r = y1 + (v1);	      g = y1 - (u1) - (v2);	      b = y1 + (u2);	      r = CLIP (r);	      g = CLIP (g);	      b = CLIP (b);	    }	  else	    {	      r = g = b = 0;	    }	  *RGB1++ = r;	  *RGB1++ = g;	  *RGB1++ = b;	  //down-right	  y2 = (*pty2++);	  if (y2 > 0)	    {	      r = y2 + (v1);	      g = y2 - (u1) - (v2);	      b = y2 + (u2);	      r = CLIP (r);	      g = CLIP (g);	      b = CLIP (b);	    }	  else	    {	      r = b = g = 0;	    }	  *RGB2++ = r;	  *RGB2++ = g;	  *RGB2++ = b;	}      RGB1 += 3 * width;      RGB2 += 3 * width;      pty1 += width;      pty2 += width;    }//printf ("done YUV420 -> RGB \n");}int get_jpegsize (unsigned char *buf, int insize){ int i; 	 for ( i= 1024 ; i< insize; i++) { 	if ((buf[i] == 0xFF) && (buf[i+1] == 0xD9)) return i+10; } return -1;}/****************************************************************************//*  *    linux/drivers/video/fbcon-jpegdec.c - a tiny jpeg decoder. *       *      (w) August 2001 by Michael Schroeder, <mls@suse.de> *                   */ /*	february 2005 by Michel Xhaard, <mxhaard at magic dot fr >	change 	only produce RGB24 output	flip R and B component	Realloc output buffer if width and height change 	rewrite error check in jpeg_decode	update include for userspace use	decode 221111 jpeg411 and 211111 jpeg422 stream	*//****************************************************************************/#define ISHIFT 11#define IFIX(a) ((int)((a) * (1 << ISHIFT) + .5))#define IMULT(a, b) (((a) * (b)) >> ISHIFT)#define ITOINT(a) ((a) >> ISHIFT)#ifndef __P# define __P(x) x#endif/* special markers */#define M_BADHUFF	-1#define M_EOF		0x80struct jpeg_decdata {	int dcts[6 * 64 + 16];	int out[64 * 6];	int dquant[3][64];};struct in {	unsigned char *p;	unsigned int bits;	int left;	int marker;	int (*func) __P((void *));	void *data;};/*********************************/struct dec_hufftbl;struct enc_hufftbl;union hufftblp {	struct dec_hufftbl *dhuff;	struct enc_hufftbl *ehuff;};struct scan {	int dc;			/* old dc value */	union hufftblp hudc;	union hufftblp huac;	int next;		/* when to switch to next scan */	int cid;		/* component id */	int hv;			/* horiz/vert, copied from comp */	int tq;			/* quant tbl, copied from comp */};/*********************************/#define DECBITS 10		/* seems to be the optimum */struct dec_hufftbl {	int maxcode[17];	int valptr[16];	unsigned char vals[256];	unsigned int llvals[1 << DECBITS];};static void decode_mcus __P((struct in *, int *, int, struct scan *, int *));static int dec_readmarker __P((struct in *));static void dec_makehuff __P((struct dec_hufftbl *, int *, unsigned char *));static void setinput __P((struct in *, unsigned char *));/*********************************/#undef PREC#define PREC intstatic void idctqtab __P((unsigned char *, PREC *));static void idct __P((int *, int *, PREC *, PREC, int));static void scaleidctqtab __P((PREC *, PREC));/*********************************/static void initcol __P((PREC[][64]));static void col221111 __P((int *, unsigned char *, int));/*********************************/#define M_SOI	0xd8#define M_APP0	0xe0#define M_DQT	0xdb#define M_SOF0	0xc0#define M_DHT   0xc4#define M_DRI	0xdd#define M_SOS	0xda#define M_RST0	0xd0#define M_EOI	0xd9#define M_COM	0xfestatic unsigned char *datap;static int getbyte(void){	return *datap++;}static int getword(void){	int c1, c2;	c1 = *datap++;	c2 = *datap++;	return c1 << 8 | c2;}struct comp {	int cid;	int hv;	int tq;};#define MAXCOMP 4struct jpginfo {	int nc;			/* number of components */	int ns;			/* number of scans */	int dri;		/* restart interval */	int nm;			/* mcus til next marker */	int rm;			/* next restart marker */};static struct jpginfo info;static struct comp comps[MAXCOMP];static struct scan dscans[MAXCOMP];static unsigned char quant[4][64];static struct dec_hufftbl dhuff[4];#define dec_huffdc (dhuff + 0)#define dec_huffac (dhuff + 2)static struct in in;static int readtables(int till){	int m, l, i, j, lq, pq, tq;	int tc, th, tt;	for (;;) {		if (getbyte() != 0xff)			return -1;		if ((m = getbyte()) == till)			break;		switch (m) {		case 0xc2:			return 0;		case M_DQT:			lq = getword();			while (lq > 2) {				pq = getbyte();				tq = pq & 15;				if (tq > 3)					return -1;				pq >>= 4;				if (pq != 0)					return -1;				for (i = 0; i < 64; i++)					quant[tq][i] = getbyte();				lq -= 64 + 1;			}			break;		case M_DHT:			l = getword();			while (l > 2) {				int hufflen[16], k;				unsigned char huffvals[256];				tc = getbyte();				th = tc & 15;				tc >>= 4;				tt = tc * 2 + th;				if (tc > 1 || th > 1)					return -1;				for (i = 0; i < 16; i++)					hufflen[i] = getbyte();				l -= 1 + 16;				k = 0;				for (i = 0; i < 16; i++) {					for (j = 0; j < hufflen[i]; j++)						huffvals[k++] = getbyte();					l -= hufflen[i];				}				dec_makehuff(dhuff + tt, hufflen,					     huffvals);			}			break;		case M_DRI:			l = getword();			info.dri = getword();			break;		default:			l = getword();			while (l-- > 2)				getbyte();			break;		}	}	return 0;}static void dec_initscans(void){	int i;	info.nm = info.dri + 1;	info.rm = M_RST0;	for (i = 0; i < info.ns; i++)		dscans[i].dc = 0;}static int dec_checkmarker(void){	int i;	if (dec_readmarker(&in) != info.rm)		return -1;	info.nm = info.dri;	info.rm = (info.rm + 1) & ~0x08;	for (i = 0; i < info.ns; i++)		dscans[i].dc = 0;	return 0;}int jpeg_decode(unsigned char **pic, unsigned char *buf, int *width, int *height ){	struct jpeg_decdata *decdata;	int i, j, m, tac, tdc;	int intwidth ,intheight;	int mcusx, mcusy, mx, my;	int max[6];	int err = 0;	int enc411 = 1;	decdata = (struct jpeg_decdata*)malloc(sizeof(struct jpeg_decdata));	if (!decdata){		err= -1;		goto error;	}		if (buf == NULL){		err = -1;		goto error;	}	datap = buf;	if (getbyte() != 0xff){		err= ERR_NO_SOI;		goto error;	}	if (getbyte() != M_SOI){		err= ERR_NO_SOI;		goto error;	}	if (readtables(M_SOF0)){		err= ERR_BAD_TABLES;		goto error;	}	getword();	i = getbyte();	if (i != 8){		err = ERR_NOT_8BIT;		goto error;	}	intheight = getword();	intwidth = getword();		//if ((intheight & 15) || (intwidth & 15)){	if ((intheight & 7) || (intwidth & 15)){			err = ERR_BAD_WIDTH_OR_HEIGHT;		goto error;	}	info.nc = getbyte();	if (info.nc > MAXCOMP){		err = ERR_TOO_MANY_COMPPS;		goto error;	}	for (i = 0; i < info.nc; i++) {		int h, v;		comps[i].cid = getbyte();		comps[i].hv = getbyte();		v = comps[i].hv & 15;		h = comps[i].hv >> 4;		comps[i].tq = getbyte();		if (h > 3 || v > 3){			err = ERR_ILLEGAL_HV;			goto error;		}		if (comps[i].tq > 3){			err = ERR_QUANT_TABLE_SELECTOR;			goto error;		}	}	if (readtables(M_SOS)){		err = ERR_BAD_TABLES;		goto error;	}	getword();	info.ns = getbyte();	if (info.ns != 3){		err = ERR_NOT_YCBCR_221111;		goto error;	}	for (i = 0; i < 3; i++) {		dscans[i].cid = getbyte();		tdc = getbyte();		tac = tdc & 15;		tdc >>= 4;		if (tdc > 1 || tac > 1){			err = ERR_QUANT_TABLE_SELECTOR;			goto error;		}		for (j = 0; j < info.nc; j++)			if (comps[j].cid == dscans[i].cid)				break;		if (j == info.nc){			err= ERR_UNKNOWN_CID_IN_SCAN;			goto error;		}		dscans[i].hv = comps[j].hv;		dscans[i].tq = comps[j].tq;		dscans[i].hudc.dhuff = dec_huffdc + tdc;		dscans[i].huac.dhuff = dec_huffac + tac;	}		i = getbyte();	j = getbyte();	m = getbyte();		if (i != 0 || j != 63 || m != 0){		err = ERR_NOT_SEQUENTIAL_DCT;		goto error;	}		if (dscans[0].cid != 1 || dscans[1].cid != 2 || dscans[2].cid != 3){		err = ERR_NOT_YCBCR_221111;		goto error;	}	if (dscans[1].hv != 0x11 || dscans[2].hv != 0x11){		err = ERR_NOT_YCBCR_221111;		goto error;	}	/* if internal width and external are not the same or heigth too 	and pic not allocated realloc the good size and mark the change 	need 1 macroblock line more ?? */	if (intwidth != *width || intheight != *height || *pic == NULL){		*width = intwidth;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产尤物一区二区在线| 国产乱码精品一区二区三| 26uuu亚洲综合色| 99精品视频一区二区三区| 久久精品国产免费| 一区二区三区在线播放| 久久久久久久久岛国免费| 欧美日韩一区二区在线观看 | 中文字幕不卡在线观看| 精品视频全国免费看| 成人教育av在线| 久色婷婷小香蕉久久| 一区二区三区在线观看欧美| 国产日韩高清在线| 日韩一区二区电影| 欧日韩精品视频| 91小宝寻花一区二区三区| 韩国成人精品a∨在线观看| 婷婷综合久久一区二区三区| 亚洲免费伊人电影| 欧美激情资源网| 2024国产精品| 欧美成人video| 欧美疯狂做受xxxx富婆| 欧美中文字幕一区二区三区 | 91.com视频| 欧美亚洲图片小说| 色综合久久久久久久久久久| 成人免费观看男女羞羞视频| 国产精品一区二区x88av| 麻豆成人综合网| 人人精品人人爱| 日本午夜一本久久久综合| 亚洲v日本v欧美v久久精品| 亚洲伦理在线精品| 亚洲免费观看高清完整版在线观看 | 欧美在线视频不卡| 91久久久免费一区二区| 色婷婷av一区二区三区大白胸| aaa国产一区| av在线一区二区| 91免费视频网址| 99久久er热在这里只有精品15| 成人黄色国产精品网站大全在线免费观看 | 欧美精品一区二| 精品国产乱码久久久久久闺蜜| 日韩欧美一级在线播放| 欧美xxx久久| 2020国产精品自拍| 久久精品一区二区三区av| 国产日韩成人精品| 亚洲欧美一区二区视频| 一区二区三区欧美激情| 亚洲国产成人tv| 日产国产欧美视频一区精品| 久色婷婷小香蕉久久| 国产一区日韩二区欧美三区| 国产成人精品三级麻豆| 92精品国产成人观看免费| 色欲综合视频天天天| 欧美日韩精品专区| 精品日韩成人av| 中文文精品字幕一区二区| 亚洲另类在线一区| 日本vs亚洲vs韩国一区三区二区 | 97久久超碰国产精品| 欧美中文字幕亚洲一区二区va在线| 欧美美女一区二区| 26uuu国产一区二区三区| 国产精品国产三级国产三级人妇| 一区二区三区高清在线| 日韩av二区在线播放| 成人免费看的视频| 欧美老肥妇做.爰bbww| 亚洲精品在线一区二区| 亚洲欧美另类图片小说| 人妖欧美一区二区| 成人永久看片免费视频天堂| 欧美在线看片a免费观看| 日韩精品在线一区二区| 日韩一区中文字幕| 免费日本视频一区| 91在线观看地址| 日韩一级完整毛片| 中文字幕一区二区三区在线不卡| 午夜精品福利久久久| 国产精品亚洲第一| 精品视频999| 国产人伦精品一区二区| 亚洲在线视频一区| 国产精品一区二区在线看| 在线国产亚洲欧美| 久久精品一区二区| 丝袜亚洲精品中文字幕一区| 丰满少妇在线播放bd日韩电影| 欧美美女激情18p| 成人免费在线播放视频| 亚洲高清视频的网址| 成人久久视频在线观看| 欧美日本一道本| 国产精品理论在线观看| 久久国产精品99精品国产| 色噜噜狠狠成人中文综合| 久久久午夜电影| 日日骚欧美日韩| 一本一道久久a久久精品| 久久综合精品国产一区二区三区| 亚洲免费观看高清在线观看| 国产精品一区二区三区99| 91精品国产黑色紧身裤美女| 亚洲精选视频在线| 国产成人99久久亚洲综合精品| 欧美一区二区视频网站| 亚洲最大色网站| 99久久精品久久久久久清纯| 久久精品人人爽人人爽| 美女视频一区二区| 51精品国自产在线| 亚洲成人自拍网| 一本一道波多野结衣一区二区| 久久久精品影视| 精品无人区卡一卡二卡三乱码免费卡| 欧美精品丝袜久久久中文字幕| 亚洲综合色噜噜狠狠| 99热这里都是精品| 中文字幕一区二区三中文字幕| 国产不卡在线视频| 久久久久久久一区| 精品亚洲porn| 精品国产91乱码一区二区三区 | 久久国产精品72免费观看| 欧美巨大另类极品videosbest | 免费黄网站欧美| 欧美男同性恋视频网站| 五月婷婷综合激情| 欧美精品久久久久久久多人混战| 亚洲一级二级三级| 欧美日韩一区二区三区高清| 亚洲狠狠爱一区二区三区| 欧美日韩亚洲不卡| 五月激情丁香一区二区三区| 欧美人与z0zoxxxx视频| 午夜视频一区二区三区| 欧美精品一卡二卡| 美脚の诱脚舐め脚责91 | 国产免费成人在线视频| 国产成a人亚洲| 亚洲欧洲性图库| 欧美自拍丝袜亚洲| 日韩精品欧美精品| 欧美成人a视频| 国产精品88av| 成人欧美一区二区三区| 91福利社在线观看| 婷婷六月综合网| 精品国产一区二区三区久久影院 | 国产精品美女久久久久高潮| www.日韩精品| 亚洲一区二区精品3399| 欧美一区二区视频网站| 国产精品一级二级三级| 日韩理论片一区二区| 欧美日韩中文字幕精品| 美腿丝袜亚洲一区| 中文字幕欧美日韩一区| 91免费视频网| 男男视频亚洲欧美| 国产网站一区二区| 色素色在线综合| 美女一区二区在线观看| 国产精品入口麻豆原神| 色综合天天性综合| 老司机精品视频在线| 国产精品你懂的在线| 欧美四级电影网| 国产麻豆午夜三级精品| 国产精品欧美综合在线| 欧美制服丝袜第一页| 国内精品久久久久影院一蜜桃| 1区2区3区国产精品| 欧美一区二视频| 高清在线成人网| 亚洲第一主播视频| 久久久www成人免费毛片麻豆| 在线免费亚洲电影| 国产在线观看一区二区| 一区二区三区 在线观看视频| 欧美成人a∨高清免费观看| 91蜜桃传媒精品久久久一区二区| 免费在线欧美视频| 亚洲免费观看视频| 久久久久综合网| 欧美美女黄视频| 91小宝寻花一区二区三区| 久久99精品久久久久久久久久久久| 亚洲人午夜精品天堂一二香蕉| 精品久久一区二区三区| 精品视频资源站| 成人黄色在线网站| 国内精品伊人久久久久av一坑|