Introduction
For the stage 2 of the project, we are going to examine an open source project, and determine its use case. This time, I will choose ffmpeg as an open source that I am going to examine. ffmpeg
is the leading multimedia framework, able to decode, encode, transcode, etc., and the purpose of it is to convert audio or video formats. This package is actively maintained by the contributors, I can see there are multiple commits are pushed to master branch everyday.
FFmpeg
FFmpeg contains multiple library for its functions such as:
-
libavcodec
provides the implementtation of a wider range of codecs. -
libavformat
implements streaming protocols, container formats and basic I/O access. -
libavutil
includes hashers, decompressors and miscellaneous utility functions. -
libavfilter
provides means to alter decoded audio and video through a directed graph of connected filters. -
libavdevice
provides an abstraction to access capture and playback devices. -
libswresample
implements audio mixing and resampling routines. -
libswscale
implements color conversion and scaling routines.
Aarch64 (Israel)
Thanks to those libraries, and also commands find
and grep
, I was able to find some of the examples of SIMD inside ffmpeg package in Aarch64 system. The tested .mp4 file named h264.mp4
, which located in ~/ffmpeg/tests/ref/lavf-fate/
in Aarch64 system is an example of SIMD usage. The ffmpeg
package is huge, so finding a certain code inside this took a lot of times. By using find . -name '*.[Ss]'
, I was able to find ./h264pred_neon.S
file, which has a good example of SIMD usage in ffmpeg package. They are implemented using assembler source file, the reason is because it is contained inside .s
file. Here is the source code example of SIMD usage:
x86_64 (Portugal)
Beside the example of SIMD usage above in Aarch64 server, I also found another one in difference architecture, which is x86_64. It took a bit of time when I found the example in Aarch64 server, however, I just realize that the maintainers put those code in separate directory, so it would be easier for me to find it in x86_64 architecture. I found the example of SIMD usage in x86_64 by navigating to ffmpeg
directory and used grep -R -i simd.c |& less
, and I found the location of the file:
Once I already knew the location, I headed into the file and saw the code inside it. They are implemented using inline assembler, however, it is nested in __asm__
. Here is the example of the SIMD usage inside the file:
Conclusion
After all, I have understood the importance of using SIMD in ffmpeg
package. And the main purpose of it is the processing of multiple data elements with a single instruction at the same time. And thanks to my amazing professor Chris Tyler, he was helping me out whenever I have any problems during the stage 2 of the project.
Top comments (0)