Patches

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Patches

by Vinnie-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Due to the modular way that agg is built, there is no need to overwrite existing classes with optimizations. I think that would be a mistake. Optimized versions of the original code should be provided as separate templates, clearly marked as to the nature of the optimization.

On the other hand, actual bug-fixes should certainly be made to the original classes. However, the 'accurate' versus 'fast' blending implementation ( right shifting by 8 versus dividing by 255 ) is not a bug.

If anything, 'accurate', reference implementations of the pixel format and blender templates should replace the original classes, defined as unoptimized versions of the routines that will work on any environment, with the original right shifting code moved into separate templates that are clearly marked as 'faster'.

New implementations that take advantage of doing two multiplies at once, or SSE, should go into separate classes.

There's no benefit to shoving all the optimizations back into the original templates, while there is certainly a drawback (break others' changes).

The accurate / canonical versions of the blender and pixel formats should always be available as a reference for benchmarks, and for those cases when someone wants to optimize from scratch on a new environment.



> I have an idea for generalizing this double-blend technique
> and the 
> SSE work that other people are doing. Let's extend the
> blender class 
> to have a multi-pixel blend_pix method and an enum that
> defines how 
> many pixels blend_pix_multi blends. The pixfmt class would
> use 
> blend_pix to blend individual pixels and blend_pix_multi to
> blend 
> aligned blocks of pixels. The default implementation would
> use various 
> permutations of the double-blend technique, but SSE
> versions could be 
> written too.

> The patch corrects things that are wrong in Agg. And if
> people want to
> keep the old way, very likely the that can be fixed with a
> simple #define.
> So do you think you can make a patch like that John? I can
> imagine that
> int_lerp int_mult etc. In two versions using a #define ,
> will do the
> trick already, since it is all inline.
> I personally don't mind a small performance impact.
>
> To conclude i suggest to wait to the END of the WEEK, if no
> serious
> issues arise, apply the patch.
>
> So those against, please speak up, and come with suggestion
> to improve
> the patch. Or wait, and supply a patch later to improve Agg
> even more.
>
> I volunteer to apply the patch, unless someone else wants
> to do it?
> ( i am not a SVN hero, but i think i manage).
>
> Regards,
>
> Klaas
>
>
>
>
> ------------------------------
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal
> Reports 2008 30-Day
> trial. Simplify your report design, integration and
> deployment - and focus on
> what you do best, core application coding. Discover what's
> new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>
> ------------------------------
>
> _______________________________________________
> Vector-agg-general mailing list
> Vector-agg-general@...
> https://lists.sourceforge.net/lists/listinfo/vector-agg-general
>
>
> End of Vector-agg-general Digest, Vol 39, Issue 7
> *************************************************
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Vector-agg-general mailing list
Vector-agg-general@...
https://lists.sourceforge.net/lists/listinfo/vector-agg-general

Re: Patches

by klaas.holwerda-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Vinnie,

Please don't change the subjects of threads, it is confusing.

I believe the next were your words ;-)
> This is flat out wrong! Using this formula, v will never make it to 255 since (255/256) is always less than one. Sure, the shift is faster...but as anyone who read Graphic Gems 1 knows, dividing by 255 is the only accurate way.

Vinnie wrote:
> Due to the modular way that agg is built, there is no need to overwrite existing classes with optimizations. I think that would be a mistake. Optimized versions of the original code should be provided as separate templates, clearly marked as to the nature of the optimization.
>  
So how many classes would be effected by this patch? And are there any
options to prevent duplicating to many classes? If 90% of the code stays
the same, and only at the very bottom there is a change, it most of the
time better to think of using a #define.

> If anything, 'accurate', reference implementations of the pixel format and blender templates should replace the original classes, defined as unoptimized versions of the routines that will work on any environment, with the original right shifting code moved into separate templates that are clearly marked as 'faster'.
>
> New implementations that take advantage of doing two multiplies at once, or SSE, should go into separate classes.
>  
It depends a lot. If duplicating most of those classes can be prevented
using a simple #define, that should be used.

> There's no benefit to shoving all the optimizations back into the original templates, while there is certainly a drawback (break others' changes).
>  
Is that the case here?
I have the impression that it is about doing the correct alpha blending.
> The accurate / canonical versions of the blender and pixel formats should always be available as a reference for benchmarks, and for those cases when someone wants to optimize from scratch on a new environment.
>  
Agreed, that is why i prefer to combine them. But many agrre that there should be separate classes, so be it. Lets wait for more opinions. And lets judge them one by one.

The important thing is not to ignore patches, and somehow get them in to the repository. But of course in them most elegant manner.

Regards,

Klaas

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Vector-agg-general mailing list
Vector-agg-general@...
https://lists.sourceforge.net/lists/listinfo/vector-agg-general