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: Alpha Premultiplication and Optimization




On Jun 13, 2005, at 12:24 PM, Jason Harris wrote:


On Jun 13, 2005, at 10:15 AM, Haroon Sheikh wrote:



The idea is the same as Andrew discussed related to pre- multiplication. Don't unnecessarily pre-multiply just to pass the data to CoreGraphics.



I seem to have missed this conversation. Can you elaborate on this statement, please?



If your application, as part of it's normal course, generates premultiplied data, then you can pass that to Core Graphics and skip the premultiplication step altogether.


However, if your application is generating ARGB data that is not premultiplied, then you will probably be better off passing that un- premultiplied data to Core Graphics and let it handle that step for you. Presumably this is because Core Graphics has a much better understanding of the context used to move your image data through the graphics pipeline. For example, If you are scaling your image then I might imagine Core Graphics may be able to get away with only premultiplying some subset of your data.

Moreover, I suspect that Apple has put a lot of effort into tuning the premultiplication routines for various processors etc. Core Graphics can select the most efficient tools at it's disposal to do the premultiplication. This frees you from having to deal with very complex issues such as processor features, cache line sizes, junk like that.

The end result is, if your are already generating premultiplied data, send that to Core Graphics. If you don't have premultiplied data, let Core Graphics deal with it instead of trying to preprocess the data on it's behalf because it can probably make a quicker job of it.

Scott


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

This email sent to email@hidden
References: 
 >The byte order constants (From: Scott Thompson <email@hidden>)
 >Re: The byte order constants (From: Haroon Sheikh <email@hidden>)
 >Alpha Premultiplication and Optimization (From: Jason Harris <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.