def execute(self, slot): work = self input_path = '/mnt/media/' + work.set + '/' + work.filename try: slot.start_shell('/home/ec2-user/rd_tool/ab_meta_compare.sh ' + shellquote(str(self.bpp)) + ' ' + shellquote(self.runid) + ' ' + work.set + ' ' + shellquote(input_path) + ' ' + shellquote(self.codec)) (stdout, stderr) = slot.gather() # filename with extension if 'video' in work.set: filename = input_path.split('/')[-1].rsplit('.', 1)[0] + '.ogv' else: filename = input_path.split('/')[-1].rsplit('.', 1)[0] + '.png' middle = self.runid + '/' + work.set + '/bpp_' + str(self.bpp) remote_file = '/home/ec2-user/runs/' + middle + '/' + shellquote(filename) local_folder = '../runs/' + middle local_file = '../runs/' + middle + '/' + filename subprocess.Popen(['mkdir', '--parents', local_folder]) slot.get_file(remote_file, local_file) self.failed = False except IndexError: rd_print('Encoding and copying', filename, 'at bpp', str(self.bpp), 'failed') rd_print('stdout:') rd_print(stdout.decode('utf-8')) rd_print('stderr:') rd_print(stderr.decode('utf-8')) self.failed = True
def execute(self, slot): work = self if self.individual: input_path = '/mnt/media/'+work.filename else: input_path = '/mnt/media/'+work.set+'/'+work.filename self.quality = int(float(subprocess.check_output(['../quantizer_log.m','../runs/'+self.runid+'/'+work.set+'/'+work.filename+'-daala.out',self.bpp]))) rd_print(self.filename + ' using quantizer ' + str(self.quality)) slot.start_shell(('DAALA_ROOT=/home/ec2-user/daala/ WORK_ROOT="'+slot.work_root+'" x="'+str(work.quality) + '" CODEC="'+work.codec+'" EXTRA_OPTIONS="'+work.extra_options + '" NO_DELETE=1 /home/ec2-user/rd_tool/metrics_gather.sh '+shellquote(input_path))) (stdout, stderr) = slot.gather() print(stdout) print(stderr)
def parse(self, stdout, stderr): self.raw = stdout split = None try: split = self.raw.decode('utf-8').replace(')', ' ').split() self.pixels = split[1] self.size = split[2] self.metric = {} self.metric['psnr'] = {} self.metric["psnr"][0] = split[6] self.metric["psnr"][1] = split[8] self.metric["psnr"][2] = split[10] self.metric['psnrhvs'] = {} self.metric["psnrhvs"][0] = split[14] self.metric["psnrhvs"][1] = split[16] self.metric["psnrhvs"][2] = split[18] self.metric['ssim'] = {} self.metric["ssim"][0] = split[22] self.metric["ssim"][1] = split[24] self.metric["ssim"][2] = split[26] self.metric['fastssim'] = {} self.metric["fastssim"][0] = split[30] self.metric["fastssim"][1] = split[32] self.metric["fastssim"][2] = split[34] self.metric['ciede2000'] = split[36] self.metric['apsnr'] = {} self.metric['apsnr'][0] = split[40] self.metric['apsnr'][1] = split[42] self.metric['apsnr'][2] = split[44] self.metric['msssim'] = {} self.metric['msssim'][0] = split[48] self.metric['msssim'][1] = split[50] self.metric['msssim'][2] = split[52] self.failed = False except IndexError: rd_print('Decoding result for ' + self.filename + ' at quality ' + str(self.quality) + 'failed!') rd_print('stdout:') rd_print(stdout.decode('utf-8')) rd_print('stderr:') rd_print(stderr.decode('utf-8')) self.failed = True
def parse(self, stdout, stderr): self.raw = stdout split = None try: split = self.raw.decode('utf-8').replace(')',' ').split() self.pixels = split[1] self.size = split[2] self.metric = {} self.metric['psnr'] = {} self.metric["psnr"][0] = split[6] self.metric["psnr"][1] = split[8] self.metric["psnr"][2] = split[10] self.metric['psnrhvs'] = {} self.metric["psnrhvs"][0] = split[14] self.metric["psnrhvs"][1] = split[16] self.metric["psnrhvs"][2] = split[18] self.metric['ssim'] = {} self.metric["ssim"][0] = split[22] self.metric["ssim"][1] = split[24] self.metric["ssim"][2] = split[26] self.metric['fastssim'] = {} self.metric["fastssim"][0] = split[30] self.metric["fastssim"][1] = split[32] self.metric["fastssim"][2] = split[34] self.metric['ciede2000'] = split[36] self.metric['apsnr'] = {} self.metric['apsnr'][0] = split[40] self.metric['apsnr'][1] = split[42] self.metric['apsnr'][2] = split[44] self.metric['msssim'] = {} self.metric['msssim'][0] = split[48] self.metric['msssim'][1] = split[50] self.metric['msssim'][2] = split[52] self.metric['encodetime'] = split[53] self.failed = False except IndexError: rd_print('Decoding result for '+self.filename+' at quality '+str(self.quality)+' failed!') rd_print('stdout:') rd_print(stdout.decode('utf-8')) rd_print('stderr:') rd_print(stderr.decode('utf-8')) self.failed = True
def execute(self, slot): work = self if self.individual: input_path = '/mnt/media/' + work.filename else: input_path = '/mnt/media/' + work.set + '/' + work.filename self.quality = int( float( subprocess.check_output([ '../quantizer_log.m', '../runs/' + self.runid + '/' + work.set + '/' + work.filename + '-daala.out', self.bpp ]))) rd_print(self.filename + ' using quantizer ' + str(self.quality)) slot.start_shell( ('DAALA_ROOT=/home/ec2-user/daala/ WORK_ROOT="' + slot.work_root + '" x="' + str(work.quality) + '" CODEC="' + work.codec + '" EXTRA_OPTIONS="' + work.extra_options + '" NO_DELETE=1 /home/ec2-user/rd_tool/metrics_gather.sh ' + shellquote(input_path))) (stdout, stderr) = slot.gather() print(stdout) print(stderr)
def execute(self, slot): work = self input_path = '/mnt/media/' + work.set + '/' + work.filename try: slot.start_shell('/home/ec2-user/rd_tool/ab_meta_compare.sh ' + shellquote(str(self.bpp)) + ' ' + shellquote(self.runid) + ' ' + work.set + ' ' + shellquote(input_path) + ' ' + shellquote(self.codec)) (stdout, stderr) = slot.gather() # filename with extension if 'video' in work.set: filename = input_path.split('/')[-1].rsplit('.', 1)[0] + '.ogv' else: filename = input_path.split('/')[-1].rsplit('.', 1)[0] + '.png' middle = self.runid + '/' + work.set + '/bpp_' + str(self.bpp) remote_file = '/home/ec2-user/runs/' + middle + '/' + shellquote( filename) local_folder = '../runs/' + middle local_file = '../runs/' + middle + '/' + filename subprocess.Popen(['mkdir', '--parents', local_folder]) slot.get_file(remote_file, local_file) self.failed = False except IndexError: rd_print('Encoding and copying', filename, 'at bpp', str(self.bpp), 'failed') rd_print('stdout:') rd_print(stdout.decode('utf-8')) rd_print('stderr:') rd_print(stderr.decode('utf-8')) self.failed = True
import awsremote import scheduler import sshslot # Finding files such as `this_(that)` requires `'` be placed on both # sides of the quote so the `()` are both captured. Files such as # `du_Parterre_d'Eau` must be converted into #`'du_Parterre_d'"'"'Eau' # ^^^ Required to make sure the `'` is captured. def shellquote(s): return "'" + s.replace("'", "'\"'\"'") + "'" if 'DAALA_ROOT' not in os.environ: rd_print( "Please specify the DAALA_ROOT environment variable to use this tool.") sys.exit(1) daala_root = os.environ['DAALA_ROOT'] extra_options = '' if 'EXTRA_OPTIONS' in os.environ: extra_options = os.environ['EXTRA_OPTIONS'] print(get_time(), 'Passing extra command-line options:"%s"' % extra_options) class Work: def __init__(self): self.failed = False
import json import codecs import awsremote import scheduler import sshslot # Finding files such as `this_(that)` requires `'` be placed on both # sides of the quote so the `()` are both captured. Files such as # `du_Parterre_d'Eau` must be converted into #`'du_Parterre_d'"'"'Eau' # ^^^ Required to make sure the `'` is captured. def shellquote(s): return "'" + s.replace("'", "'\"'\"'") + "'" if 'DAALA_ROOT' not in os.environ: rd_print("Please specify the DAALA_ROOT environment variable to use this tool.") sys.exit(1) daala_root = os.environ['DAALA_ROOT'] extra_options = '' if 'EXTRA_OPTIONS' in os.environ: extra_options = os.environ['EXTRA_OPTIONS'] print(get_time(),'Passing extra command-line options:"%s"' % extra_options) class Work: def __init__(self): self.failed = False def parse(self, stdout, stderr): self.raw = stdout split = None