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

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

?? vfile.py

?? reduced python source for embedded apps
?? PY
?? 第 1 頁 / 共 2 頁
字號:
# Classes to read and write CMIF video files.# (For a description of the CMIF video format, see cmif-file.ms.)# Layers of functionality:## VideoParams: maintain essential parameters of a video file# Displayer: display a frame in a window (with some extra parameters)# BasicVinFile: read a CMIF video file# BasicVoutFile: write a CMIF video file# VinFile: BasicVinFile + Displayer# VoutFile: BasicVoutFile + Displayer## XXX Future extension:# BasicVinoutFile: supports overwriting of individual frames# Imported modulesimport systry:	import gl	import GL	import GET	no_gl = 0except ImportError:	no_gl = 1import colorsysimport imageop# Exception raised for various occasionsError = 'VFile.Error'			# file format errorsCallError = 'VFile.CallError'		# bad callAssertError = 'VFile.AssertError'	# internal malfunction# Max nr. of colormap entries to useMAXMAP = 4096 - 256# Parametrizations of colormap handling based on color system.# (These functions are used via eval with a constructed argument!)def conv_grey(l, x, y):	return colorsys.yiq_to_rgb(l, 0, 0)def conv_grey4(l, x, y):	return colorsys.yiq_to_rgb(l*17, 0, 0)def conv_mono(l, x, y):	return colorsys.yiq_to_rgb(l*255, 0, 0)def conv_yiq(y, i, q):	return colorsys.yiq_to_rgb(y, (i-0.5)*1.2, q-0.5)def conv_hls(l, h, s):	return colorsys.hls_to_rgb(h, l, s)def conv_hsv(v, h, s):	return colorsys.hsv_to_rgb(h, s, v)def conv_rgb(r, g, b):	raise Error, 'Attempt to make RGB colormap'def conv_rgb8(rgb, d1, d2):	rgb = int(rgb*255.0)	r = (rgb >> 5) & 0x07	g = (rgb     ) & 0x07	b = (rgb >> 3) & 0x03	return (r/7.0, g/7.0, b/3.0)def conv_jpeg(r, g, b):	raise Error, 'Attempt to make RGB colormap (jpeg)'conv_jpeggrey = conv_greyconv_grey2 = conv_grey# Choose one of the above based upon a color system namedef choose_conversion(format):	try:		return eval('conv_' + format)	except:		raise Error, 'Unknown color system: ' + `format`# Inverses of the abovedef inv_grey(r, g, b):	y, i, q = colorsys.rgb_to_yiq(r, g, b)	return y, 0, 0def inv_yiq(r, g, b):	y, i, q = colorsys.rgb_to_yiq(r, g, b)	return y, i/1.2 + 0.5, q + 0.5def inv_hls(r, g, b):	h, l, s = colorsys.rgb_to_hls(r, g, b)	return l, h, sdef inv_hsv(r, g, b):	h, s, v = colorsys.rgb_to_hsv(r, g, b)	return v, h, sdef inv_rgb(r, g, b):	raise Error, 'Attempt to invert RGB colormap'def inv_rgb8(r, g, b):	r = int(r*7.0)	g = int(g*7.0)	b = int(b*7.0)	rgb = ((r&7) << 5) | ((b&3) << 3) | (g&7)	return rgb / 255.0, 0, 0def inv_jpeg(r, g, b):	raise Error, 'Attempt to invert RGB colormap (jpeg)'inv_jpeggrey = inv_grey# Choose one of the above based upon a color system namedef choose_inverse(format):	try:		return eval('inv_' + format)	except:		raise Error, 'Unknown color system: ' + `format`# Predicate to see whether this is an entry level (non-XS) Indigo.# If so we can lrectwrite 8-bit wide pixels into a window in RGB modedef is_entry_indigo():	# XXX hack, hack.  We should call gl.gversion() but that doesn't	# exist in earlier Python versions.  Therefore we check the number	# of bitplanes *and* the size of the monitor.	xmax = gl.getgdesc(GL.GD_XPMAX)	if xmax <> 1024: return 0	ymax = gl.getgdesc(GL.GD_YPMAX)	if ymax != 768: return 0	r = gl.getgdesc(GL.GD_BITS_NORM_SNG_RED)	g = gl.getgdesc(GL.GD_BITS_NORM_SNG_GREEN)	b = gl.getgdesc(GL.GD_BITS_NORM_SNG_BLUE)	return (r, g, b) == (3, 3, 2)# Predicate to see whether this machine supports pixmode(PM_SIZE) with# values 1 or 4.## XXX Temporarily disabled, since it is unclear which machines support# XXX which pixelsizes.## XXX The XS appears to support 4 bit pixels, but (looking at osview) it# XXX seems as if the conversion is done by the kernel (unpacking ourselves# XXX is faster than using PM_SIZE=4)def support_packed_pixels():	return 0   # To be architecture-dependent# Tables listing bits per pixel for some formatsbitsperpixel = { \	  'rgb': 32, \	  'rgb8': 8, \	  'grey': 8, \	  'grey4': 4, \	  'grey2': 2, \	  'mono': 1, \	  'compress': 32, \}bppafterdecomp = {'jpeg': 32, 'jpeggrey': 8}# Base class to manage video format parametersclass VideoParams:	# Initialize an instance.	# Set all parameters to something decent	# (except width and height are set to zero)	def __init__(self):		# Essential parameters		self.frozen = 0		# if set, can't change parameters		self.format = 'grey'	# color system used		# Choose from: grey, rgb, rgb8, hsv, yiq, hls, jpeg, jpeggrey,		#              mono, grey2, grey4		self.width = 0		# width of frame		self.height = 0		# height of frame		self.packfactor = 1, 1	# expansion using rectzoom		# Colormap info		self.c0bits = 8		# bits in first color dimension		self.c1bits = 0		# bits in second color dimension		self.c2bits = 0		# bits in third color dimension		self.offset = 0		# colormap index offset (XXX ???)		self.chrompack = 0	# set if separate chrominance data		self.setderived()		self.decompressor = None	# Freeze the parameters (disallow changes)	def freeze(self):		self.frozen = 1	# Unfreeze the parameters (allow changes)	def unfreeze(self):		self.frozen = 0	# Set some values derived from the standard info values	def setderived(self):		if self.frozen: raise AssertError		if bitsperpixel.has_key(self.format):			self.bpp = bitsperpixel[self.format]		else:			self.bpp = 0		xpf, ypf = self.packfactor		self.xpf = abs(xpf)		self.ypf = abs(ypf)		self.mirror_image = (xpf < 0)		self.upside_down = (ypf < 0)		self.realwidth = self.width / self.xpf		self.realheight = self.height / self.ypf	# Set colormap info	def setcmapinfo(self):		stuff = 0, 0, 0, 0, 0		if self.format in ('rgb8', 'grey'):			stuff = 8, 0, 0, 0, 0		if self.format == 'grey4':			stuff = 4, 0, 0, 0, 0		if self.format == 'grey2':			stuff = 2, 0, 0, 0, 0		if self.format == 'mono':			stuff = 1, 0, 0, 0, 0		self.c0bits, self.c1bits, self.c2bits, \			  self.offset, self.chrompack = stuff	# Set the frame width and height (e.g. from gl.getsize())	def setsize(self, width, height):		if self.frozen: raise CallError		width = (width/self.xpf)*self.xpf		height = (height/self.ypf)*self.ypf		self.width, self.height = width, height		self.setderived()	# Retrieve the frame width and height (e.g. for gl.prefsize())	def getsize(self):		return (self.width, self.height)	# Set the format	def setformat(self, format):		if self.frozen: raise CallError		self.format = format		self.setderived()		self.setcmapinfo()	# Get the format	def getformat(self):		return self.format	# Set the packfactor	def setpf(self, pf):		if self.frozen: raise CallError		if type(pf) == type(1):			pf = (pf, pf)		if type(pf) is not type(()) or len(pf) <> 2: raise CallError		self.packfactor = pf		self.setderived()	# Get the packfactor	def getpf(self):		return self.packfactor	# Set all parameters	def setinfo(self, values):		if self.frozen: raise CallError		self.setformat(values[0])		self.setpf(values[3])		self.setsize(values[1], values[2])		(self.c0bits, self.c1bits, self.c2bits, \			  self.offset, self.chrompack) = values[4:9]		if self.format == 'compress' and len(values) > 9:			self.compressheader = values[9]		self.setderived()	# Retrieve all parameters in a format suitable for a subsequent	# call to setinfo()	def getinfo(self):		return (self.format, self.width, self.height, self.packfactor,\			self.c0bits, self.c1bits, self.c2bits, self.offset, \			self.chrompack)	def getcompressheader(self):		return self.compressheader	def setcompressheader(self, ch):		self.compressheader = ch	# Write the relevant bits to stdout	def printinfo(self):		print 'Format:  ', self.format		print 'Size:    ', self.width, 'x', self.height		print 'Pack:    ', self.packfactor, '; chrom:', self.chrompack		print 'Bpp:     ', self.bpp		print 'Bits:    ', self.c0bits, self.c1bits, self.c2bits		print 'Offset:  ', self.offset	# Calculate data size, if possible	# (Not counting frame header or cdata size)	def calcframesize(self):		if not self.bpp: raise CallError		size = self.width/self.xpf * self.height/self.ypf		size = (size * self.bpp + 7) / 8		return size	# Decompress a possibly compressed frame. This method is here	# since you sometimes want to use it on a VFile instance and sometimes	# on a Displayer instance.	#	# XXXX This should also handle jpeg. Actually, the whole mechanism	# should be much more of 'ihave/iwant' style, also allowing you to	# read, say, greyscale images from a color movie.		def decompress(self, data):		if self.format <> 'compress':			return data		if not self.decompressor:			import cl			scheme = cl.QueryScheme(self.compressheader)			self.decompressor = cl.OpenDecompressor(scheme)			headersize = self.decompressor.ReadHeader(self.compressheader)			width = self.decompressor.GetParam(cl.IMAGE_WIDTH)			height = self.decompressor.GetParam(cl.IMAGE_HEIGHT)			params = [cl.ORIGINAL_FORMAT, cl.RGBX, \				  cl.ORIENTATION, cl.BOTTOM_UP, \				  cl.FRAME_BUFFER_SIZE, width*height*cl.BytesPerPixel(cl.RGBX)]			self.decompressor.SetParams(params)		data = self.decompressor.Decompress(1, data)		return data# Class to display video frames in a window.# It is the caller's responsibility to ensure that the correct window# is current when using showframe(), initcolormap(), clear() and clearto()class Displayer(VideoParams):	# Initialize an instance.	# This does not need a current window	def __init__(self):		if no_gl:			raise RuntimeError, \				  'no gl module available, so cannot display'		VideoParams.__init__(self)		# User-settable parameters		self.magnify = 1.0	# frame magnification factor		self.xorigin = 0	# x frame offset		self.yorigin = 0	# y frame offset (from bottom)		self.quiet = 0		# if set, don't print messages		self.fallback = 1	# allow fallback to grey		# Internal flags		self.colormapinited = 0	# must initialize window		self.skipchrom = 0	# don't skip chrominance data		self.color0 = None	# magic, used by clearto()		self.fixcolor0 = 0	# don't need to fix color0		self.mustunpack = (not support_packed_pixels())	# setinfo() must reset some internal flags	def setinfo(self, values):		VideoParams.setinfo(self, values)		self.colormapinited = 0		self.skipchrom = 0		self.color0 = None		self.fixcolor0 = 0	# Show one frame, initializing the window if necessary	def showframe(self, data, chromdata):		self.showpartframe(data, chromdata, \			  (0,0,self.width,self.height))	def showpartframe(self, data, chromdata, (x,y,w,h)):		pmsize = self.bpp		xpf, ypf = self.xpf, self.ypf		if self.upside_down:			gl.pixmode(GL.PM_TTOB, 1)		if self.mirror_image:			gl.pixmode(GL.PM_RTOL, 1)		if self.format in ('jpeg', 'jpeggrey'):			import jpeg			data, width, height, bytes = jpeg.decompress(data)			pmsize = bytes*8		elif self.format == 'compress':			data = self.decompress(data)			pmsize = 32		elif self.format in ('mono', 'grey4'):			if self.mustunpack:				if self.format == 'mono':					data = imageop.mono2grey(data, \						  w/xpf, h/ypf, 0x20, 0xdf)				elif self.format == 'grey4':					data = imageop.grey42grey(data, \						  w/xpf, h/ypf)				pmsize = 8		elif self.format == 'grey2':			data = imageop.grey22grey(data, w/xpf, h/ypf)			pmsize = 8		if not self.colormapinited:			self.initcolormap()		if self.fixcolor0:			gl.mapcolor(self.color0)			self.fixcolor0 = 0		xfactor = yfactor = self.magnify		xfactor = xfactor * xpf		yfactor = yfactor * ypf		if chromdata and not self.skipchrom:			cp = self.chrompack			cx = int(x*xfactor*cp) + self.xorigin			cy = int(y*yfactor*cp) + self.yorigin			cw = (w+cp-1)/cp			ch = (h+cp-1)/cp			gl.rectzoom(xfactor*cp, yfactor*cp)			gl.pixmode(GL.PM_SIZE, 16)			gl.writemask(self.mask - ((1 << self.c0bits) - 1))			gl.lrectwrite(cx, cy, cx + cw - 1, cy + ch - 1, \				  chromdata)		#		if pmsize < 32:			gl.writemask((1 << self.c0bits) - 1)		gl.pixmode(GL.PM_SIZE, pmsize)		w = w/xpf		h = h/ypf		x = x/xpf		y = y/ypf		gl.rectzoom(xfactor, yfactor)		x = int(x*xfactor)+self.xorigin		y = int(y*yfactor)+self.yorigin		gl.lrectwrite(x, y, x + w - 1, y + h - 1, data)		gl.gflush()	# Initialize the window: set RGB or colormap mode as required,	# fill in the colormap, and clear the window	def initcolormap(self):		self.colormapinited = 1		self.color0 = None		self.fixcolor0 = 0		if self.format in ('rgb', 'jpeg', 'compress'):			self.set_rgbmode()			gl.RGBcolor(200, 200, 200) # XXX rather light grey			gl.clear()			return		# This only works on an Entry-level Indigo from IRIX 4.0.5		if self.format == 'rgb8' and is_entry_indigo() and \			  gl.gversion() == 'GL4DLG-4.0.': # Note trailing '.'!			self.set_rgbmode()			gl.RGBcolor(200, 200, 200) # XXX rather light grey			gl.clear()			gl.pixmode(GL.PM_SIZE, 8)			return		self.set_cmode()		self.skipchrom = 0		if self.offset == 0:			self.mask = 0x7ff		else:			self.mask = 0xfff		if not self.quiet:			sys.stderr.write('Initializing color map...')		self._initcmap()		gl.clear()		if not self.quiet:			sys.stderr.write(' Done.\n')	# Set the window in RGB mode (may be overridden for Glx window)	def set_rgbmode(self):		gl.RGBmode()		gl.gconfig()	# Set the window in colormap mode (may be overridden for Glx window)	def set_cmode(self):		gl.cmode()		gl.gconfig()	# Clear the window to a default color	def clear(self):		if not self.colormapinited: raise CallError		if gl.getdisplaymode() in (GET.DMRGB, GET.DMRGBDOUBLE):			gl.RGBcolor(200, 200, 200) # XXX rather light grey			gl.clear()			return		gl.writemask(0xffffffff)		gl.clear()	# Clear the window to a given RGB color.	# This may steal the first color index used; the next call to	# showframe() will restore the intended mapping for that index	def clearto(self, r, g, b):		if not self.colormapinited: raise CallError		if gl.getdisplaymode() in (GET.DMRGB, GET.DMRGBDOUBLE):			gl.RGBcolor(r, g, b)			gl.clear()			return		index = self.color0[0]		self.fixcolor0 = 1		gl.mapcolor(index, r, g, b)		gl.writemask(0xffffffff)		gl.clear()		gl.gflush()	# Do the hard work for initializing the colormap (internal).	# This also sets the current color to the first color index	# used -- the caller should never change this since it is used	# by clear() and clearto()	def _initcmap(self):		map = []		if self.format in ('mono', 'grey4') and self.mustunpack:			convcolor = conv_grey		else:			convcolor = choose_conversion(self.format)		maxbits = gl.getgdesc(GL.GD_BITS_NORM_SNG_CMODE)		if maxbits > 11:			maxbits = 11		c0bits = self.c0bits		c1bits = self.c1bits		c2bits = self.c2bits		if c0bits+c1bits+c2bits > maxbits:			if self.fallback and c0bits < maxbits:				# Cannot display frames in this mode, use grey				self.skipchrom = 1				c1bits = c2bits = 0				convcolor = choose_conversion('grey')			else:				raise Error, 'Sorry, '+`maxbits`+ \				  ' bits max on this machine'		maxc0 = 1 << c0bits		maxc1 = 1 << c1bits		maxc2 = 1 << c2bits		if self.offset == 0 and maxbits == 11:			offset = 2048		else:			offset = self.offset		if maxbits <> 11:			offset = offset & ((1<<maxbits)-1)		self.color0 = None		self.fixcolor0 = 0		for c0 in range(maxc0):			c0v = c0/float(maxc0-1)			for c1 in range(maxc1):				if maxc1 == 1:					c1v = 0				else:					c1v = c1/float(maxc1-1)				for c2 in range(maxc2):					if maxc2 == 1:						c2v = 0					else:						c2v = c2/float(maxc2-1)					index = offset + c0 + (c1<<c0bits) + \						(c2 << (c0bits+c1bits))					if index < MAXMAP:						rv, gv, bv = \						  convcolor(c0v, c1v, c2v)						r, g, b = int(rv*255.0), \							  int(gv*255.0), \							  int(bv*255.0)						map.append((index, r, g, b))						if self.color0 == None:							self.color0 = \								index, r, g, b		self.install_colormap(map)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二| 欧美又粗又大又爽| 99视频热这里只有精品免费| 欧美日韩国产免费| 久久九九99视频| 亚洲风情在线资源站| 夫妻av一区二区| 欧美一激情一区二区三区| 亚洲欧美一区二区三区久本道91| 老司机精品视频一区二区三区| 91福利国产成人精品照片| 久久免费看少妇高潮| 天堂精品中文字幕在线| 91免费看视频| 国产欧美日韩亚州综合| 国产专区综合网| 精品一区二区三区在线播放| 91官网在线免费观看| 国产女主播视频一区二区| 久久精品国产久精国产| 欧美日本韩国一区| 亚洲国产精品综合小说图片区| 成人午夜精品在线| 国产精品每日更新| 成人精品小蝌蚪| 国产日韩一级二级三级| 国内成人自拍视频| xnxx国产精品| 极品瑜伽女神91| 精品成人私密视频| 久久66热re国产| 久久只精品国产| 国产精品亚洲午夜一区二区三区 | 精品一区二区三区av| 日韩一区二区在线观看视频| 日韩精品电影在线观看| 91精品视频网| 69精品人人人人| 欧美性极品少妇| 精品少妇一区二区三区免费观看| 日韩成人av影视| 欧美另类变人与禽xxxxx| 性做久久久久久久久| 欧美日韩中文另类| 亚洲成人免费观看| 欧美一区二区三区思思人| 久久国产三级精品| 日韩一区二区三区在线视频| 国产精品一区久久久久| 国产精品久久久久久户外露出| 91在线视频观看| 亚洲一区在线视频观看| 69久久99精品久久久久婷婷| 韩国精品主播一区二区在线观看| 国产色一区二区| 国产91清纯白嫩初高中在线观看 | 97se亚洲国产综合自在线| 亚洲人成在线观看一区二区| 欧美狂野另类xxxxoooo| 国产成人精品免费网站| 欧美国产精品一区二区三区| 色综合久久久久综合99| 性久久久久久久久| 国产亚洲一区字幕| 精品视频1区2区3区| 狠狠色狠狠色合久久伊人| 1区2区3区国产精品| 制服丝袜日韩国产| 成人久久视频在线观看| 午夜精品视频在线观看| 精品盗摄一区二区三区| 91国产精品成人| 精品系列免费在线观看| 亚洲在线视频一区| 久久综合色鬼综合色| 91精品1区2区| 国产成人综合自拍| 婷婷夜色潮精品综合在线| 中文字幕在线一区| 日韩久久精品一区| 欧美性受xxxx黑人xyx| 国产 日韩 欧美大片| 日产精品久久久久久久性色| 中文字幕一区二区在线观看 | 一本色道亚洲精品aⅴ| 国产在线精品一区在线观看麻豆| 亚洲一二三四在线| 国产精品素人视频| 精品国产一区二区三区久久影院| 欧美体内she精视频| 99久久久久久99| 国产一区二区美女| 美女国产一区二区| 日韩福利电影在线观看| 一级做a爱片久久| 亚洲视频网在线直播| 久久视频一区二区| 精品蜜桃在线看| 8x福利精品第一导航| 精品视频色一区| 色噜噜狠狠色综合欧洲selulu| 成人一区二区三区中文字幕| 久久机这里只有精品| 日韩精品一卡二卡三卡四卡无卡 | 国产日产精品一区| 久久精品人人爽人人爽| 精品久久久久久久久久久院品网 | 国产女主播一区| 国产女人18水真多18精品一级做| 亚洲精品在线三区| 亚洲精品一区在线观看| 欧美大肚乱孕交hd孕妇| 欧美一区在线视频| 日韩精品最新网址| 精品精品国产高清a毛片牛牛| 欧美一二区视频| 精品入口麻豆88视频| 欧美成人官网二区| 国产亚洲一区二区三区| 国产视频亚洲色图| 中文字幕亚洲成人| 亚洲精品乱码久久久久久日本蜜臀| 中文字幕日韩一区二区| 亚洲人成影院在线观看| 一区二区三区视频在线看| 悠悠色在线精品| 亚洲chinese男男1069| 日本在线不卡视频一二三区| 另类的小说在线视频另类成人小视频在线 | 国产精品人成在线观看免费| 中文字幕制服丝袜成人av| 一区二区在线电影| 日韩精品免费专区| 国产一区二区视频在线| 成人动漫视频在线| 欧美专区亚洲专区| 日韩三级免费观看| 国产精品免费丝袜| 亚洲大片精品永久免费| 捆绑调教一区二区三区| 国产麻豆视频精品| 91精品91久久久中77777| 日韩一区二区三| 国产欧美日韩精品a在线观看| 亚洲麻豆国产自偷在线| 免费人成网站在线观看欧美高清| 国内精品写真在线观看| 91麻豆免费观看| 日韩欧美另类在线| 中文字幕在线观看不卡视频| 日韩不卡一二三区| 成人动漫一区二区| 日韩精品最新网址| 亚洲精品免费电影| 国产在线麻豆精品观看| 欧美三级午夜理伦三级中视频| 2023国产精华国产精品| 一级特黄大欧美久久久| 国产乱子伦视频一区二区三区 | 成人性生交大片免费看中文| 欧美日韩国产中文| 国产精品国产三级国产普通话99 | 一本色道久久综合亚洲aⅴ蜜桃 | 国产精品一区二区免费不卡| 成人sese在线| 欧美老女人在线| 日本一区二区成人| 蜜臀av一区二区| 91久久线看在观草草青青| 亚洲国产高清在线| 蜜臀av性久久久久蜜臀aⅴ四虎| 成人av资源在线观看| 日韩欧美一区电影| 亚洲第一综合色| 91免费看`日韩一区二区| 国产亚洲欧美激情| 亚洲免费观看高清完整版在线观看| 亚洲一级二级在线| 色婷婷一区二区| 久久天堂av综合合色蜜桃网| 天堂成人免费av电影一区| 色婷婷综合激情| 亚洲免费在线电影| 成人免费毛片高清视频| 国产亚洲成av人在线观看导航| 水蜜桃久久夜色精品一区的特点| 色哟哟亚洲精品| 亚洲精品欧美激情| 色呦呦国产精品| 亚洲人成精品久久久久| 99久久久久久| 中文字幕一区二| 91亚洲精品久久久蜜桃网站| 亚洲欧洲一区二区三区| 不卡视频在线观看| 亚洲视频一区在线| 一本一本大道香蕉久在线精品 | 婷婷开心久久网| 欧美三区在线视频| 爽爽淫人综合网网站|