openexr-devel
[Top][All Lists]
Advanced

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

Re: [Openexr-devel] Reading incomplete exr


From: Florian Kainz
Subject: Re: [Openexr-devel] Reading incomplete exr
Date: Wed, 28 Jan 2004 14:44:57 -0800

Ken McGaugh wrote:
> 
> Florian Kainz wrote:
> >
> > Reading an incomplete image file should be possible.
> >
> > However, once you encounter the first missing scan line
> > or tile, you should close and re-open the file, so that
> > the library re-reads the file's scan line or tile directory.
> > The library does not scan the file for new pixels while the
> > file is open.
> >
> > Florian
> >
> 
> Thanks Florian.  I now see that my problem was that the
> exr was stored in DECREASING_Y line order.  No matter what
> I do, I cannot get one of these to read if the image is
> incomplete.  I think the problem is in the reconstructLineOffsets
> function in ImfInputFile.cpp, but I'm not certain.
> 
> I think we may be using DECREASING_Y exr's quite a bit, so
> it would be very nice to have this work.
> 
> Thanks again.
> --Ken

You are right, this is a bug in reconstructLineOffsets().
This will be fixed in version 1.1 (should be out real soon).
In the mean time you may want to patch ImfInputFile.cpp; see
the diff output, below.  The line numbers are off because I
diffed against the 1.1 version of the file, but you should
still be able to find the lines.

Florian




*** 130,136 ****
  
  
  void
! reconstructLineOffsets (ifstream &is, vector<long> &lineOffsets)
  {
      long position = is.tellg();
  
--- 129,137 ----
  
  
  void
! reconstructLineOffsets (ifstream &is,
!                       LineOrder lineOrder,
!                       vector<long> &lineOffsets)
  {
      long position = is.tellg();
  
***************
*** 148,154 ****
  
            Xdr::skip <StreamIO> (is, dataSize);
  
!           lineOffsets[i] = lineOffset;
        }
      }
      catch (...)
--- 149,158 ----
  
            Xdr::skip <StreamIO> (is, dataSize);
  
!           if (lineOrder == INCREASING_Y)
!               lineOffsets[i] = lineOffset;
!           else
!               lineOffsets[lineOffsets.size() - i - 1] = lineOffset;
        }
      }
      catch (...)
***************
*** 167,173 ****
  
  
  void
! readLineOffsets (ifstream &is, vector<long> &lineOffsets)
  {
      for (unsigned int i = 0; i < lineOffsets.size(); i++)
      {
--- 171,179 ----
  
  
  void
! readLineOffsets (ifstream &is,
!                LineOrder lineOrder,
!                vector<long> &lineOffsets)
  {
      for (unsigned int i = 0; i < lineOffsets.size(); i++)
      {
***************
*** 191,197 ****
            // line data to reconstruct the line offset table.
            //
  
!           reconstructLineOffsets (is, lineOffsets);
            break;
        }
      }
--- 197,203 ----
            // line data to reconstruct the line offset table.
            //
  
!           reconstructLineOffsets (is, lineOrder, lineOffsets);
            break;
        }
      }
***************
*** 308,314 ****
                              _data->linesInBuffer) / _data->linesInBuffer;
  
        _data->lineOffsets.resize (lineOffsetSize);
!       readLineOffsets (*_data->is, _data->lineOffsets);
      }
      catch (...)
      {
--- 314,320 ----
                              _data->linesInBuffer) / _data->linesInBuffer;
  
        _data->lineOffsets.resize (lineOffsetSize);
!       readLineOffsets (*_data->is, _data->lineOrder, _data->lineOffsets);
      }
      catch (...)
      {





reply via email to

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