openexr-devel
[Top][All Lists]
Advanced

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

Re: [Openexr-devel] OpenEXR from shared libs.


From: Florian Kainz
Subject: Re: [Openexr-devel] OpenEXR from shared libs.
Date: Mon, 26 Feb 2007 14:46:16 -0800
User-agent: Mozilla Thunderbird 1.0 (X11/20041207)

Hi Nicolaj,

I am not entirely sure how to interpret your example.  I assume that your
program contains a loop to read all the scan lines in a given file, but I
am not sure which of the code in your example is meant to be included in
the loop; it does make a difference.  Let's say your code is analogous to
this:

    RgbaInputFile input_file;

    Box2i dw = input_file.dataWindow();
    Rgba pixels[width];
    input_file.setFrameBuffer(pixels - dw.min.x - dw.min.y * width, 1, width);

    while (dw.min.y <= dw.max.dy)
    {
        input_file.readPixels(dw.min.y);
        dw.min.y++;
    }

If this is the case, then frame buffer address arithmetic is wrong.
No matter which scan line you are reading, you want the leftmost pixel,
t x coordinate, dw.min.x to be stored in pixels[0].  The pixels at x
coordinates dw.min.x+1, dw.min.x+2, etc. should to to pixels[1], pixels[2],
etc.  In other words, the address of pixel (x,y) is:

    pixels - dw.min.x + x

Here's the corresponding setFrameBuffer() call (see also section 2.2 of
the Reading and Writing OpenEXR Image Files document):

    input_file.setFrameBuffer (pixels - dw.min.x, 1, 0);

Hope this helps,

Florian



Nikolaj Thygesen wrote:
Hi list,

I'm currently trying to interface to the OpenEXR library from my own shared library reading scanlines one at a time. My code is heavily based on the sample code on the OpenEXR home page describing the reading of an RGBA file using the RgbaInputFile class + a raw copy-paste of the C_IStream class using the old-skool stdio FILE *'s to access the bytes of files. When compiling my program as a stand-alone program, everything works fine for all sample *.exr files, but as soon as the code goes into a *.so, reading crashes in the "input_file.readPixels(dw.min.y);" call of the snippet below.

I should mention that I'm running FreeBSD 6.2, using gcc 4.1and OpenEXR V1.2.2, which is the release currently available in the ports tree. My question is: Does OpenEXR have any issues with shared libs?? Do I need or should I avoid any certain compiler/linker flags??

           RgbaInputFile input_file;

           Box2i dw = input_file.dataWindow();
           Rgba pixels[width];
input_file.setFrameBuffer(pixels - dw.min.x - dw.min.y * width, 1, width);
           input_file.readPixels(dw.min.y);
           dw.min.y++;
           lineno = line_number++;



   br - Nikolaj Thygesen





_______________________________________________
Openexr-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/openexr-devel






reply via email to

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