[sldev] [patch] OpenJPEG fix_mul() optimization
alissa_sabre at yahoo.co.jp
alissa_sabre at yahoo.co.jp
Fri Apr 6 02:55:37 PDT 2007
> Attached is a simple change that gives up to 10% extra performance in
> DWT time.
Hmm. If this fix_mul() is so important, why don't you make it as
follows? It's simpler, does same thing, and should be slightly faster
in general...
static INLINE int fix_mul(int a, int b) {
return (int) (((int64) a * (int64) b + 4096) >> 13);
}
> --- libopenjpeg/fix.h (revision 369)
> +++ libopenjpeg/fix.h (working copy)
> @@ -54,8 +54,9 @@
> @return Returns a * b
> */
> static INLINE int fix_mul(int a, int b) {
> - int64 temp = (int64) a * (int64) b >> 12;
> - return (int) ((temp >> 1) + (temp & 1)) ;
> + int64 temp = (int64) a * (int64) b ;
> + temp += temp & 4096;
> + return (int) (temp >> 13) ;
> }
---------------------------------
Protect Your PC Now ! - 0 yen Security Campaign
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.secondlife.com/pipermail/sldev/attachments/20070406/9bf990a7/attachment.htm
More information about the SLDev
mailing list