openexr-devel
[Top][All Lists]
Advanced

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

Re: [Openexr-devel] Invert lines during reading process ?


From: Gernot Ziegler
Subject: Re: [Openexr-devel] Invert lines during reading process ?
Date: Tue, 6 Dec 2005 00:22:16 +0100 (MET)

Hej Florian !

> in order to load an image "upside down" you'd have to set
> your frame buffer's yStride to a negative value, but since
> yStride is of type size_t, which is unsigned, you can't
> do that.
(Yepp, I tried that and bombed my OpenEXR loader ;) )

> However, there is a workaround: unsigned integer arithmetic
Thanks for the... ehem ... unconventional tip, I will try it out !

To the original restriction:
Maybe the data type for the offset can be changed to signed long or
similar ? I can imagine that this will be useful to other real-time
processing guys, too ... :-)

> is usually implemented such that results are computed modulo
> (1<<b), where b is the number of bits in an unsigned integer.
> If n is positive and of type size_t, you can effectively set
> yStride to -n like this:
>
>      yStride = (~(size_t(0)) - n + 1);
>
> If x is of type size_t, and x >= n, then computing x + yStride
> yields x - n.

Servus,
  Gernot

-- 
T----------------------------W-E-L-C-O-M-E------------------------------T
O  The Austria <=> Sweden <=> Germany <=> Netherlands connection.....   H
|  http://www.mpi-sb.mpg.de/~gziegler | http://www.lysator.liu.se/~gz   E
\-----------------------------F-U-T-U-R-E-------------------------------/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]