Optimizations, etc.

"Bradley A. Hare" <[email protected]>
Newsgroups gmane.comp.video.cinepaint.devel
Message-ID <[email protected]>

While playing around with the Cinepaint source code, I noticed that
the brightness/contrast and gamma functions could use some considerable
optimization.  Gamma seems to have been upgraded in 0.20 and 0.21,
but the other functions in app/depth could use a little tuning -
specifically in-lining, eliminating constants from the loop and
a little algebra to reduce the  number of calculations.

I also believe that the CLAMP macro used in gamma_expose.c is
producing two extra calls to pow() (checked asm using gcc -S).

For small images this probably does not matter, but for 16M and
up it makes a considerable difference in the response time.  The 
speed-up in gamma_expose.c going from 0.19 to an optimized 0.21 is about
5X (for U16 image data).

In brightness_contrast.c the math in contrast_func() is really weird, a
little algebra + in-line code (move the whole thing into the loop) would
eliminate half the code.

I have not looked at the other controls yet, but I am assuming that they
all could undergo considerable tweaking.

I fixed the color corrector for U16.  Just changed all the instances of
2^8 to 2^16.  I only work with U16 images, so this is all I need to get
going.  If I get time I'll fix it for the rest. U8 and U16 would
probably handle 99.9% of the still images out there.

Also, I have not found the bug yet, but 0.21 occasionally produces
corrupt tiff files.  I have not had time to analyze the problem, but
perhaps someone else has seen this ???

I'm still playing with Cinepaint because there seems to be no other
option.  Are we ever going to see Glasgow ???  The CVS seems to be
dead and the project is now 1 year past its original release date.
I hate to be working on my tools when I have other things to
do, but I will do what is necessary to get the job done.

Also, for the truly masochistic, I brought cinepaint glib,
gtk, lcms and libtiff into a private tree and compiled the whole lot
-malign-double.  In some places this seems to be good for a 20 - 50%
speedup.  This is a bit dangerous, but so far it has not produced
crashes in my normal work flow.

Regards to All

Brad Hare

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.