[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-bugs
Subject:    [haiku-bugs] Re: [Haiku] #7500: Image scaling < 1.0 (downsampling) shows aliasing
From:       "stippi" <trac () haiku-os ! org>
Date:       2011-05-31 14:10:18
Message-ID: 056.a27b8e7cc61718413cf82b44864f8a3e () haiku-os ! org
[Download RAW message or body]

#7500: Image scaling < 1.0 (downsampling) shows aliasing
-------------------------+-------------------------------------------------
   Reporter:  aldeck     |      Owner:  axeld
       Type:             |     Status:  new
  enhancement            |  Milestone:  R1
   Priority:  normal     |    Version:  R1/Development
  Component:             |   Keywords:  image scaling downsampling aliasing
  Servers/app_server     |   Blocking:
 Resolution:             |   Platform:  All
 Blocked By:             |
Has a Patch:  0          |
-------------------------+-------------------------------------------------

Comment (by stippi):

 If you want to play with it, and if I don't overlook something important,
 it should be possible to implement the resampler based on doing bilinear
 scaling iteratively. For each iteration step, you would scale the image
 down by a factor of 0.5, until you finally arrive at the factor you
 wanted. For example, a scaling factor of 0.25 could be achieved by doing a
 bilinear downscale with factor 0.5 two times. Since it definitely takes
 the AGG resampling filter more than two times the time it takes the
 bilinear filter, this should be much faster. And it could be even faster
 by implementing a special version of the filter for the factor 0.5. (No
 filter weights need to be calculated and the inner loop can be much
 simpler). The general purpose implementation would be used for the last
 step which would be between 0.5 and 1.0 most likely.

 Some background: When resampling an image, you look at each pixel in the
 source image to compute the target pixels (an arbitrary area of pixels
 collapses into one pixel). When doing bilinear scaling, you don't ever
 look at more than four times the pixels of the target image in the source
 image. Basically, you can imagine it as computing a floating point
 coordinate of the target pixel in the source image, and then you compute
 the target pixel by weighting the four pixels around that location. That
 makes it clear why this algorithm produces bad artifacts when the image
 scale falls below 0.5 -- you start ommiting source pixels. For a scale
 between 0.5 and 1.0, resampling and bilinear scaling should be equivalent.
 When you use the existing, optimized bilinear scaling functions and do
 multiple passes to arrive at the target scale, you could perhaps create a
 much faster resampling implementation than what AGG provides. (It also
 does not provide all the features, but only those that we need.)

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/7500#comment:4>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic