Official end

That’s it, Summer of Code is over, at least officially.
I finally updated this blog less than I expected. I have to say that after 2 month banging my head to the code, motivation is less than before. So, here is the news:
As announced in my last entry, I worked on a process to invert the computing of the transformation (ie know from where come pixels instead of where they go), to have a good image quality and avoiding aliasing. Here is how it works:
  • we set on the image a cage-sized grid
  • we apply the deformation to the grid
  • we split each grid case to two triangle
  • for each pixel inside these triangle, we compute the source coordinates
  • finally, we have for each pixel of the final, the coordinate from where to fetch color (sampling)
My first approach for iterating in a triangle was first, re-order it (find the top-high vertice, then left and right vertices), and then iterate it with straight equation. That’s not a great idea. There is a lot of special case, it’s complex and inefficient. Finally, a friend suggested me to proceed recursively, by splitting the triangle in 4, until it include only one pixel. Then, interpolation is done with a barycentric system. Tadaaa, it works every time, and that’s even efficient ! Thanks Théophile (yes, you now have contributed in free software with more than a libcaca patch =) ).
In fact, it’s so efficient that i will probably replace the “forward” method which is currently used for interactive preview (which is also quite ugly).
These is how the tool core looks like. Each circle is a Gegl operation.
  • Cage_coef_calc compute, for each pixel that need to be transformed, the coefficient series that the transform algorithm need.
  • Cage_transform compute and inverse the transformation
  • Render_mapping render the final image.
This architecture allow, with Gegl, easy reussing of this operation. In that case, my tool’s code can be easily reused and adapted to create an iWarp like tool.

To stay in the present, here is the state of things. My tool is in majority done. I mean that the core works well, and it’s usable for a classic utilisation. There is still some teething problem to correct (for instance, it doesn’t works on mask), love to give to UI, and it will be ready for code review and inclusion in master branch of Gimp. At least I hope =)

Here is some deform example:
It ain’t over, but it never was so close to be.

3 Responses to “Official end”