Category Archives: FOX

FOX Toolkit related.

Making a virtue out of sin

Signal processing often requires us to perform a sin(). Indeed, we often have to perform a cos(), too! In fact, we often need to do a lot of them, and do them quickly too! In case this wasn’t clear, we’re … Continue reading

Posted in FOX | Leave a comment

Fast, Vectorizable Arc Tangent

Arctangent(x) (or atan(x)) is an often-used function to obtain the angle given the slope. Closely related is atan2(y,x) which usually returns the full angle. While the library implementation is usually not horrible in terms of performance, it can still be … Continue reading

Posted in FOX | Leave a comment

Branch-Free Blend()

Often, we want to evaluate simple expressions like: 1 result=(a<b) ? x : yresult=(a<b) ? x : y Clearly, this implies performing a conditional branch. This is not a huge problem, unless the code fragment absolutely needs to be as … Continue reading

Posted in FOX | Leave a comment

Handling vector loop left-overs with masked loads and stores

In the previous example we used a nice little trick which is not available until AVX came to the scene: masked loads and stores. In this note we’ll go a little deeper into the use of masked loads and stores, … Continue reading

Posted in FOX | Leave a comment

FUN With AVX

Over the last few years, Intel and AMD have added 256-bit vector-support to their processors. The support for these wider vectors is commonly known as AVX (Advanced Vector eXtension). Since wider vectors also introduce more processor-state, in order to use … Continue reading

Posted in FOX, Programming | Leave a comment

The Case for Negative Semaphore Counts

The new FXParallel feature being worked on in FOX has a atomic variable for tracking completed tasks of a task-group.  This kind of works as follows: 1 2 3 if(atomicAdd(&counter,-1)==1){ completion.post(); }if(atomicAdd(&counter,-1)==1){ completion.post(); } In other words, when the specified … Continue reading

Posted in FOX, Programming | Leave a comment

Half Floats

Some time ago, I wrote an implementation of the “half float” class.  This implements 16-bit floating point numbers, particularly conversion of these to and from single precision 32-bit floats, which are supported by most hardware. The crucial idea was to … Continue reading

Posted in FOX, Programming | Leave a comment