<commit_before># Live video output (display video on the screen, presumably from the net)

import gl
from VFile import Displayer


# Video output (displayer) class.

class LiveVideoOut:

	# Call this to initialize things.  Arguments:
	# wid:    the window id where the video is to be displayed (centered)
	# vw, vh: size of the video image to be displayed

	def init(self, wid, vw, vh, type):
		##print 'Init', wid, xywh
		##print 'video', vw, vw
		self.vw = vw
		self.vh = vh
		self.disp = Displayer().init()
		if not type in ('rgb8', 'grey', 'mono', 'grey2', 'grey4'):
			raise 'Incorrent live video output type', type
		info = (type, vw, vh, 1, 8, 0, 0, 0, 0)
		self.disp.setinfo(info)
		self.wid = wid
		oldwid = gl.winget()
		gl.winset(wid)
		self.disp.initcolormap()
		self.reshapewindow()
		gl.winset(oldwid)
		return self

	# Call this in response to every REDRAW event for the window
	# or if the window size has changed for other reasons.

	def reshapewindow(self):
		oldwid = gl.winget()
		gl.winset(self.wid)
		gl.reshapeviewport()
		w, h = gl.getsize()
		self.disp.xorigin = (w-self.vw)/2
		self.disp.yorigin = (h-self.vh)/2
		self.disp.clear()
		gl.winset(oldwid)

	# Call this to change the size of the video images being displayed.
	# Implies reshapewindow().

	def resizevideo(self, vw, vh):
		self.vw, self.vh = vw, vh
		self.disp.setsize(vw, vh)
		self.reshapewindow()

	# Return the number of bytes in one video line
	def linewidth(self):
		if self.disp.format == 'mono':
			return (self.vw+7)/8
		elif self.disp.format == 'grey2':
			return (self.vw+3)/4
		elif self.disp.format == 'grey4':<commit_msg>Added support for 24-bit rgb movies<commit_after># Live video output (display video on the screen, presumably from the net)

import gl
from VFile import Displayer


# Video output (displayer) class.

class LiveVideoOut:

	# Call this to initialize things.  Arguments:
	# wid:    the window id where the video is to be displayed (centered)
	# vw, vh: size of the video image to be displayed

	def init(self, wid, vw, vh, type):
		##print 'Init', wid, xywh
		##print 'video', vw, vw
		self.vw = vw
		self.vh = vh
		self.disp = Displayer().init()
		if not type in ('rgb', 'rgb8', 'grey', 'mono', 'grey2', \
			  'grey4'):
			raise 'Incorrent live video output type', type
		if type == 'rgb':
			info = (type, vw, vh, 0, 32, 0, 0, 0, 0)
		else:
			info = (type, vw, vh, 1, 8, 0, 0, 0, 0)
		self.disp.setinfo(info)
		self.wid = wid
		oldwid = gl.winget()
		gl.winset(wid)
		self.disp.initcolormap()
		self.reshapewindow()
		gl.winset(oldwid)
		return self

	# Call this in response to every REDRAW event for the window
	# or if the window size has changed for other reasons.

	def reshapewindow(self):
		oldwid = gl.winget()
		gl.winset(self.wid)
		gl.reshapeviewport()
		w, h = gl.getsize()
		self.disp.xorigin = (w-self.vw)/2
		self.disp.yorigin = (h-self.vh)/2
		self.disp.clear()
		gl.winset(oldwid)

	# Call this to change the size of the video images being displayed.
	# Implies reshapewindow().

	def resizevideo(self, vw, vh):
		self.vw, self.vh = vw, vh
		self.disp.setsize(vw, vh)
		self.reshapewindow()

	# Return the number of bytes in one video line
	def linewidth(self):
		if self.disp.format == 'rgb':
			return self.vw*4
		if self.disp.format == 'mono':
			return (self.vw+7)/8
		elif self.disp.format == 'grey2':
			return (self.vw+3)/4
		elif self.disp.format == 'grey4':
{'fraction_non_alphanumeric': 0.13237452304079836, 'fraction_numerical': 0.012914587613736424, 'mean_word_length': 3.386100386100386, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7294839', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1265, 'n_words': 414}