Re: Concerns about using filters for downscaling
[email protected] (Søren Sandmann)
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Owen Taylor <[email protected]> writes: > On Fri, 2014-03-21 at 18:33 -0400, Owen Taylor wrote: > >> * For some reason, the results of downscaling images don't have >> left-right symmetry. The result of scaling down: >> >> 000000 000000 000000 000000 >> 000000 ffffff ffffff 000000 >> 000000 ffffff ffffff 000000 >> 000000 000000 000000 000000 >> >> By a factor of two is: >> >> 646464 3c3c3c >> 3c3c3c 242424 >> >> (I'm a bit suspicious about the fact that pixman generates >> even length filters, and wonder if that has something to do >> with the asymmetry.) > > What's going on here is: > > +-------+-------+ Destination image > * * Sampling points > +---+---+---+---+ Original image > * * * * * * * * Subpixel filter points > > So each sampling point is between two subpixel filter points, and the > picking one of them the asymmetry. When pixman has N bits of subpixel > filters, it picks the points as: > > 0.5/2^N, 1.5/2^N ... (2^N-0.5)/2^N > > To give an equal distribution in the unit interval. I think that's > actually wrong and they should be at: > > 0, 1/2^N ... (N-1)/2^N > > It shouldn't make a difference when the scale/offset of the filter > is arbitrary, but means that you avoid the half-way-between rounding > for exact integer scale-downs. I think I agree with this. It will just move the artefacts so that they now happen at different offsets, but it is probably good to make sure that the exact-integer scale-downs get an exact sampling of the filter, and I can't think of any benefits from aligning the subsample grid the way pixman does now. Søren -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo