ARM NEON Compositor  master
Fast SIMD alpha overlay and blending for ARM
compare.py
Go to the documentation of this file.
1 #!/usr/bin/env python3.8
2 
3 from os.path import dirname, realpath, join
4 import numpy as np
5 import matplotlib.pyplot as plt
6 from matplotlib import rc
7 import re
8 
9 rc('font',**{'family':'serif', 'size': 12})
10 rc('text', usetex=True)
11 
12 dir = dirname(realpath(__file__))
13 
14 def compare_simd(name: str, filename_no_simd: str, filename_simd: str):
15  small_no_simd = np.genfromtxt(join(dir, filename_no_simd), delimiter=',')
16  small_simd = np.genfromtxt(join(dir, filename_simd), delimiter=',')
17 
18  plt.figure(figsize=(6,6*3/4))
19  plt.plot(small_no_simd[:,0], small_no_simd[:,1], '-',
20  label='Without SIMD intrinsics')
21  plt.plot(small_simd[:,0], small_simd[:,1], '-',
22  label='With SIMD intrinsics')
23  plt.xlim((0, small_simd[-1, 0]*1.025))
24  plt.gca().set_ylim(bottom=0)
25 
26  plt.title("Comparison of \\verb|alpha_overlay_stride|\n" +
27  "with and without SIMD intrinsics")
28  plt.xlabel('Image size [pixels]')
29  plt.ylabel('Time [s]')
30  plt.legend()
31  plt.tight_layout()
32  plt.savefig(name + '.svg')
33 
34 def compare_rescale(name: str, filenames: list):
35 
36  results = [ np.genfromtxt(join(dir, f), delimiter=',') for f in filenames ]
37  legends = [ '\\verb|' + re.split(r' |\.', f)[-3] + '|' for f in filenames ]
38 
39  plt.figure(figsize=(6,6*3/4))
40  for data, legend in zip(results, legends):
41  plt.plot(data[:,0], data[:,1], '-', label=legend)
42  plt.xlim((0, results[0][-1, 0]*1.025))
43  plt.gca().set_ylim(bottom=0)
44 
45  plt.title("Comparison of \\verb|alpha_overlay_stride|\n" +
46  "with different scaling methods")
47  plt.xlabel('Image size [pixels]')
48  plt.ylabel('Time [s]')
49  plt.legend()
50  plt.tight_layout()
51  plt.savefig(name + '.svg')
52 
53 compare_simd('small',
54  'Wed Jul 8 15:12:30 2020 no-simd.csv',
55  'Wed Jul 8 15:13:39 2020 simd.csv')
56 compare_simd('large',
57  'Wed Jul 8 15:45:17 2020 no-simd.csv',
58  'Wed Jul 8 15:50:07 2020 simd.csv')
59 compare_rescale('rescale-small',
60  ['Wed Jul 8 22:47:42 2020 simd div255_round aarch64.csv',
61  'Wed Jul 8 22:49:26 2020 simd div255_round_approx aarch64.csv',
62  'Wed Jul 8 22:51:09 2020 simd div255_floor aarch64.csv',
63  'Wed Jul 8 22:52:49 2020 simd div256_round aarch64.csv',
64  'Wed Jul 8 22:54:28 2020 simd div256_floor aarch64.csv'])
65 plt.show()
compare.compare_simd
def compare_simd(str name, str filename_no_simd, str filename_simd)
Definition: compare.py:14
compare.compare_rescale
def compare_rescale(str name, list filenames)
Definition: compare.py:34