How to use the munch.IT214Compressor function in munch

To help you get started, we’ve selected a few munch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iamgreaser / it2everything / munch.py View on Github external
print "compressed: %i" % blkcomplen
			print "ratio: %.2f" % (float(blkcomplen*100)/length)
			
			using_it215 = False
			if COMPRESS_IT215:
				print "Recompressing sample data as IT215"
				offs = 0
				xlen = length
				it215data = []
				print "uncompressed: %i" % length
				totblkcomplen = 0
				do_stereo = (flags & 4) != 0
				if do_stereo:
					xlen >>= 1
				while xlen > 0:
					comp = IT214Compressor(unpacked_data, offs, xlen, (flags&2) != 0, True)
					it215data += comp.get_data()
					blkuncomplen = comp.get_length()
					offs += blkuncomplen
					xlen -= blkuncomplen
					if xlen <= 0 and do_stereo: # doing it XMPlay-style
						xlen = length>>1
						do_stereo = False
				blkcomplen215 = len(it215data)
				print "compressed (214): %i" % blkcomplen
				print "compressed (215): %i" % blkcomplen215
				print "ratio (215): %.2f" % (float(blkcomplen215*100)/length)
				if blkcomplen215 < blkcomplen:
					print "using IT215 sample, YES"
					self.data = it215data
					using_it215 = True
				else:
github iamgreaser / it2everything / munch.py View on Github external
#	raise Exception("unsigned-to-signed conversion not supported yet")
		
		if COMPRESS_IT214 and not (sample.flags & 8):
			print "Compressing sample data FOR THE SMULZ"
			print "Sample bit depth: %i-bit" % (16 if (flags & 2) else 8)
			offs = 0
			xlen = length
			unpacked_data = self.data
			self.data = []
			print "uncompressed: %i" % length
			totblkcomplen = 0
			do_stereo = (flags & 4) != 0
			if do_stereo:
				xlen >>= 1
			while xlen > 0:
				comp = IT214Compressor(unpacked_data, offs, xlen, (flags&2) != 0, False)
				self.data += comp.get_data()
				blkuncomplen = comp.get_length()
				offs += blkuncomplen
				xlen -= blkuncomplen
				if xlen <= 0 and do_stereo: # doing it XMPlay-style
					xlen = length>>1
					do_stereo = False
			blkcomplen = len(self.data)
			print "compressed: %i" % blkcomplen
			print "ratio: %.2f" % (float(blkcomplen*100)/length)
			
			using_it215 = False
			if COMPRESS_IT215:
				print "Recompressing sample data as IT215"
				offs = 0
				xlen = length