Re: Lanczos filter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm trying to iron out some of the anomolies here and there are several interpolations using a frig factor I dont understand. I'm probably missing the point but I get the feeling this has been done impirically to overcome a problem that has not been identified and may well be the root cause of some of the glitches that are being seen.

If I'm just being dumb, please explain and accept my appologies.


          src_col = ((gint) (x * ratio + 2.0 - 0.5)) - 2;
          /* +2, -2 is there because (int) rounds towards 0 and we need
             to round down */

now it seems to me that

          src_col = ((gint) (x * ratio + 2.0 - 0.5)) - 2;
is no different to
          src_col = ((gint) (x * ratio + 1.0 - 0.5)) - 1;
which is the same as
          src_col = ((gint) (x * ratio + 0.5)) - 1;


now I would normally expect something like (gint) (x * ratio + 0.5) to overcome the truncation error, so why is the -1 necessary afterwards.

This occurs on linear , cubic and earlier lanczos ; this suggests to me that there is a bug somewhere out side the unit where this code resides.


Why is this adjustment needed?

thx.
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux