ARM NEON Compositor  master
Fast SIMD alpha overlay and blending for ARM
Namespaces | Variables
perf_test.py File Reference

Go to the source code of this file.

Namespaces

 perf_test
 

Variables

 dir = path.dirname(path.realpath(__file__))
 
 parser = argparse.ArgumentParser(description='Benchmark for overlay_alpha')
 
 dest
 
 action
 
 help
 
 type
 
 int
 
 default
 
 choices
 
 args = parser.parse_args()
 
 uint8_t_p = ctypes.POINTER(ctypes.c_uint8)
 
 size_t = ctypes.c_size_t
 
 void = None
 
string so = "libalpha-lib-"
 
 dll = ctypes.cdll.LoadLibrary(path.join(dir, so))
 
 overlay_alpha = dll['overlay_alpha_stride_' + args.rescale]
 
 argtypes
 
 restype
 
 sizes = np.linspace(args.min_size, args.max_size, args.N, dtype=np.int)
 
 times = np.zeros((args.N, ))
 
 bg_img = np.random.randint(255, size=(size, size, 4), dtype=np.uint8)
 
 fg_img = np.random.randint(255, size=(size, size, 4), dtype=np.uint8)
 
 out_img = np.zeros((size, size, 4), dtype=np.uint8)
 
 bg_img_p = bg_img.ctypes.data_as(uint8_t_p)
 
 fg_img_p = fg_img.ctypes.data_as(uint8_t_p)
 
 out_img_p = out_img.ctypes.data_as(uint8_t_p)
 
 iterations = int(round(args.max_size * args.max_iterations / size))
 
 start_time = time.perf_counter()
 
 end_time = time.perf_counter()
 
 results = np.column_stack((sizes, times))
 
tuple simd = (' simd ' if args.SIMD else ' no-simd ')
 
tuple name = str(time.asctime()) + simd + args.rescale + ' ' + platform.machine()
 
 delimiter