I apologise for only skimming through your question/answer and the links you gave but I thought it would be a good idea to post what needs to be done to correctly do any blending and/or filtering on images with an alpha channel.
The first thing to note is that all calculations should be done in a linear colour space, but the image data in PNGs and JPEGs is most likely to be in sRGB which is non-linear. You should convert this data to a linear form before doing any calculations. For example, the average of black (0,0,0) and white (255,255,255) in sRGB is not (127,127,127) but (off the top of my head) something like (186,186,186). The filtering of images, especially those with neighbouring, complementary, saturated colours (e.g. Yellow&Blue), can look quite odd if you don't take gamma into account.
The second part of this theory dates back to Porter and Duff's seminal 1984 paper, "Compositing Digital Images", which introduces the concept of pre-multiplied alpha. Pre-multiplied alpha basically means that you multiply the RGBs by the alpha value before doing calculations.
The Porter-Duff paper states...
There are a few reasons to dismiss this proposal,
the most severe being that all compositing operations
will involve multiplying the 1 in the red channel by
the .5 in the alpha channel to compute the red contribution
of this object at this pixel. The desire to avoid this
multiplication points up a better solution, storing the
pre-multiplied value in the color component, so that
(.5,0,0,.5) will indicate a full red object half covering a
... which suggests this was initially done just to reduce computation costs, but in Jim Blinn's article "Compositing-Theory", he demonstrates that the correct way to do any filtering or compositing operations is to first convert everything to premultipled.
Once you have linearised and then pre-multiplied your pixel data, do the filtering/blending and, finally, undo the pre-multiply and reapply the gamma function to map back to sRGB.