Efficient Evaluation of Image Expressions

Hermann <hermann.rodrigues@gmail.com>
Wed, 18 Jul 2007 21:40:11 -0000

          From comp.compilers

Related articles
Efficient Evaluation of Image Expressions hermann.rodrigues@gmail.com (Hermann) (2007-07-18)
Re: Efficient Evaluation of Image Expressions torbenm@app-2.diku.dk (2007-07-19)
Re: Efficient Evaluation of Image Expressions tmk@netvision.net.il (Michael Tiomkin) (2007-07-19)
Re: Efficient Evaluation of Image Expressions Ibeam2000@gmail.com (Nick) (2007-07-22)
Re: Efficient Evaluation of Image Expressions hermann.rodrigues@gmail.com (Hermann) (2007-07-23)
Re: Efficient Evaluation of Image Expressions Ibeam2000@gmail.com (Nick) (2007-07-30)
Re: Efficient Evaluation of Image Expressions Ibeam2000@gmail.com (Nick) (2007-08-01)
| List of all articles for this month |
From: Hermann <hermann.rodrigues@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 18 Jul 2007 21:40:11 -0000
Organization: Compilers Central
Keywords: question, performance
Posted-Date: 18 Jul 2007 20:05:08 EDT

Hi all,


I have a language used perform map/image algebra calculations using
expressions like the following:


------------------------------------------------------
if isNull(i1) or isNull(i2) or isNull(i3) or isNull(i4) or isNull(i5)
or isNull(i6) or
          isNull(i7) or isNull(i8)
    then null
    else
        (if (-4113.26 + 0.07*i7 - 5.08*i8/100 + 47.89*abs(i1) +
99.72*abs(i2) + 214.96*
              (
                  -2.332 + 2.561*i4 + 0.55*i6
              ) +
              1.57*i3) > 0 then
              -4113.26 + 0.07*i7 - 5.08*i8/100 + 47.89*abs(i1) +
99.72*abs(i2) + 214.96*
              (
                  -2.332 + 2.561*i4 + 0.55*i6
              ) +
              1.57*i3
              else 0
          )/1000
-------------------------------------------------------


This language deals with sub expressions, much like a functional
language. In this example, i1, i2, i3... represent cells of images.
So, the expression above is calculating a new image using for eight
different images (i1 .. i8)


Basically, the expression is parsed and an intermediate structure is
constructed. Then, for each image coordinate, the corresponding cells
of the eight images are scanned, presented to expression, and the
expression evaluated, much like a pixel shader does.


The problem is how to represent the expression so that the execution
becomes more efficient.


Currently I have a base Expression class and subclasses representing
the possible operators (+, -, abs, if-then-else, isNull etc). This
expressions are linked forming a tree. The evaluation process walk on
this tree evaluating sub-expression by expression and passing the
resulting values to the dependent ones, until I get a final result
representing the overall expression value.


Simple expressions, like the one above, have good performance, but if
the expression gets more complicated, the evaluation process becomes
painfully slow. Any advice?


Thank you.


Hermann


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.