Imagine Kernel Internals

Saturday, June 15th, 2013

Imagine is an image processing framework that I began writing in 2009. The framework makes it easy to load, manipulate, and analyze images and perform lots of common tasks. I've used imagine in several of my projects involving graphics, games, computer vision, and artificial intelligence. There are a lot of components in the framework that we could cover in this post, but I'd like to focus on one particular area: image resampling.

Continue reading...

Negative Shift Operands in C++

Saturday, March 5th, 2013

A few years ago I came across a snippet of code that was causing problems in a multi-platform product I was working on. The code was attempting to perform a shift-right operation but, in certain circumstances, used negative right hand operands.

The C++ language supports this as valid syntax (it should compile), but the results are undefined (see ISO 9899:1999 6.5.7). Needless to say, use of negative right hand shift operands is highly discouraged!

For the sake of simplicity, I've expanded a series of macros and reduced the offending code down to the following trivial example:

Continue reading...

Avoiding a Common Objective-C Mistake

Wednesday, July 6th, 2011

There is one particular mistake that stands out to me as the most common error made by beginning iOS developers (even above misuse of auto-release pools). It essentially boils down to a (quite forgivable) lack of understanding of how properties and reference counting work within Modern Objective-C.

Continue reading...

Big Buck Bunny: Cairo vs. H.264

Sunday, July 3rd, 2011

Cairo is a simple video codec that I developed in early 2011 during the later stages of everyAir. The purpose of this codec was to experiment with compression features and learn about their individual impact on efficiency while developing a simple framework for future work. Cairo was also designed to be easy to understand, and serves as a great learning aid for students.

Throughout the development of Cairo I was greatly assisted by the availability of several world class H.264 encoders. These encoders provided a benchmark to which Cairo was tuned and re-tuned. Now that Cairo is complete, I thought it might be interesting to see how it performs against the best H.264 coder around: x264.

Note that this is not a rigorous comparison by any means. Further, it is notoriously difficult to compare video codecs due to the subjective nature of quality, inherent sampling error, operator bias, etc. This comparison is no doubt biased in favor of Cairo and should be taken with a large grain of salt.

Continue reading...

Objective-C Class Properties

Saturday, April 2nd, 2011

In Objective-C, an instance variable is simply an object member variable whose value is stored uniquely for each instance of the object. In a similar manner, instance member functions operate on a particular instance of an object, and have access to the object's instance variables. Interestingly, there is also the notion of a class member function, which must be called without respect to a particular object instance, and cannot access instance variables.


So far these concepts are fairly familiar to C++ programmers, as they are very similar to the concepts of static member variables, member functions (or methods), and static methods, respectively.


Judging by a quick scan of the popular programming websites however, it's clear that significant confusion arises from the fact that Objective-C provides no direct support for class member variables, similar to the notion of a static member variable in C++.

Continue reading...

Basics of Huffman Coding

Sunday, January 9th, 2011

Compression is the process of reducing the storage space requirement for a set of data by converting it into a more compact form than its original format. Huffman coding is one of the most well known compression schemes and it dates back to the early 1950s, when David Huffman first described it in his paper, "A Method for the Construction of Minimum Redundancy Codes."

Huffman coding works by deriving an optimal prefix code for a given alphabet that reduces the cost of frequent symbols, at the expense of less common ones. Let's walk through a simple example that demonstrates the process of building a Huffman code.

Continue reading...



previous page    |    1    2    3    4    5    |    next page