Re: [gtkmm] Higher performance and saving image options



On Fri, Oct 10, 2003 at 12:39:07PM +0530, Ramachandra Putti wrote:
> Hi Friends,
>     I have to manipulate ( rotate ) a tiff file having 5600 x 6600
> pixels.
>
> [snip]
> 
> This code works fine , but takes lot of time to rotate large image.
> 
> Is there any other way to make this operation faster?

Having two buffers of that size will use up a lot of memory. Theoretically,
rotation by 90 degrees can be performed in constant memory space.
Suppose you have an image with 6 pixels:

AB
CD
EF

and you want to rotate it to

BDF
ACE

The memory layout is, for image 1:

A B C D E F

Then, if M0-M5 are the 6 memory cells and T is a temporary memory cell, the
transformation can be performed like this (you also have to swap width and
height info, of course):

T <- M0
M0 <- M1
M1 <- M3
M3 <- T
T <- P2
P2 <- P5
P5 <- P4
P4 <- T

and get:

B D F A C E

I don't have the general algorithm, but I'm quite sure someone has solved
this problem before.

/Fredrik Arnerup
e97_far e kth se



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]