[Gdal-dev] [RFC] RasterIO speedup patch

Frank Warmerdam warmerdam at pobox.com
Tue Feb 18 09:46:33 EST 2003


Tim Beckmann wrote:
> Resend... Frank, you didn't reply to this email and it has a question in 
> that I need an answer to...

Tim,

Sorry about that.  Approximately 1400 "in queue" email message fell into an
HD black hole a week and a half ago.

> Okay, I put it in bugzilla.  It is #281.

As noted in Bugzilla Andrey has applied your patch.

> I still need to clean up the other changes a bit before I submit them. One 
> question for you.  When GDALCopyWords does data type conversions, it uses 
> memcpy for copying out a single data element at a time.  The only reason I 
> can think of why this would be done is that you're worried about being 
> given data buffers that aren't properly aligned in memory for platforms 
> that have such limitations.  Is this correct?  The next set of changes 
> assumes memory alignment is correct.  I can either try using memcpy and 
> see if it impacts speed in my changes, or I can make it one more special 
> case that the changes I've done are only used when memory alignment 
> constraints are met.  Actually, I can't think of a case where memory 
> wouldn't be correctly aligned when going through RasterIO.  But I suppose 
> someone could end up with incorrectly aligned buffers when calling 
> GDALCopyWords directly (but for efficiency maybe it should just error out 
> in that case and the driver should be fixed).

GDALCopyWords() is sometimes used to copy data out of buffers read from disk
that are not word aligned, so this is an issue.  I think that if you want to
copy by word in some cases then GDALCopyWords() should verify that the
pointer is word aligned.

Don't hesitate to poke me when I don't respond in a day or two to a question.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list