SPO 600 - Lab 5

In Lab 5, I will be looking at Algorithm Selection and how the algorithm affect the system's performance. For more information, click here.

I will be doing this lab on Aarch64, and I will compile my programs with -O3 optimization.

Original version

Right now I will checking if it produces the same result every single time, how long it takes to scaling the sound samples, and how long it takes to run. (Note: to view how long it takes for the system to execute a command, type time before it. For more information, consult the man page of time.)

In each run, the program always produces the same result, but the time of scaling the sound samples and the run-time in each run are slightly different.

Yes, the difference is so small, but at the end the numbers are still different, right?



Version 2 - Lookup table

In this version, I will create a lookup table of all possible sample values multiplied by the volume factor.

Like the original, in each run, it also always produces the same result, the time of scaling the sound samples is very close, and the run-time is exactly the same.
But overall it takes less time to scale the sound samples and run (largely because it only have two loops to execute and doesn't have the scale_sample function).











Version 3 - Bit-shifting and Conversion

In this version, I will convert the volume factor (0.75) to a fix-point integer by multiplying by a binary number (0b100000000 in my case) representing a fixed-point value of 1. Then I will shift result to the right by 8, since I am using 256 as the multiplier.

In each run, it also always produces the same result, the time of scaling the sound samples is very close, and the run-time is exactly the same.
It takes longer to run than version 2 (after all, it still has three loops to execute), yet it is slightly faster than version 1, since it is using bit-shifting to scale the sample.

In conclusion, version 2 is the fastest, while version 3 is the second and the original is the third.

You can find the source code of the three versions, the header file and the Makefile from here:
https://github.com/wu-geoff/SPO600/blob/master/aarchie/lab5/spo600_20181_vol_skel/Makefile
https://github.com/wu-geoff/SPO600/blob/master/aarchie/lab5/spo600_20181_vol_skel/vol.h
https://github.com/wu-geoff/SPO600/blob/master/aarchie/lab5/spo600_20181_vol_skel/vol1.c
https://github.com/wu-geoff/SPO600/blob/master/aarchie/lab5/spo600_20181_vol_skel/vol2.c
https://github.com/wu-geoff/SPO600/blob/master/aarchie/lab5/spo600_20181_vol_skel/vol3.c 

Comments

  1. Great information!!! Thanks for your wonderful informative blog.
    Village Talkies a top-quality professional corporate video production company in Bangalore and also best explainer video company in Bangalore & animation video makers in Bangalore, Chennai, India & Maryland, Baltimore, USA provides Corporate & Brand films, Promotional, Marketing videos & Training videos, Product demo videos, Employee videos, Product video explainers, eLearning videos, 2d Animation, 3d Animation, Motion Graphics, Whiteboard Explainer videos Client Testimonial Videos, Video Presentation and more for all start-ups, industries, and corporate companies. From scripting to corporate video production services, explainer & 3d, 2d animation video production , our solutions are customized to your budget, timeline, and to meet the company goals and objectives.
    As a best video production company in Bangalore, we produce quality and creative videos to our clients.

    ReplyDelete

Post a Comment

Popular posts from this blog

SPO 600 Project - Stage 1

SPO 600 - Lab 1