FROM : Jens Alfke
DATE : Sun May 25 18:58:46 2008
On 25 May '08, at 8:14 AM, Steve Christensen wrote:
> Unless you know for a fact that your bitmap data is packed such that
> each row begins immediately after the previous row, you'll need to
> do a bit more work. Bitmaps can be created with [bits bytesPerRow] >
> bytesPerPixel * [bits pixelsWide]. In that case you could have some
> uninitialized bytes between the end of one row and the beginning of
> the next, which could affect the outcome of your test.
I agree — I've been burned by this in the past. RowBytes often seems
to get rounded up to multiples of a power of 2, such as 8 or 16,
probably for better cache coherency or because GPUs are optimized for
it.
—Jens
DATE : Sun May 25 18:58:46 2008
On 25 May '08, at 8:14 AM, Steve Christensen wrote:
> Unless you know for a fact that your bitmap data is packed such that
> each row begins immediately after the previous row, you'll need to
> do a bit more work. Bitmaps can be created with [bits bytesPerRow] >
> bytesPerPixel * [bits pixelsWide]. In that case you could have some
> uninitialized bytes between the end of one row and the beginning of
> the next, which could affect the outcome of your test.
I agree — I've been burned by this in the past. RowBytes often seems
to get rounded up to multiples of a power of 2, such as 8 or 16,
probably for better cache coherency or because GPUs are optimized for
it.
—Jens
| Related mails | Author | Date |
|---|---|---|
| Graham Cox | May 25, 07:55 | |
| Ken Thomases | May 25, 08:10 | |
| Jens Alfke | May 25, 09:13 | |
| Graham Cox | May 25, 13:34 | |
| Steve Christensen | May 25, 17:14 | |
| Gary L. Wade | May 25, 18:52 | |
| Jens Alfke | May 25, 18:58 | |
| Ken Ferry | May 26, 01:44 | |
| Graham Cox | May 26, 12:43 |






Cocoa mail archive

