SPO600 - Project Stage 2

tuanthanh2067

Tuan Thanh Tan

Posted on December 11, 2021

SPO600 - Project Stage 2

Introduction

Hello everyone, my name is Dustin. Today I'd like to talk about my process of working with project stage 2 in SPO600 course, and how I got it done, and the result.

For this stage 2 of the project, you have to choose one of these packages open source packages
ardour
eigen
ffmpeg
gnuradio
gromacs
lame
mjpegtools
nettle
numpy
pipewire
pulseaudio
vlc
xz

to do a little research about. After a while looking it up online, I decided to go with ffmpeg because it may be the closest one to me :) The project can be found here.

As they state on their github: FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata. This basically means that we have already used it before but we don't really know their existence because it is just a small program in daily use of computer but has a huge importance. This project has lasted for more than a decade now since it's first created but we can see it's still actively being updated and contributed by looking at the last commit which is just a few hours ago.

Image description

About the package

SIMD (Single Instruction Multiple Data) is a processing which using single instruction to process data including audio, video, subtitles and related metadata.

They have like more than thousands files which contain humongous lines of code in there so finding which one is which also proposes a great challenge. But Github makes it easier as it offers people with search in the directory.

Image description

This is an example of them using SIMD in Aarch64 architecture.

Regarding x86_64 folder, it can be found here

Image description

and SIMD use can be found here

Because I'm not familiar with these architectures and I just spent a few hours looking at it. So I cannot fully understand what's going on in these files. It's just my personal perspective. And these files don't include lots of comments which brings the difficulty to a whole new level.

Speaking of h264pred_neon.s, in my opinion, it will be called during runtime because the line will only be called when the function outside is called. As we can see, this function is deep inside a file, another function from outside of this file can directly calls the function. Apart from that, it has a lot of function declarations and its implementations which I think will be called somewhere else.

For hscale_fast_bilinear_simd.c, as far as I understand, it's written in c because it's in .c file but nested within a __asm__. This file will create optimized horizontal scaling routine. This scaler is made of runtime-generated MMXEXT code using specially tuned pshufw instructions. For every four output pixels, if four input pixels are enough for the fast bilinear scaling, then a chunk of fragmentB is used. If five input pixels are needed, then a chunk of fragmentA is used.

Wrap up

It seems like this project is using a lot of SIMD in its code as in aarch64 folder, most of the files are .c, and .S. Because this is a transcoding, conversing library so it needs to utilize SIMD to maximize its performance.

This is one of the most difficult assignment I've ever had in this course. Mostly because I have not got a chance to deeply learn about these architectures. Besides, this is a big project that has been there for more than 1 decade, more than 100k commits have been made. So a few hours of looking at the source code means nothing.

💖 💪 🙅 🚩
tuanthanh2067
Tuan Thanh Tan

Posted on December 11, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related