I have done the seamless cloning project for GIMP and finished it in August. So, you may ask, why on earth is it not integrated yet? The answer is short and simple - last university semester combined with real life. But, I'm not here to bring excuses, I'm here to bring results:
- On Thursday I had my last university exam (Computational Complexity). Unless I fail, and I hope I don't, I finished university!
- In the last two weeks of university, I had more and more free time so I began working again on my GSoC project. The current things that are waiting to happen are:
- Fix the triangulation refinement implementation. For those who are not familiar with the algorithm behind the scene, the algorithm itself is based on interpolation of image differences in a triangular mesh. Therfor, it is a critical part.
The algorithm currently would get stuck in an infinite loop of refining the triangulation, even though it was gauranteed to stop (meaning an implementation bug). I think I just fixed it now (now as in 5 minutes ago), more on this below.
- Make the algorithm iterate over tiles inside of allocating a big chunk of memory, and thus limiting the maximal image size for the algorithm.
- Fix memory leaks (there are several known leaks, and hopefully none unknown).
- Improve a small glitch on the borders of the image.
- Optimize the speed!
- Get it reviewed, and merge back to master.
- Being free of university, and free from other work (I have a day work on which I don't work "after-hours"), I'm now free from chores on evenings (if I get home at sane hours) and weekends. For the first time in the last 3.5 years, I really have free time with nothing on my mind. So don't worry, I'll get into GIMP :D
Now, before I get into details on my GSoC bug, a short "what's going on?".
- Last time I left the geometry library, I was completly stuck with no idea what was the bug.
- When I got to it again, I decided to re-write it in a language which is more type-safe (no pointer bugs), with less memory issues (garbage collection), and much easier to debug (no offense, but gdb isn't always ideal). Eventually I chose C# (and not Java, my favorite language) in order to learn a bit.
- I have been spending my free time between the exams, in the last two weekends, to re-write the library. The re-write was something like "look at the code and write it in a different language". Almost no structural changes or anything, so that I'll keep synced with the source.
- And then I found the bug...
Now for the bug, which made me like C much less than I did before:
// Relevant type declarations:
typedef enum
{
INCIRCLE_ON,
INCIRCLE_INSIDE,
INCIRCLE_OUTSIDE
} P2tRInCircle;
// Types from GLib
typedef int gint;
typedef gint gboolean;
// The function I called
P2tRInCircle p2tr_math_incircle (P2tRPoint* a,
P2tRPoint* b,
P2tRPoint* c,
P2tRPoint* d);
// Somewhere in the code, in the function that I knew that
// was deeply related to the problem:
gboolean inside = p2tr_math_incircle (p, a, q, b);
if (inside)
{
...
}
I don't even feel like explaining this. It is so trivial (and if not, go learn C!) Other than feeling
stupid silly for falling on such a bug for days of debugging, I don't have anything else I can say... So, with all the dislike of some people to high level languages, I like type safety. It saved my here simply since this code, when converted directly to C#, didn't compile and produce an error instead!
So, Hurray for C#, Hurray for end of University (hopefully) at least untill second degree, and just some other random hapiness. And don't worry, I'm not gone yet :)
Edit: More silly bugs found. I'm starting to like re-writing stuff - way better than debugging...
Edit 2 (February 11th, 2012): The geometry library works, at least in C#. Now it's time to re-implement in C.