Quick post here about a problem I came across when trying to use intrinsics in a Qt project on 32-bit Ubuntu 10.10.
Archive for the ‘C++’ Category
Converting CMYK to RGB In Qt Using Little CMS :: Part 2
In the first post of this series we saw how we can use a library called Little CMS to create accurate CMYK to RGB conversions in Qt. In this post we’ll take a look at the actual act of conversion as well as address performance concerns.
Converting CMYK to RGB In Qt Using Little CMS :: Part 1
In this post we’ll create at a multi-threaded application that properly converts CMYK images to RGB. The key here is properly, by which I mean a ‘standard’ conversion to CMYK goes something like:
R = ( (255-C)*(255-K) ) / 255;
G = ( (255-M)*(255-K) ) / 255;
B = ( (255-Y)*(255-K) ) / 255;
…which is simple but unfortunately leaves our images looking pretty awful. The reason is we are not taking into account any color profile information, which means the mapping of say, a green we see in CMYK is not the same green in we’ll get in RGB.
The solution for this problem is to complicate the solution just a touch by employing a third party library called Little CMS to act as the middle-man for the color conversion process.
This comprehensive library does many things you may be interested in, but for us, allows us to employ color profiles during the CMYK -> RGB conversion process. The end result is an RGB images that very closely matches the original CMYK source.
Linking libjpeg and Boost+GIL in Qt and X-Code
In this post I’d like to share my experiences of linking an external library and code files to an X-Code and Qt project. This task, more than anything, requires a good deal of “glue” information, that is, knowing how and when to do this or that little task to get to the next stage. It’s not too hard, but can be quite time consuming as you scour the net for hints. Hopefully this single write-up will help others.
Qt – 3 Methods Of Adding & Integrating Designer Forms
The Qt Designer tool allows us to create forms for our application in a visual manner, freeing us from the tedium of hand-coding. While this saves time, it’s important to understand the various ways Qt creates these forms and by extension, the methods at our disposal to integrate these forms into a larger application.
In this post we’ll look at the 3 main technical options Qt Designer employs to serve this function:
- Aggregation as a pointer member
- Aggregation
- Multiple Inheritance
We’ll also see examples of each method in practice. By the end of this post we should have a good grasp on the various ways we can use Qt Designer to create and integrate designer forms into a larger application.
Threading In Qt 4
In this quick post we’ll take a look at Qt’s elegant and simple QFuture, QtConcurrentRun, and QFutureWatcher interfaces. Using these classes allows us to consume a QThreadPool thread for a specific function.
This is handy for many operations, and while simplistic in that we’re not synchronizing data, still has many uses, from processing large blocks of images to streaming chunks of data.
In this post we’ll check out some sample code for implementing QFuture.
C++ Performance – Counting Clocks
Performance computing can be an interesting task to undertake, as it lets us get under the hood of a complex abstraction (C++) and talk to the machine directly.
In the next two posts we’ll take a look at the Fibonacci algorithm used in a few other posts and see just how fast we can make it by looking at loop implementation, data type usage, and assembly code optimizations. In this first post we’ll take a look at some basic timing code, what gcc will do for us using the -O2 flag, then in the second post, see what we can do (if anything) to improve upon the generated code.
C++ 64-bit Inline Assembly Primer – Part 2
In this series we examine the relationship and implementations of C++ and raw assembly code. In this post we create our own add function in gcc extended assembly.
In the previous post we wrote a short C++ program that loaded two numbers. Despite its simplicity in C++, we saw how the assembly version was comprised of several dozen individual instructions in a rather cryptic format. Much of this complexity stems from the fact that in our sample program we called a function to perform our addition. Calling functions means dealing with a stack, base pointers, and the setup and maintenance of that stack. It means dealing with memory offsets, relative positions, and several other factors. The good news is that at this point we can safely ignore these details. In fact, we will do well to ignore them and focus on just the core competencies of function implementation code. In other words, we’ll let gcc create the function shells, calls, and stack management, we’ll focus on the core logic.
C++ 64-bit Inline Assembly Primer – Part 1
We can talk directly to our machines in C++ by inserting assembly code via the asm() or extended assembly __asm__ commands.
Doing so allows us to exploit potential performance gains, learn more about our machines, and is in all cases, a fascinating exercise in the lowest level of computer programming.
In this post I want to share a few tips and tricks I’ve learned when using AT&T style syntax on Linux/gcc, and also explain how basic assembly coding works. We’ll start by creating a simple function and checking out the gcc created assembly code. We’ll then take this apart and step through the code to understand how it works.
Porting to the Qt C++ Framework :: Part 4
Having created a shell of our app in step 2, porting the image cleaner code in step 3, we’re now at the stage where we can to port our command line XML cleaner code to Qt. At the end of this post we’ll have a fully functioning C++ Qt app.