Linear Feedback Shift Registers (Generating Random Sequences XII)

26/06/2018

While working on a project with a student, I had a look at linear feedback shift registers as a mean of generating (pseudo)random values. The principle isn’t very complicated: you select a number of bits in the register and use them to compute one bit value, you shift the register by one position and insert the new bit in the vacant spot.

Typically, the function is merely a series of exclusive ors, which basically computes the parity of the selected bits. This will help us create an efficient implementation—maybe using the compiler intrinsics.

Read the rest of this entry »


Pantone Colors (Colorspaces X)

19/06/2018

Let’s have a look at another physical colorspace: Pantone.

The Pantone color system isn’t particularly useful for us as it is mainly concerned with “real world” colors, as in print. It also uses a variety of special dies, for metallic or fluorescent finish. It does, however, allow very accurate and consistent color reproduction for packaging, posters, and comics.

Read the rest of this entry »


Munsell Colorspace (Colorspaces IX)

12/06/2018

While the RGB and its transformed colorspaces are useful for computer graphics and video compression, there are other colorspaces that deal with “real life” materials, like ink and paint. Albert Henry Munsell (1858–1918), a painter, proposed such a system.

Unlike RGB and its friends, the Munsell colorspace isn’t based on mixing three primaries, but rather on hue (tint), value (brightness) and chroma (density of color, or saturation), and colors are arranged on a color wheel, but unlike the usual three/six primary color wheel, Munsell’s has 5 primary colors [1].

Read the rest of this entry »


Easy numbers

05/06/2018

Some numbers are easier to work with than others, especially for computer arithmetic—and even more so with weak processors. So let’s have a look at easy numbers that we can sometimes exploit to get faster code.

Read the rest of this entry »