Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance Sanity Check?




Bob Currier wrote:

The code I'm working on is doing a simple rectangular pixel transfer,
with possible scaling and RGB lookup table. I'm currently testing on a
dual 2GHz PowerMac with Radeon 9600 under 10.3.4. In the test case I'm
scaling a 2K x 1K image down to 700 x 350 pixels for display.

Using OpenGL, I can do this in 20 ms using a texture (and all the Apple-
recommended optimizations) or 17 ms by using glDrawPixels.

Your timings with glDrawPixels vs optimal texturing are interesting. I redid my own tests, and glDrawPixels can indeed be very competitive with texturing, but only if the source dimensions are powers of two.


But if I enable a LUT, then things go wonky. If I use GL_COLOR_TABLE with
a texture, the times go up by a factor of 20x. If I use GL_COLOR_TABLE
with glDrawPixels, it goes up by a factor of 100x! And with glDrawPixels,
there are random horizontal lines through the image if any scaling is
being done.


Judging from the dramatic slowdown, I have to assume that the color table
is being implemented in software, and very poorly at that.


You could do the look-up yourself. The inner loop here takes around 8 ms for a 1920 x 1200 image on my 2.5 GHz.

void DrawImageFromCLUT( UInt8* srcIndexedImage, UInt32* clut, UInt32* destRGBImage, UInt32 width, UInt32 height )
{
UInt32 nPixels = width*height;
glFinish(); // ensure we have sole access to destRGBImage
while ( nPixels > 0 )
{
*destRGBImage++ = clut[*srcIndexedImage++];
nPixels--;
}
glRasterPos2f( -1.0f, -1.0f );
glDrawPixels( width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, (GLvoid*)destRGBImage );
aglSwapBuffers( gContext );
}


Robert P.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden
References: 
 >Performance Sanity Check? (From: "Bob Currier" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.