Nerd Stuff: Map of C++ STL algorithms

And Jesus answered: “Man shall not live on bread alone”. When digging the forest of C++ STL, I found something that is too nerd to not be reshared (I laughed when I saw it). A map of C++ algorithms. The map was made by Jonathan Boccara, this guy has a page in which a lot of good stuff is available to read about C++. And I would recommend if, like me, you are studying some new features of C++ standard template library. [Read More]

Codility MinAvgTwoSlice Solution in C++

Short Premise Find the minimal average of any slice containing at least two elements. Long Premise Slice Definition A non-empty array $A$ consisting of $N$ integers is given. A pair of integers $(P, Q)$, such that $ 0 \leq P < Q < N $, is called a slice of array $A$ (notice that the slice contains at least two elements). The average of a slice $(P, Q)$ is the sum of $A(P) + A(P + 1) + … + A(Q)$ divided by the length of the slice. [Read More]

Codility BinaryGap Solution in C++

Short Premise Find the maximum consecutive zeros that are surrounded by ones in the binary representation of a number N in a range between 0 and 2.147.483.647. Approach The approach to this solution is to build a state machine that can process the language generated by zeros and ones in a binary number and count the size of all zero gaps. The maximum gap should be computed from all gap values. [Read More]

Collecting and Displaying Camera Frame using V4L2 API

What is V4L2 Before start digging V4L2 API we should understand what is this platform and how to use it properly. The V4L2 API is a Linux Kernel API to support realtime video capture. There are too many device drivers built on top of this API and a lot of libraries and applications that communicates with the exposed interfaces to the user’s space. Next session will walthrough the interaction process between V4L2 user’s space and kernel interfaces in detail. [Read More]
c  linux  v4l2  video  capture 

What is and how to create a Linux Kernel Module

Introduction This article is a basic explanation of what is and how to create a Linux kernel module. The Linux Kernel As we know the Linux kernel is an open-source, monolithic, soft preemptive UNIX like operating system partially compatible with POSIX specification. The Linux kernel is widely used in specific and general purpose applications. The Monolithic Kernel Wolfgang Mauerer (2016)1, in his book Professional Linux Kernel Architecture, says that a monolithic kernel is on that: [Read More]

Enabling pthread in your C++ Verilator Testbench

Form multiple reasons you could need a verilator simulation using multi-threading in C++. This article is a simple tutorial on how to create a simple multi-threaded ready project using Verilator. In this project i gonna use Ubuntu 18.04. Download and build latest verilator version First of all you should build the latest version from veripool git repository, once the distro package won’t supply the latest stable version. In Ubuntu 18.04, the package manager states that the current supplied version is 3. [Read More]

A Verilog Implementation of Combinational Multiplier based on Ancient Egyptian Algorithm

This algorithm is a combinational implementation of peasant algorithm. The peasant algorithm is based on an ancient Egyptian technique written in the seventh century B.C. by the scribe Ahmes1. Despite the inexistence of the base two’s concept, the algorithm is essentially the same as modern computers use to make fast multiplications. Sometimes, this algorithm is called Egyptian, sometimes is called Russian peasant algorithm. Besides the pedagogic effectiveness of concrete constructions, and equally correct, as a friend of me did in this blog post, I dislike them. [Read More]

Docker Image for OpenCV development

OpenCV is an Open Source Computer Vision Library released under BSD license and can be used to academic and commercial use. It has various languages interfaces that supports multiple operating systems1. Multiple computer vision algorithms are implemented in OpenCV and it is being actively being developed by a very large comunity 1. Usage ranges from interactive art, to mines inspection, stitching maps on the web or through advanced robotics. Docker Docker is a platform promoted by Docker, Inc. [Read More]